[FIX] website: can add block in translate mode.

Fix for saas-6 only, don't forward port.

If the user translate a record html field like product... and add block after in English version, the translation doesn't have the new blocks.
In version >= 9.0 the translations contain only textual contents (with font, bold, color...). If a user add a block in english the block appear in all translations (with new text marked to translate).
This commit is contained in:
Christophe Matthieu
2015-09-23 16:16:52 +02:00
parent a669433326
commit 1c460e3ca8
2 changed files with 9 additions and 6 deletions
@@ -1292,7 +1292,7 @@ define(['summernote/summernote'], function () {
setTimeout(function () {$destroy.destroy();},150); // setTimeout to remove flickering when change to editable zone (re-create an editor)
$last = null;
}
if ($editable.size() && (!$last || $last[0] != $editable[0]) &&
if ($editable.not('.o_skip_rte').size() && (!$last || $last[0] != $editable[0]) &&
($target.closest('[contenteditable]').attr('contenteditable') || "").toLowerCase() !== 'false') {
$editable.summernote(self._config());
$editable.data('NoteHistory', self.history);
@@ -34,24 +34,25 @@
edit: function () {
var self = this;
var mysuper = this._super;
var $editables = $('[data-oe-model]:not([data-oe-type="html"])').addClass('o_skip_rte');
if (!localStorage[nodialog]) {
var dialog = new website.TranslatorDialog();
dialog.appendTo($(document.body));
dialog.on('activate', this, function () {
localStorage[nodialog] = dialog.$('input[name=do_not_show]').prop('checked') || '';
dialog.$el.modal('hide');
mysuper.call(self, !$('[data-oe-type="html"]').length);
self.translate().then(function () {
mysuper.call(self, true);
if(self.gengo_translate){
self.translation_gengo_display()
self.translation_gengo_display();
}
});
});
} else {
mysuper.call(self, !$('[data-oe-type="html"]').length);
this.translate().then(function () {
mysuper.call(self, true);
if(self.gengo_translate){
self.translation_gengo_display()
self.translation_gengo_display();
}
});
}
@@ -153,7 +154,9 @@
var self = this;
var trans = {};
// this._super.apply(this, arguments);
$('.oe_translatable_text.o_dirty').each(function () {
$('.oe_translatable_text.o_dirty').filter(function () {
return self.getInitialContent(this) !== $(this).text();
}).each(function () {
var $node = $(this);
var data = $node.data();
if (!trans[data.oeTranslationViewId]) {