MDL-51605 Rangy: Patch out AMD support (we can't use it from YUI).

This commit is contained in:
Damyon Wiese
2015-09-30 13:17:28 +08:00
parent 0fde7efad1
commit fc07d950ea
10 changed files with 76 additions and 203 deletions
+9
View File
@@ -4,8 +4,17 @@ Description of the import of libraries associated with the Atto editor.
* Download the latest stable release;
* 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):
(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) {
* 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.
@@ -9,16 +9,8 @@
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module.
define(factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory();
} else {
// No AMD or CommonJS support so we place Rangy in (probably) the global variable
root.rangy = factory();
}
// No AMD or CommonJS support so we place Rangy in (probably) the global variable
root.rangy = factory();
})(function() {
var OBJECT = "object", FUNCTION = "function", UNDEFINED = "undefined";
@@ -3843,6 +3835,7 @@
return api;
}, this);
/**
* Selection save and restore module for Rangy.
* Saves and restores user selections using marker invisible elements in the DOM.
@@ -3858,16 +3851,8 @@
* Build date: 10 May 2015
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module with a dependency on Rangy.
define(["./rangy-core"], factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory( require("rangy") );
} else {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
}
// 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) {
var dom = api.dom;
@@ -4095,6 +4080,7 @@
return rangy;
}, this);
/**
* 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
@@ -4111,16 +4097,8 @@
* Build date: 10 May 2015
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module with a dependency on Rangy.
define(["./rangy-core"], factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory( require("rangy") );
} else {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
}
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
})(function(rangy) {
rangy.createModule("Serializer", ["WrappedSelection"], function(api, module) {
var UNDEF = "undefined";
@@ -4409,6 +4387,7 @@
return rangy;
}, this);
/**
* Class Applier module for Rangy.
* Adds, removes and toggles classes on Ranges and Selections
@@ -4424,16 +4403,8 @@
* Build date: 10 May 2015
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module with a dependency on Rangy.
define(["./rangy-core"], factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory( require("rangy") );
} else {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
}
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
})(function(rangy) {
rangy.createModule("ClassApplier", ["WrappedSelection"], function(api, module) {
var dom = api.dom;
@@ -5525,16 +5496,8 @@
* Build date: 10 May 2015
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module with a dependency on Rangy.
define(["./rangy-core"], factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory( require("rangy") );
} else {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
}
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
})(function(rangy) {
rangy.createModule("Highlighter", ["ClassApplier"], function(api, module) {
var dom = api.dom;
@@ -6200,16 +6163,8 @@
* feature-tested
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module with a dependency on Rangy.
define(["./rangy-core"], factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory( require("rangy") );
} else {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
}
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
})(function(rangy) {
rangy.createModule("TextRange", ["WrappedSelection"], function(api, module) {
var UNDEF = "undefined";
@@ -8063,7 +8018,8 @@
});
return rangy;
}, this);YUI.add('moodle-editor_atto-rangy', function (Y, NAME) {
}, this);
YUI.add('moodle-editor_atto-rangy', function (Y, NAME) {
// This file is part of Moodle - http://moodle.org/
//
File diff suppressed because one or more lines are too long
@@ -9,16 +9,8 @@
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module.
define(factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory();
} else {
// No AMD or CommonJS support so we place Rangy in (probably) the global variable
root.rangy = factory();
}
// No AMD or CommonJS support so we place Rangy in (probably) the global variable
root.rangy = factory();
})(function() {
var OBJECT = "object", FUNCTION = "function", UNDEFINED = "undefined";
@@ -3843,6 +3835,7 @@
return api;
}, this);
/**
* Selection save and restore module for Rangy.
* Saves and restores user selections using marker invisible elements in the DOM.
@@ -3858,16 +3851,8 @@
* Build date: 10 May 2015
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module with a dependency on Rangy.
define(["./rangy-core"], factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory( require("rangy") );
} else {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
}
// 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) {
var dom = api.dom;
@@ -4095,6 +4080,7 @@
return rangy;
}, this);
/**
* 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
@@ -4111,16 +4097,8 @@
* Build date: 10 May 2015
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module with a dependency on Rangy.
define(["./rangy-core"], factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory( require("rangy") );
} else {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
}
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
})(function(rangy) {
rangy.createModule("Serializer", ["WrappedSelection"], function(api, module) {
var UNDEF = "undefined";
@@ -4409,6 +4387,7 @@
return rangy;
}, this);
/**
* Class Applier module for Rangy.
* Adds, removes and toggles classes on Ranges and Selections
@@ -4424,16 +4403,8 @@
* Build date: 10 May 2015
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module with a dependency on Rangy.
define(["./rangy-core"], factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory( require("rangy") );
} else {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
}
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
})(function(rangy) {
rangy.createModule("ClassApplier", ["WrappedSelection"], function(api, module) {
var dom = api.dom;
@@ -5525,16 +5496,8 @@
* Build date: 10 May 2015
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module with a dependency on Rangy.
define(["./rangy-core"], factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory( require("rangy") );
} else {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
}
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
})(function(rangy) {
rangy.createModule("Highlighter", ["ClassApplier"], function(api, module) {
var dom = api.dom;
@@ -6200,16 +6163,8 @@
* feature-tested
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module with a dependency on Rangy.
define(["./rangy-core"], factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory( require("rangy") );
} else {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
}
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
})(function(rangy) {
rangy.createModule("TextRange", ["WrappedSelection"], function(api, module) {
var UNDEF = "undefined";
@@ -8063,7 +8018,8 @@
});
return rangy;
}, this);YUI.add('moodle-editor_atto-rangy', function (Y, NAME) {
}, this);
YUI.add('moodle-editor_atto-rangy', function (Y, NAME) {
// This file is part of Moodle - http://moodle.org/
//
+2 -10
View File
@@ -13,16 +13,8 @@
* Build date: 10 May 2015
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module with a dependency on Rangy.
define(["./rangy-core"], factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory( require("rangy") );
} else {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
}
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
})(function(rangy) {
rangy.createModule("ClassApplier", ["WrappedSelection"], function(api, module) {
var dom = api.dom;
+3 -11
View File
@@ -9,16 +9,8 @@
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module.
define(factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory();
} else {
// No AMD or CommonJS support so we place Rangy in (probably) the global variable
root.rangy = factory();
}
// No AMD or CommonJS support so we place Rangy in (probably) the global variable
root.rangy = factory();
})(function() {
var OBJECT = "object", FUNCTION = "function", UNDEFINED = "undefined";
@@ -3842,4 +3834,4 @@
}
return api;
}, this);
}, this);
+2 -10
View File
@@ -10,16 +10,8 @@
* Build date: 10 May 2015
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module with a dependency on Rangy.
define(["./rangy-core"], factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory( require("rangy") );
} else {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
}
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
})(function(rangy) {
rangy.createModule("Highlighter", ["ClassApplier"], function(api, module) {
var dom = api.dom;
@@ -13,16 +13,8 @@
* Build date: 10 May 2015
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module with a dependency on Rangy.
define(["./rangy-core"], factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory( require("rangy") );
} else {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
}
// 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) {
var dom = api.dom;
@@ -249,4 +241,4 @@
});
return rangy;
}, this);
}, this);
+3 -11
View File
@@ -14,16 +14,8 @@
* Build date: 10 May 2015
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module with a dependency on Rangy.
define(["./rangy-core"], factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory( require("rangy") );
} else {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
}
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
})(function(rangy) {
rangy.createModule("Serializer", ["WrappedSelection"], function(api, module) {
var UNDEF = "undefined";
@@ -311,4 +303,4 @@
});
return rangy;
}, this);
}, this);
+3 -11
View File
@@ -64,16 +64,8 @@
* feature-tested
*/
(function(factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module with a dependency on Rangy.
define(["./rangy-core"], factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory( require("rangy") );
} else {
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
}
// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
factory(root.rangy);
})(function(rangy) {
rangy.createModule("TextRange", ["WrappedSelection"], function(api, module) {
var UNDEF = "undefined";
@@ -1927,4 +1919,4 @@
});
return rangy;
}, this);
}, this);