Bug #23778 » rtehtmlarea_bugfix_16045_trunk.patch
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.js (copie de travail) | ||
---|---|---|
}
|
||
return type;
|
||
};
|
||
/*
|
||
* Return the ranges of the selection
|
||
*/
|
||
HTMLArea.Editor.prototype.getSelectionRanges = function(selection) {
|
||
if (!selection) {
|
||
var selection = this._getSelection();
|
||
}
|
||
var ranges = [];
|
||
for (var i = selection.rangeCount; --i >= 0;) {
|
||
ranges.push(selection.getRangeAt(i));
|
||
}
|
||
return ranges;
|
||
};
|
||
/*
|
||
* Add ranges to the selection
|
||
*/
|
||
HTMLArea.Editor.prototype.setSelectionRanges = function(ranges, selection) {
|
||
if (!selection) {
|
||
var selection = this._getSelection();
|
||
}
|
||
this.emptySelection(selection);
|
||
for (var i = ranges.length; --i >= 0;) {
|
||
this.addRangeToSelection(selection, ranges[i]);
|
||
}
|
||
};
|
||
/*
|
||
* Retrieves the selected element (if any), just in the case that a single element (object like and image or a table) is selected.
|
||
*/
|
||
HTMLArea.Editor.prototype.getSelectedElement = function(selection) {
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/ContextMenu/context-menu.js (copie de travail) | ||
---|---|---|
*/
|
||
showMenu: function (event, target) {
|
||
this.showContextItems(target);
|
||
if (!Ext.isIE) {
|
||
this.ranges = this.editor.getSelectionRanges();
|
||
}
|
||
var iframeEl = this.editor.iframe.getEl();
|
||
this.menu.showAt([Ext.get(target).getX() + iframeEl.getX(), Ext.get(target).getY() + iframeEl.getY()]);
|
||
},
|
||
... | ... | |
* Handler invoked when a menu item is clicked on
|
||
*/
|
||
onItemClick: function (item, event) {
|
||
if (!Ext.isIE) {
|
||
this.editor.setSelectionRanges(this.ranges);
|
||
}
|
||
var button = this.getButton(item.getItemId());
|
||
if (button) {
|
||
button.fireEvent('HTMLAreaEventContextMenu', button, event);
|