mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-28 11:26:16 -04:00
ace.js AMDification
This commit is contained in:
parent
2f12fc0229
commit
2472cd365e
3 changed files with 296 additions and 298 deletions
|
@ -24,23 +24,21 @@
|
|||
// requires: plugins
|
||||
// requires: undefined
|
||||
|
||||
Ace2Editor.registry = {
|
||||
define(['ep_etherpad-lite/static/js/pluginfw/hooks', 'underscore'], function (hooks, _) {
|
||||
Ace2Editor.registry = {
|
||||
nextId: 1
|
||||
};
|
||||
};
|
||||
|
||||
var hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks');
|
||||
var _ = require('./underscore');
|
||||
|
||||
function scriptTag(source) {
|
||||
function scriptTag(source) {
|
||||
return (
|
||||
'<script type="text/javascript">\n'
|
||||
+ source.replace(/<\//g, '<\\/') +
|
||||
'</script>'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Ace2Editor()
|
||||
{
|
||||
function Ace2Editor()
|
||||
{
|
||||
var ace2 = Ace2Editor;
|
||||
|
||||
var editor = {};
|
||||
|
@ -237,9 +235,9 @@ function Ace2Editor()
|
|||
(function () {return this}())[thisFunctionsName] = Ace2Editor;
|
||||
|
||||
var outerScript = '\
|
||||
editorId = ' + JSON.stringify(info.id) + ';\n\
|
||||
editorInfo = parent[' + JSON.stringify(thisFunctionsName) + '].registry[editorId];\n\
|
||||
window.onload = function () {\n\
|
||||
editorId = ' + JSON.stringify(info.id) + ';\n\
|
||||
editorInfo = parent[' + JSON.stringify(thisFunctionsName) + '].registry[editorId];\n\
|
||||
window.onload = function () {\n\
|
||||
window.onload = null;\n\
|
||||
setTimeout(function () {\n\
|
||||
var iframe = document.createElement("IFRAME");\n\
|
||||
|
@ -262,7 +260,7 @@ window.onload = function () {\n\
|
|||
doc.write(text);\n\
|
||||
doc.close();\n\
|
||||
}, 0);\n\
|
||||
}';
|
||||
}';
|
||||
|
||||
var outerHTML = [doctype, '<html><head>']
|
||||
|
||||
|
@ -296,6 +294,7 @@ window.onload = function () {\n\
|
|||
};
|
||||
|
||||
return editor;
|
||||
}
|
||||
}
|
||||
|
||||
exports.Ace2Editor = Ace2Editor;
|
||||
return {Ace2Editor: Ace2Editor};
|
||||
});
|
||||
|
|
|
@ -474,7 +474,10 @@ var pad = {
|
|||
// start the custom js
|
||||
if (typeof customStart == "function") customStart();
|
||||
getParams();
|
||||
|
||||
padeditor.init(function () {
|
||||
handshake();
|
||||
}, pad.padOptions.view || {}, pad);
|
||||
|
||||
// To use etherpad you have to allow cookies.
|
||||
// This will check if the creation of a test-cookie has success.
|
||||
|
@ -525,12 +528,9 @@ var pad = {
|
|||
padimpexp.init(this);
|
||||
padsavedrevs.init(this);
|
||||
|
||||
padeditor.init(postAceInit, pad.padOptions.view || {}, this);
|
||||
|
||||
paduserlist.init(pad.myUserInfo, this);
|
||||
padconnectionstatus.init();
|
||||
padmodals.init(this);
|
||||
|
||||
pad.collabClient = getCollabClient(padeditor.ace, clientVars.collab_client_vars, pad.myUserInfo, {
|
||||
colorPalette: pad.getColorPalette()
|
||||
}, pad);
|
||||
|
@ -554,8 +554,6 @@ var pad = {
|
|||
$("#chatloadmessagesbutton").css("display", "none");
|
||||
}
|
||||
|
||||
function postAceInit()
|
||||
{
|
||||
padeditbar.init();
|
||||
setTimeout(function()
|
||||
{
|
||||
|
@ -591,7 +589,6 @@ var pad = {
|
|||
})
|
||||
|
||||
hooks.aCallAll("postAceInit", {ace: padeditor.ace, pad: pad});
|
||||
}
|
||||
},
|
||||
dispose: function()
|
||||
{
|
||||
|
|
|
@ -39,9 +39,10 @@ var padeditor = (function()
|
|||
ace: null,
|
||||
// this is accessed directly from other files
|
||||
viewZoom: 100,
|
||||
init: function(readyFunc, initialViewOptions, _pad)
|
||||
{
|
||||
Ace2Editor = require('./ace').Ace2Editor;
|
||||
init: function(readyFunc, initialViewOptions, _pad) {
|
||||
requirejs(['ep_etherpad-lite/static/js/ace'], function (ace) {
|
||||
|
||||
Ace2Editor = ace.Ace2Editor;
|
||||
pad = _pad;
|
||||
settings = pad.settings;
|
||||
|
||||
|
@ -66,6 +67,7 @@ var padeditor = (function()
|
|||
|
||||
// view bar
|
||||
$("#viewbarcontents").show();
|
||||
});
|
||||
},
|
||||
initViewOptions: function()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue