MDL-76918 libraries: upgrade to version 1.3.1 of Rangy.

This commit is contained in:
Paul Holden 2023-03-02 15:56:06 +00:00
parent 12a8176926
commit caf236427e
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164
11 changed files with 2119 additions and 1984 deletions

View File

@ -1,20 +1,22 @@
Description of the import of libraries associated with the Atto editor.
1) Rangy (version 1.2.3)
* Download the latest stable release;
* Download the latest stable release from https://github.com/timdown/rangy/releases ("rangy-X.Z.Y"
rather than the "Source code" version)
* Delete all files in yui/src/rangy/js
* Copy the content of the 'currentrelease/uncompressed' folder into yui/src/rangy/js
* Patch out the AMD / module support from rangy (because we are loading it with YUI)
To do this - change the code start of each js file to look like (just delete the other lines):
To do this - change the code start of each js file except rangy-core.js to look like (just delete the other lines):
(function(factory, root) {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
})(function(rangy) {
* rangy-core.js should look like this:
(function(factory, root) {
// No AMD or CommonJS support so we place Rangy in (probably) the global variable
root.rangy = factory();
})(function() {
* Run shifter against yui/src/rangy
Notes:
* We have patched 1.2.3 with a backport fix from the next release of Rangy which addresses an incompatibility
between Rangy and HTML5Shiv which is used in the bootstrapclean theme. See MDL-44798 for further information.

View File

@ -4,7 +4,7 @@
<location>yui/src/rangy/js/*.*</location>
<name>Rangy</name>
<description>A cross-browser JavaScript range and selection library.</description>
<version>1.3.0</version>
<version>1.3.1</version>
<license>MIT</license>
<repository>https://github.com/timdown/rangy</repository>
<copyrights>

File diff suppressed because one or more lines are too long

View File

@ -1,17 +1,17 @@
/**
* Class Applier module for Rangy.
* Adds, removes and toggles classes on Ranges and Selections
*
* Part of Rangy, a cross-browser JavaScript range and selection library
* https://github.com/timdown/rangy
*
* Depends on Rangy core.
*
* Copyright 2015, Tim Down
* Licensed under the MIT license.
* Version: 1.3.0
* Build date: 10 May 2015
*/
/**
* Class Applier module for Rangy.
* Adds, removes and toggles classes on Ranges and Selections
*
* Part of Rangy, a cross-browser JavaScript range and selection library
* https://github.com/timdown/rangy
*
* Depends on Rangy core.
*
* Copyright 2022, Tim Down
* Licensed under the MIT license.
* Version: 1.3.1
* Build date: 17 August 2022
*/
(function(factory, root) {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
@ -441,7 +441,7 @@
var getPreviousMergeableTextNode = createAdjacentMergeableTextNodeGetter(false),
getNextMergeableTextNode = createAdjacentMergeableTextNodeGetter(true);
function Merge(firstNode) {
this.isElementMerge = (firstNode.nodeType == 1);
this.textNodes = [];
@ -475,7 +475,7 @@
// Handle case where both text nodes precede the position within the same parent node
if (position.node == parent && position.offset > firstTextNodeIndex) {
--position.offset;
if (position.offset == firstTextNodeIndex + 1 && i < len - 1) {
if (position.offset == firstTextNodeIndex + 1 && i < textNodes.length - 1) {
position.node = firstTextNode;
position.offset = combinedTextLength;
}
@ -690,13 +690,10 @@
// Normalizes nodes after applying a class to a Range.
postApply: function(textNodes, range, positionsToPreserve, isUndo) {
var firstNode = textNodes[0], lastNode = textNodes[textNodes.length - 1];
var merges = [], currentMerge;
var rangeStartNode = firstNode, rangeEndNode = lastNode;
var rangeStartOffset = 0, rangeEndOffset = lastNode.length;
var textNode, precedingTextNode;
var precedingTextNode;
// Check for every required merge and create a Merge object for each
forEach(textNodes, function(textNode) {
@ -733,7 +730,7 @@
// Apply the merges
if (merges.length) {
for (i = 0, len = merges.length; i < len; ++i) {
for (var i = 0, len = merges.length; i < len; ++i) {
merges[i].doMerge(positionsToPreserve);
}
@ -1090,6 +1087,6 @@
api.createClassApplier = createClassApplier;
util.createAliasForDeprecatedMethod(api, "createCssClassApplier", "createClassApplier", module);
});
return rangy;
}, this);
}, this);

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,14 @@
/**
* Highlighter module for Rangy, a cross-browser JavaScript range and selection library
* https://github.com/timdown/rangy
*
* Depends on Rangy core, ClassApplier and optionally TextRange modules.
*
* Copyright 2015, Tim Down
* Licensed under the MIT license.
* Version: 1.3.0
* Build date: 10 May 2015
*/
/**
* Highlighter module for Rangy, a cross-browser JavaScript range and selection library
* https://github.com/timdown/rangy
*
* Depends on Rangy core, ClassApplier and optionally TextRange modules.
*
* Copyright 2022, Tim Down
* Licensed under the MIT license.
* Version: 1.3.1
* Build date: 17 August 2022
*/
(function(factory, root) {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
@ -452,13 +452,12 @@
options = createOptions(options, {
containerElementId: null,
selection: api.getSelection(this.doc),
exclusive: true
});
var containerElementId = options.containerElementId;
var exclusive = options.exclusive;
var selection = options.selection;
var selection = options.selection || api.getSelection(this.doc);
var doc = selection.win.document;
var containerElement = getContainerElement(doc, containerElementId);
@ -607,6 +606,6 @@
return new Highlighter(doc, rangeCharacterOffsetConverterType);
};
});
return rangy;
}, this);
}, this);

View File

@ -1,22 +1,22 @@
/**
* Selection save and restore module for Rangy.
* Saves and restores user selections using marker invisible elements in the DOM.
*
* Part of Rangy, a cross-browser JavaScript range and selection library
* https://github.com/timdown/rangy
*
* Depends on Rangy core.
*
* Copyright 2015, Tim Down
* Licensed under the MIT license.
* Version: 1.3.0
* Build date: 10 May 2015
*/
/**
* Selection save and restore module for Rangy.
* Saves and restores user selections using marker invisible elements in the DOM.
*
* Part of Rangy, a cross-browser JavaScript range and selection library
* https://github.com/timdown/rangy
*
* Depends on Rangy core.
*
* Copyright 2022, Tim Down
* Licensed under the MIT license.
* Version: 1.3.1
* Build date: 17 August 2022
*/
(function(factory, root) {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
})(function(rangy) {
rangy.createModule("SaveRestore", ["WrappedRange"], function(api, module) {
rangy.createModule("SaveRestore", ["WrappedSelection"], function(api, module) {
var dom = api.dom;
var removeNode = dom.removeNode;
var isDirectionBackward = api.Selection.isDirectionBackward;
@ -239,6 +239,6 @@
removeMarkers: removeMarkers
});
});
return rangy;
}, this);
}, this);

View File

@ -1,18 +1,18 @@
/**
* Serializer module for Rangy.
* Serializes Ranges and Selections. An example use would be to store a user's selection on a particular page in a
* cookie or local storage and restore it on the user's next visit to the same page.
*
* Part of Rangy, a cross-browser JavaScript range and selection library
* https://github.com/timdown/rangy
*
* Depends on Rangy core.
*
* Copyright 2015, Tim Down
* Licensed under the MIT license.
* Version: 1.3.0
* Build date: 10 May 2015
*/
/**
* Serializer module for Rangy.
* Serializes Ranges and Selections. An example use would be to store a user's selection on a particular page in a
* cookie or local storage and restore it on the user's next visit to the same page.
*
* Part of Rangy, a cross-browser JavaScript range and selection library
* https://github.com/timdown/rangy
*
* Depends on Rangy core.
*
* Copyright 2022, Tim Down
* Licensed under the MIT license.
* Version: 1.3.1
* Build date: 17 August 2022
*/
(function(factory, root) {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
@ -301,6 +301,6 @@
util.crc32 = crc32;
});
return rangy;
}, this);
}, this);

