From 2a0dc6af7a40b1fbb2a4ac99e69055f48add0810 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 30 Jul 2013 11:43:20 +0200 Subject: [PATCH 1/2] [ADD] quote, text justification, list indent/outdent todo: really need contextual conditions on buttons bzr revid: xmo@openerp.com-20130730094320-n352j55bo7bs3ubj --- addons/website/static/src/js/website.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js index 02ea41d0fa5..de484a6ea31 100644 --- a/addons/website/static/src/js/website.js +++ b/addons/website/static/src/js/website.js @@ -215,9 +215,12 @@ instance.website.RTE = instance.web.Widget.extend({ [Command, "\uf12c", 'subscript'], [Command, "\uf0c1", 'link'], [Command, "\uf127", 'unlink'], + [Command, "\uf10d", 'blockquote'], [Group, "\uf0ca", [ [Command, "\uf0ca", 'bulletedlist'], - [Command, "\uf0cb", 'numberedlist'] + [Command, "\uf0cb", 'numberedlist'], + [Command, "\uf03b", 'outdent'], + [Command, "\uf03c", 'indent'] ]], [Group, _lt("Heading"), [ [Style, _lt('H1'), { element: 'h1' }], @@ -226,6 +229,12 @@ instance.website.RTE = instance.web.Widget.extend({ [Style, _lt('H4'), { element: 'h4', }], [Style, _lt('H5'), { element: 'h5', }], [Style, _lt('H6'), { element: 'h6', }] + ]], + [Group, "\uf039", [ + [Command, "\uf039", 'justifyblock'], + [Command, "\uf036", 'justifyleft'], + [Command, "\uf038", 'justifyright'], + [Command, "\uf037", 'justifycenter'] ]] ], // editor.ui.items -> possible commands &al From 4d41a7f3899b044d1dbefc8066189a2f48c97a63 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 30 Jul 2013 17:09:55 +0200 Subject: [PATCH 2/2] [FIX] add event handlers on non-rte contenteditables to trigger enabling of save button, fixup filters bzr revid: xmo@openerp.com-20130730150955-ttqovqamexqtd8r9 --- addons/website/static/src/js/website.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js index de484a6ea31..fd1f0531fd2 100644 --- a/addons/website/static/src/js/website.js +++ b/addons/website/static/src/js/website.js @@ -42,11 +42,22 @@ instance.website.EditorBar = instance.web.Widget.extend({ .add(this.$buttons.save) .parent().show(); // TODO: span edition changing edition state (save button) - this.rte.start_edition( - $('[data-oe-model]') - .not('link, script') - .prop('contentEditable', true) - .addClass('oe_editable')); + var $editables = $('[data-oe-model]') + .not('link, script').prop('contentEditable', true) + .addClass('oe_editable'); + var $rte_ables = $editables.filter('div, p, :not([data-oe-type])'); + var $raw_editables = $editables.not($rte_ables); + + this.rte.start_edition($rte_ables); + $raw_editables.on('keydown keypress cut paste', function (e) { + var $target = $(e.target); + if ($target.hasClass('oe_dirty')) { + return; + } + + $target.addClass('oe_dirty'); + this.$buttons.save.prop('disabled', false); + }.bind(this)); }, rte_changed: function () { this.$buttons.save.prop('disabled', false);