*/
public function buildJavascriptConfiguration($editorId) {
$registerRTEinJavascriptString = '';
- if (is_array( $this->thisConfig['contextMenu.'])) {
+ if (is_array($this->thisConfig['contextMenu.'])) {
$registerRTEinJavascriptString .= '
- RTEarea['.$editorId.'].contextMenu = new Object();';
+ RTEarea['.$editorId.'].contextMenu = ' . $this->htmlAreaRTE->buildNestedJSArray($this->thisConfig['contextMenu.']) . ';';
if ($this->thisConfig['contextMenu.']['showButtons']) {
$registerRTEinJavascriptString .= '
RTEarea['.$editorId.'].contextMenu.showButtons = ' . json_encode(t3lib_div::trimExplode(',', $this->htmlAreaRTE->cleanList(t3lib_div::strtolower($this->thisConfig['contextMenu.']['showButtons'])), 1)) . ';';
*/
configurePlugin : function(editor) {
this.pageTSConfiguration = this.editorConfiguration.contextMenu;
- if (this.pageTSConfiguration) {
- if (this.pageTSConfiguration.showButtons) {
- this.showButtons = this.pageTSConfiguration.showButtons;
- }
- if (this.pageTSConfiguration.hideButtons) {
- this.hideButtons = this.pageTSConfiguration.hideButtons;
- }
+ if (!this.pageTSConfiguration) {
+ this.pageTSConfiguration = {};
+ }
+ if (this.pageTSConfiguration.showButtons) {
+ this.showButtons = this.pageTSConfiguration.showButtons;
+ }
+ if (this.pageTSConfiguration.hideButtons) {
+ this.hideButtons = this.pageTSConfiguration.hideButtons;
}
/*
* Registering plugin "About" information
*/
onGenerate: function() {
// Build the context menu
- this.menu = new Ext.menu.Menu({
+ this.menu = new Ext.menu.Menu(Ext.applyIf({
cls: 'htmlarea-context-menu',
- height: 800,
defaultType: 'menuitem',
listeners: {
itemClick: {
}
},
items: this.buildItemsConfig()
- });
+ }, this.pageTSConfiguration));
// Monitor contextmenu clicks on the iframe
- this.menu.mon(Ext.get(Ext.isIE ? this.editor.document.body : this.editor.document.documentElement), 'contextmenu', this.show, this, {single: true});
+ this.menu.mon(Ext.get(this.editor.document.documentElement), 'contextmenu', this.show, this, {single: true});
},
/*
* Create the menu items config
* Handler when the menu gets shown
*/
onShow: function () {
- this.menu.mun(Ext.get(Ext.isIE ? this.editor.document.body : this.editor.document.documentElement), 'contextmenu', this.show, this);
- this.menu.mon(Ext.get(Ext.isIE ? this.editor.document.body : this.editor.document.documentElement), 'mousedown', this.menu.hide, this.menu, {single: true});
+ this.menu.mun(Ext.get(this.editor.document.documentElement), 'contextmenu', this.show, this);
+ this.menu.mon(Ext.get(this.editor.document.documentElement), 'mousedown', this.menu.hide, this.menu, {single: true});
},
/*
* Handler when the menu gets hidden
*/
onHide: function () {
- this.menu.mon(Ext.get(Ext.isIE ? this.editor.document.body : this.editor.document.documentElement), 'contextmenu', this.show, this);
- this.menu.mun(Ext.get(Ext.isIE ? this.editor.document.body : this.editor.document.documentElement), 'mousedown', this.menu.hide, this.menu);
+ this.menu.mon(Ext.get(this.editor.document.documentElement), 'contextmenu', this.show, this);
+ this.menu.mun(Ext.get(this.editor.document.documentElement), 'mousedown', this.menu.hide, this.menu);
},
/*
* Handler to show the context menu