');
- this.module.editorInstance._createComponent($content, FileUploader, this.getFileUploaderOptions());
-
- return $content;
- }
- }, {
- itemType: 'simple',
- colSpan: 11,
- label: { visible: false },
- editorType: 'dxCheckBox',
- editorOptions: {
- value: this.useBase64,
- visible: this.isBase64Editable(),
- text: localizationMessage.format(DIALOG_IMAGE_ENCODE_TO_BASE64),
- onValueChanged: (e) => {
- if(this.isBase64Editable()) {
- this.useBase64 = e.value;
- }
- }
- }
+ return extend({}, getFileUploaderBaseOptions(), fileUploaderOptions, this.config.fileUploaderOptions);
+ }
+
+ getItemsConfig() {
+ return [
+ {
+ itemType: 'simple',
+ dataField: 'files',
+ colSpan: 11,
+ label: { visible: false },
+ template: () => {
+ const $content = $('
');
+ this.module.editorInstance._createComponent($content, FileUploader, this.getFileUploaderOptions());
+
+ return $content;
+ },
+ }, {
+ itemType: 'simple',
+ colSpan: 11,
+ label: { visible: false },
+ editorType: 'dxCheckBox',
+ editorOptions: {
+ value: this.useBase64,
+ visible: this.isBase64Editable(),
+ text: localizationMessage.format(DIALOG_IMAGE_ENCODE_TO_BASE64),
+ onValueChanged: (e) => {
+ if (this.isBase64Editable()) {
+ this.useBase64 = e.value;
}
- ];
- }
+ },
+ },
+ },
+ ];
+ }
}
export function correctSlashesInUrl(url) {
- return url[url.length - 1] !== '/' ? (url + '/') : url;
+ return url[url.length - 1] !== '/' ? `${url}/` : url;
}
export function getFileUploaderBaseOptions() {
- return {
- value: [],
- name: FILE_UPLOADER_NAME,
- accept: 'image/*',
- uploadMode: 'useButtons'
- };
+ return {
+ value: [],
+ name: FILE_UPLOADER_NAME,
+ accept: 'image/*',
+ uploadMode: 'useButtons',
+ };
}
export function urlUpload(quill, index, attributes) {
- quill.insertEmbed(index, 'extendedImage', attributes, USER_ACTION);
- quill.setSelection(index + 1, 0, USER_ACTION);
+ quill.insertEmbed(index, 'extendedImage', attributes, USER_ACTION);
+ quill.setSelection(index + 1, 0, USER_ACTION);
}
export function serverUpload(url, fileName, quill, pasteIndex) {
- if(url) {
- const imageUrl = correctSlashesInUrl(url) + fileName;
+ if (url) {
+ const imageUrl = correctSlashesInUrl(url) + fileName;
- urlUpload(quill, pasteIndex, { src: imageUrl });
- }
+ urlUpload(quill, pasteIndex, { src: imageUrl });
+ }
}
diff --git a/packages/devextreme/js/__internal/ui/html_editor/utils/m_table_helper.ts b/packages/devextreme/js/__internal/ui/html_editor/utils/m_table_helper.ts
index 080afab9d345..3a4f19f49f1a 100644
--- a/packages/devextreme/js/__internal/ui/html_editor/utils/m_table_helper.ts
+++ b/packages/devextreme/js/__internal/ui/html_editor/utils/m_table_helper.ts
@@ -1,104 +1,104 @@
-import $ from '../../../core/renderer';
-import { each } from '../../../core/utils/iterator';
-import { camelize } from '../../../core/utils/inflector';
-
+import type { dxElementWrapper } from '@js/core/renderer';
+import $ from '@js/core/renderer';
+import { camelize } from '@js/core/utils/inflector';
+import { each } from '@js/core/utils/iterator';
const TABLE_FORMATS = ['table', 'tableHeaderCell'];
const TABLE_OPERATIONS = [
- 'insertTable',
- 'insertHeaderRow',
- 'insertRowAbove',
- 'insertRowBelow',
- 'insertColumnLeft',
- 'insertColumnRight',
- 'deleteColumn',
- 'deleteRow',
- 'deleteTable',
- 'cellProperties',
- 'tableProperties'
+ 'insertTable',
+ 'insertHeaderRow',
+ 'insertRowAbove',
+ 'insertRowBelow',
+ 'insertColumnLeft',
+ 'insertColumnRight',
+ 'deleteColumn',
+ 'deleteRow',
+ 'deleteTable',
+ 'cellProperties',
+ 'tableProperties',
];
-
function getTableFormats(quill) {
- const tableModule = quill.getModule('table');
+ const tableModule = quill.getModule('table');
- // backward compatibility with an old devextreme-quill packages
- return tableModule?.tableFormats ? tableModule.tableFormats() : TABLE_FORMATS;
+ // backward compatibility with an old devextreme-quill packages
+ return tableModule?.tableFormats ? tableModule.tableFormats() : TABLE_FORMATS;
}
function hasEmbedContent(module, selection) {
- return !!selection && module.quill.getText(selection).length < selection.length;
+ return !!selection && module.quill.getText(selection).length < selection.length;
}
-function unfixTableWidth($table, { tableBlot, quill }) {
- const unfixValue = 'initial';
+function unfixTableWidth($table, { tableBlot, quill }: { tableBlot?: any; quill: any }) {
+ const unfixValue = 'initial';
- const formatBlot = tableBlot ?? quill.scroll.find($table.get(0));
+ const formatBlot = tableBlot ?? quill.scroll.find($table.get(0));
- formatBlot.format('tableWidth', unfixValue);
+ formatBlot.format('tableWidth', unfixValue);
}
function getColumnElements($table, index = 0) {
- return $table.find('tr').eq(index).find('th, td');
+ return $table.find('tr').eq(index).find('th, td');
}
function getAutoSizedElements($table, direction = 'horizontal') {
- const result = [];
- const isHorizontal = direction === 'horizontal';
- const $lineElements = isHorizontal ? getColumnElements($table) : getRowElements($table);
-
- $lineElements.each((index, element) => {
- const $element = $(element);
- if($element.get(0).style[isHorizontal ? 'width' : 'height'] === '') {
- result.push($element);
- }
- });
-
- return result;
+ const result: dxElementWrapper[] = [];
+ const isHorizontal = direction === 'horizontal';
+ const $lineElements = isHorizontal ? getColumnElements($table) : getRowElements($table);
+
+ $lineElements.each((index, element) => {
+ const $element = $(element);
+ // @ts-expect-error
+ if ($element.get(0).style[isHorizontal ? 'width' : 'height'] === '') {
+ result.push($element);
+ }
+ });
+
+ return result;
}
function setLineElementsFormat(module, { elements, property, value }) {
- const tableBlotNames = module.quill.getModule('table').tableBlots;
- const fullPropertyName = `cell${camelize(property, true)}`;
- each(elements, (i, element) => {
- let formatBlot = module.quill.scroll.find(element);
- if(!tableBlotNames.includes(formatBlot.statics.blotName)) {
- const descendBlot = formatBlot.descendant((blot) => tableBlotNames.includes(blot.statics.blotName));
- formatBlot = descendBlot ? descendBlot[0] : null;
- }
- formatBlot?.format(fullPropertyName, value + 'px');
- });
+ const tableBlotNames = module.quill.getModule('table').tableBlots;
+ const fullPropertyName = `cell${camelize(property, true)}`;
+ each(elements, (i, element) => {
+ let formatBlot = module.quill.scroll.find(element);
+ if (!tableBlotNames.includes(formatBlot.statics.blotName)) {
+ const descendBlot = formatBlot.descendant((blot) => tableBlotNames.includes(blot.statics.blotName));
+ formatBlot = descendBlot ? descendBlot[0] : null;
+ }
+ formatBlot?.format(fullPropertyName, `${value}px`);
+ });
}
function getLineElements($table, index, direction = 'horizontal') {
- return direction === 'horizontal' ? getRowElements($table, index) : getColumnElements($table, index);
+ return direction === 'horizontal' ? getRowElements($table, index) : getColumnElements($table, index);
}
function getRowElements($table, index = 0) {
- return $table.find(`th:nth-child(${(1 + index)}), td:nth-child(${(1 + index)})`);
+ return $table.find(`th:nth-child(${1 + index}), td:nth-child(${1 + index})`);
}
function getTableOperationHandler(quill, operationName, ...rest) {
- return () => {
- const table = quill.getModule('table');
-
- if(!table) {
- return;
- }
- quill.focus();
- return table[operationName](...rest);
- };
+ return () => {
+ const table = quill.getModule('table');
+
+ if (!table) {
+ return;
+ }
+ quill.focus();
+ return table[operationName](...rest);
+ };
}
export {
- TABLE_OPERATIONS,
- getTableFormats,
- getTableOperationHandler,
- unfixTableWidth,
- getColumnElements,
- getAutoSizedElements,
- setLineElementsFormat,
- getLineElements,
- getRowElements,
- hasEmbedContent
+ getAutoSizedElements,
+ getColumnElements,
+ getLineElements,
+ getRowElements,
+ getTableFormats,
+ getTableOperationHandler,
+ hasEmbedContent,
+ setLineElementsFormat,
+ TABLE_OPERATIONS,
+ unfixTableWidth,
};
diff --git a/packages/devextreme/js/__internal/ui/html_editor/utils/m_templates_storage.ts b/packages/devextreme/js/__internal/ui/html_editor/utils/m_templates_storage.ts
index 5f739696c3cf..41f929778ad5 100644
--- a/packages/devextreme/js/__internal/ui/html_editor/utils/m_templates_storage.ts
+++ b/packages/devextreme/js/__internal/ui/html_editor/utils/m_templates_storage.ts
@@ -1,36 +1,40 @@
-import { isDefined, isEmptyObject } from '../../../core/utils/type';
+import { isDefined, isEmptyObject } from '@js/core/utils/type';
export default class TemplatesStorage {
- constructor() {
- this._storage = {};
- }
+ _storage: any;
- set({ editorKey, marker }, value) {
- this._storage[editorKey] ??= {};
- this._storage[editorKey][marker] = value;
- }
+ constructor() {
+ this._storage = {};
+ }
- get({ editorKey, marker }) {
- const isQuillFormatCall = !isDefined(editorKey);
+ set({ editorKey, marker }, value) {
+ this._storage[editorKey] ??= {};
+ this._storage[editorKey][marker] = value;
+ }
- // NOTE: If anonymous templates are used, mentions are parsed from the markup.
- // The Quill format does not have information about a related HtmlEditor instance.
- // In this case, we need to use the latest template in the storage
- // because the appropriate instance was already created and added to the storage.
+ get({ editorKey, marker }) {
+ const isQuillFormatCall = !isDefined(editorKey);
- return isQuillFormatCall
- ? Object.values(this._storage).at(-1)?.[marker]
- : this._storage[editorKey]?.[marker];
- }
+ // NOTE: If anonymous templates are used, mentions are parsed from the markup.
+ // The Quill format does not have information about a related HtmlEditor instance.
+ // In this case, we need to use the latest template in the storage
+ // because the appropriate instance was already created and added to the storage.
- delete({ editorKey, marker }) {
- if(!this._storage[editorKey]) {
- return;
- }
+ return isQuillFormatCall
+ ? Object.values(this._storage).at(-1)?.[marker]
+ : this._storage[editorKey]?.[marker];
+ }
+
+ delete({ editorKey, marker }) {
+ if (!this._storage[editorKey]) {
+ return;
+ }
- delete this._storage[editorKey][marker];
- if(isEmptyObject(this._storage[editorKey])) {
- delete this._storage[editorKey];
- }
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
+ delete this._storage[editorKey][marker];
+ if (isEmptyObject(this._storage[editorKey])) {
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
+ delete this._storage[editorKey];
}
+ }
}
diff --git a/packages/devextreme/js/__internal/ui/html_editor/utils/m_toolbar_helper.ts b/packages/devextreme/js/__internal/ui/html_editor/utils/m_toolbar_helper.ts
index 8265d9f0aa41..f107910b39a8 100644
--- a/packages/devextreme/js/__internal/ui/html_editor/utils/m_toolbar_helper.ts
+++ b/packages/devextreme/js/__internal/ui/html_editor/utils/m_toolbar_helper.ts
@@ -1,36 +1,33 @@
-import $ from '../../../core/renderer';
-import localizationMessage from '../../../localization/message';
+import $ from '@js/core/renderer';
+import { camelize } from '@js/core/utils/inflector';
+import { each } from '@js/core/utils/iterator';
+import { getOuterHeight, getOuterWidth, getWidth } from '@js/core/utils/size';
+import { isBoolean, isDefined } from '@js/core/utils/type';
+import { getWindow } from '@js/core/utils/window';
+import localizationMessage from '@js/localization/message';
+import ButtonGroup from '@js/ui/button_group';
+import ColorBox from '@js/ui/color_box';
+import Form from '@js/ui/form';
+import ScrollView from '@js/ui/scroll_view';
+
+import { getQuill } from '../m_quill_importer';
+import { ImageUploader } from './m_image_uploader_helper';
import {
- getTableOperationHandler,
- hasEmbedContent,
- unfixTableWidth,
- getColumnElements,
- getAutoSizedElements,
- setLineElementsFormat,
- getLineElements,
- getRowElements
-} from './table_helper';
-import { isDefined, isBoolean } from '../../../core/utils/type';
-import { each } from '../../../core/utils/iterator';
-
-import Form from '../../form';
-import ButtonGroup from '../../button_group';
-import ColorBox from '../../color_box';
-import ScrollView from '../../scroll_view';
-
-import { getOuterHeight, getWidth, getOuterWidth } from '../../../core/utils/size';
-
-import { ImageUploader } from './image_uploader_helper';
-
-import { camelize } from '../../../core/utils/inflector';
-import { getWindow } from '../../../core/utils/window';
-import { getQuill } from '../quill_importer';
+ getAutoSizedElements,
+ getColumnElements,
+ getLineElements,
+ getRowElements,
+ getTableOperationHandler,
+ hasEmbedContent,
+ setLineElementsFormat,
+ unfixTableWidth,
+} from './m_table_helper';
const MIN_HEIGHT = 400;
const BORDER_STYLES = ['none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset'];
-const BORDER_STYLES_TRANSLATED = BORDER_STYLES.map(style => ({
- id: style,
- value: localizationMessage.format(`dxHtmlEditor-borderStyle${camelize(style, true)}`),
+const BORDER_STYLES_TRANSLATED = BORDER_STYLES.map((style) => ({
+ id: style,
+ value: localizationMessage.format(`dxHtmlEditor-borderStyle${camelize(style, true)}`),
}));
const USER_ACTION = 'user';
@@ -50,827 +47,855 @@ const DIALOG_TABLE_FIELD_COLUMNS = 'dxHtmlEditor-dialogInsertTableRowsField';
const DIALOG_TABLE_FIELD_ROWS = 'dxHtmlEditor-dialogInsertTableColumnsField';
const ICON_MAP = {
- insertHeaderRow: 'header',
- clear: 'clearformat'
+ insertHeaderRow: 'header',
+ clear: 'clearformat',
};
function getFormatHandlers(module) {
- return {
- clear: ({ event }) => {
- const range = module.quill.getSelection();
- if(range) {
- module.saveValueChangeEvent(event);
- module.quill.removeFormat(range);
- getToolbarModule(module)?.updateFormatWidgets();
- }
- },
- link: prepareLinkHandler(module),
- image: prepareImageHandler(module, module.editorInstance.option('imageUpload')),
- color: prepareColorClickHandler(module, 'color'),
- background: prepareColorClickHandler(module, 'background'),
- orderedList: prepareShortcutHandler(module, 'list', 'ordered'),
- bulletList: prepareShortcutHandler(module, 'list', 'bullet'),
- alignLeft: prepareShortcutHandler(module, 'align', 'left'),
- alignCenter: prepareShortcutHandler(module, 'align', 'center'),
- alignRight: prepareShortcutHandler(module, 'align', 'right'),
- alignJustify: prepareShortcutHandler(module, 'align', 'justify'),
- codeBlock: getDefaultClickHandler(module, 'code-block'),
- undo: ({ event }) => {
- module.saveValueChangeEvent(event);
- module.quill.history.undo();
- },
- redo: ({ event }) => {
- module.saveValueChangeEvent(event);
- module.quill.history.redo();
- },
- increaseIndent: ({ event }) => {
- applyFormat(module, ['indent', '+1', USER_ACTION], event);
- },
- decreaseIndent: ({ event }) => {
- applyFormat(module, ['indent', '-1', USER_ACTION], event);
- },
- superscript: prepareShortcutHandler(module, 'script', 'super'),
- subscript: prepareShortcutHandler(module, 'script', 'sub'),
- insertTable: prepareInsertTableHandler(module),
- insertHeaderRow: getTableOperationHandler(module.quill, 'insertHeaderRow'),
- insertRowAbove: getTableOperationHandler(module.quill, 'insertRowAbove'),
- insertRowBelow: getTableOperationHandler(module.quill, 'insertRowBelow'),
- insertColumnLeft: getTableOperationHandler(module.quill, 'insertColumnLeft'),
- insertColumnRight: getTableOperationHandler(module.quill, 'insertColumnRight'),
- deleteColumn: getTableOperationHandler(module.quill, 'deleteColumn'),
- deleteRow: getTableOperationHandler(module.quill, 'deleteRow'),
- deleteTable: getTableOperationHandler(module.quill, 'deleteTable'),
- cellProperties: prepareShowFormProperties(module, 'cell'),
- tableProperties: prepareShowFormProperties(module, 'table')
- };
+ return {
+ clear: ({ event }) => {
+ const range = module.quill.getSelection();
+ if (range) {
+ module.saveValueChangeEvent(event);
+ module.quill.removeFormat(range);
+ getToolbarModule(module)?.updateFormatWidgets();
+ }
+ },
+ link: prepareLinkHandler(module),
+ image: prepareImageHandler(module, module.editorInstance.option('imageUpload')),
+ color: prepareColorClickHandler(module, 'color'),
+ background: prepareColorClickHandler(module, 'background'),
+ orderedList: prepareShortcutHandler(module, 'list', 'ordered'),
+ bulletList: prepareShortcutHandler(module, 'list', 'bullet'),
+ alignLeft: prepareShortcutHandler(module, 'align', 'left'),
+ alignCenter: prepareShortcutHandler(module, 'align', 'center'),
+ alignRight: prepareShortcutHandler(module, 'align', 'right'),
+ alignJustify: prepareShortcutHandler(module, 'align', 'justify'),
+ codeBlock: getDefaultClickHandler(module, 'code-block'),
+ undo: ({ event }) => {
+ module.saveValueChangeEvent(event);
+ module.quill.history.undo();
+ },
+ redo: ({ event }) => {
+ module.saveValueChangeEvent(event);
+ module.quill.history.redo();
+ },
+ increaseIndent: ({ event }) => {
+ applyFormat(module, ['indent', '+1', USER_ACTION], event);
+ },
+ decreaseIndent: ({ event }) => {
+ applyFormat(module, ['indent', '-1', USER_ACTION], event);
+ },
+ superscript: prepareShortcutHandler(module, 'script', 'super'),
+ subscript: prepareShortcutHandler(module, 'script', 'sub'),
+ insertTable: prepareInsertTableHandler(module),
+ insertHeaderRow: getTableOperationHandler(module.quill, 'insertHeaderRow'),
+ insertRowAbove: getTableOperationHandler(module.quill, 'insertRowAbove'),
+ insertRowBelow: getTableOperationHandler(module.quill, 'insertRowBelow'),
+ insertColumnLeft: getTableOperationHandler(module.quill, 'insertColumnLeft'),
+ insertColumnRight: getTableOperationHandler(module.quill, 'insertColumnRight'),
+ deleteColumn: getTableOperationHandler(module.quill, 'deleteColumn'),
+ deleteRow: getTableOperationHandler(module.quill, 'deleteRow'),
+ deleteTable: getTableOperationHandler(module.quill, 'deleteTable'),
+ cellProperties: prepareShowFormProperties(module, 'cell'),
+ tableProperties: prepareShowFormProperties(module, 'table'),
+ };
}
-function resetFormDialogOptions(editorInstance, { contentTemplate, title, minHeight, minWidth, maxWidth }) {
- editorInstance.formDialogOption({
- contentTemplate,
- title,
- minHeight: minHeight ?? 0,
- minWidth: minWidth ?? 0,
- maxWidth: maxWidth ?? 'none'
- });
+function resetFormDialogOptions(editorInstance, {
+ contentTemplate, title, minHeight, minWidth, maxWidth,
+}) {
+ editorInstance.formDialogOption({
+ contentTemplate,
+ title,
+ minHeight: minHeight ?? 0,
+ minWidth: minWidth ?? 0,
+ maxWidth: maxWidth ?? 'none',
+ });
}
function prepareShowFormProperties(module, type) {
- return ($element) => {
- if(!$element?.length) {
- $element = $(getTargetTableNode(module, type));
- }
- const [tableBlot, rowBlot] = module.quill.getModule('table').getTable() ?? [];
-
- const formats = module.quill.getFormat(module.editorInstance.getSelection(true));
-
- const tablePropertiesFormConfig = getFormConfigConstructor(type)(module, { $element, formats, tableBlot, rowBlot });
+ return ($element) => {
+ if (!$element?.length) {
+ $element = $(getTargetTableNode(module, type));
+ }
+ const [tableBlot, rowBlot] = module.quill.getModule('table').getTable() ?? [];
- const { contentTemplate, title, minHeight, minWidth, maxWidth } = module.editorInstance._formDialog._popup.option();
- const savedOptions = { contentTemplate, title, minHeight, minWidth, maxWidth };
+ const formats = module.quill.getFormat(module.editorInstance.getSelection(true));
- let formInstance;
+ const tablePropertiesFormConfig = getFormConfigConstructor(type)(module, {
+ $element, formats, tableBlot, rowBlot,
+ });
- module.editorInstance.formDialogOption({
- 'contentTemplate': (container) => {
- const $content = $('
').appendTo(container);
- const $form = $('
').appendTo($content);
- module.editorInstance._createComponent($form, Form, tablePropertiesFormConfig.formOptions);
- module.editorInstance._createComponent($content, ScrollView, {});
- formInstance = $form.dxForm('instance');
+ const {
+ contentTemplate, title, minHeight, minWidth, maxWidth,
+ } = module.editorInstance._formDialog._popup.option();
+ const savedOptions = {
+ contentTemplate, title, minHeight, minWidth, maxWidth,
+ };
- return $content;
- },
- title: localizationMessage.format(`dxHtmlEditor-${type}Properties`),
- minHeight: MIN_HEIGHT,
- minWidth: Math.min(800, getWidth(getWindow()) * 0.9 - 1),
- maxWidth: getWidth(getWindow()) * 0.9
- });
+ let formInstance;
+
+ module.editorInstance.formDialogOption({
+ contentTemplate: (container) => {
+ const $content = $('
').appendTo(container);
+ const $form = $('
').appendTo($content);
+ module.editorInstance._createComponent($form, Form, tablePropertiesFormConfig.formOptions);
+ module.editorInstance._createComponent($content, ScrollView, {});
+ // @ts-expect-error
+ formInstance = $form.dxForm('instance');
+
+ return $content;
+ },
+ title: localizationMessage.format(`dxHtmlEditor-${type}Properties`),
+ minHeight: MIN_HEIGHT,
+ minWidth: Math.min(800, getWidth(getWindow()) * 0.9 - 1),
+ maxWidth: getWidth(getWindow()) * 0.9,
+ });
- const promise = module.editorInstance.showFormDialog();
+ const promise = module.editorInstance.showFormDialog();
- promise.done((formData, event) => {
- module.saveValueChangeEvent(event);
- tablePropertiesFormConfig.applyHandler(formInstance);
- resetFormDialogOptions(module.editorInstance, savedOptions);
- });
+ promise.done((formData, event) => {
+ module.saveValueChangeEvent(event);
+ tablePropertiesFormConfig.applyHandler(formInstance);
+ resetFormDialogOptions(module.editorInstance, savedOptions);
+ });
- promise.fail(() => {
- module.quill.focus();
- resetFormDialogOptions(module.editorInstance, savedOptions);
- });
- };
+ promise.fail(() => {
+ module.quill.focus();
+ resetFormDialogOptions(module.editorInstance, savedOptions);
+ });
+ };
}
function applyFormat(module, formatArgs, event) {
- module.saveValueChangeEvent(event);
- module.quill.format(...formatArgs);
+ module.saveValueChangeEvent(event);
+ module.quill.format(...formatArgs);
}
function getTargetTableNode(module, partName) {
- const currentSelectionParts = module.quill.getModule('table').getTable();
- return partName === 'table' ? currentSelectionParts[0].domNode : currentSelectionParts[2].domNode;
+ const currentSelectionParts = module.quill.getModule('table').getTable();
+ return partName === 'table' ? currentSelectionParts[0].domNode : currentSelectionParts[2].domNode;
}
function getLinkRange(module, range) {
- const Quill = getQuill();
- const LinkBlot = Quill.import('formats/link');
- let link;
- let linkOffset;
-
+ const Quill = getQuill();
+ const LinkBlot = Quill.import('formats/link');
+ let link;
+ let linkOffset;
+
+ [link, linkOffset] = module.quill.scroll.descendant(
+ LinkBlot,
+ range.index,
+ );
+
+ if (!link && range.length === 0) {
+ // NOTE:
+ // See T1157840
+ // When a mouse pointer is placed on the link's right border, the quill.scroll.descendant method does not return information about the link.
+ // In this case, we receive a necessary information from the previous index.
[link, linkOffset] = module.quill.scroll.descendant(
- LinkBlot,
- range.index
+ LinkBlot,
+ range.index - 1,
);
-
- if(!link && range.length === 0) {
- // NOTE:
- // See T1157840
- // When a mouse pointer is placed on the link's right border, the quill.scroll.descendant method does not return information about the link.
- // In this case, we receive a necessary information from the previous index.
- [link, linkOffset] = module.quill.scroll.descendant(
- LinkBlot,
- range.index - 1
- );
- if(link) {
- linkOffset += 1;
- }
+ if (link) {
+ linkOffset += 1;
}
+ }
- const result = !link ? null : {
- index: range.index - linkOffset,
- length: link.length()
- };
+ const result = !link ? null : {
+ index: range.index - linkOffset,
+ length: link.length(),
+ };
- return result;
+ return result;
}
function getColorFromFormat(value) {
- return Array.isArray(value) ? value[0] : value;
+ return Array.isArray(value) ? value[0] : value;
}
function prepareLinkHandler(module) {
- return () => {
- module.quill.focus();
+ return () => {
+ module.quill.focus();
+
+ let selection = module.quill.getSelection();
+ const formats = selection ? module.quill.getFormat() : {};
+ const isCursorAtLink = formats.link !== undefined && selection?.length === 0;
+ let href = formats.link || '';
+
+ if (isCursorAtLink) {
+ const linkRange = getLinkRange(module, selection);
+ if (linkRange) {
+ selection = linkRange;
+ } else {
+ href = '';
+ }
+ }
- let selection = module.quill.getSelection();
- const formats = selection ? module.quill.getFormat() : {};
- const isCursorAtLink = formats.link !== undefined && selection?.length === 0;
- let href = formats.link || '';
-
- if(isCursorAtLink) {
- const linkRange = getLinkRange(module, selection);
- if(linkRange) {
- selection = linkRange;
- } else {
- href = '';
- }
- }
+ const selectionHasEmbedContent = hasEmbedContent(module, selection);
+ const formData = {
+ href,
+ text: selection && !selectionHasEmbedContent ? module.quill.getText(selection) : '',
+ target: Object.prototype.hasOwnProperty.call(formats, 'target') ? !!formats.target : true,
+ };
+ module.editorInstance.formDialogOption('title', localizationMessage.format(DIALOG_LINK_CAPTION));
- const selectionHasEmbedContent = hasEmbedContent(module, selection);
- const formData = {
- href,
- text: selection && !selectionHasEmbedContent ? module.quill.getText(selection) : '',
- target: Object.prototype.hasOwnProperty.call(formats, 'target') ? !!formats.target : true
- };
- module.editorInstance.formDialogOption('title', localizationMessage.format(DIALOG_LINK_CAPTION));
-
- const promise = module.editorInstance.showFormDialog({
- formData: formData,
- items: getLinkFormItems(selectionHasEmbedContent)
- });
+ const promise = module.editorInstance.showFormDialog({
+ formData,
+ items: getLinkFormItems(selectionHasEmbedContent),
+ });
- promise.done((formData, event) => {
- if(selection && !selectionHasEmbedContent) {
- const text = formData.text || formData.href;
- const { index, length } = selection;
-
- formData.text = undefined;
- module.saveValueChangeEvent(event);
-
- length && module.quill.deleteText(index, length, SILENT_ACTION);
- module.quill.insertText(index, text, 'link', formData, USER_ACTION);
- module.quill.setSelection(index + text.length, 0, USER_ACTION);
- } else {
- formData.text = !selection && !formData.text ? formData.href : formData.text;
- applyFormat(module, ['link', formData, USER_ACTION], event);
- }
- });
+ promise.done((formData, event) => {
+ if (selection && !selectionHasEmbedContent) {
+ const text = formData.text || formData.href;
+ const { index, length } = selection;
+
+ formData.text = undefined;
+ module.saveValueChangeEvent(event);
+
+ length && module.quill.deleteText(index, length, SILENT_ACTION);
+ module.quill.insertText(index, text, 'link', formData, USER_ACTION);
+ module.quill.setSelection(index + text.length, 0, USER_ACTION);
+ } else {
+ formData.text = !selection && !formData.text ? formData.href : formData.text;
+ applyFormat(module, ['link', formData, USER_ACTION], event);
+ }
+ });
- promise.fail(() => {
- module.quill.focus();
- });
- };
+ promise.fail(() => {
+ module.quill.focus();
+ });
+ };
}
function prepareImageHandler(module, imageUploadOption) {
- const imageUploader = new ImageUploader(module, imageUploadOption);
- return () => {
- imageUploader.render();
- };
+ const imageUploader = new ImageUploader(module, imageUploadOption);
+ return () => {
+ imageUploader.render();
+ };
}
function getLinkFormItems(selectionHasEmbedContent) {
- return [
- { dataField: 'href', label: { text: localizationMessage.format(DIALOG_LINK_FIELD_URL) } },
- {
- dataField: 'text',
- label: { text: localizationMessage.format(DIALOG_LINK_FIELD_TEXT) },
- visible: !selectionHasEmbedContent
- },
- {
- dataField: 'target',
- editorType: 'dxCheckBox',
- editorOptions: {
- text: localizationMessage.format(DIALOG_LINK_FIELD_TARGET)
- },
- cssClass: DIALOG_LINK_FIELD_TARGET_CLASS,
- label: { visible: false }
- }
- ];
+ return [
+ { dataField: 'href', label: { text: localizationMessage.format(DIALOG_LINK_FIELD_URL) } },
+ {
+ dataField: 'text',
+ label: { text: localizationMessage.format(DIALOG_LINK_FIELD_TEXT) },
+ visible: !selectionHasEmbedContent,
+ },
+ {
+ dataField: 'target',
+ editorType: 'dxCheckBox',
+ editorOptions: {
+ text: localizationMessage.format(DIALOG_LINK_FIELD_TARGET),
+ },
+ cssClass: DIALOG_LINK_FIELD_TARGET_CLASS,
+ label: { visible: false },
+ },
+ ];
}
function prepareColorClickHandler(module, name) {
- return () => {
- const formData = module.quill.getFormat();
- const caption = name === 'color' ? DIALOG_COLOR_CAPTION : DIALOG_BACKGROUND_CAPTION;
- module.editorInstance.formDialogOption('title', localizationMessage.format(caption));
- const promise = module.editorInstance.showFormDialog({
- formData: formData,
- items: [{
- dataField: name,
- editorType: 'dxColorView',
- editorOptions: {
- focusStateEnabled: false
- },
- label: { visible: false }
- }]
- });
+ return () => {
+ const formData = module.quill.getFormat();
+ const caption = name === 'color' ? DIALOG_COLOR_CAPTION : DIALOG_BACKGROUND_CAPTION;
+ module.editorInstance.formDialogOption('title', localizationMessage.format(caption));
+ const promise = module.editorInstance.showFormDialog({
+ formData,
+ items: [{
+ dataField: name,
+ editorType: 'dxColorView',
+ editorOptions: {
+ focusStateEnabled: false,
+ },
+ label: { visible: false },
+ }],
+ });
- promise.done((formData, event) => {
- applyFormat(module, [name, formData[name], USER_ACTION], event);
- });
- promise.fail(() => {
- module.quill.focus();
- });
- };
+ promise.done((formData, event) => {
+ applyFormat(module, [name, formData[name], USER_ACTION], event);
+ });
+ promise.fail(() => {
+ module.quill.focus();
+ });
+ };
}
function prepareShortcutHandler(module, name, shortcutValue) {
- return ({ event }) => {
- const formats = module.quill.getFormat();
- const value = formats[name] === shortcutValue ? false : shortcutValue;
+ return ({ event }) => {
+ const formats = module.quill.getFormat();
+ const value = formats[name] === shortcutValue ? false : shortcutValue;
- applyFormat(module, [name, value, USER_ACTION], event);
+ applyFormat(module, [name, value, USER_ACTION], event);
- getToolbarModule(module)?.updateFormatWidgets(true);
- };
+ getToolbarModule(module)?.updateFormatWidgets(true);
+ };
}
function getToolbarModule(module) {
- return module._updateFormatWidget ? module : module.quill.getModule('toolbar');
+ return module._updateFormatWidget ? module : module.quill.getModule('toolbar');
}
function getDefaultClickHandler(module, name) {
- return ({ event }) => {
- const formats = module.quill.getFormat();
- const value = formats[name];
- const newValue = !(isBoolean(value) ? value : isDefined(value));
+ return ({ event }) => {
+ const formats = module.quill.getFormat();
+ const value = formats[name];
+ const newValue = !(isBoolean(value) ? value : isDefined(value));
- applyFormat(module, [name, newValue, USER_ACTION], event);
+ applyFormat(module, [name, newValue, USER_ACTION], event);
- getToolbarModule(module)?._updateFormatWidget(name, newValue, formats);
- };
+ getToolbarModule(module)?._updateFormatWidget(name, newValue, formats);
+ };
}
function insertTableFormItems() {
- return [
- {
- dataField: 'columns',
- editorType: 'dxNumberBox',
- editorOptions: {
- min: 1
- },
- label: { text: localizationMessage.format(DIALOG_TABLE_FIELD_COLUMNS) }
- },
- {
- dataField: 'rows',
- editorType: 'dxNumberBox',
- editorOptions: {
- min: 1
- },
- label: { text: localizationMessage.format(DIALOG_TABLE_FIELD_ROWS) }
- }
- ];
+ return [
+ {
+ dataField: 'columns',
+ editorType: 'dxNumberBox',
+ editorOptions: {
+ min: 1,
+ },
+ label: { text: localizationMessage.format(DIALOG_TABLE_FIELD_COLUMNS) },
+ },
+ {
+ dataField: 'rows',
+ editorType: 'dxNumberBox',
+ editorOptions: {
+ min: 1,
+ },
+ label: { text: localizationMessage.format(DIALOG_TABLE_FIELD_ROWS) },
+ },
+ ];
}
function prepareInsertTableHandler(module) {
- return () => {
- const formats = module.quill.getFormat();
- const isTableFocused = module._tableFormats.some(
- format => Object.prototype.hasOwnProperty.call(formats, format)
- );
- const formData = { rows: 1, columns: 1 };
-
- if(isTableFocused) {
- module.quill.focus();
- return;
- }
+ return () => {
+ const formats = module.quill.getFormat();
+ const isTableFocused = module._tableFormats.some(
+ (format) => Object.prototype.hasOwnProperty.call(formats, format),
+ );
+ const formData = { rows: 1, columns: 1 };
+
+ if (isTableFocused) {
+ module.quill.focus();
+ return;
+ }
- module.editorInstance.formDialogOption('title', localizationMessage.format(DIALOG_TABLE_CAPTION));
+ module.editorInstance.formDialogOption('title', localizationMessage.format(DIALOG_TABLE_CAPTION));
- const promise = module.editorInstance.showFormDialog({
- formData,
- items: insertTableFormItems()
- });
+ const promise = module.editorInstance.showFormDialog({
+ formData,
+ items: insertTableFormItems(),
+ });
- promise
- .done((formData, event) => {
- module.quill.focus();
+ promise
+ .done((formData, event) => {
+ module.quill.focus();
- const table = module.quill.getModule('table');
- if(table) {
- module.saveValueChangeEvent(event);
+ const table = module.quill.getModule('table');
+ if (table) {
+ module.saveValueChangeEvent(event);
- const { columns, rows } = formData;
- table.insertTable(columns, rows);
- }
- })
- .always(() => {
- module.quill.focus();
- });
- };
+ const { columns, rows } = formData;
+ table.insertTable(columns, rows);
+ }
+ })
+ .always(() => {
+ module.quill.focus();
+ });
+ };
}
function getTablePropertiesFormConfig(module, { $element, formats, tableBlot }) {
- const window = getWindow();
- let alignmentEditorInstance;
- let borderColorEditorInstance;
- let backgroundColorEditorInstance;
- const $table = $element;
- const editorInstance = module.editorInstance;
- const startTableWidth = parseInt(formats.tableWidth) || getOuterWidth($table);
- const tableStyles = window.getComputedStyle($table.get(0));
- const startTextAlign = tableStyles.textAlign === 'start' ? 'left' : tableStyles.textAlign;
-
- const formOptions = {
- colCount: 2,
- formData: {
- width: startTableWidth,
- height: isDefined(formats.tableHeight) ? parseInt(formats.tableHeight) : getOuterHeight($table),
- backgroundColor: formats.tableBackgroundColor || tableStyles.backgroundColor,
- borderStyle: formats.tableBorderStyle || tableStyles.borderTopStyle,
- borderColor: formats.tableBorderColor || tableStyles.borderTopColor,
- borderWidth: parseInt(isDefined(formats.tableBorderWidth) ? formats.tableBorderWidth : tableStyles.borderTopWidth),
- alignment: formats.tableAlign || startTextAlign
+ const window = getWindow();
+ let alignmentEditorInstance;
+ let borderColorEditorInstance;
+ let backgroundColorEditorInstance;
+ const $table = $element;
+ const { editorInstance } = module;
+ // eslint-disable-next-line radix
+ const startTableWidth = parseInt(formats.tableWidth) || getOuterWidth($table);
+ const tableStyles = window.getComputedStyle($table.get(0));
+ const startTextAlign = tableStyles.textAlign === 'start' ? 'left' : tableStyles.textAlign;
+
+ const formOptions = {
+ colCount: 2,
+ formData: {
+ width: startTableWidth,
+ // eslint-disable-next-line radix
+ height: isDefined(formats.tableHeight) ? parseInt(formats.tableHeight) : getOuterHeight($table),
+ backgroundColor: formats.tableBackgroundColor || tableStyles.backgroundColor,
+ borderStyle: formats.tableBorderStyle || tableStyles.borderTopStyle,
+ borderColor: formats.tableBorderColor || tableStyles.borderTopColor,
+ // eslint-disable-next-line radix
+ borderWidth: parseInt(isDefined(formats.tableBorderWidth) ? formats.tableBorderWidth : tableStyles.borderTopWidth),
+ alignment: formats.tableAlign || startTextAlign,
+ },
+ items: [{
+ itemType: 'group',
+ caption: localizationMessage.format('dxHtmlEditor-border'),
+ colCountByScreen: {
+ xs: 2,
+ },
+ colCount: 2,
+ items: [
+ {
+ dataField: 'borderStyle',
+ label: { text: localizationMessage.format('dxHtmlEditor-style') },
+ editorType: 'dxSelectBox',
+ editorOptions: {
+ items: BORDER_STYLES_TRANSLATED,
+ valueExpr: 'id',
+ displayExpr: 'value',
+ placeholder: 'Select style',
+ },
},
- items: [{
- itemType: 'group',
- caption: localizationMessage.format('dxHtmlEditor-border'),
- colCountByScreen: {
- xs: 2
- },
- colCount: 2,
- items: [
- {
- dataField: 'borderStyle',
- label: { text: localizationMessage.format('dxHtmlEditor-style') },
- editorType: 'dxSelectBox',
- editorOptions: {
- items: BORDER_STYLES_TRANSLATED,
- valueExpr: 'id',
- displayExpr: 'value',
- placeholder: 'Select style'
- }
- },
- {
- dataField: 'borderWidth',
- label: { text: localizationMessage.format('dxHtmlEditor-borderWidth') },
- editorOptions: {
- placeholder: localizationMessage.format('dxHtmlEditor-pixels')
- }
- },
- {
- itemType: 'simple',
- dataField: 'borderColor',
- label: { text: localizationMessage.format('dxHtmlEditor-borderColor') },
- colSpan: 2,
- template: (e) => {
- const $content = $('
');
- editorInstance._createComponent($content, ColorBox, {
- editAlphaChannel: true,
- value: e.component.option('formData').borderColor,
- onInitialized: (e) => {
- borderColorEditorInstance = e.component;
- }
- });
- return $content;
- }
- }
- ]
- }, {
- itemType: 'group',
- caption: localizationMessage.format('dxHtmlEditor-dimensions'),
- colCountByScreen: {
- xs: 2
+ {
+ dataField: 'borderWidth',
+ label: { text: localizationMessage.format('dxHtmlEditor-borderWidth') },
+ editorOptions: {
+ placeholder: localizationMessage.format('dxHtmlEditor-pixels'),
+ },
+ },
+ {
+ itemType: 'simple',
+ dataField: 'borderColor',
+ label: { text: localizationMessage.format('dxHtmlEditor-borderColor') },
+ colSpan: 2,
+ template: (e) => {
+ const $content = $('
');
+ editorInstance._createComponent($content, ColorBox, {
+ editAlphaChannel: true,
+ value: e.component.option('formData').borderColor,
+ onInitialized: (e) => {
+ borderColorEditorInstance = e.component;
+ },
+ });
+ return $content;
+ },
+ },
+ ],
+ }, {
+ itemType: 'group',
+ caption: localizationMessage.format('dxHtmlEditor-dimensions'),
+ colCountByScreen: {
+ xs: 2,
+ },
+ colCount: 2,
+ items: [
+ {
+ dataField: 'width',
+ label: { text: localizationMessage.format('dxHtmlEditor-width') },
+ editorOptions: {
+ min: 0,
+ placeholder: localizationMessage.format('dxHtmlEditor-pixels'),
+ },
+ },
+ {
+ dataField: 'height',
+ label: { text: localizationMessage.format('dxHtmlEditor-height') },
+ editorOptions: {
+ min: 0,
+ placeholder: localizationMessage.format('dxHtmlEditor-pixels'),
+ },
+ },
+ ],
+ }, {
+ itemType: 'group',
+ caption: localizationMessage.format('dxHtmlEditor-tableBackground'),
+ items: [
+ {
+ itemType: 'simple',
+ dataField: 'backgroundColor',
+ label: { text: localizationMessage.format('dxHtmlEditor-borderColor') },
+ template: (e) => {
+ const $content = $('
');
+ editorInstance._createComponent($content, ColorBox, {
+ editAlphaChannel: true,
+ value: e.component.option('formData').backgroundColor,
+ onInitialized: (e) => {
+ backgroundColorEditorInstance = e.component;
+ },
+ });
+ return $content;
+ },
+ },
+ ],
+ }, {
+ itemType: 'group',
+ caption: localizationMessage.format('dxHtmlEditor-alignment'),
+ items: [{
+ itemType: 'simple',
+ label: { text: localizationMessage.format('dxHtmlEditor-horizontal') },
+ template: () => {
+ const $content = $('
');
+ editorInstance._createComponent($content, ButtonGroup, {
+ items: [{ value: 'left', icon: 'alignleft' }, { value: 'center', icon: 'aligncenter' }, { value: 'right', icon: 'alignright' }, { value: 'justify', icon: 'alignjustify' }],
+ keyExpr: 'value',
+ selectedItemKeys: [startTextAlign],
+ onInitialized: (e) => {
+ alignmentEditorInstance = e.component;
},
- colCount: 2,
- items: [
- {
- dataField: 'width',
- label: { text: localizationMessage.format('dxHtmlEditor-width') },
- editorOptions: {
- min: 0,
- placeholder: localizationMessage.format('dxHtmlEditor-pixels')
- }
- },
- {
- dataField: 'height',
- label: { text: localizationMessage.format('dxHtmlEditor-height') },
- editorOptions: {
- min: 0,
- placeholder: localizationMessage.format('dxHtmlEditor-pixels')
- }
- }
- ]
- }, {
- itemType: 'group',
- caption: localizationMessage.format('dxHtmlEditor-tableBackground'),
- items: [
- {
- itemType: 'simple',
- dataField: 'backgroundColor',
- label: { text: localizationMessage.format('dxHtmlEditor-borderColor') },
- template: (e) => {
- const $content = $('
');
- editorInstance._createComponent($content, ColorBox, {
- editAlphaChannel: true,
- value: e.component.option('formData').backgroundColor,
- onInitialized: (e) => {
- backgroundColorEditorInstance = e.component;
- }
- });
- return $content;
- }
- }
- ]
- }, {
- itemType: 'group',
- caption: localizationMessage.format('dxHtmlEditor-alignment'),
- items: [{
- itemType: 'simple',
- label: { text: localizationMessage.format('dxHtmlEditor-horizontal') },
- template: () => {
- const $content = $('
');
- editorInstance._createComponent($content, ButtonGroup, {
- items: [{ value: 'left', icon: 'alignleft' }, { value: 'center', icon: 'aligncenter' }, { value: 'right', icon: 'alignright' }, { value: 'justify', icon: 'alignjustify' }],
- keyExpr: 'value',
- selectedItemKeys: [startTextAlign],
- onInitialized: (e) => {
- alignmentEditorInstance = e.component;
- }
- });
- return $content;
- }
- }]
- }],
- showColonAfterLabel: true,
- labelLocation: 'top',
- minColWidth: 400
- };
-
- const applyHandler = (formInstance) => {
- const formData = formInstance.option('formData');
- const newWidth = formData.width === startTableWidth ? undefined : formData.width;
- const newHeight = formData.height;
- applyTableDimensionChanges(module, { $table, newHeight, newWidth, tableBlot });
-
- module.editorInstance.format('tableBorderStyle', formData.borderStyle);
- module.editorInstance.format('tableBorderWidth', formData.borderWidth + 'px');
- module.editorInstance.format('tableBorderColor', borderColorEditorInstance.option('value'));
- module.editorInstance.format('tableBackgroundColor', backgroundColorEditorInstance.option('value'));
- module.editorInstance.format('tableTextAlign', alignmentEditorInstance.option('selectedItemKeys')[0]);
- };
+ });
+ return $content;
+ },
+ }],
+ }],
+ showColonAfterLabel: true,
+ labelLocation: 'top',
+ minColWidth: 400,
+ };
+
+ const applyHandler = (formInstance) => {
+ const formData = formInstance.option('formData');
+ const newWidth = formData.width === startTableWidth ? undefined : formData.width;
+ const newHeight = formData.height;
+ applyTableDimensionChanges(module, {
+ $table, newHeight, newWidth, tableBlot,
+ });
- return {
- formOptions,
- applyHandler
- };
+ module.editorInstance.format('tableBorderStyle', formData.borderStyle);
+ module.editorInstance.format('tableBorderWidth', `${formData.borderWidth}px`);
+ module.editorInstance.format('tableBorderColor', borderColorEditorInstance.option('value'));
+ module.editorInstance.format('tableBackgroundColor', backgroundColorEditorInstance.option('value'));
+ module.editorInstance.format('tableTextAlign', alignmentEditorInstance.option('selectedItemKeys')[0]);
+ };
+
+ return {
+ formOptions,
+ applyHandler,
+ };
}
-function getCellPropertiesFormConfig(module, { $element, formats, tableBlot, rowBlot }) {
- const window = getWindow();
- let alignmentEditorInstance;
- let verticalAlignmentEditorInstance;
- let borderColorEditorInstance;
- let backgroundColorEditorInstance;
-
- const $cell = $element;
- const startCellWidth = isDefined(formats.cellWidth) ? parseInt(formats.cellWidth) : getOuterWidth($cell);
- const editorInstance = module.editorInstance;
- const cellStyles = window.getComputedStyle($cell.get(0));
- const startTextAlign = cellStyles.textAlign === 'start' ? 'left' : cellStyles.textAlign;
-
- const formOptions = {
- colCount: 2,
- formData: {
- width: startCellWidth,
- height: isDefined(formats.cellHeight) ? parseInt(formats.cellHeight) : getOuterHeight($cell),
- backgroundColor: getColorFromFormat(formats.cellBackgroundColor) || cellStyles.backgroundColor,
- borderStyle: formats.cellBorderStyle || cellStyles.borderTopStyle,
- borderColor: getColorFromFormat(formats.cellBorderColor) || cellStyles.borderTopColor,
- borderWidth: parseInt(isDefined(formats.cellBorderWidth) ? formats.cellBorderWidth : cellStyles.borderTopWidth),
- alignment: formats.cellTextAlign || startTextAlign,
- verticalAlignment: formats.cellVerticalAlign || cellStyles.verticalAlign,
- verticalPadding: parseInt(isDefined(formats.cellPaddingTop) ? formats.cellPaddingTop : cellStyles.paddingTop),
- horizontalPadding: parseInt(isDefined(formats.cellPaddingLeft) ? formats.cellPaddingLeft : cellStyles.paddingLeft),
+function getCellPropertiesFormConfig(module, {
+ $element, formats, tableBlot, rowBlot,
+}) {
+ const window = getWindow();
+ let alignmentEditorInstance;
+ let verticalAlignmentEditorInstance;
+ let borderColorEditorInstance;
+ let backgroundColorEditorInstance;
+
+ const $cell = $element;
+ // eslint-disable-next-line radix
+ const startCellWidth = isDefined(formats.cellWidth) ? parseInt(formats.cellWidth) : getOuterWidth($cell);
+ const { editorInstance } = module;
+ const cellStyles = window.getComputedStyle($cell.get(0));
+ const startTextAlign = cellStyles.textAlign === 'start' ? 'left' : cellStyles.textAlign;
+
+ const formOptions = {
+ colCount: 2,
+ formData: {
+ width: startCellWidth,
+ // eslint-disable-next-line radix
+ height: isDefined(formats.cellHeight) ? parseInt(formats.cellHeight) : getOuterHeight($cell),
+ backgroundColor: getColorFromFormat(formats.cellBackgroundColor) || cellStyles.backgroundColor,
+ borderStyle: formats.cellBorderStyle || cellStyles.borderTopStyle,
+ borderColor: getColorFromFormat(formats.cellBorderColor) || cellStyles.borderTopColor,
+ // eslint-disable-next-line radix
+ borderWidth: parseInt(isDefined(formats.cellBorderWidth) ? formats.cellBorderWidth : cellStyles.borderTopWidth),
+ alignment: formats.cellTextAlign || startTextAlign,
+ verticalAlignment: formats.cellVerticalAlign || cellStyles.verticalAlign,
+ // eslint-disable-next-line radix
+ verticalPadding: parseInt(isDefined(formats.cellPaddingTop) ? formats.cellPaddingTop : cellStyles.paddingTop),
+ // eslint-disable-next-line radix
+ horizontalPadding: parseInt(isDefined(formats.cellPaddingLeft) ? formats.cellPaddingLeft : cellStyles.paddingLeft),
+ },
+ items: [{
+ itemType: 'group',
+ caption: localizationMessage.format('dxHtmlEditor-border'),
+ colCountByScreen: {
+ xs: 2,
+ },
+ colCount: 2,
+ items: [
+ {
+ dataField: 'borderStyle',
+ label: { text: localizationMessage.format('dxHtmlEditor-style') },
+ editorType: 'dxSelectBox',
+ editorOptions: {
+ items: BORDER_STYLES_TRANSLATED,
+ valueExpr: 'id',
+ displayExpr: 'value',
+ },
},
- items: [{
- itemType: 'group',
- caption: localizationMessage.format('dxHtmlEditor-border'),
- colCountByScreen: {
- xs: 2
- },
- colCount: 2,
- items: [
- {
- dataField: 'borderStyle',
- label: { text: localizationMessage.format('dxHtmlEditor-style') },
- editorType: 'dxSelectBox',
- editorOptions: {
- items: BORDER_STYLES_TRANSLATED,
- valueExpr: 'id',
- displayExpr: 'value'
- }
- },
- {
- dataField: 'borderWidth',
- label: { text: localizationMessage.format('dxHtmlEditor-borderWidth') },
- editorOptions: {
- placeholder: localizationMessage.format('dxHtmlEditor-pixels')
- }
- },
- {
- itemType: 'simple',
- dataField: 'borderColor',
- colSpan: 2,
- label: { text: localizationMessage.format('dxHtmlEditor-borderColor') },
- template: (e) => {
- const $content = $('
');
- editorInstance._createComponent($content, ColorBox, {
- editAlphaChannel: true,
- value: e.component.option('formData').borderColor,
- onInitialized: (e) => {
- borderColorEditorInstance = e.component;
- }
- });
- return $content;
- }
- }
- ]
- }, {
- itemType: 'group',
- caption: localizationMessage.format('dxHtmlEditor-dimensions'),
- colCount: 2,
- colCountByScreen: {
- xs: 2
- },
- items: [
- {
- dataField: 'width',
- label: { text: localizationMessage.format('dxHtmlEditor-width') },
- editorOptions: {
- min: 0,
- placeholder: localizationMessage.format('dxHtmlEditor-pixels')
- }
- },
- {
- dataField: 'height',
- label: { text: localizationMessage.format('dxHtmlEditor-height') },
- editorOptions: {
- min: 0,
- placeholder: localizationMessage.format('dxHtmlEditor-pixels')
- }
- },
- {
- dataField: 'verticalPadding',
- label: { text: localizationMessage.format('dxHtmlEditor-paddingVertical') },
- editorOptions: {
- placeholder: localizationMessage.format('dxHtmlEditor-pixels')
- }
- },
- {
- label: { text: localizationMessage.format('dxHtmlEditor-paddingHorizontal') },
- dataField: 'horizontalPadding',
- editorOptions: {
- placeholder: localizationMessage.format('dxHtmlEditor-pixels')
- }
- }
- ]
- }, {
- itemType: 'group',
- caption: localizationMessage.format('dxHtmlEditor-tableBackground'),
- items: [
- {
- itemType: 'simple',
- dataField: 'backgroundColor',
- label: { text: localizationMessage.format('dxHtmlEditor-borderColor') },
- template: (e) => {
- const $content = $('
');
- editorInstance._createComponent($content, ColorBox, {
- editAlphaChannel: true,
- value: e.component.option('formData').backgroundColor,
- onInitialized: (e) => {
- backgroundColorEditorInstance = e.component;
- }
- });
- return $content;
- }
- }
- ]
+ {
+ dataField: 'borderWidth',
+ label: { text: localizationMessage.format('dxHtmlEditor-borderWidth') },
+ editorOptions: {
+ placeholder: localizationMessage.format('dxHtmlEditor-pixels'),
+ },
+ },
+ {
+ itemType: 'simple',
+ dataField: 'borderColor',
+ colSpan: 2,
+ label: { text: localizationMessage.format('dxHtmlEditor-borderColor') },
+ template: (e) => {
+ const $content = $('
');
+ editorInstance._createComponent($content, ColorBox, {
+ editAlphaChannel: true,
+ value: e.component.option('formData').borderColor,
+ onInitialized: (e) => {
+ borderColorEditorInstance = e.component;
+ },
+ });
+ return $content;
+ },
+ },
+ ],
+ }, {
+ itemType: 'group',
+ caption: localizationMessage.format('dxHtmlEditor-dimensions'),
+ colCount: 2,
+ colCountByScreen: {
+ xs: 2,
+ },
+ items: [
+ {
+ dataField: 'width',
+ label: { text: localizationMessage.format('dxHtmlEditor-width') },
+ editorOptions: {
+ min: 0,
+ placeholder: localizationMessage.format('dxHtmlEditor-pixels'),
+ },
+ },
+ {
+ dataField: 'height',
+ label: { text: localizationMessage.format('dxHtmlEditor-height') },
+ editorOptions: {
+ min: 0,
+ placeholder: localizationMessage.format('dxHtmlEditor-pixels'),
+ },
+ },
+ {
+ dataField: 'verticalPadding',
+ label: { text: localizationMessage.format('dxHtmlEditor-paddingVertical') },
+ editorOptions: {
+ placeholder: localizationMessage.format('dxHtmlEditor-pixels'),
+ },
+ },
+ {
+ label: { text: localizationMessage.format('dxHtmlEditor-paddingHorizontal') },
+ dataField: 'horizontalPadding',
+ editorOptions: {
+ placeholder: localizationMessage.format('dxHtmlEditor-pixels'),
+ },
+ },
+ ],
+ }, {
+ itemType: 'group',
+ caption: localizationMessage.format('dxHtmlEditor-tableBackground'),
+ items: [
+ {
+ itemType: 'simple',
+ dataField: 'backgroundColor',
+ label: { text: localizationMessage.format('dxHtmlEditor-borderColor') },
+ template: (e) => {
+ const $content = $('
');
+ editorInstance._createComponent($content, ColorBox, {
+ editAlphaChannel: true,
+ value: e.component.option('formData').backgroundColor,
+ onInitialized: (e) => {
+ backgroundColorEditorInstance = e.component;
+ },
+ });
+ return $content;
+ },
+ },
+ ],
+ }, {
+ itemType: 'group',
+ caption: localizationMessage.format('dxHtmlEditor-alignment'),
+ colCount: 2,
+ items: [
+ {
+ itemType: 'simple',
+ label: { text: localizationMessage.format('dxHtmlEditor-horizontal') },
+ template: () => {
+ const $content = $('
');
+ editorInstance._createComponent($content, ButtonGroup, {
+ items: [{ value: 'left', icon: 'alignleft' }, { value: 'center', icon: 'aligncenter' }, { value: 'right', icon: 'alignright' }, { value: 'justify', icon: 'alignjustify' }],
+ keyExpr: 'value',
+ selectedItemKeys: [startTextAlign],
+ onInitialized: (e) => {
+ alignmentEditorInstance = e.component;
+ },
+ });
+ return $content;
+ },
}, {
- itemType: 'group',
- caption: localizationMessage.format('dxHtmlEditor-alignment'),
- colCount: 2,
- items: [
- {
- itemType: 'simple',
- label: { text: localizationMessage.format('dxHtmlEditor-horizontal') },
- template: () => {
- const $content = $('
');
- editorInstance._createComponent($content, ButtonGroup, {
- items: [{ value: 'left', icon: 'alignleft' }, { value: 'center', icon: 'aligncenter' }, { value: 'right', icon: 'alignright' }, { value: 'justify', icon: 'alignjustify' }],
- keyExpr: 'value',
- selectedItemKeys: [startTextAlign],
- onInitialized: (e) => {
- alignmentEditorInstance = e.component;
- }
- });
- return $content;
- }
- }, {
- itemType: 'simple',
- label: { text: localizationMessage.format('dxHtmlEditor-vertical') },
- template: () => {
- const $content = $('
');
- editorInstance._createComponent($content, ButtonGroup, {
- items: [{ value: 'top', icon: 'verticalaligntop' }, { value: 'middle', icon: 'verticalaligncenter' }, { value: 'bottom', icon: 'verticalalignbottom' }],
- keyExpr: 'value',
- selectedItemKeys: [cellStyles.verticalAlign],
- onInitialized: (e) => {
- verticalAlignmentEditorInstance = e.component;
- }
- });
- return $content;
- }
- }
- ]
- }],
- showColonAfterLabel: true,
- labelLocation: 'top',
- minColWidth: 400
- };
-
- const applyHandler = (formInstance) => {
- const formData = formInstance.option('formData');
- const newWidth = formData.width === parseInt(startCellWidth) ? undefined : formData.width;
- const newHeight = formData.height;
- applyCellDimensionChanges(module, { $cell, newHeight, newWidth, tableBlot, rowBlot });
-
- module.editorInstance.format('cellBorderWidth', formData.borderWidth + 'px');
- module.editorInstance.format('cellBorderColor', borderColorEditorInstance.option('value'));
- module.editorInstance.format('cellBorderStyle', formData.borderStyle);
- module.editorInstance.format('cellBackgroundColor', backgroundColorEditorInstance.option('value'));
- module.editorInstance.format('cellTextAlign', alignmentEditorInstance.option('selectedItemKeys')[0]);
-
- module.editorInstance.format('cellVerticalAlign', verticalAlignmentEditorInstance.option('selectedItemKeys')[0]);
- module.editorInstance.format('cellPaddingLeft', formData.horizontalPadding + 'px');
- module.editorInstance.format('cellPaddingRight', formData.horizontalPadding + 'px');
- module.editorInstance.format('cellPaddingTop', formData.verticalPadding + 'px');
- module.editorInstance.format('cellPaddingBottom', formData.verticalPadding + 'px');
- };
+ itemType: 'simple',
+ label: { text: localizationMessage.format('dxHtmlEditor-vertical') },
+ template: () => {
+ const $content = $('
');
+ editorInstance._createComponent($content, ButtonGroup, {
+ items: [{ value: 'top', icon: 'verticalaligntop' }, { value: 'middle', icon: 'verticalaligncenter' }, { value: 'bottom', icon: 'verticalalignbottom' }],
+ keyExpr: 'value',
+ selectedItemKeys: [cellStyles.verticalAlign],
+ onInitialized: (e) => {
+ verticalAlignmentEditorInstance = e.component;
+ },
+ });
+ return $content;
+ },
+ },
+ ],
+ }],
+ showColonAfterLabel: true,
+ labelLocation: 'top',
+ minColWidth: 400,
+ };
+
+ const applyHandler = (formInstance) => {
+ const formData = formInstance.option('formData');
+ // eslint-disable-next-line radix
+ const newWidth = formData.width === parseInt(startCellWidth) ? undefined : formData.width;
+ const newHeight = formData.height;
+ applyCellDimensionChanges(module, {
+ $cell, newHeight, newWidth, tableBlot, rowBlot,
+ });
- return {
- formOptions,
- applyHandler
- };
+ module.editorInstance.format('cellBorderWidth', `${formData.borderWidth}px`);
+ module.editorInstance.format('cellBorderColor', borderColorEditorInstance.option('value'));
+ module.editorInstance.format('cellBorderStyle', formData.borderStyle);
+ module.editorInstance.format('cellBackgroundColor', backgroundColorEditorInstance.option('value'));
+ module.editorInstance.format('cellTextAlign', alignmentEditorInstance.option('selectedItemKeys')[0]);
+
+ module.editorInstance.format('cellVerticalAlign', verticalAlignmentEditorInstance.option('selectedItemKeys')[0]);
+ module.editorInstance.format('cellPaddingLeft', `${formData.horizontalPadding}px`);
+ module.editorInstance.format('cellPaddingRight', `${formData.horizontalPadding}px`);
+ module.editorInstance.format('cellPaddingTop', `${formData.verticalPadding}px`);
+ module.editorInstance.format('cellPaddingBottom', `${formData.verticalPadding}px`);
+ };
+
+ return {
+ formOptions,
+ applyHandler,
+ };
}
function getFormConfigConstructor(type) {
- return type === 'cell' ? getCellPropertiesFormConfig : getTablePropertiesFormConfig;
+ return type === 'cell' ? getCellPropertiesFormConfig : getTablePropertiesFormConfig;
}
-function applyTableDimensionChanges(module, { $table, newHeight, newWidth, tableBlot }) {
- if(isDefined(newWidth)) {
- const autoWidthColumns = getAutoSizedElements($table);
+function applyTableDimensionChanges(module, {
+ $table, newHeight, newWidth, tableBlot,
+}) {
+ if (isDefined(newWidth)) {
+ const autoWidthColumns = getAutoSizedElements($table);
- if(autoWidthColumns.length > 0) {
- module.editorInstance.format('tableWidth', newWidth + 'px');
- } else {
- const $columns = getColumnElements($table);
- const oldTableWidth = getOuterWidth($table);
-
- unfixTableWidth($table, { tableBlot });
+ if (autoWidthColumns.length > 0) {
+ module.editorInstance.format('tableWidth', `${newWidth}px`);
+ } else {
+ const $columns = getColumnElements($table);
+ const oldTableWidth = getOuterWidth($table);
+ // @ts-expect-error
+ unfixTableWidth($table, { tableBlot });
- each($columns, (i, element) => {
- const $element = $(element);
- const newElementWidth = newWidth / oldTableWidth * getOuterWidth($element);
+ each($columns, (i, element) => {
+ const $element = $(element);
+ const newElementWidth = newWidth / oldTableWidth * getOuterWidth($element);
- const $lineElements = getLineElements($table, $element.index(), 'horizontal');
+ const $lineElements = getLineElements($table, $element.index(), 'horizontal');
- setLineElementsFormat(module, {
- elements: $lineElements,
- property: 'width',
- value: newElementWidth
- });
- });
- }
- }
-
- const autoHeightRows = getAutoSizedElements($table, 'vertical');
-
- if(autoHeightRows?.length > 0) {
- tableBlot.format('tableHeight', newHeight + 'px');
- } else {
- const $rows = getRowElements($table);
- const oldTableHeight = getOuterHeight($table);
-
- each($rows, (i, element) => {
- const $element = $(element);
- const newElementHeight = newHeight / oldTableHeight * getOuterHeight($element);
- const $lineElements = getLineElements($table, i, 'vertical');
- setLineElementsFormat(module, {
- elements: $lineElements,
- property: 'height',
- value: newElementHeight
- });
+ setLineElementsFormat(module, {
+ elements: $lineElements,
+ property: 'width',
+ value: newElementWidth,
});
+ });
}
+ }
+
+ const autoHeightRows = getAutoSizedElements($table, 'vertical');
+
+ if (autoHeightRows?.length > 0) {
+ tableBlot.format('tableHeight', `${newHeight}px`);
+ } else {
+ const $rows = getRowElements($table);
+ const oldTableHeight = getOuterHeight($table);
+
+ each($rows, (i, element) => {
+ const $element = $(element);
+ const newElementHeight = newHeight / oldTableHeight * getOuterHeight($element);
+ const $lineElements = getLineElements($table, i, 'vertical');
+ setLineElementsFormat(module, {
+ elements: $lineElements,
+ property: 'height',
+ value: newElementHeight,
+ });
+ });
+ }
}
-function applyCellDimensionChanges(module, { $cell, newHeight, newWidth, tableBlot, rowBlot }) {
- const $table = $($cell.closest('table'));
- if(isDefined(newWidth)) {
- const index = $($cell).index();
- let $verticalCells = getLineElements($table, index);
+function applyCellDimensionChanges(module, {
+ $cell, newHeight, newWidth, tableBlot, rowBlot,
+}) {
+ const $table = $($cell.closest('table'));
+ if (isDefined(newWidth)) {
+ const index = $($cell).index();
+ let $verticalCells = getLineElements($table, index);
+ const widthDiff = newWidth - getOuterWidth($cell);
+ const tableWidth = getOuterWidth($table);
- const widthDiff = newWidth - getOuterWidth($cell);
- const tableWidth = getOuterWidth($table);
+ if (newWidth > tableWidth) {
+ // @ts-expect-error
+ unfixTableWidth($table, { tableBlot });
+ }
- if(newWidth > tableWidth) {
- unfixTableWidth($table, { tableBlot });
- }
+ setLineElementsFormat(module, {
+ elements: $verticalCells,
+ property: 'width',
+ value: newWidth,
+ });
+
+ const $nextColumnCell = $cell.next();
+ const shouldUpdateNearestColumnWidth = getAutoSizedElements($table).length === 0;
+ if (shouldUpdateNearestColumnWidth) {
+ // @ts-expect-error
+ unfixTableWidth($table, { tableBlot });
+ if ($nextColumnCell.length === 1) {
+ $verticalCells = getLineElements($table, index + 1);
+ const nextColumnWidth = getOuterWidth($verticalCells.eq(0)) - widthDiff;
setLineElementsFormat(module, {
+ elements: $verticalCells,
+ property: 'width',
+ value: Math.max(nextColumnWidth, 0),
+ });
+ } else {
+ const $prevColumnCell = $cell.prev();
+ if ($prevColumnCell.length === 1) {
+ $verticalCells = getLineElements($table, index - 1);
+ const prevColumnWidth = getOuterWidth($verticalCells.eq(0)) - widthDiff;
+ setLineElementsFormat(module, {
elements: $verticalCells,
property: 'width',
- value: newWidth
- });
-
- const $nextColumnCell = $cell.next();
- const shouldUpdateNearestColumnWidth = getAutoSizedElements($table).length === 0;
-
- if(shouldUpdateNearestColumnWidth) {
- unfixTableWidth($table, { tableBlot });
- if($nextColumnCell.length === 1) {
- $verticalCells = getLineElements($table, index + 1);
- const nextColumnWidth = getOuterWidth($verticalCells.eq(0)) - widthDiff;
- setLineElementsFormat(module, {
- elements: $verticalCells,
- property: 'width',
- value: Math.max(nextColumnWidth, 0)
- });
- } else {
- const $prevColumnCell = $cell.prev();
- if($prevColumnCell.length === 1) {
- $verticalCells = getLineElements($table, index - 1);
- const prevColumnWidth = getOuterWidth($verticalCells.eq(0)) - widthDiff;
- setLineElementsFormat(module, {
- elements: $verticalCells,
- property: 'width',
- value: Math.max(prevColumnWidth, 0)
- });
- }
- }
+ value: Math.max(prevColumnWidth, 0),
+ });
}
+ }
}
+ }
- rowBlot.children.forEach((rowCell) => {
- rowCell.format('cellHeight', newHeight + 'px');
- });
+ rowBlot.children.forEach((rowCell) => {
+ rowCell.format('cellHeight', `${newHeight}px`);
+ });
- const autoHeightRows = getAutoSizedElements($table, 'vertical');
+ const autoHeightRows = getAutoSizedElements($table, 'vertical');
- if(autoHeightRows.length === 0) {
- $table.css('height', 'auto');
- }
+ if (autoHeightRows.length === 0) {
+ $table.css('height', 'auto');
+ }
}
-
export {
- getFormatHandlers,
- getDefaultClickHandler,
- ICON_MAP,
- applyFormat
+ applyFormat,
+ getDefaultClickHandler,
+ getFormatHandlers,
+ ICON_MAP,
};
diff --git a/packages/devextreme/js/__internal/ui/text_box/m_utils.scroll.ts b/packages/devextreme/js/__internal/ui/text_box/m_utils.scroll.ts
index a764ecf48c09..5ee6e307f364 100644
--- a/packages/devextreme/js/__internal/ui/text_box/m_utils.scroll.ts
+++ b/packages/devextreme/js/__internal/ui/text_box/m_utils.scroll.ts
@@ -29,7 +29,7 @@ const allowScroll = function (container, delta, shiftKey?: boolean) {
}
};
-const prepareScrollData = function (container, validateTarget) {
+const prepareScrollData = function (container, validateTarget?: any) {
const $container = $(container);
const isCorrectTarget = function (eventTarget) {
return validateTarget ? $(eventTarget).is(container) : true;
diff --git a/packages/devextreme/js/ui/html_editor/converters/markdown.js b/packages/devextreme/js/ui/html_editor/converters/markdown.js
new file mode 100644
index 000000000000..4633e811513b
--- /dev/null
+++ b/packages/devextreme/js/ui/html_editor/converters/markdown.js
@@ -0,0 +1,3 @@
+import MarkdownConverter from '../../../__internal/ui/html_editor/converters/m_markdown';
+
+export default MarkdownConverter;
diff --git a/packages/devextreme/js/ui/html_editor/quill_importer.js b/packages/devextreme/js/ui/html_editor/quill_importer.js
new file mode 100644
index 000000000000..b9b12051d495
--- /dev/null
+++ b/packages/devextreme/js/ui/html_editor/quill_importer.js
@@ -0,0 +1,3 @@
+import { getQuill } from '../../__internal/ui/html_editor/m_quill_importer';
+
+export default { getQuill };
diff --git a/packages/devextreme/js/ui/html_editor/quill_registrator.js b/packages/devextreme/js/ui/html_editor/quill_registrator.js
new file mode 100644
index 000000000000..60a8d473d4e9
--- /dev/null
+++ b/packages/devextreme/js/ui/html_editor/quill_registrator.js
@@ -0,0 +1,3 @@
+import QuillRegistrator from '../../__internal/ui/html_editor/m_quill_registrator';
+
+export default QuillRegistrator;
diff --git a/packages/devextreme/js/ui/html_editor/ui.html_editor.js b/packages/devextreme/js/ui/html_editor/ui.html_editor.js
new file mode 100644
index 000000000000..e6ea1b3b877e
--- /dev/null
+++ b/packages/devextreme/js/ui/html_editor/ui.html_editor.js
@@ -0,0 +1,5 @@
+import HtmlEditor from '../../__internal/ui/html_editor/m_html_editor';
+
+export default HtmlEditor;
+
+// STYLE htmlEditor
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/converterController.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/converterController.tests.js
index c9c61b236126..88b4146f970a 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/converterController.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/converterController.tests.js
@@ -1,7 +1,7 @@
import $ from 'jquery';
import 'ui/html_editor';
-import ConverterController from 'ui/html_editor/converterController';
+import ConverterController from '__internal/ui/html_editor/m_converterController';
const { test } = QUnit;
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/converters.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/converters.tests.js
index 3ee82a6826a1..7f6c345e690e 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/converters.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/converters.tests.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
-import DeltaConverter from 'ui/html_editor/converters/delta';
+import DeltaConverter from '__internal/ui/html_editor/converters/m_delta';
import MarkdownConverter from 'ui/html_editor/converters/markdown';
import { getQuill } from 'ui/html_editor/quill_importer';
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/dropImageModule.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/dropImageModule.tests.js
index 722f52379c68..a9b345d1f952 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/dropImageModule.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/dropImageModule.tests.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
-import DropImage from 'ui/html_editor/modules/dropImage';
+import DropImage from '__internal/ui/html_editor/modules/m_dropImage';
import { createBlobFile } from '../../../helpers/fileHelper.js';
import browser from 'core/utils/browser';
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/formDialog.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/formDialog.tests.js
index a154c9fdcf83..53353a6694c8 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/formDialog.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/formDialog.tests.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
-import FormDialog from 'ui/html_editor/ui/formDialog';
+import FormDialog from '__internal/ui/html_editor/ui/m_formDialog';
import { isPromise } from 'core/utils/type';
import devices from 'core/devices';
import { getCurrentScreenFactor, hasWindow } from 'core/utils/window';
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/imageCursorModule.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/imageCursorModule.tests.js
index 5dfabe222416..423781adbbc5 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/imageCursorModule.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/imageCursorModule.tests.js
@@ -1,5 +1,5 @@
import $ from 'jquery';
-import ImageCursor from 'ui/html_editor/modules/imageCursor';
+import ImageCursor from '__internal/ui/html_editor/modules/m_imageCursor';
import { name as clickEvent } from 'events/click';
const moduleConfig = {
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/imageUploadModule.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/imageUploadModule.tests.js
index 6f79b575d88a..c4d2dbb806b5 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/imageUploadModule.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/imageUploadModule.tests.js
@@ -1,5 +1,5 @@
import $ from 'jquery';
-import ImageUpload from 'ui/html_editor/modules/imageUpload';
+import ImageUpload from '__internal/ui/html_editor/modules/m_imageUpload';
const moduleConfig = {
beforeEach: function() {
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/mentionModule.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/mentionModule.tests.js
index a38808b9dfa4..f0157608ff15 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/mentionModule.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/mentionModule.tests.js
@@ -1,7 +1,7 @@
import $ from 'jquery';
-import MentionFormat from 'ui/html_editor/formats/mention';
-import Mentions from 'ui/html_editor/modules/mentions';
+import MentionFormat from '__internal/ui/html_editor/formats/m_mention';
+import Mentions from '__internal/ui/html_editor/modules/m_mentions';
import { noop } from 'core/utils/common';
import devices from 'core/devices';
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/popupModule.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/popupModule.tests.js
index 4ff5d944e7fd..bf7a95256c07 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/popupModule.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/popupModule.tests.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
-import PopupModule from 'ui/html_editor/modules/popup';
+import PopupModule from '__internal/ui/html_editor/modules/m_popup';
import windowUtils from 'core/utils/window';
const POPUP_CLASS = 'dx-popup';
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/quillRegistrator.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/quillRegistrator.tests.js
index 46ee2c9f9aad..8ff646ffd372 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/quillRegistrator.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/quillRegistrator.tests.js
@@ -1,9 +1,9 @@
import $ from 'jquery';
import QuillRegistrator from 'ui/html_editor/quill_registrator';
-import Image from 'ui/html_editor/formats/image';
-import Font from 'ui/html_editor/formats/font';
-import Size from 'ui/html_editor/formats/size';
+import Image from '__internal/ui/html_editor/formats/m_image';
+import Font from '__internal/ui/html_editor/formats/m_font';
+import Size from '__internal/ui/html_editor/formats/m_size';
const { test } = QUnit;
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/resizingModule.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/resizingModule.tests.js
index 7ae637bdeaa3..6a541c7a1c0f 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/resizingModule.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/resizingModule.tests.js
@@ -1,7 +1,7 @@
import $ from 'jquery';
import Quill from 'devextreme-quill';
-import Resizing from 'ui/html_editor/modules/resizing';
+import Resizing from '__internal/ui/html_editor/modules/m_resizing';
import devices from 'core/devices';
import { name as clickEvent } from 'events/click';
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/tableContextMenuModule.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/tableContextMenuModule.tests.js
index a5be0032a0ed..9457ea4e07d1 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/tableContextMenuModule.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/tableContextMenuModule.tests.js
@@ -1,5 +1,5 @@
import $ from 'jquery';
-import TableUI from 'ui/html_editor/modules/tableContextMenu';
+import TableUI from '__internal/ui/html_editor/modules/m_tableContextMenu';
const moduleConfig = {
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/tableResizingModule.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/tableResizingModule.tests.js
index 79102858d690..939672ded248 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/tableResizingModule.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/tableResizingModule.tests.js
@@ -1,5 +1,5 @@
import $ from 'jquery';
-import TableResizing from 'ui/html_editor/modules/tableResizing';
+import TableResizing from '__internal/ui/html_editor/modules/m_tableResizing';
import resizeCallbacks from 'core/utils/resize_callbacks';
const DX_COLUMN_RESIZE_FRAME_CLASS = 'dx-table-resize-frame';
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/toolbarModule.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/toolbarModule.tests.js
index f5c9822d317c..dd71847d5de9 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/toolbarModule.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/toolbarModule.tests.js
@@ -5,8 +5,8 @@ import 'generic_light.css!';
import 'ui/select_box';
import '__internal/ui/color_box/m_color_view';
-import Toolbar from 'ui/html_editor/modules/toolbar';
-import FormDialog from 'ui/html_editor/ui/formDialog';
+import Toolbar from '__internal/ui/html_editor/modules/m_toolbar';
+import FormDialog from '__internal/ui/html_editor/ui/m_formDialog';
import { noop } from 'core/utils/common';
import keyboardMock from '../../../helpers/keyboardMock.js';
import fx from 'animation/fx';
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/variablesModule.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/variablesModule.tests.js
index 9cc58985cdcc..8096b2888ee3 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/variablesModule.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/variablesModule.tests.js
@@ -1,7 +1,7 @@
import $ from 'jquery';
-import VariableFormat from 'ui/html_editor/formats/variable';
-import Variables from 'ui/html_editor/modules/variables';
+import VariableFormat from '__internal/ui/html_editor/formats/m_variable';
+import Variables from '__internal/ui/html_editor/modules/m_variables';
import { noop } from 'core/utils/common';
const SUGGESTION_LIST_CLASS = 'dx-suggestion-list';