mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-08 16:05:05 -04:00
Child frame uses parent's require.
This commit is contained in:
parent
6fd73ecfda
commit
b977e1acd6
3 changed files with 4 additions and 18 deletions
|
@ -136,8 +136,6 @@ function getAceFile(callback) {
|
||||||
if (!settings.minify) {
|
if (!settings.minify) {
|
||||||
founds = [];
|
founds = [];
|
||||||
}
|
}
|
||||||
// Always include the require kernel.
|
|
||||||
founds.push('$$INCLUDE_JS("../static/js/require-kernel.js")');
|
|
||||||
|
|
||||||
data += ';\n';
|
data += ';\n';
|
||||||
data += 'Ace2Editor.EMBEDED = Ace2Editor.EMBEDED || {};\n';
|
data += 'Ace2Editor.EMBEDED = Ace2Editor.EMBEDED || {};\n';
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"yajsml" : "1.1.2",
|
"yajsml" : "1.1.2",
|
||||||
"request" : "2.9.100",
|
"request" : "2.9.100",
|
||||||
"require-kernel" : "1.0.3",
|
"require-kernel" : "1.0.4",
|
||||||
"socket.io" : "0.8.7",
|
"socket.io" : "0.8.7",
|
||||||
"ueberDB" : "0.1.7",
|
"ueberDB" : "0.1.7",
|
||||||
"async" : "0.1.18",
|
"async" : "0.1.18",
|
||||||
|
|
|
@ -154,16 +154,6 @@ function Ace2Editor()
|
||||||
|
|
||||||
return {embeded: embededFiles, remote: remoteFiles};
|
return {embeded: embededFiles, remote: remoteFiles};
|
||||||
}
|
}
|
||||||
function pushRequireScriptTo(buffer) {
|
|
||||||
var KERNEL_SOURCE = '../static/js/require-kernel.js';
|
|
||||||
var KERNEL_BOOT = 'require.setRootURI("../minified/");\nrequire.setGlobalKeyPath("require");'
|
|
||||||
if (Ace2Editor.EMBEDED && Ace2Editor.EMBEDED[KERNEL_SOURCE]) {
|
|
||||||
buffer.push('<script type="text/javascript">');
|
|
||||||
buffer.push(Ace2Editor.EMBEDED[KERNEL_SOURCE]);
|
|
||||||
buffer.push(KERNEL_BOOT);
|
|
||||||
buffer.push('<\/script>');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function pushScriptsTo(buffer) {
|
function pushScriptsTo(buffer) {
|
||||||
/* Folling is for packaging regular expression. */
|
/* Folling is for packaging regular expression. */
|
||||||
/* $$INCLUDE_JS("../minified/ace2_inner.js?callback=require.define"); */
|
/* $$INCLUDE_JS("../minified/ace2_inner.js?callback=require.define"); */
|
||||||
|
@ -253,13 +243,11 @@ function Ace2Editor()
|
||||||
var includedJS = [];
|
var includedJS = [];
|
||||||
var $$INCLUDE_JS = function(filename) {includedJS.push(filename)};
|
var $$INCLUDE_JS = function(filename) {includedJS.push(filename)};
|
||||||
pushRequireScriptTo(iframeHTML);
|
pushRequireScriptTo(iframeHTML);
|
||||||
// Inject my plugins into my child.
|
// Inject my require into my child.
|
||||||
|
// HACK: Sharing this means that `window` can be bound cross frame.
|
||||||
iframeHTML.push('\
|
iframeHTML.push('\
|
||||||
<script type="text/javascript">\
|
<script type="text/javascript">\
|
||||||
require.define("/plugins", null);\n\
|
require = parent.parent.require;
|
||||||
require.define("/plugins.js", function (require, exports, module) {\
|
|
||||||
module.exports = parent.parent.require("/plugins");\
|
|
||||||
});\
|
|
||||||
</script>\
|
</script>\
|
||||||
');
|
');
|
||||||
pushScriptsTo(iframeHTML);
|
pushScriptsTo(iframeHTML);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue