Make intialization of Ace2Inner analogous to other page controllers.

pull/1006/head
Chad Weider 2012-09-12 00:04:15 -07:00
parent 9f5946c942
commit 622819ba93
2 changed files with 53 additions and 47 deletions

View File

@ -246,7 +246,11 @@ hooks.plugins = plugins;\n\
plugins.adoptPluginsFromAncestorsOf(window);\n\ plugins.adoptPluginsFromAncestorsOf(window);\n\
\n\ \n\
$ = jQuery = require("ep_etherpad-lite/static/js/rjquery").jQuery; // Expose jQuery #HACK\n\ $ = jQuery = require("ep_etherpad-lite/static/js/rjquery").jQuery; // Expose jQuery #HACK\n\
require("ep_etherpad-lite/static/js/ace2_inner");\n\ var Ace2Inner = require("ep_etherpad-lite/static/js/ace2_inner");\n\
\n\
plugins.ensure(function () {\n\
Ace2Inner.init();\n\
});\n\
')); '));
iframeHTML.push('<style type="text/css" title="dynamicsyntax"></style>'); iframeHTML.push('<style type="text/css" title="dynamicsyntax"></style>');

View File

@ -19,7 +19,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
var editor, _, $, jQuery, plugins, Ace2Common; var _, $, jQuery, plugins, Ace2Common;
Ace2Common = require('./ace2_common'); Ace2Common = require('./ace2_common');
@ -5430,6 +5430,7 @@ function Ace2Inner(){
return documentAttributeManager.setAttributesOnRange.apply(documentAttributeManager, arguments); return documentAttributeManager.setAttributesOnRange.apply(documentAttributeManager, arguments);
}; };
this.init = function () {
$(document).ready(function(){ $(document).ready(function(){
doc = document; // defined as a var in scope outside doc = document; // defined as a var in scope outside
inCallStack("setup", function() inCallStack("setup", function()
@ -5482,10 +5483,11 @@ function Ace2Inner(){
isSetUp = true; isSetUp = true;
}); });
}
} }
// Ensure that plugins are loaded before initializing the editor exports.init = function () {
plugins.ensure(function () { var editor = new Ace2Inner()
var editor = new Ace2Inner(); editor.init();
}); };