Update TinyMCE to version 7

Closes #8683
This commit is contained in:
Adrià Tarroja Caubet
2024-05-07 00:29:45 +02:00
parent af50a2fd64
commit d590139f93
6 changed files with 26 additions and 47 deletions
@@ -47,12 +47,6 @@ from trytond.wsgi import Base64Converter
from .exceptions import ConditionError, DomainError, TemplateError
from .mixin import MarketingAutomationMixin
if not config.get(
'html', 'plugins-marketing.automation.activity-email_template'):
config.set(
'html', 'plugins-marketing.automation.activity-email_template',
'fullpage')
USE_SSL = bool(config.get('ssl', 'certificate'))
URL_BASE = config.get('marketing', 'automation_base', default=http_host())
URL_OPEN = urljoin(URL_BASE, '/m/empty.gif')
-6
View File
@@ -38,12 +38,6 @@ from trytond.wizard import Button, StateTransition, StateView, Wizard
from .exceptions import EMailValidationError, TemplateError
if not config.get(
'html', 'plugins-marketing.email.message-content'):
config.set(
'html', 'plugins-marketing.email.message-content',
'fullpage')
URL_BASE = config.get('marketing', 'email_base', default=http_host())
URL_OPEN = urljoin(URL_BASE, '/m/empty.gif')
-5
View File
@@ -1,15 +1,10 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.config import config
from trytond.model import fields
from trytond.pool import PoolMeta
from trytond.pyson import Eval
if not config.get('html', 'plugins-product.template-web_shop_description'):
config.set(
'html', 'plugins-product.template-web_shop_description', 'fullpage')
class Template(metaclass=PoolMeta):
__name__ = 'product.template'
+1
View File
@@ -1,3 +1,4 @@
* Update TinyMCE to version 7
* Add python-format flag to PO files
* Add partial support for constraints with SQLite backend
-5
View File
@@ -8,7 +8,6 @@ from operator import itemgetter
from genshi.template.text import TextTemplate
from trytond.cache import Cache, MemoryCache
from trytond.config import config
from trytond.i18n import gettext
from trytond.model import (
DeactivableMixin, Index, ModelSingleton, ModelSQL, ModelStorage, ModelView,
@@ -21,10 +20,6 @@ from trytond.tools import file_open
from trytond.transaction import (
Transaction, inactive_records, without_check_access)
if not config.get('html', 'plugins-ir.action.report-report_content_html'):
config.set(
'html', 'plugins-ir.action.report-report_content_html', 'fullpage')
class WizardModelError(ValidationError):
pass
+25 -25
View File
@@ -16,7 +16,8 @@ from trytond.transaction import Transaction
from trytond.wsgi import app
SOURCE = config.get(
'html', 'src', default='https://cloud.tinymce.com/stable/tinymce.min.js')
'html', 'src',
default='https://cdn.tiny.cloud/1/no-api-key/tinymce/7/tinymce.min.js')
AVATAR_TIMEOUT = config.getint(
'web', 'avatar_timeout', default=7 * 24 * 60 * 60)
@@ -102,54 +103,54 @@ TEMPLATE = '''<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script src="%(source)s"></script>
<script src="%(source)s" referrerpolicy="origin"></script>
<script>
tinymce.init({
selector: '#text',
language: '%(language)s',
plugins: 'fullscreen autosave code %(plugins)s',
plugins: 'autosave code %(plugins)s',
removed_menuitems: 'newdocument',
toolbar: 'save | undo redo | styleselect | bold italic | ' +
'alignleft aligncenter alignright alignjustify | ' +
'bullist numlist outdent indent | link image | close',
extended_valid_elements:
'py:if[test],' +
'py:choose[test],py:when[test],py:otherwise,' +
'py:for[each],' +
'py:def[function],' +
'py:match[path],' +
'py:with[vars],' +
'py:replace[value]',
'py\\\\:if[test],' +
'py\\\\:choose[test],py\\\\:when[test],py\\\\:otherwise,' +
'py\\\\:for[each],' +
'py\\\\:def[function],' +
'py\\\\:match[path],' +
'py\\\\:with[vars],' +
'py\\\\:replace[value]',
custom_elements:
'py:if,' +
'py:choose,py:when,py:otherwise,' +
'py:for,' +
'py:def,' +
'py:match,' +
'py:with,' +
'py:replace',
'py\\\\:if,' +
'py\\\\:choose,py\\\\:when,py\\\\:otherwise,' +
'py\\\\:for,' +
'py\\\\:def,' +
'py\\\\:match,' +
'py\\\\:with,' +
'py\\\\:replace',
content_css: %(css)s,
body_class: %(class)s,
setup: function(editor) {
editor.addMenuItem('save', {
editor.ui.registry.addMenuItem('save', {
text: 'Save',
icon: 'save',
context: 'file',
cmd: 'save',
onAction: () => editor.execCommand('save')
});
editor.addButton('save', {
editor.ui.registry.addButton('save', {
title: 'Save',
icon: 'save',
cmd: 'save',
onAction: () => editor.execCommand('save')
});
editor.addShortcut('ctrl+s', 'save', 'save');
editor.addCommand('save', function() {
document.form.submit();
});
editor.addButton('close', {
editor.ui.registry.addButton('close', {
title: 'Close',
icon: 'remove',
onclick: function() {
icon: 'close',
onAction: function() {
window.location =
window.location.protocol + '//_@' +
window.location.host +
@@ -159,7 +160,6 @@ TEMPLATE = '''<!DOCTYPE html>
});
},
init_instance_callback: function(editor) {
editor.execCommand('mceFullScreen');
var error = '%(error)s';
if (error) {
editor.notificationManager.open({