[FIX] RTE on links and 'correct' enabling of save button

bzr revid: xmo@openerp.com-20130730151544-m3ggaaoyckvhos65
This commit is contained in:
Xavier Morel
2013-07-30 17:15:44 +02:00
+26 -6
View File
@@ -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);
@@ -215,9 +226,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 +240,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