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
|
@ -154,16 +154,6 @@ function Ace2Editor()
|
|||
|
||||
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) {
|
||||
/* Folling is for packaging regular expression. */
|
||||
/* $$INCLUDE_JS("../minified/ace2_inner.js?callback=require.define"); */
|
||||
|
@ -253,13 +243,11 @@ function Ace2Editor()
|
|||
var includedJS = [];
|
||||
var $$INCLUDE_JS = function(filename) {includedJS.push(filename)};
|
||||
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('\
|
||||
<script type="text/javascript">\
|
||||
require.define("/plugins", null);\n\
|
||||
require.define("/plugins.js", function (require, exports, module) {\
|
||||
module.exports = parent.parent.require("/plugins");\
|
||||
});\
|
||||
require = parent.parent.require;
|
||||
</script>\
|
||||
');
|
||||
pushScriptsTo(iframeHTML);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue