From 83774e3038734910dfc2cde42f9eb03724287ff5 Mon Sep 17 00:00:00 2001 From: cdujeu Date: Sat, 21 Sep 2013 20:54:47 +0200 Subject: [PATCH] Tab-based editors --- .../editor.codemirror/class.CodeMirrorEditor.js | 4 ++-- .../editor.etherpad/class.EtherpadLauncher.js | 4 ++-- core/src/plugins/gui.ajax/manifest.xml | 9 +-------- .../res/js/ajaxplorer/class.AbstractEditor.js | 12 +++++++----- .../res/js/ajaxplorer/class.AjxpTabulator.js | 11 ++++++----- 5 files changed, 18 insertions(+), 22 deletions(-) diff --git a/core/src/plugins/editor.codemirror/class.CodeMirrorEditor.js b/core/src/plugins/editor.codemirror/class.CodeMirrorEditor.js index 24c404fb87..719ebe2b69 100644 --- a/core/src/plugins/editor.codemirror/class.CodeMirrorEditor.js +++ b/core/src/plugins/editor.codemirror/class.CodeMirrorEditor.js @@ -19,9 +19,9 @@ */ Class.create("CodeMirrorEditor", AbstractEditor, { - initialize: function($super, oFormObject) + initialize: function($super, oFormObject, options) { - $super(oFormObject); + $super(oFormObject, options); this.textWrapping = false; this.lineNumbers = true; diff --git a/core/src/plugins/editor.etherpad/class.EtherpadLauncher.js b/core/src/plugins/editor.etherpad/class.EtherpadLauncher.js index 88446c0766..2695e95eb5 100644 --- a/core/src/plugins/editor.etherpad/class.EtherpadLauncher.js +++ b/core/src/plugins/editor.etherpad/class.EtherpadLauncher.js @@ -23,9 +23,9 @@ Class.create("EtherpadLauncher", AbstractEditor, { sessionID: null, node: null, - initialize: function($super, oFormObject) + initialize: function($super, oFormObject, options) { - $super(oFormObject); + $super(oFormObject, options); if(!ajaxplorer.user || ajaxplorer.user.canWrite()){ this.canWrite = true; this.actions.get("saveButton").observe('click', function(){ diff --git a/core/src/plugins/gui.ajax/manifest.xml b/core/src/plugins/gui.ajax/manifest.xml index eaf7e236c6..0b2e58f597 100644 --- a/core/src/plugins/gui.ajax/manifest.xml +++ b/core/src/plugins/gui.ajax/manifest.xml @@ -137,7 +137,7 @@
-
+
@@ -146,13 +146,6 @@
-
diff --git a/core/src/plugins/gui.ajax/res/js/ajaxplorer/class.AbstractEditor.js b/core/src/plugins/gui.ajax/res/js/ajaxplorer/class.AbstractEditor.js index 26d71176d1..cfb3aa96bf 100644 --- a/core/src/plugins/gui.ajax/res/js/ajaxplorer/class.AbstractEditor.js +++ b/core/src/plugins/gui.ajax/res/js/ajaxplorer/class.AbstractEditor.js @@ -383,11 +383,13 @@ Class.create("AbstractEditor" , { * @param size int|null */ resize : function(size){ - if(size){ - this.contentMainContainer.setStyle({height:size+"px"}); - }else{ - fitHeightToBottom(this.contentMainContainer, this.element); - } + if(this.contentMainContainer){ + if(size){ + this.contentMainContainer.setStyle({height:size+"px"}); + }else{ + fitHeightToBottom(this.contentMainContainer, this.element); + } + } this.element.fire("editor:resize", size); }, /** diff --git a/core/src/plugins/gui.ajax/res/js/ajaxplorer/class.AjxpTabulator.js b/core/src/plugins/gui.ajax/res/js/ajaxplorer/class.AjxpTabulator.js index 491ca4a3f2..b10288a659 100644 --- a/core/src/plugins/gui.ajax/res/js/ajaxplorer/class.AjxpTabulator.js +++ b/core/src/plugins/gui.ajax/res/js/ajaxplorer/class.AjxpTabulator.js @@ -88,7 +88,7 @@ Class.create("AjxpTabulator", AjxpPane, { if(tabInfo.iconClass){ td.insert(new Element('span', {className:tabInfo.iconClass})); } - td.insert(''+MessageHash[tabInfo.label]+''); + td.insert(''+label+''); td.observe('click', function(){ this.switchTabulator(tabInfo.id); }.bind(this) ); @@ -176,10 +176,10 @@ Class.create("AjxpTabulator", AjxpPane, { }else if(paneInfo.type == 'widget'){ } - - this.resize(); this.tabulatorData.push(tabInfo); this.switchTabulator(tabInfo.id); + this.resize(); + window.setTimeout(this.resize.bind(this), 750); }, /** @@ -270,8 +270,9 @@ Class.create("AjxpTabulator", AjxpPane, { if(!this.selectedTabInfo) return; var ajxpObject = this.getAndSetAjxpObject(this.selectedTabInfo); if(ajxpObject){ - fitHeightToBottom($(this.htmlElement).down("#"+this.selectedTabInfo.element)); - ajxpObject.resize(); + var nodeElement = $(this.htmlElement).down("#"+this.selectedTabInfo.element); + fitHeightToBottom(nodeElement); + ajxpObject.resize(nodeElement?nodeElement.getHeight():this.htmlElement.getHeight()); var left ; var total = 0; var cont = this.htmlElement.down('div.tabulatorContainer');