[ADD] Added upstream patch for web_editor,website_gengo

This commit is contained in:
Hiren Jungi 2018-07-19 17:02:41 +05:30
parent 750aef6e5f
commit 73bc1fec3e
4 changed files with 20 additions and 17 deletions

View File

@ -105,9 +105,9 @@ var FieldTextHtmlSimple = basic_fields.DebouncedField.extend(TranslatableFieldMi
attachedDocumentDomain.unshift('&'); attachedDocumentDomain.unshift('&');
attachedDocumentDomain.push(['create_uid', '=', session.uid]); attachedDocumentDomain.push(['create_uid', '=', session.uid]);
} }
if (this.recordData.model) { if (this.recordData.res_model || this.recordData.model) {
var relatedDomain = ['&', var relatedDomain = ['&',
['res_model', '=', this.recordData.model], ['res_model', '=', this.recordData.res_model || this.recordData.model],
['res_id', '=', this.recordData.res_id|0]]; ['res_id', '=', this.recordData.res_id|0]];
if (!this.recordData.res_id) { if (!this.recordData.res_id) {
relatedDomain.unshift('&'); relatedDomain.unshift('&');
@ -136,7 +136,7 @@ var FieldTextHtmlSimple = basic_fields.DebouncedField.extend(TranslatableFieldMi
['color', ['color']], ['color', ['color']],
['para', ['ul', 'ol', 'paragraph']], ['para', ['ul', 'ol', 'paragraph']],
['table', ['table']], ['table', ['table']],
['insert', ['link', 'picture']], ['insert', this.nodeOptions['no-attachment'] ? ['link'] : ['link', 'picture']],
['history', ['undo', 'redo']] ['history', ['undo', 'redo']]
], ],
prettifyHtml: false, prettifyHtml: false,
@ -144,6 +144,7 @@ var FieldTextHtmlSimple = basic_fields.DebouncedField.extend(TranslatableFieldMi
inlinemedia: ['p'], inlinemedia: ['p'],
lang: "flectra", lang: "flectra",
onChange: this._doDebouncedAction.bind(this), onChange: this._doDebouncedAction.bind(this),
disableDragAndDrop: !!this.nodeOptions['no-attachment'],
}; };
var fieldNameAttachment =_.chain(this.recordData) var fieldNameAttachment =_.chain(this.recordData)
@ -158,8 +159,9 @@ var FieldTextHtmlSimple = basic_fields.DebouncedField.extend(TranslatableFieldMi
this.fieldNameAttachment = fieldNameAttachment; this.fieldNameAttachment = fieldNameAttachment;
this.attachments = []; this.attachments = [];
summernoteConfig.onUpload = this._onUpload.bind(this); summernoteConfig.onUpload = this._onUpload.bind(this);
summernoteConfig.getMediaDomain = this._getAttachmentsDomain.bind(this);
} }
summernoteConfig.getMediaDomain = this._getAttachmentsDomain.bind(this);
if (config.debug) { if (config.debug) {
summernoteConfig.toolbar.splice(7, 0, ['view', ['codeview']]); summernoteConfig.toolbar.splice(7, 0, ['view', ['codeview']]);
@ -172,9 +174,9 @@ var FieldTextHtmlSimple = basic_fields.DebouncedField.extend(TranslatableFieldMi
*/ */
_getValue: function () { _getValue: function () {
if (this.nodeOptions['style-inline']) { if (this.nodeOptions['style-inline']) {
transcoder.linkImgToAttachmentThumbnail(this.$content); transcoder.attachmentThumbnailToLinkImg(this.$content);
transcoder.classToStyle(this.$content);
transcoder.fontToImg(this.$content); transcoder.fontToImg(this.$content);
transcoder.classToStyle(this.$content);
} }
return this.$content.html(); return this.$content.html();
}, },
@ -220,6 +222,8 @@ var FieldTextHtmlSimple = basic_fields.DebouncedField.extend(TranslatableFieldMi
this.$content.trigger('mouseup'); this.$content.trigger('mouseup');
if (this.nodeOptions['style-inline']) { if (this.nodeOptions['style-inline']) {
transcoder.styleToClass(this.$content); transcoder.styleToClass(this.$content);
transcoder.imgToFont(this.$content);
transcoder.linkImgToAttachmentThumbnail(this.$content);
} }
// reset the history (otherwise clicking on undo before editing the // reset the history (otherwise clicking on undo before editing the
// value will empty the editor) // value will empty the editor)

View File

@ -41,6 +41,7 @@ snippet_editor.Class.include({
start: function () { start: function () {
_.defer(function () { _.defer(function () {
var $editable = $('#editable_area'); var $editable = $('#editable_area');
transcoder.linkImgToAttachmentThumbnail($editable);
transcoder.imgToFont($editable); transcoder.imgToFont($editable);
transcoder.styleToClass($editable); transcoder.styleToClass($editable);
@ -53,7 +54,7 @@ snippet_editor.Class.include({
this._super.apply(this, arguments); this._super.apply(this, arguments);
var $editable = $('#editable_area'); var $editable = $('#editable_area');
transcoder.linkImgToAttachmentThumbnail($editable); transcoder.attachmentThumbnailToLinkImg($editable);
transcoder.fontToImg($editable); transcoder.fontToImg($editable);
transcoder.classToStyle($editable); transcoder.classToStyle($editable);

View File

@ -3,6 +3,7 @@
/// ///
html, body { html, body {
position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }

View File

@ -8,9 +8,6 @@ var Widget = require('web.Widget');
var weContext = require('web_editor.context'); var weContext = require('web_editor.context');
require('web_editor.editor'); require('web_editor.editor');
var translate = require('web_editor.translate'); var translate = require('web_editor.translate');
var websiteNavbarData = require('website.navbar');
var WebsiteNavbar = websiteNavbarData.WebsiteNavbar;
var qweb = core.qweb; var qweb = core.qweb;
var _t = core._t; var _t = core._t;
@ -83,7 +80,7 @@ translate.Class.include({
'lang': weContext.get().lang, 'lang': weContext.get().lang,
}).then(function () { }).then(function () {
ajax.jsonRpc('/website/post_gengo_jobs', 'call', {}); ajax.jsonRpc('/website/post_gengo_jobs', 'call', {});
self.save_and_reload(); self._save();
}).fail(function () { }).fail(function () {
Dialog.alert(null, _t("Could not Post translation")); Dialog.alert(null, _t("Could not Post translation"));
}); });
@ -113,12 +110,12 @@ translate.Class.include({
}); });
var GengoTranslatorPostDialog = Widget.extend({ var GengoTranslatorPostDialog = Widget.extend({
events: _.extend({}, WebsiteNavbar.prototype.events, { events: {
'hidden.bs.modal': 'destroy', 'hidden.bs.modal': 'destroy',
'click button[data-action=service_level]': function () { 'click button[data-action=service_level]': function () {
this.trigger('service_level'); this.trigger('service_level');
}, },
}), },
template: 'website.GengoTranslatorPostDialog', template: 'website.GengoTranslatorPostDialog',
init: function (new_words){ init: function (new_words){
this.new_words = new_words; this.new_words = new_words;
@ -130,9 +127,9 @@ var GengoTranslatorPostDialog = Widget.extend({
}); });
var GengoTranslatorStatisticDialog = Widget.extend({ var GengoTranslatorStatisticDialog = Widget.extend({
events: _.extend({}, WebsiteNavbar.prototype.events, { events: {
'hidden.bs.modal': 'destroy', 'hidden.bs.modal': 'destroy',
}), },
template: 'website.GengoTranslatorStatisticDialog', template: 'website.GengoTranslatorStatisticDialog',
init: function (res) { init: function (res) {
var self = this; var self = this;
@ -154,10 +151,10 @@ var GengoTranslatorStatisticDialog = Widget.extend({
}); });
var GengoApiConfigDialog = Widget.extend({ var GengoApiConfigDialog = Widget.extend({
events: _.extend({}, WebsiteNavbar.prototype.events, { events: {
'hidden.bs.modal': 'destroy', 'hidden.bs.modal': 'destroy',
'click button[data-action=set_config]': 'set_config' 'click button[data-action=set_config]': 'set_config'
}), },
template: 'website.GengoApiConfigDialog', template: 'website.GengoApiConfigDialog',
init:function (company_id){ init:function (company_id){
this.company_id = company_id; this.company_id = company_id;