* Feature #6712: htmlArea RTE: make hotkeys configurable in PageTSConfig
* Feature #6712 continued: htmlArea RTE: adding hotkeys to default configuration settings
* Bugfix: htmlArea RTE: Correction to InlineDefault plugin causing frame reload.
+ * Feature #6712 corected: htmlArea RTE: correction to DefaultInline plugin and enhanced API
2007-11-14 Ingmar Schlecht <ingmar@typo3.org>
* Feature #6712: htmlArea RTE: make hotkeys configurable in PageTSConfig
* Feature #6712 continued: htmlArea RTE: adding hotkeys to default configuration settings
* Bugfix: htmlArea RTE: Correction to InlineDefault plugin causing frame reload.
+ * Feature #6712 corected: htmlArea RTE: correction to DefaultInline plugin and enhanced API
2007-11-13 Stanislas Rolland <stanislas.rolland@fructifor.ca>
}
break;
default:
- if (editor._toolbarObjects[editor.config.hotKeyList[key]]) {
+ if (editor._toolbarObjects[editor.config.hotKeyList[key].cmd]) {
cmd = editor.config.hotKeyList[key].cmd;
if(cmd == "FormatBlock") value = (HTMLArea.is_ie || HTMLArea.is_safari) ? "<p>" : "p";
}
}
}
}
- if(cmd) {
+ if(cmd && !editor.config.hotKeyList[key].action) {
editor.execCommand(cmd, false, value);
HTMLArea._stopEvent(ev);
return false;
var toolbar = this.editorConfiguration.toolbar;
var n = toolbar.length;
for ( var i = 0; i < n; ++i ) {
- if (toolbar[i].join(",").indexOf(buttonId) != -1) {
+ var buttonInToolbar = new RegExp( "^(" + toolbar[i].join("|") + ")$", "i");
+ if (buttonInToolbar.test(buttonId)) {
return true;
}
}
if (buttonConfiguration.hotKey) {
var hotKeyConfiguration = {
id : buttonConfiguration.hotKey,
+ cmd : buttonConfiguration.id,
action : hotKeyAction
};
return this.registerHotKey(hotKeyConfiguration);
}
},
+ /**
+ * Returns the buttonId corresponding to the hotkey, if any
+ *
+ * @param string key: the hotkey
+ *
+ * @return string the buttonId or ""
+ */
+ translateHotKey : function(key) {
+ if (typeof(this.editorConfiguration.hotKeyList[key]) !== "undefined") {
+ var buttonId = this.editorConfiguration.hotKeyList[key].cmd;
+ if (typeof(buttonId) !== "undefined") {
+ return buttonId;
+ } else {
+ return "";
+ }
+ }
+ return "";
+ },
+
/**
* The toolbar refresh handler of the plugin
* This function may be defined by the plugin subclass.
*/
onButtonPress : function (editor, id, UI, param) {
// Could be a button or its hotkey
- var buttonId = DefaultInline.hotKeyList[id]?DefaultInline.hotKeyList[id]:id;
+ var buttonId = this.translateHotKey(id);
+ buttonId = buttonId ? buttonId : id;
editor.focusEditor();
try {
editor._doc.execCommand(buttonId, UI, param);
var buttonId, n = buttonList.length, commandState;
for (var i = 0; i < n; ++i) {
buttonId = buttonList[i][0];
- if (typeof(editor._toolbarObjects[buttonId]) !== "undefined") {
+ if (this.isButtonInToolbar(buttonId)) {
commandState = false;
if ((editor._editMode != "textmode")) {
try {
["Underline", null]
];
-/* The list of hotkeys handled by this plugin */
-DefaultInline.hotKeyList = {
- b : "Bold",
- i : "Italic",
- s : "StrikeThrough",
- u : "Underline"
-};
-