From 7533fe77b44df28ccbe1708df6dbd36ce023ed48 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 24 Sep 2013 13:06:01 +0200 Subject: [PATCH] [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 --- addons/website/static/src/js/website.editor.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index b82f665c838..413d26bda3a 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -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);