ace.js AMDification

This commit is contained in:
Egil Moeller 2015-04-12 18:10:17 +02:00
parent 2f12fc0229
commit 2472cd365e
3 changed files with 296 additions and 298 deletions

View file

@ -24,13 +24,11 @@
// requires: plugins
// requires: undefined
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) {
return (
'<script type="text/javascript">\n'
@ -298,4 +296,5 @@ window.onload = function () {\n\
return editor;
}
exports.Ace2Editor = Ace2Editor;
return {Ace2Editor: Ace2Editor};
});

View file

@ -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()
{

View file

@ -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()
{