From 265dda960a58bbf31f19c9a3f325d3fe20fe733a Mon Sep 17 00:00:00 2001 From: Davide Cavarretta Date: Tue, 2 Feb 2016 15:43:27 +0100 Subject: [PATCH] Added Sorting on Deserialize highlights Serialize has highlights sorting but Deserialize, added it. --- lib/rangy-classapplier.js | 2 +- lib/rangy-core.js | 2 +- lib/rangy-highlighter.js | 3 ++- lib/rangy-selectionsaverestore.js | 2 +- lib/rangy-serializer.js | 2 +- lib/rangy-textrange.js | 2 +- src/modules/rangy-highlighter.js | 1 + 7 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/rangy-classapplier.js b/lib/rangy-classapplier.js index b9ab8924..c1c73738 100644 --- a/lib/rangy-classapplier.js +++ b/lib/rangy-classapplier.js @@ -10,7 +10,7 @@ * Copyright 2016, Tim Down * Licensed under the MIT license. * Version: 1.3.1-dev - * Build date: 15 January 2016 + * Build date: 2 February 2016 */ (function(factory, root) { if (typeof define == "function" && define.amd) { diff --git a/lib/rangy-core.js b/lib/rangy-core.js index b08bbf70..d9c3ea13 100644 --- a/lib/rangy-core.js +++ b/lib/rangy-core.js @@ -5,7 +5,7 @@ * Copyright 2016, Tim Down * Licensed under the MIT license. * Version: 1.3.1-dev - * Build date: 15 January 2016 + * Build date: 2 February 2016 */ (function(factory, root) { diff --git a/lib/rangy-highlighter.js b/lib/rangy-highlighter.js index b2a1b276..d26c15f3 100644 --- a/lib/rangy-highlighter.js +++ b/lib/rangy-highlighter.js @@ -7,7 +7,7 @@ * Copyright 2016, Tim Down * Licensed under the MIT license. * Version: 1.3.1-dev - * Build date: 15 January 2016 + * Build date: 2 February 2016 */ (function(factory, root) { if (typeof define == "function" && define.amd) { @@ -612,6 +612,7 @@ highlight.apply(); highlights.push(highlight); } + highlights.sort(compareHighlights); this.highlights = highlights; } }; diff --git a/lib/rangy-selectionsaverestore.js b/lib/rangy-selectionsaverestore.js index 1cd73ce8..ad8a0658 100644 --- a/lib/rangy-selectionsaverestore.js +++ b/lib/rangy-selectionsaverestore.js @@ -10,7 +10,7 @@ * Copyright 2016, Tim Down * Licensed under the MIT license. * Version: 1.3.1-dev - * Build date: 15 January 2016 + * Build date: 2 February 2016 */ (function(factory, root) { if (typeof define == "function" && define.amd) { diff --git a/lib/rangy-serializer.js b/lib/rangy-serializer.js index fdd102d2..0538d5a5 100644 --- a/lib/rangy-serializer.js +++ b/lib/rangy-serializer.js @@ -11,7 +11,7 @@ * Copyright 2016, Tim Down * Licensed under the MIT license. * Version: 1.3.1-dev - * Build date: 15 January 2016 + * Build date: 2 February 2016 */ (function(factory, root) { if (typeof define == "function" && define.amd) { diff --git a/lib/rangy-textrange.js b/lib/rangy-textrange.js index 55898953..07dfbbc8 100644 --- a/lib/rangy-textrange.js +++ b/lib/rangy-textrange.js @@ -27,7 +27,7 @@ * Copyright 2016, Tim Down * Licensed under the MIT license. * Version: 1.3.1-dev - * Build date: 15 January 2016 + * Build date: 2 February 2016 */ /** diff --git a/src/modules/rangy-highlighter.js b/src/modules/rangy-highlighter.js index 9fed2703..69fb8334 100644 --- a/src/modules/rangy-highlighter.js +++ b/src/modules/rangy-highlighter.js @@ -601,6 +601,7 @@ rangy.createModule("Highlighter", ["ClassApplier"], function(api, module) { highlight.apply(); highlights.push(highlight); } + highlights.sort(compareHighlights); this.highlights = highlights; } };