[ADD] attempt to correctly initialize ckeditor widgets (fontawesome icon things at the moment) within a dropped snippet

bzr revid: xmo@openerp.com-20140121131841-u0qzlk1ytng3af2h
This commit is contained in:
Xavier Morel
2014-01-21 14:18:41 +01:00
parent 35b8850ecc
commit a6ad36ef89
@@ -821,6 +821,28 @@
document.execCommand("enableInlineTableEditing", false, "false");
} catch (e) {}
// detect & setup any CKEDITOR widget within a newly dropped
// snippet. There does not seem to be a simple way to do it for
// HTML not inserted via ckeditor APIs:
// https://dev.ckeditor.com/ticket/11472
$(document.body)
.off('snippet-dropped')
.on('snippet-dropped', function (e, el) {
// CKEDITOR data processor extended by widgets plugin
// to add wrappers around upcasting elements
el.outerHTML = editor.dataProcessor.toHtml(el.outerHTML, {
fixForBody: false,
dontFilter: true,
});
// then repository.initOnAll() handles the conversion
// from wrapper to actual widget instance (or something
// like that).
setTimeout(function () {
editor.widgets.initOnAll();
}, 0);
});
self.trigger('rte:ready');
def.resolve();
});