r1345 - xwiki/trunk/src/main/web/wiki_editor/plugins

Phung Hai Nam namphunghai at users.forge.objectweb.org
Thu Sep 28 05:19:06 CEST 2006


Author: namphunghai
Date: 2006-09-28 05:19:06 +0200 (Thu, 28 Sep 2006)
New Revision: 1345

Modified:
   xwiki/trunk/src/main/web/wiki_editor/plugins/core.js
Log:
Fixed the bug XWIKI-308  "Indent buttons grayed on normal text"

Modified: xwiki/trunk/src/main/web/wiki_editor/plugins/core.js
===================================================================
--- xwiki/trunk/src/main/web/wiki_editor/plugins/core.js	2006-09-28 02:34:17 UTC (rev 1344)
+++ xwiki/trunk/src/main/web/wiki_editor/plugins/core.js	2006-09-28 03:19:06 UTC (rev 1345)
@@ -92,7 +92,8 @@
     // Toolbar handlers
 	this.addToolbarHandler('handleTextButtons');
 	this.addToolbarHandler('handleListButtons');
-	this.addToolbarHandler('handleUndoButtons');
+    this.addToolbarHandler('handleIndentButtons');
+    this.addToolbarHandler('handleUndoButtons');
 	this.addToolbarHandler('handleTitlesList');
 	this.addToolbarHandler('handleLinkButtons');
     this.addToolbarHandler('handleTableButtons');
@@ -369,6 +370,18 @@
 	}
 }
 
+WikiEditor.prototype.handleIndentButtons = function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
+    // indent, outdent for all element
+    tinyMCE.switchClassSticky(editor_id + '_outdent', 'mceButtonDisabled', true);
+	tinyMCE.switchClassSticky(editor_id + '_indent', 'mceButtonNormal');
+
+    var indent = this.core.getParentElement(node, "blockquote");
+    var ul = this.core.getParentElement(node, "ul");
+    if (indent || ul) {
+        tinyMCE.switchClassSticky(editor_id + '_outdent', 'mceButtonNormal', false);
+    }
+}
+
 WikiEditor.prototype.handleUndoButtons = function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
 	if (undo_levels != -1)
 	{
@@ -393,8 +406,6 @@
 	// Reset old states
 	tinyMCE.switchClassSticky(editor_id + '_bullist', 'mceButtonNormal');
 	tinyMCE.switchClassSticky(editor_id + '_numlist', 'mceButtonNormal');
-	tinyMCE.switchClassSticky(editor_id + '_outdent', 'mceButtonDisabled', true);
-	tinyMCE.switchClassSticky(editor_id + '_indent', 'mceButtonDisabled', true);
 
 	do {
 		switch (node.nodeName.toLowerCase()) {





More information about the Xwiki-notifications mailing list