diff --git a/addons/web_editor/__manifest__.py b/addons/web_editor/__manifest__.py index f68bbd9dede..319f10e6857 100644 --- a/addons/web_editor/__manifest__.py +++ b/addons/web_editor/__manifest__.py @@ -41,7 +41,6 @@ Odoo Web Editor widget. 'web_editor/static/lib/odoo-editor/src/utils/constants.js', 'web_editor/static/lib/odoo-editor/src/utils/sanitize.js', 'web_editor/static/lib/odoo-editor/src/utils/serialize.js', - 'web_editor/static/lib/odoo-editor/src/utils/utils.js', 'web_editor/static/lib/odoo-editor/src/utils/DOMPurify.js', 'web_editor/static/lib/odoo-editor/src/tablepicker/TablePicker.js', 'web_editor/static/lib/odoo-editor/src/powerbox/patienceDiff.js', @@ -88,6 +87,7 @@ Odoo Web Editor widget. 'web.assets_common': [ 'web_editor/static/lib/vkbeautify/**/*', 'web_editor/static/src/js/common/**/*', + 'web_editor/static/lib/odoo-editor/src/utils/utils.js', ], 'web.assets_backend': [ 'web_editor/static/src/scss/web_editor.common.scss', diff --git a/addons/web_editor/static/src/js/backend/convert_inline.js b/addons/web_editor/static/src/js/backend/convert_inline.js index 8ae146c96ee..50c81a2395f 100644 --- a/addons/web_editor/static/src/js/backend/convert_inline.js +++ b/addons/web_editor/static/src/js/backend/convert_inline.js @@ -1,24 +1,11 @@ -odoo.define('web_editor.convertInline', function (require) { +/** @odoo-module alias=web_editor.convertInline */ 'use strict'; -var FieldHtml = require('web_editor.field.html'); +import FieldHtml from 'web_editor.field.html'; +import { rgbToHex } from '../../../lib/odoo-editor/src/utils/utils'; const SELECTORS_IGNORE = /(^\*$|:hover|:before|:after|:active|:link|::|'|\([^(),]+[,(])/; -// Note: duplicated from odoo-editor utils. -// DOES NOT SUPPORT RGBA (Outlook doesn't support transparency) -function rgbToHex(rgb = '') { - return ( - '#' + - (rgb.match(/\d{1,3}/g) || []) - .map(x => { - x = parseInt(x).toString(16); - return x.length === 1 ? '0' + x : x; - }) - .join('') - ); -} - /** * Returns the css rules which applies on an element, tweaked so that they are * browser/mail client ok. @@ -839,7 +826,7 @@ FieldHtml.include({ }, }); -return { +export default { fontToImg: fontToImg, bootstrapToTable: bootstrapToTable, cardToTable: cardToTable, @@ -851,4 +838,3 @@ return { normalizeRem: normalizeRem, attachmentThumbnailToLinkImg: attachmentThumbnailToLinkImg, }; -});