diff --git a/addons/website/static/lib/ckeditor b/addons/website/static/lib/ckeditor
new file mode 120000
index 00000000000..71bda480b99
--- /dev/null
+++ b/addons/website/static/lib/ckeditor
@@ -0,0 +1 @@
+/Users/masklinn/projects/thirdparty/ckeditor-dev
\ No newline at end of file
diff --git a/addons/website/static/lib/ckeditor.sharedspace/plugin.js b/addons/website/static/lib/ckeditor.sharedspace/plugin.js
new file mode 100644
index 00000000000..ae8ddc79eb4
--- /dev/null
+++ b/addons/website/static/lib/ckeditor.sharedspace/plugin.js
@@ -0,0 +1,124 @@
+/**
+ * @license Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md or http://ckeditor.com/license
+ */
+
+(function() {
+
+ 'use strict';
+
+ var containerTpl = CKEDITOR.addTemplate( 'sharedcontainer', '
').parent().html();
- }
- return (new instance.web.DataSet(this, 'ir.ui.view')).call('save', [data.oeModel, data.oeId, data.oeField, html, xpath]);
+ /**
+ * Saves an RTE content, which always corresponds to a view section (?).
+ *
+ *
+ */
+ saveEditor: function (editor) {
+ var element = editor.element;
+ var data = editor.getData();
+ return new instance.web.Model('ir.ui.view').call('save', {
+ res_id: element.data('oe-id'),
+ xpath: element.data('oe-xpath'),
+ value: data,
+ });
},
cancel: function () {
window.location.reload();
@@ -170,11 +153,10 @@ instance.website.RTE = instance.web.Widget.extend({
var self = this;
this.snippet_carousel();
$elements
- .not('span, [data-oe-type]')
.each(function () {
var $this = $(this);
- CKEDITOR.inline(this, self._config()).on('change', function () {
- $this.addClass('oe_dirty');
+ var editor = CKEDITOR.inline(this, self._config());
+ editor.on('change', function () {
self.trigger('change', this, null);
});
});
@@ -201,7 +183,7 @@ instance.website.RTE = instance.web.Widget.extend({
autoParagraph: false,
filebrowserImageUploadUrl: "/website/attach",
// Support for sharedSpaces in 4.x
- extraPlugins: 'sharedspace',
+ extraPlugins: 'sharedspace,oeref',
// Place toolbar in controlled location
sharedSpaces: { top: 'oe_rte_toolbar' },
toolbar: [
@@ -343,4 +325,35 @@ instance.web.GoToWebsite = function(parent, action) {
};
instance.web.client_actions.add("website.gotowebsite", "instance.web.GoToWebsite");
+if (!window.CKEDITOR) { return; }
+
+CKEDITOR.plugins.add('oeref', {
+ requires: 'widget',
+
+ init: function (editor) {
+ editor.widgets.add('oeref', {
+ inline: true,
+ // dialog: 'oeref',
+ allowedContent: '[data-oe-type]',
+ editables: { text: '*' },
+
+ init: function () {
+ var element = this.element;
+ this.setData({
+ model: element.data('oe-model'),
+ id: parseInt(element.data('oe-id'), 10),
+ field: element.data('oe-field'),
+ });
+ },
+ data: function () {
+ this.element.data('oe-model', this.data.model);
+ this.element.data('oe-id', this.data.id);
+ this.element.data('oe-field', this.data.field);
+ },
+ upcast: function (el) {
+ return el.attributes['data-oe-type'];
+ },
+ });
+ }
+});
};
diff --git a/addons/website/static/src/xml/website.xml b/addons/website/static/src/xml/website.xml
index 941015fd0f5..db46123a9de 100644
--- a/addons/website/static/src/xml/website.xml
+++ b/addons/website/static/src/xml/website.xml
@@ -4,10 +4,11 @@
-
-
-
-
+
+
+
+
diff --git a/addons/website/views/views.xml b/addons/website/views/views.xml
index 326b5e0b344..91d559a9bb2 100644
--- a/addons/website/views/views.xml
+++ b/addons/website/views/views.xml
@@ -54,7 +54,7 @@
-
+