[FIX] paste in webkit-ish browsers
clipboard plugin was getting lost due to method used to get a readonly toplevel editor with editable sub-sections in it. The clipboard plugin creates a hidden pasteboard element to safely get a the clipboard data before inserting it at paste point, this clipboard may have to be made @contenteditable if it's created in a readonly area. Which was the case here: the pasteboard was inserted at the root of the editor, which is not editable. But because of @data-cke-editable being explicitly set, ckeditor would believe it had inserted the pasteboard in an editable section and thus would *not* set its @contenteditable leading to a useless readonly pasteboard. The purpose of @data-cke-editable was to make the editor itself "editable" for cke (in order for the toolbar to not be disabled) while it would not actually be editable (@contenteditable) for users. This is better reimplemented by calling API methods to make the editor editable but its root element not editable, one of the improvements being that commands (and thus toolbar buttons) now switch state correctly based on context. bzr revid: xmo@openerp.com-20130924110601-gfvc395rsedpnoh3
This commit is contained in:
@@ -321,16 +321,16 @@
|
||||
var self = this;
|
||||
// create a single editor for the whole page
|
||||
var root = document.getElementById('wrapwrap');
|
||||
$(root).attr('data-cke-editable', 'true')
|
||||
.on('dragstart', 'img', function (e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
this.editor = CKEDITOR.inline(root, self._config());
|
||||
this.editor.on('instanceReady', function () {
|
||||
$(root).on('dragstart', 'img', function (e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
var editor = this.editor = CKEDITOR.inline(root, self._config());
|
||||
editor.on('instanceReady', function () {
|
||||
editor.setReadOnly(false);
|
||||
// ckeditor set root to editable, disable it (only inner
|
||||
// sections are editable)
|
||||
// FIXME: are there cases where the whole editor is editable?
|
||||
root.contentEditable = false;
|
||||
editor.editable().setReadOnly(true);
|
||||
|
||||
self.setup_editables(root);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user