ace: Format script strings for readability
parent
b3416c4eeb
commit
c9b1f17f25
|
@ -197,23 +197,22 @@ const Ace2Editor = function () {
|
||||||
iframeHTML.push(`<script type="text/javascript" src="../javascripts/lib/ep_etherpad-lite/static/js/ace2_inner.js?callback=require.define&v=${clientVars.randomVersionString}"></script>`);
|
iframeHTML.push(`<script type="text/javascript" src="../javascripts/lib/ep_etherpad-lite/static/js/ace2_inner.js?callback=require.define&v=${clientVars.randomVersionString}"></script>`);
|
||||||
iframeHTML.push(`<script type="text/javascript" src="../javascripts/lib/ep_etherpad-lite/static/js/ace2_common.js?callback=require.define&v=${clientVars.randomVersionString}"></script>`);
|
iframeHTML.push(`<script type="text/javascript" src="../javascripts/lib/ep_etherpad-lite/static/js/ace2_common.js?callback=require.define&v=${clientVars.randomVersionString}"></script>`);
|
||||||
|
|
||||||
iframeHTML.push(scriptTag(
|
iframeHTML.push(scriptTag(`
|
||||||
`\n\
|
require.setRootURI("../javascripts/src");
|
||||||
require.setRootURI("../javascripts/src");\n\
|
require.setLibraryURI("../javascripts/lib");
|
||||||
require.setLibraryURI("../javascripts/lib");\n\
|
require.setGlobalKeyPath("require");
|
||||||
require.setGlobalKeyPath("require");\n\
|
|
||||||
\n\
|
// intentially moved before requiring client_plugins to save a 307
|
||||||
// intentially moved before requiring client_plugins to save a 307
|
var Ace2Inner = require("ep_etherpad-lite/static/js/ace2_inner");
|
||||||
var Ace2Inner = require("ep_etherpad-lite/static/js/ace2_inner");\n\
|
var plugins = require("ep_etherpad-lite/static/js/pluginfw/client_plugins");
|
||||||
var plugins = require("ep_etherpad-lite/static/js/pluginfw/client_plugins");\n\
|
plugins.adoptPluginsFromAncestorsOf(window);
|
||||||
plugins.adoptPluginsFromAncestorsOf(window);\n\
|
|
||||||
\n\
|
$ = jQuery = require("ep_etherpad-lite/static/js/rjquery").jQuery; // Expose jQuery #HACK
|
||||||
$ = jQuery = require("ep_etherpad-lite/static/js/rjquery").jQuery; // Expose jQuery #HACK\n\
|
|
||||||
\n\
|
plugins.ensure(function () {
|
||||||
plugins.ensure(function () {\n\
|
Ace2Inner.init();
|
||||||
Ace2Inner.init();\n\
|
});
|
||||||
});\n\
|
`));
|
||||||
`));
|
|
||||||
|
|
||||||
iframeHTML.push('<style type="text/css" title="dynamicsyntax"></style>');
|
iframeHTML.push('<style type="text/css" title="dynamicsyntax"></style>');
|
||||||
|
|
||||||
|
@ -228,33 +227,34 @@ plugins.ensure(function () {\n\
|
||||||
const gt = typeof globalThis === 'object' ? globalThis : window;
|
const gt = typeof globalThis === 'object' ? globalThis : window;
|
||||||
gt.ChildAccessibleAce2Editor = Ace2Editor;
|
gt.ChildAccessibleAce2Editor = Ace2Editor;
|
||||||
|
|
||||||
const outerScript = `\
|
const outerScript = `
|
||||||
editorId = ${JSON.stringify(info.id)};\n\
|
editorId = ${JSON.stringify(info.id)};
|
||||||
editorInfo = parent.ChildAccessibleAce2Editor.registry[editorId];\n\
|
editorInfo = parent.ChildAccessibleAce2Editor.registry[editorId];
|
||||||
window.onload = function () {\n\
|
window.onload = function () {
|
||||||
window.onload = null;\n\
|
window.onload = null;
|
||||||
setTimeout(function () {\n\
|
setTimeout(function () {
|
||||||
var iframe = document.createElement("IFRAME");\n\
|
var iframe = document.createElement("IFRAME");
|
||||||
iframe.name = "ace_inner";\n\
|
iframe.name = "ace_inner";
|
||||||
iframe.title = "pad";\n\
|
iframe.title = "pad";
|
||||||
iframe.scrolling = "no";\n\
|
iframe.scrolling = "no";
|
||||||
var outerdocbody = document.getElementById("outerdocbody");\n\
|
var outerdocbody = document.getElementById("outerdocbody");
|
||||||
iframe.frameBorder = 0;\n\
|
iframe.frameBorder = 0;
|
||||||
iframe.allowTransparency = true; // for IE\n\
|
iframe.allowTransparency = true; // for IE
|
||||||
outerdocbody.insertBefore(iframe, outerdocbody.firstChild);\n\
|
outerdocbody.insertBefore(iframe, outerdocbody.firstChild);
|
||||||
iframe.ace_outerWin = window;\n\
|
iframe.ace_outerWin = window;
|
||||||
readyFunc = function () {\n\
|
readyFunc = function () {
|
||||||
editorInfo.onEditorReady();\n\
|
editorInfo.onEditorReady();
|
||||||
readyFunc = null;\n\
|
readyFunc = null;
|
||||||
editorInfo = null;\n\
|
editorInfo = null;
|
||||||
};\n\
|
};
|
||||||
var doc = iframe.contentWindow.document;\n\
|
var doc = iframe.contentWindow.document;
|
||||||
doc.open();\n\
|
doc.open();
|
||||||
var text = (${JSON.stringify(iframeHTML.join('\n'))});\n\
|
var text = (${JSON.stringify(iframeHTML.join('\n'))});
|
||||||
doc.write(text);\n\
|
doc.write(text);
|
||||||
doc.close();\n\
|
doc.close();
|
||||||
}, 0);\n\
|
}, 0);
|
||||||
}`;
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
const outerHTML =
|
const outerHTML =
|
||||||
[doctype, `<html class="inner-editor outerdoc ${clientVars.skinVariants}"><head>`];
|
[doctype, `<html class="inner-editor outerdoc ${clientVars.skinVariants}"><head>`];
|
||||||
|
|
Loading…
Reference in New Issue