Define packaging for iframe JS in the same way as pad.js and timeslider.js.
This commit is contained in:
parent
458b5a4f03
commit
348e7ef1d5
|
@ -239,9 +239,15 @@ function getAceFile(callback) {
|
|||
// the kernel isn’t actually on the file system.
|
||||
handleEmbed(null, requireDefinition());
|
||||
} else {
|
||||
fs.readFile(ROOT_DIR + filename, "utf8", function (error, data) {
|
||||
handleEmbed(error, isolateJS(data, shortFilename));
|
||||
});
|
||||
var contents = '';
|
||||
tarCode(tar[shortFilename] || shortFilename
|
||||
, function (content) {
|
||||
contents += content;
|
||||
}
|
||||
, function () {
|
||||
handleEmbed(null, contents);
|
||||
}
|
||||
);
|
||||
}
|
||||
} else {
|
||||
fs.readFile(ROOT_DIR + filename, "utf8", handleEmbed);
|
||||
|
|
|
@ -48,4 +48,18 @@
|
|||
, "broadcast_revisions.js"
|
||||
, "timeslider.js"
|
||||
]
|
||||
, "ace2_inner.js": [
|
||||
"ace2_common.js"
|
||||
, "skiplist.js"
|
||||
, "virtual_lines.js"
|
||||
, "easysync2.js"
|
||||
, "cssmanager.js"
|
||||
, "colorutils.js"
|
||||
, "undomodule.js"
|
||||
, "contentcollector.js"
|
||||
, "changesettracker.js"
|
||||
, "linestylefilter.js"
|
||||
, "domline.js"
|
||||
, "ace2_inner.js"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -228,29 +228,23 @@ function Ace2Editor()
|
|||
buffer.push('<script type="application/javascript" src="'+KERNEL_SOURCE+'"><\/script>');
|
||||
}
|
||||
}
|
||||
function pushScriptTagsFor(buffer, files) {
|
||||
var sorted = sortFilesByEmbeded(files);
|
||||
var embededFiles = sorted.embeded;
|
||||
var remoteFiles = sorted.remote;
|
||||
|
||||
for (var i = 0, ii = remoteFiles.length; i < ii; i++) {
|
||||
var file = remoteFiles[i];
|
||||
function pushScriptsTo(buffer) {
|
||||
/* Folling is for packaging regular expression. */
|
||||
/* $$INCLUDE_JS("../static/js/ace2_inner.js"); */
|
||||
var ACE_SOURCE = '../static/js/ace2_inner.js';
|
||||
if (Ace2Editor.EMBEDED && Ace2Editor.EMBEDED[ACE_SOURCE]) {
|
||||
buffer.push('<script type="text/javascript">');
|
||||
buffer.push(Ace2Editor.EMBEDED[ACE_SOURCE]);
|
||||
buffer.push('require("/ace2_inner");');
|
||||
buffer.push('<\/script>');
|
||||
} else {
|
||||
file = ACE_SOURCE;
|
||||
file = file.replace(/^\.\.\/static\/js\//, '../minified/');
|
||||
buffer.push('<script type="application/javascript" src="' + file + '"><\/script>');
|
||||
buffer.push('<script type="text/javascript">');
|
||||
buffer.push('require("/ace2_inner");');
|
||||
buffer.push('<\/script>');
|
||||
}
|
||||
|
||||
buffer.push('<script type="text/javascript">');
|
||||
for (var i = 0, ii = embededFiles.length; i < ii; i++) {
|
||||
var file = embededFiles[i];
|
||||
buffer.push(Ace2Editor.EMBEDED[file].replace(/<\//g, '<\\/'));
|
||||
buffer.push(';\n');
|
||||
}
|
||||
for (var i = 0, ii = files.length; i < ii; i++) {
|
||||
var file = files[i];
|
||||
file = file.replace(/^\.\.\/static\/js\//, '');
|
||||
buffer.push('require('+ JSON.stringify('/' + file) + ');\n');
|
||||
}
|
||||
buffer.push('<\/script>');
|
||||
}
|
||||
function pushStyleTagsFor(buffer, files) {
|
||||
var sorted = sortFilesByEmbeded(files);
|
||||
|
@ -324,18 +318,6 @@ function Ace2Editor()
|
|||
|
||||
var includedJS = [];
|
||||
var $$INCLUDE_JS = function(filename) {includedJS.push(filename)};
|
||||
$$INCLUDE_JS("../static/js/ace2_common.js");
|
||||
$$INCLUDE_JS("../static/js/skiplist.js");
|
||||
$$INCLUDE_JS("../static/js/virtual_lines.js");
|
||||
$$INCLUDE_JS("../static/js/easysync2.js");
|
||||
$$INCLUDE_JS("../static/js/cssmanager.js");
|
||||
$$INCLUDE_JS("../static/js/colorutils.js");
|
||||
$$INCLUDE_JS("../static/js/undomodule.js");
|
||||
$$INCLUDE_JS("../static/js/contentcollector.js");
|
||||
$$INCLUDE_JS("../static/js/changesettracker.js");
|
||||
$$INCLUDE_JS("../static/js/linestylefilter.js");
|
||||
$$INCLUDE_JS("../static/js/domline.js");
|
||||
$$INCLUDE_JS("../static/js/ace2_inner.js");
|
||||
pushRequireScriptTo(iframeHTML);
|
||||
// Inject my plugins into my child.
|
||||
iframeHTML.push('\
|
||||
|
@ -346,7 +328,7 @@ function Ace2Editor()
|
|||
});\
|
||||
</script>\
|
||||
');
|
||||
pushScriptTagsFor(iframeHTML, includedJS);
|
||||
pushScriptsTo(iframeHTML);
|
||||
|
||||
iframeHTML.push('<style type="text/css" title="dynamicsyntax"></style>');
|
||||
iframeHTML.push('</head><body id="innerdocbody" class="syntax" spellcheck="false"> </body></html>');
|
||||
|
|
Loading…
Reference in New Issue