Index: /CKEditor/trunk/CHANGES.html
===================================================================
--- /CKEditor/trunk/CHANGES.html (revision 5243)
+++ /CKEditor/trunk/CHANGES.html (revision 5244)
@@ -70,4 +70,5 @@
#4791 : Can't place cusor inside a form that end with a checkbox/radio.
#4479 : Style combo doesn't reflect the selection until it's first opened.
+ #4717 : 'Unlink' and 'Outdent' command buttons should be disabled on editor startup.
Index: /CKEditor/trunk/_source/core/commanddefinition.js
===================================================================
--- /CKEditor/trunk/_source/core/commanddefinition.js (revision 5243)
+++ /CKEditor/trunk/_source/core/commanddefinition.js (revision 5244)
@@ -1,3 +1,3 @@
-/*
+/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
@@ -85,2 +85,18 @@
* });
*/
+
+
+/**
+ * Whether the command state should be set to {@link CKEDITOR.TRISTATE_DISABLED} on startup.
+ * @name CKEDITOR.commandDefinition.startDisabled
+ * @type {Boolean}
+ * @default false
+ * @example
+ * editorInstance.addCommand( 'unlink',
+ * {
+ * exec : function( editor )
+ * {
+ * },
+ * startDisabled : true // Command is unavailable until selection is inside a link.
+ * });
+ */
Index: /CKEditor/trunk/_source/core/editor.js
===================================================================
--- /CKEditor/trunk/_source/core/editor.js (revision 5243)
+++ /CKEditor/trunk/_source/core/editor.js (revision 5244)
@@ -332,5 +332,5 @@
{
command = commands[ name ];
- command[ command.modes[ mode ] ? 'enable' : 'disable' ]();
+ command[ command.startDisabled ? 'disable' : command.modes[ mode ] ? 'enable' : 'disable' ]();
}
}
Index: /CKEditor/trunk/_source/plugins/indent/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/indent/plugin.js (revision 5243)
+++ /CKEditor/trunk/_source/plugins/indent/plugin.js (revision 5244)
@@ -256,4 +256,5 @@
else
this.indentCssProperty = editor.config.contentsLangDirection == 'ltr' ? 'margin-left' : 'margin-right';
+ this.startDisabled = name == 'outdent';
}
Index: /CKEditor/trunk/_source/plugins/link/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/link/plugin.js (revision 5243)
+++ /CKEditor/trunk/_source/plugins/link/plugin.js (revision 5244)
@@ -179,5 +179,7 @@
editor.document.$.execCommand( 'unlink', false, null );
selection.selectBookmarks( bookmarks );
- }
+ },
+
+ startDisabled : true
};