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

View File

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

View File

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

View File

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