View File

@ -1,68 +1,68 @@
/**
* Text range module for Rangy.
* Text-based manipulation and searching of ranges and selections.
*
* Features
*
* - Ability to move range boundaries by character or word offsets
* - Customizable word tokenizer
* - Ignores text nodes inside <script> or <style> elements or those hidden by CSS display and visibility properties
* - Range findText method to search for text or regex within the page or within a range. Flags for whole words and case
* sensitivity
* - Selection and range save/restore as text offsets within a node
* - Methods to return visible text within a range or selection
* - innerText method for elements
*
* References
*
* https://www.w3.org/Bugs/Public/show_bug.cgi?id=13145
* http://aryeh.name/spec/innertext/innertext.html
* http://dvcs.w3.org/hg/editing/raw-file/tip/editing.html
*
* Part of Rangy, a cross-browser JavaScript range and selection library
* https://github.com/timdown/rangy
*
* Depends on Rangy core.
*
* Copyright 2015, Tim Down
* Licensed under the MIT license.
* Version: 1.3.0
* Build date: 10 May 2015
*/
/**
* Problem: handling of trailing spaces before line breaks is handled inconsistently between browsers.
*
* First, a <br>: this is relatively simple. For the following HTML:
*
* 1 <br>2
*
* - IE and WebKit render the space, include it in the selection (i.e. when the content is selected and pasted into a
* textarea, the space is present) and allow the caret to be placed after it.
* - Firefox does not acknowledge the space in the selection but it is possible to place the caret after it.
* - Opera does not render the space but has two separate caret positions on either side of the space (left and right
* arrow keys show this) and includes the space in the selection.
*
* The other case is the line break or breaks implied by block elements. For the following HTML:
*
* <p>1 </p><p>2<p>
*
* - WebKit does not acknowledge the space in any way
* - Firefox, IE and Opera as per <br>
*
* One more case is trailing spaces before line breaks in elements with white-space: pre-line. For the following HTML:
*
* <p style="white-space: pre-line">1
* 2</p>
*
* - Firefox and WebKit include the space in caret positions
* - IE does not support pre-line up to and including version 9
* - Opera ignores the space
* - Trailing space only renders if there is a non-collapsed character in the line
*
* Problem is whether Rangy should ever acknowledge the space and if so, when. Another problem is whether this can be
* feature-tested
*/
/**
* Text range module for Rangy.
* Text-based manipulation and searching of ranges and selections.
*
* Features
*
* - Ability to move range boundaries by character or word offsets
* - Customizable word tokenizer
* - Ignores text nodes inside <script> or <style> elements or those hidden by CSS display and visibility properties
* - Range findText method to search for text or regex within the page or within a range. Flags for whole words and case
* sensitivity
* - Selection and range save/restore as text offsets within a node
* - Methods to return visible text within a range or selection
* - innerText method for elements
*
* References
*
* https://www.w3.org/Bugs/Public/show_bug.cgi?id=13145
* http://aryeh.name/spec/innertext/innertext.html
* http://dvcs.w3.org/hg/editing/raw-file/tip/editing.html
*
* Part of Rangy, a cross-browser JavaScript range and selection library
* https://github.com/timdown/rangy
*
* Depends on Rangy core.
*
* Copyright 2022, Tim Down
* Licensed under the MIT license.
* Version: 1.3.1
* Build date: 17 August 2022
*/
/**
* Problem: handling of trailing spaces before line breaks is handled inconsistently between browsers.
*
* First, a <br>: this is relatively simple. For the following HTML:
*
* 1 <br>2
*
* - IE and WebKit render the space, include it in the selection (i.e. when the content is selected and pasted into a
* textarea, the space is present) and allow the caret to be placed after it.
* - Firefox does not acknowledge the space in the selection but it is possible to place the caret after it.
* - Opera does not render the space but has two separate caret positions on either side of the space (left and right
* arrow keys show this) and includes the space in the selection.
*
* The other case is the line break or breaks implied by block elements. For the following HTML:
*
* <p>1 </p><p>2<p>
*
* - WebKit does not acknowledge the space in any way
* - Firefox, IE and Opera as per <br>
*
* One more case is trailing spaces before line breaks in elements with white-space: pre-line. For the following HTML:
*
* <p style="white-space: pre-line">1
* 2</p>
*
* - Firefox and WebKit include the space in caret positions
* - IE does not support pre-line up to and including version 9
* - Opera ignores the space
* - Trailing space only renders if there is a non-collapsed character in the line
*
* Problem is whether Rangy should ever acknowledge the space and if so, when. Another problem is whether this can be
* feature-tested
*/
(function(factory, root) {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
@ -328,7 +328,7 @@
/*----------------------------------------------------------------------------------------------------------------*/
// "A block node is either an Element whose "display" property does not have
// resolved value "inline" or "inline-block" or "inline-table" or "none", or a
// Document, or a DocumentFragment."
@ -1917,6 +1917,6 @@
)
};
});
return rangy;
}, this);
}, this);