From 767728c71240f49ff69691017fbb7beaff7ad658 Mon Sep 17 00:00:00 2001 From: AlekseyManetov Date: Thu, 28 Nov 2024 17:15:04 +0100 Subject: [PATCH 1/8] Update RTE example content --- uui-docs/src/demoData/slateInitialValue.ts | 401 ++++++++++++++++----- 1 file changed, 303 insertions(+), 98 deletions(-) diff --git a/uui-docs/src/demoData/slateInitialValue.ts b/uui-docs/src/demoData/slateInitialValue.ts index c49873634d..cb6e5c5706 100644 --- a/uui-docs/src/demoData/slateInitialValue.ts +++ b/uui-docs/src/demoData/slateInitialValue.ts @@ -10,7 +10,7 @@ export const slateInitialValue = [ ], }, { - type: 'uui-richTextEditor-header-3', + type: 'uui-richTextEditor-header-2', data: {}, children: [ { @@ -24,8 +24,16 @@ export const slateInitialValue = [ data: {}, children: [ { - text: '@epam/uui-editor package contains a full-featured Rich Text Editor, based on open-source ', + text: 'The ', + }, + { + text: '@epam/uui-editor', 'uui-richTextEditor-span-mark': true, + 'uui-richTextEditor-code': true, + }, + { + 'uui-richTextEditor-span-mark': true, + text: ' package contains a full-featured Rich Text Editor, based on open-source ', }, { type: 'link', @@ -107,9 +115,7 @@ export const slateInitialValue = [ }, { type: 'uui-richTextEditor-header-3', - data: { - checked: false, - }, + data: {}, children: [ { text: 'Basic layout', @@ -151,13 +157,13 @@ export const slateInitialValue = [ 'uui-richTextEditor-underlined': true, }, { - text: ' several UUI-friendly text colors: ', + text: ' align with several UUI-friendly text colors: ', 'uui-richTextEditor-span-mark': true, }, { text: 'red', - color: '#FF4E33', 'uui-richTextEditor-span-mark': true, + color: 'var(--uui-text-critical)', }, { text: ', ', @@ -165,29 +171,35 @@ export const slateInitialValue = [ }, { text: 'yellow', - color: '#FFA21D', 'uui-richTextEditor-span-mark': true, + color: 'var(--uui-text-warning)', }, { text: ', and ', 'uui-richTextEditor-span-mark': true, }, { - text: 'green.', + text: 'green', + 'uui-richTextEditor-span-mark': true, + color: 'var(--uui-text-success)', + }, + { color: '#9BC837', 'uui-richTextEditor-span-mark': true, + text: '.', }, ], }, { - type: 'paragraph', + type: 'uui-richTextEditor-header-3', data: { checked: false, }, children: [ { - text: 'Numbered lists:', + text: 'Numbered lists', 'uui-richTextEditor-span-mark': true, + 'uui-richTextEditor-bold': true, }, ], }, @@ -206,9 +218,12 @@ export const slateInitialValue = [ }, children: [ { - text: "In edit mode, we detect '1.' and start list automatically", + text: 'In edit mode, ', 'uui-richTextEditor-span-mark': true, }, + { + text: "typing '1.' automatically starts a numbered list.", + }, ], }, ], @@ -224,9 +239,12 @@ export const slateInitialValue = [ }, children: [ { - text: "You can use 'tab' / 'shift/tab' to indent the list", + text: "You can use 'Tab' / 'Shift+Tab' to ", 'uui-richTextEditor-span-mark': true, }, + { + text: "adjust the list's indentation level.", + }, ], }, ], @@ -234,14 +252,15 @@ export const slateInitialValue = [ ], }, { - type: 'paragraph', + type: 'uui-richTextEditor-header-3', data: { checked: false, }, children: [ { - text: 'Bullet lists:', + text: 'Bullet lists', 'uui-richTextEditor-span-mark': true, + 'uui-richTextEditor-bold': true, }, ], }, @@ -260,9 +279,12 @@ export const slateInitialValue = [ }, children: [ { - text: "Type '- ' to start the list", + text: "Type '- ' ", 'uui-richTextEditor-span-mark': true, }, + { + text: 'to start a bullet list.', + }, ], }, ], @@ -278,7 +300,10 @@ export const slateInitialValue = [ }, children: [ { - text: "You can create multi-level lists with 'tab' / 'shift+tab'. Example:", + text: 'Create multi-level lists using', + }, + { + text: " 'Tab' / 'Shift+Tab'. Example:", 'uui-richTextEditor-span-mark': true, }, ], @@ -335,39 +360,113 @@ export const slateInitialValue = [ }, ], }, + { + type: 'h5', + children: [ + { + text: 'Headers and Links', + 'uui-richTextEditor-bold': true, + }, + ], + }, { type: 'paragraph', + children: [ + { + text: 'We also support three levels of headers, ', + }, + { + type: 'link', + url: 'https://uui.epam.com/', + target: '_blank', + children: [ + { + text: 'hyperlinks', + }, + ], + }, + { + text: ', ', + }, + { + text: 'superscript', + 'uui-richTextEditor-superscript': true, + }, + { + text: ', and more.', + }, + ], + }, + { + type: 'uui-richTextEditor-header-2', data: { checked: false, }, children: [ { - text: "There's also support 3 levels of headers, hyperlinks, superscript, and more.", + text: 'Embedded content', 'uui-richTextEditor-span-mark': true, }, ], }, { - type: 'uui-richTextEditor-header-3', + type: 'paragraph', data: { checked: false, }, children: [ { - text: 'Embedded content', - 'uui-richTextEditor-span-mark': true, + text: 'You can embed various types of content into the editor:', }, ], }, { - type: 'paragraph', + type: 'uui-richTextEditor-header-3', data: { checked: false, }, children: [ { - text: 'Files can be dropped directly into the editor. You can embed images (align and resizing is supported):', - 'uui-richTextEditor-span-mark': true, + text: 'Images', + 'uui-richTextEditor-bold': true, + }, + ], + }, + { + type: 'unordered-list', + children: [ + { + type: 'list-item', + children: [ + { + type: 'list-item-child', + children: [ + { + text: 'Embed images via the ', + }, + { + text: '"Add Image"', + 'uui-richTextEditor-bold': true, + }, + { + text: ' icon, drag-and-drop from your computer, or insert a direct internet address link.', + }, + ], + }, + ], + }, + { + type: 'list-item', + children: [ + { + type: 'list-item-child', + children: [ + { + text: 'Images support alignment and resizing.', + }, + ], + }, + ], }, ], }, @@ -383,7 +482,7 @@ export const slateInitialValue = [ }, url: '/static/uploads/blue-orange.jpg', align: 'center', - width: 800, + width: 862, height: 417, children: [ { @@ -393,73 +492,181 @@ export const slateInitialValue = [ ], caption: [ { - text: 'Image caption', + text: 'Picture from a file', }, ], }, { type: 'paragraph', - data: { - checked: false, - }, children: [ { - text: 'Video:', - 'uui-richTextEditor-span-mark': true, + text: '', + }, + ], + }, + { + align: 'center', + url: 'https://c.files.bbci.co.uk/D8CD/production/_117310555_16.jpg', + width: 862, + type: 'image', + children: [ + { + text: '', + }, + ], + caption: [ + { + text: 'Picture from the internet', + }, + ], + }, + { + type: 'uui-richTextEditor-header-3', + children: [ + { + text: 'PDFs', + 'uui-richTextEditor-bold': true, + }, + ], + }, + { + type: 'paragraph', + children: [ + { + text: 'Embed PDFs via the ', + }, + { + text: '"Add PDF" ', + 'uui-richTextEditor-bold': true, + }, + { + text: 'icon or drag-and-drop.', }, ], }, { type: 'iframe', - data: {}, - url: 'https://www.youtube.com/embed/5qap5aO4i9A', children: [ { text: '', - 'uui-richTextEditor-span-mark': true, + }, + ], + data: {}, + url: 'https://pdfobject.com/pdf/sample.pdf', + }, + { + type: 'uui-richTextEditor-header-3', + children: [ + { + text: 'Files', + 'uui-richTextEditor-bold': true, }, ], }, { type: 'paragraph', + children: [ + { + text: 'Upload arbitrary files using the ', + }, + { + text: '"Add Attachment"', + 'uui-richTextEditor-bold': true, + }, + { + text: ' icon. Files appear as downloadable links.', + }, + ], + }, + { + type: 'attachment', data: { - checked: false, + path: '/static/uploads/blue-orange.jpg', + name: 'Excel.xlsx', + size: 8710, + id: 1, + type: 'attachment', + extension: 'xlsx', + fileName: 'DemoExcelAttachment.xlsx', }, children: [ { - text: 'Arbitrary attachments:', - 'uui-richTextEditor-span-mark': true, + text: '', }, ], }, { type: 'attachment', data: { - path: '/static/uploads/DemoExcelAttachment.xlsx', - name: 'DemoExcelAttachment.xlsx', - size: 8669, - id: '100500', + path: '/static/uploads/blue-orange.jpg', + name: 'Word.docx', + size: 11943, + id: 2, type: 'attachment', - fileName: 'DemoExcelAttachment.xlsx', - extension: 'xlsx', + extension: 'docx', + fileName: 'DemoWordAttachment.docx', }, - url: '/static/uploads/DemoExcelAttachment.xlsx', children: [ { text: '', - 'uui-richTextEditor-span-mark': true, + }, + ], + }, + { + type: 'attachment', + data: { + path: '/static/uploads/blue-orange.jpg', + name: '5mb-file.txt', + size: 5000000, + id: 4, + type: 'attachment', + extension: 'txt', + fileName: 'DemoTxtAttachment.txt', + }, + children: [ + { + text: '', + }, + ], + }, + { + type: 'uui-richTextEditor-header-3', + data: { + checked: false, + }, + children: [ + { + text: 'Videos', + 'uui-richTextEditor-bold': true, }, ], }, { type: 'paragraph', - data: {}, children: [ { - text: 'You can also embed any arbitrary content, like PDF files, directly into the document, inside IFrame.', + text: 'Embed videos via the ', + }, + { + text: '"Add Video"', + 'uui-richTextEditor-bold': true, + }, + { + text: ' icon.', }, ], }, + { + type: 'iframe', + children: [ + { + text: '', + 'uui-richTextEditor-span-mark': true, + }, + ], + data: {}, + url: 'https://www.youtube.com/embed/jfKfPfyJRdk', + }, { type: 'uui-richTextEditor-header-3', data: {}, @@ -480,22 +687,12 @@ export const slateInitialValue = [ }, { type: 'table', - data: {}, - colSizes: [ - 130, - 200, - 200, - 183, - 161, - ], children: [ { type: 'table_row', - data: {}, children: [ { type: 'table_header_cell', - data: {}, children: [ { type: 'paragraph', @@ -510,8 +707,6 @@ export const slateInitialValue = [ }, { type: 'table_header_cell', - data: {}, - colSpan: 2, children: [ { type: 'paragraph', @@ -523,10 +718,11 @@ export const slateInitialValue = [ ], }, ], + colSpan: 2, + rowSpan: 1, }, { type: 'table_header_cell', - data: {}, children: [ { type: 'paragraph', @@ -543,12 +739,9 @@ export const slateInitialValue = [ }, { type: 'table_row', - data: {}, children: [ { type: 'table_cell', - data: {}, - rowSpan: 2, children: [ { type: 'paragraph', @@ -560,10 +753,11 @@ export const slateInitialValue = [ ], }, ], + colSpan: 1, + rowSpan: 2, }, { type: 'table_cell', - data: {}, children: [ { type: 'paragraph', @@ -575,10 +769,11 @@ export const slateInitialValue = [ ], }, ], + rowSpan: 1, + colSpan: 1, }, { type: 'table_cell', - data: {}, children: [ { type: 'paragraph', @@ -590,10 +785,11 @@ export const slateInitialValue = [ ], }, ], + rowSpan: 1, + colSpan: 1, }, { type: 'table_cell', - data: {}, children: [ { type: 'paragraph', @@ -610,14 +806,13 @@ export const slateInitialValue = [ ], }, ], + size: 47, }, { type: 'table_row', - data: {}, children: [ { type: 'table_cell', - data: {}, children: [ { type: 'paragraph', @@ -629,10 +824,11 @@ export const slateInitialValue = [ ], }, ], + colSpan: 1, + rowSpan: 1, }, { type: 'table_cell', - data: {}, children: [ { type: 'paragraph', @@ -644,10 +840,11 @@ export const slateInitialValue = [ ], }, ], + colSpan: 1, + rowSpan: 1, }, { type: 'table_cell', - data: {}, children: [ { type: 'paragraph', @@ -662,17 +859,16 @@ export const slateInitialValue = [ ], }, ], + colSpan: 1, + rowSpan: 1, }, ], }, { type: 'table_row', - data: {}, children: [ { type: 'table_cell', - data: {}, - rowSpan: 1, children: [ { type: 'paragraph', @@ -684,11 +880,11 @@ export const slateInitialValue = [ ], }, ], + colSpan: 1, + rowSpan: 1, }, { type: 'table_cell', - data: {}, - rowSpan: 1, children: [ { type: 'paragraph', @@ -700,11 +896,11 @@ export const slateInitialValue = [ ], }, ], + colSpan: 1, + rowSpan: 1, }, { type: 'table_cell', - data: {}, - rowSpan: 1, children: [ { type: 'paragraph', @@ -716,11 +912,11 @@ export const slateInitialValue = [ ], }, ], + colSpan: 1, + rowSpan: 1, }, { type: 'table_cell', - data: {}, - rowSpan: 1, children: [ { type: 'paragraph', @@ -735,20 +931,20 @@ export const slateInitialValue = [ ], }, ], + colSpan: 1, + rowSpan: 1, }, ], + size: 47, }, { type: 'table_row', - data: {}, children: [ { type: 'table_cell', - data: {}, children: [ { type: 'paragraph', - data: {}, children: [ { text: '', @@ -756,11 +952,11 @@ export const slateInitialValue = [ ], }, ], + colSpan: 1, + rowSpan: 1, }, { type: 'table_cell', - data: {}, - colSpan: 3, children: [ { type: 'paragraph', @@ -772,17 +968,35 @@ export const slateInitialValue = [ ], }, ], + colSpan: 3, + rowSpan: 1, }, ], }, ], + data: {}, + colSizes: [ + 200, + 154, + 150, + 189, + ], }, { type: 'uui-richTextEditor-header-3', data: {}, children: [ { - text: 'Placeholders:', + text: '', + }, + ], + }, + { + type: 'uui-richTextEditor-header-3', + data: {}, + children: [ + { + text: 'Placeholders', }, ], }, @@ -791,7 +1005,7 @@ export const slateInitialValue = [ data: {}, children: [ { - text: 'Allows to insert ', + text: '', }, { type: 'placeholder', @@ -806,16 +1020,7 @@ export const slateInitialValue = [ ], }, { - text: " into text. Can be used for editing templates, for example for emails. Placeholders can be then replaced with real values programmatically (currently that's done by some apps in back-end code).", - }, - ], - }, - { - type: 'paragraph', - data: {}, - children: [ - { - text: '', + text: ' can be inserted into text and are useful for creating editable templates, such as emails. These placeholders can be programmatically replaced with real values (currently handled by some apps in back-end code).', }, ], }, @@ -824,7 +1029,7 @@ export const slateInitialValue = [ data: {}, children: [ { - text: 'Misc features', + text: 'Miscellaneous Features', }, ], }, @@ -901,4 +1106,4 @@ export const slateInitialValue = [ }, ], }, -] as any; +]; From b98ffaea171a7b772e5e5c4fe84a97c2dabd6717 Mon Sep 17 00:00:00 2001 From: AlekseyManetov Date: Thu, 28 Nov 2024 17:19:42 +0100 Subject: [PATCH 2/8] [Modals]: prevent scrolling to the modal toggler because of focus return after modal close --- changelog.md | 1 + uui-components/src/overlays/ModalBlocker.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 7dc2f29be9..058d0c00f3 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,7 @@ * [PickerInput]: fixed unnecessary api calls on body open with `minCharsToSearch` prop and search in body * [RTE]: fixed image caption not being visible when RTE initially in readonly mode * [DatePicker]: fixed body close if date picker input scrolled out from view +* [Modals]: prevent scrolling to the modal toggler because of focus return after modal close # 5.11.0 - 15.11.2024 diff --git a/uui-components/src/overlays/ModalBlocker.tsx b/uui-components/src/overlays/ModalBlocker.tsx index 948fb50187..891ead3b58 100644 --- a/uui-components/src/overlays/ModalBlocker.tsx +++ b/uui-components/src/overlays/ModalBlocker.tsx @@ -53,7 +53,7 @@ export const ModalBlocker = React.forwardRef( onClick={ handleBlockerClick } aria-label="Click to close a modal" /> - + {props.children} From 2f4c68db832cd426e151c2c1cd0b05eae491c9bc Mon Sep 17 00:00:00 2001 From: AlekseyManetov Date: Thu, 28 Nov 2024 17:23:04 +0100 Subject: [PATCH 3/8] update changelog --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index 058d0c00f3..8672f913e3 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,7 @@ * [RTE]: fixed image caption not being visible when RTE initially in readonly mode * [DatePicker]: fixed body close if date picker input scrolled out from view * [Modals]: prevent scrolling to the modal toggler because of focus return after modal close +* [RTE]: fixed scroll to the top of the editor after editor modal windows(Add image/link/video etc.) were close # 5.11.0 - 15.11.2024 From 38071576aab0e093b7870e28a7ac8d9ead0b130c Mon Sep 17 00:00:00 2001 From: AlekseyManetov Date: Thu, 28 Nov 2024 19:21:46 +0100 Subject: [PATCH 4/8] [RTE]: fixed error while merging cells without content --- changelog.md | 1 + uui-editor/src/migrations/normalizers.ts | 1 + .../src/plugins/tablePlugin/tablePlugin.tsx | 1 - yarn.lock | 192 +++++++++--------- 4 files changed, 101 insertions(+), 94 deletions(-) diff --git a/changelog.md b/changelog.md index 8672f913e3..fb5a0fff8a 100644 --- a/changelog.md +++ b/changelog.md @@ -11,6 +11,7 @@ * [DatePicker]: fixed body close if date picker input scrolled out from view * [Modals]: prevent scrolling to the modal toggler because of focus return after modal close * [RTE]: fixed scroll to the top of the editor after editor modal windows(Add image/link/video etc.) were close +* [RTE]: fixed error while merging cells without content # 5.11.0 - 15.11.2024 diff --git a/uui-editor/src/migrations/normalizers.ts b/uui-editor/src/migrations/normalizers.ts index 5685652d95..2290d691d1 100644 --- a/uui-editor/src/migrations/normalizers.ts +++ b/uui-editor/src/migrations/normalizers.ts @@ -32,6 +32,7 @@ export const normalizeTableCellElement = (editor: PlateEditor, entry: TNo cellNode, { at: path }, ); + return; } }; diff --git a/uui-editor/src/plugins/tablePlugin/tablePlugin.tsx b/uui-editor/src/plugins/tablePlugin/tablePlugin.tsx index c5e7c237c5..4d2299c0a0 100644 --- a/uui-editor/src/plugins/tablePlugin/tablePlugin.tsx +++ b/uui-editor/src/plugins/tablePlugin/tablePlugin.tsx @@ -168,7 +168,6 @@ export const tablePlugin = (): PlatePlugin => if (isElement(node) && (TABLE_CELL_TYPE === node.type || TABLE_CELL_TYPE === node.type)) { normalizeTableCellElement(editor, entry); - return; } normalizeNode(entry); diff --git a/yarn.lock b/yarn.lock index cdffbfc8e7..97e5dabce9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3124,80 +3124,85 @@ estree-walker "^2.0.2" picomatch "^2.3.1" -"@rollup/rollup-android-arm-eabi@4.14.2": - version "4.14.2" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.14.2.tgz#9047b5b1ec19f58c0fdf3a072bd977bcec056576" - integrity sha512-ahxSgCkAEk+P/AVO0vYr7DxOD3CwAQrT0Go9BJyGQ9Ef0QxVOfjDZMiF4Y2s3mLyPrjonchIMH/tbWHucJMykQ== - -"@rollup/rollup-android-arm64@4.14.2": - version "4.14.2" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.14.2.tgz#08a2d2705193ebb3054941994e152808beb5254e" - integrity sha512-lAarIdxZWbFSHFSDao9+I/F5jDaKyCqAPMq5HqnfpBw8dKDiCaaqM0lq5h1pQTLeIqueeay4PieGR5jGZMWprw== - -"@rollup/rollup-darwin-arm64@4.14.2": - version "4.14.2" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.14.2.tgz#bf746c610f337b104408ec001549d825a91eca57" - integrity sha512-SWsr8zEUk82KSqquIMgZEg2GE5mCSfr9sE/thDROkX6pb3QQWPp8Vw8zOq2GyxZ2t0XoSIUlvHDkrf5Gmf7x3Q== - -"@rollup/rollup-darwin-x64@4.14.2": - version "4.14.2" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.14.2.tgz#59ebe3b858a44680d5f87546ea2df1c7e3135f6a" - integrity sha512-o/HAIrQq0jIxJAhgtIvV5FWviYK4WB0WwV91SLUnsliw1lSAoLsmgEEgRWzDguAFeUEUUoIWXiJrPqU7vGiVkA== - -"@rollup/rollup-linux-arm-gnueabihf@4.14.2": - version "4.14.2" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.14.2.tgz#44cffc07d04d659cb635aec11bef530d5757ee6a" - integrity sha512-nwlJ65UY9eGq91cBi6VyDfArUJSKOYt5dJQBq8xyLhvS23qO+4Nr/RreibFHjP6t+5ap2ohZrUJcHv5zk5ju/g== - -"@rollup/rollup-linux-arm64-gnu@4.14.2": - version "4.14.2" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.14.2.tgz#9901e2288fb192b74a2f8428c507d43cc2739ceb" - integrity sha512-Pg5TxxO2IVlMj79+c/9G0LREC9SY3HM+pfAwX7zj5/cAuwrbfj2Wv9JbMHIdPCfQpYsI4g9mE+2Bw/3aeSs2rQ== - -"@rollup/rollup-linux-arm64-musl@4.14.2": - version "4.14.2" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.14.2.tgz#8a2c55a72e0c716a15d830fee3bf5a1a756f13ec" - integrity sha512-cAOTjGNm84gc6tS02D1EXtG7tDRsVSDTBVXOLbj31DkwfZwgTPYZ6aafSU7rD/4R2a34JOwlF9fQayuTSkoclA== - -"@rollup/rollup-linux-powerpc64le-gnu@4.14.2": - version "4.14.2" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.14.2.tgz#71bf99c8017476ac85b09d21b3fa2eacbad96100" - integrity sha512-4RyT6v1kXb7C0fn6zV33rvaX05P0zHoNzaXI/5oFHklfKm602j+N4mn2YvoezQViRLPnxP8M1NaY4s/5kXO5cw== - -"@rollup/rollup-linux-riscv64-gnu@4.14.2": - version "4.14.2" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.14.2.tgz#48ee7fe5fee7b6d0028b6dda4fab95238208a0cd" - integrity sha512-KNUH6jC/vRGAKSorySTyc/yRYlCwN/5pnMjXylfBniwtJx5O7X17KG/0efj8XM3TZU7raYRXJFFReOzNmL1n1w== - -"@rollup/rollup-linux-s390x-gnu@4.14.2": - version "4.14.2" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.14.2.tgz#65ad6f82729ef9d8634847189214e3205892f42f" - integrity sha512-xPV4y73IBEXToNPa3h5lbgXOi/v0NcvKxU0xejiFw6DtIYQqOTMhZ2DN18/HrrP0PmiL3rGtRG9gz1QE8vFKXQ== - -"@rollup/rollup-linux-x64-gnu@4.14.2": - version "4.14.2" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.14.2.tgz#2ab802ce25c0d0d44a0ea55b0068f79e462d22cd" - integrity sha512-QBhtr07iFGmF9egrPOWyO5wciwgtzKkYPNLVCFZTmr4TWmY0oY2Dm/bmhHjKRwZoGiaKdNcKhFtUMBKvlchH+Q== - -"@rollup/rollup-linux-x64-musl@4.14.2": - version "4.14.2" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.14.2.tgz#85dcd3f549c2fdbcf1cb1f1b5f501933ed590880" - integrity sha512-8zfsQRQGH23O6qazZSFY5jP5gt4cFvRuKTpuBsC1ZnSWxV8ZKQpPqOZIUtdfMOugCcBvFGRa1pDC/tkf19EgBw== - -"@rollup/rollup-win32-arm64-msvc@4.14.2": - version "4.14.2" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.14.2.tgz#10f608dfc1e5bb96aca18c7784cc4a94d890c03c" - integrity sha512-H4s8UjgkPnlChl6JF5empNvFHp77Jx+Wfy2EtmYPe9G22XV+PMuCinZVHurNe8ggtwoaohxARJZbaH/3xjB/FA== - -"@rollup/rollup-win32-ia32-msvc@4.14.2": - version "4.14.2" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.14.2.tgz#f27f9fb64b7e10b04121e0054d9145ee21589267" - integrity sha512-djqpAjm/i8erWYF0K6UY4kRO3X5+T4TypIqw60Q8MTqSBaQNpNXDhxdjpZ3ikgb+wn99svA7jxcXpiyg9MUsdw== - -"@rollup/rollup-win32-x64-msvc@4.14.2": - version "4.14.2" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.14.2.tgz#5d2d9dc96b436469dc74ef93de069b14fb12aace" - integrity sha512-teAqzLT0yTYZa8ZP7zhFKEx4cotS8Tkk5XiqNMJhD4CpaWB1BHARE4Qy+RzwnXvSAYv+Q3jAqCVBS+PS+Yee8Q== +"@rollup/rollup-android-arm-eabi@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.4.tgz#8b613b9725e8f9479d142970b106b6ae878610d5" + integrity sha512-Fxamp4aEZnfPOcGA8KSNEohV8hX7zVHOemC8jVBoBUHu5zpJK/Eu3uJwt6BMgy9fkvzxDaurgj96F/NiLukF2w== + +"@rollup/rollup-android-arm64@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.4.tgz#654ca1049189132ff602bfcf8df14c18da1f15fb" + integrity sha512-VXoK5UMrgECLYaMuGuVTOx5kcuap1Jm8g/M83RnCHBKOqvPPmROFJGQaZhGccnsFtfXQ3XYa4/jMCJvZnbJBdA== + +"@rollup/rollup-darwin-arm64@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.4.tgz#6d241d099d1518ef0c2205d96b3fa52e0fe1954b" + integrity sha512-xMM9ORBqu81jyMKCDP+SZDhnX2QEVQzTcC6G18KlTQEzWK8r/oNZtKuZaCcHhnsa6fEeOBionoyl5JsAbE/36Q== + +"@rollup/rollup-darwin-x64@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.4.tgz#42bd19d292a57ee11734c980c4650de26b457791" + integrity sha512-aJJyYKQwbHuhTUrjWjxEvGnNNBCnmpHDvrb8JFDbeSH3m2XdHcxDd3jthAzvmoI8w/kSjd2y0udT+4okADsZIw== + +"@rollup/rollup-linux-arm-gnueabihf@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.4.tgz#f23555ee3d8fe941c5c5fd458cd22b65eb1c2232" + integrity sha512-j63YtCIRAzbO+gC2L9dWXRh5BFetsv0j0va0Wi9epXDgU/XUi5dJKo4USTttVyK7fGw2nPWK0PbAvyliz50SCQ== + +"@rollup/rollup-linux-arm-musleabihf@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.4.tgz#f3bbd1ae2420f5539d40ac1fde2b38da67779baa" + integrity sha512-dJnWUgwWBX1YBRsuKKMOlXCzh2Wu1mlHzv20TpqEsfdZLb3WoJW2kIEsGwLkroYf24IrPAvOT/ZQ2OYMV6vlrg== + +"@rollup/rollup-linux-arm64-gnu@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.4.tgz#7abe900120113e08a1f90afb84c7c28774054d15" + integrity sha512-AdPRoNi3NKVLolCN/Sp4F4N1d98c4SBnHMKoLuiG6RXgoZ4sllseuGioszumnPGmPM2O7qaAX/IJdeDU8f26Aw== + +"@rollup/rollup-linux-arm64-musl@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.4.tgz#9e655285c8175cd44f57d6a1e8e5dedfbba1d820" + integrity sha512-Gl0AxBtDg8uoAn5CCqQDMqAx22Wx22pjDOjBdmG0VIWX3qUBHzYmOKh8KXHL4UpogfJ14G4wk16EQogF+v8hmA== + +"@rollup/rollup-linux-powerpc64le-gnu@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.4.tgz#9a79ae6c9e9d8fe83d49e2712ecf4302db5bef5e" + integrity sha512-3aVCK9xfWW1oGQpTsYJJPF6bfpWfhbRnhdlyhak2ZiyFLDaayz0EP5j9V1RVLAAxlmWKTDfS9wyRyY3hvhPoOg== + +"@rollup/rollup-linux-riscv64-gnu@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.4.tgz#67ac70eca4ace8e2942fabca95164e8874ab8128" + integrity sha512-ePYIir6VYnhgv2C5Xe9u+ico4t8sZWXschR6fMgoPUK31yQu7hTEJb7bCqivHECwIClJfKgE7zYsh1qTP3WHUA== + +"@rollup/rollup-linux-s390x-gnu@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.4.tgz#9f883a7440f51a22ed7f99e1d070bd84ea5005fc" + integrity sha512-GqFJ9wLlbB9daxhVlrTe61vJtEY99/xB3C8e4ULVsVfflcpmR6c8UZXjtkMA6FhNONhj2eA5Tk9uAVw5orEs4Q== + +"@rollup/rollup-linux-x64-gnu@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.4.tgz#70116ae6c577fe367f58559e2cffb5641a1dd9d0" + integrity sha512-87v0ol2sH9GE3cLQLNEy0K/R0pz1nvg76o8M5nhMR0+Q+BBGLnb35P0fVz4CQxHYXaAOhE8HhlkaZfsdUOlHwg== + +"@rollup/rollup-linux-x64-musl@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.4.tgz#f473f88219feb07b0b98b53a7923be716d1d182f" + integrity sha512-UV6FZMUgePDZrFjrNGIWzDo/vABebuXBhJEqrHxrGiU6HikPy0Z3LfdtciIttEUQfuDdCn8fqh7wiFJjCNwO+g== + +"@rollup/rollup-win32-arm64-msvc@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.4.tgz#4349482d17f5d1c58604d1c8900540d676f420e0" + integrity sha512-BjI+NVVEGAXjGWYHz/vv0pBqfGoUH0IGZ0cICTn7kB9PyjrATSkX+8WkguNjWoj2qSr1im/+tTGRaY+4/PdcQw== + +"@rollup/rollup-win32-ia32-msvc@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.4.tgz#a6fc39a15db618040ec3c2a24c1e26cb5f4d7422" + integrity sha512-SiWG/1TuUdPvYmzmYnmd3IEifzR61Tragkbx9D3+R8mzQqDBz8v+BvZNDlkiTtI9T15KYZhP0ehn3Dld4n9J5g== + +"@rollup/rollup-win32-x64-msvc@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.4.tgz#3dd5d53e900df2a40841882c02e56f866c04d202" + integrity sha512-j8pPKp53/lq9lMXN57S8cFz0MynJk8OWNuUnXct/9KCpKU7DgU3bYMJhwWmcqC0UU29p8Lr0/7KEVcaM6bf47Q== "@rushstack/eslint-patch@^1.1.0": version "1.10.2" @@ -15413,28 +15418,29 @@ rollup-pluginutils@^2.8.2: dependencies: estree-walker "^0.6.1" -rollup@4.14.2: - version "4.14.2" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.14.2.tgz#992df3c3bb4ca84ce6b00d51aacb1e5a62d0a14c" - integrity sha512-WkeoTWvuBoFjFAhsEOHKRoZ3r9GfTyhh7Vff1zwebEFLEFjT1lG3784xEgKiTa7E+e70vsC81roVL2MP4tgEEQ== +rollup@4.22.4: + version "4.22.4" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.22.4.tgz#4135a6446671cd2a2453e1ad42a45d5973ec3a0f" + integrity sha512-vD8HJ5raRcWOyymsR6Z3o6+RzfEPCnVLMFJ6vRslO1jt4LO6dUo5Qnpg7y4RkZFM2DMe3WUirkI5c16onjrc6A== dependencies: "@types/estree" "1.0.5" optionalDependencies: - "@rollup/rollup-android-arm-eabi" "4.14.2" - "@rollup/rollup-android-arm64" "4.14.2" - "@rollup/rollup-darwin-arm64" "4.14.2" - "@rollup/rollup-darwin-x64" "4.14.2" - "@rollup/rollup-linux-arm-gnueabihf" "4.14.2" - "@rollup/rollup-linux-arm64-gnu" "4.14.2" - "@rollup/rollup-linux-arm64-musl" "4.14.2" - "@rollup/rollup-linux-powerpc64le-gnu" "4.14.2" - "@rollup/rollup-linux-riscv64-gnu" "4.14.2" - "@rollup/rollup-linux-s390x-gnu" "4.14.2" - "@rollup/rollup-linux-x64-gnu" "4.14.2" - "@rollup/rollup-linux-x64-musl" "4.14.2" - "@rollup/rollup-win32-arm64-msvc" "4.14.2" - "@rollup/rollup-win32-ia32-msvc" "4.14.2" - "@rollup/rollup-win32-x64-msvc" "4.14.2" + "@rollup/rollup-android-arm-eabi" "4.22.4" + "@rollup/rollup-android-arm64" "4.22.4" + "@rollup/rollup-darwin-arm64" "4.22.4" + "@rollup/rollup-darwin-x64" "4.22.4" + "@rollup/rollup-linux-arm-gnueabihf" "4.22.4" + "@rollup/rollup-linux-arm-musleabihf" "4.22.4" + "@rollup/rollup-linux-arm64-gnu" "4.22.4" + "@rollup/rollup-linux-arm64-musl" "4.22.4" + "@rollup/rollup-linux-powerpc64le-gnu" "4.22.4" + "@rollup/rollup-linux-riscv64-gnu" "4.22.4" + "@rollup/rollup-linux-s390x-gnu" "4.22.4" + "@rollup/rollup-linux-x64-gnu" "4.22.4" + "@rollup/rollup-linux-x64-musl" "4.22.4" + "@rollup/rollup-win32-arm64-msvc" "4.22.4" + "@rollup/rollup-win32-ia32-msvc" "4.22.4" + "@rollup/rollup-win32-x64-msvc" "4.22.4" fsevents "~2.3.2" rollup@^2.43.1: From 0be8b6c36f995cf2ba56ab64f353947a834450c6 Mon Sep 17 00:00:00 2001 From: AlekseyManetov Date: Mon, 2 Dec 2024 18:03:33 +0100 Subject: [PATCH 5/8] remove prop-types from UUI packages dependencies. Remove uuiContextTypes interface, since it was needed for outdated React context API. --- app/package.json | 1 - changelog.md | 1 + epam-electric/package.json | 1 - epam-promo/package.json | 1 - extra/package.json | 1 - loveship/package.json | 1 - uui-components/package.json | 1 - uui-core/package.json | 1 - uui-core/src/types/contexts.ts | 18 ------------------ uui-db/package.json | 1 - uui-docs/package.json | 1 - uui/package.json | 1 - 12 files changed, 1 insertion(+), 28 deletions(-) diff --git a/app/package.json b/app/package.json index 99f89ab19b..20659f7e8d 100644 --- a/app/package.json +++ b/app/package.json @@ -40,7 +40,6 @@ "imask": "6.0.7", "lodash.assign": "4.2.0", "prismjs": "^1.19.0", - "prop-types": "15.7.2", "qhistory": "1.0.3", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/changelog.md b/changelog.md index fb5a0fff8a..b059c9bf45 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,7 @@ # 5.xx.xx - xx.xx.2024 **What's New** +* Remove 'prop-types' from UUI packages dependencies. Remove `uuiContextTypes` interface, since it was needed for already outdated React context API. * [Alert]: added support for size theming * [DataTable]: added support of column groups in table header. Read more - https://uui.epam.com/documents?id=advancedTables&mode=doc&category=tables&theme=electric#table_with_header_groups * [ErrorPage]: added field for additional message with support link (it works with `500, 503, default` errors), added support link for the site diff --git a/epam-electric/package.json b/epam-electric/package.json index 3615bcfb6b..b19ef96a85 100644 --- a/epam-electric/package.json +++ b/epam-electric/package.json @@ -20,7 +20,6 @@ "mockdate": "^3.0.5" }, "peerDependencies": { - "prop-types": "*", "react": ">=16.0.0", "react-dom": ">=16.0.0" }, diff --git a/epam-promo/package.json b/epam-promo/package.json index e7c7b40533..9433b7ee6d 100644 --- a/epam-promo/package.json +++ b/epam-promo/package.json @@ -20,7 +20,6 @@ "classnames": "2.2.6" }, "peerDependencies": { - "prop-types": "*", "react": ">=16.0.0", "react-dom": ">=16.0.0" }, diff --git a/extra/package.json b/extra/package.json index 72735aecce..aa9c31bdd4 100644 --- a/extra/package.json +++ b/extra/package.json @@ -17,7 +17,6 @@ "immutable": "3.8.2" }, "peerDependencies": { - "prop-types": "*", "react": ">=16.0.0", "react-dom": ">=16.0.0" }, diff --git a/loveship/package.json b/loveship/package.json index 1ecddaa308..af7dfaccdc 100644 --- a/loveship/package.json +++ b/loveship/package.json @@ -20,7 +20,6 @@ "classnames": "2.2.6" }, "peerDependencies": { - "prop-types": "*", "react": ">=16.0.0", "react-dom": ">=16.0.0" }, diff --git a/uui-components/package.json b/uui-components/package.json index 064d404d1e..9744b90003 100644 --- a/uui-components/package.json +++ b/uui-components/package.json @@ -28,7 +28,6 @@ "react-transition-group": "4.4.5" }, "peerDependencies": { - "prop-types": "*", "react": ">=16.0.0", "react-dom": ">=16.0.0" }, diff --git a/uui-core/package.json b/uui-core/package.json index eb141e6775..e40c28dbaf 100644 --- a/uui-core/package.json +++ b/uui-core/package.json @@ -24,7 +24,6 @@ "react-popper": "2.3.0" }, "peerDependencies": { - "prop-types": "*", "react": ">=16.0.0", "react-dom": ">=16.0.0" }, diff --git a/uui-core/src/types/contexts.ts b/uui-core/src/types/contexts.ts index 3bbbf1c95b..a11fe63d03 100644 --- a/uui-core/src/types/contexts.ts +++ b/uui-core/src/types/contexts.ts @@ -1,5 +1,4 @@ import { AnalyticsEvent, Link } from './objects'; -import * as PropTypes from 'prop-types'; import { IModal, INotification } from './props'; import { DndContextState, TMouseCoords } from '../services/dnd/DndContext'; import { Lock } from '../services/LockContext'; @@ -293,20 +292,3 @@ export interface CommonContexts extends UuiContexts { /** React router history instance */ history?: IHistory4; } - -export const uuiContextTypes = { - uuiAnalytics: PropTypes.object, - uuiErrors: PropTypes.object, - uuiApi: PropTypes.object, - uuiModals: PropTypes.object, - uuiNotifications: PropTypes.object, - api: PropTypes.object, - uuiUserSettings: PropTypes.object, - uuiDnD: PropTypes.object, - uuiApp: PropTypes.object, - uuiRouter: PropTypes.object, - uuiLayout: PropTypes.object, - uuiLocks: PropTypes.object, - history: PropTypes.object, - uuiSkin: PropTypes.object, -}; diff --git a/uui-db/package.json b/uui-db/package.json index d4018974a4..d36e33ddf2 100644 --- a/uui-db/package.json +++ b/uui-db/package.json @@ -47,7 +47,6 @@ "ts-node": "10.9.1" }, "peerDependencies": { - "prop-types": "*", "react": ">=16.0.0", "react-dom": ">=16.0.0" }, diff --git a/uui-docs/package.json b/uui-docs/package.json index 9735d02ebf..599d34d721 100644 --- a/uui-docs/package.json +++ b/uui-docs/package.json @@ -21,7 +21,6 @@ "classnames": "^2.2.6" }, "peerDependencies": { - "prop-types": "*", "react": ">=16.0.0", "react-dom": ">=16.0.0" }, diff --git a/uui/package.json b/uui/package.json index 7c4c684e72..5fda3cfaff 100644 --- a/uui/package.json +++ b/uui/package.json @@ -22,7 +22,6 @@ "react-popper": "2.3.0" }, "peerDependencies": { - "prop-types": "*", "react": ">=16.0.0", "react-dom": ">=16.0.0" }, From ccc9033ab6c27d2fedbba3283032f8cc4b12aab8 Mon Sep 17 00:00:00 2001 From: AlekseyManetov Date: Mon, 2 Dec 2024 18:44:44 +0100 Subject: [PATCH 6/8] [RTE]: fixed bug when files added from attachment button inserted in preview mode instead of attachment block --- changelog.md | 1 + .../plugins/uploadFilePlugin/file_uploader.ts | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/changelog.md b/changelog.md index b059c9bf45..5cb39a4247 100644 --- a/changelog.md +++ b/changelog.md @@ -13,6 +13,7 @@ * [Modals]: prevent scrolling to the modal toggler because of focus return after modal close * [RTE]: fixed scroll to the top of the editor after editor modal windows(Add image/link/video etc.) were close * [RTE]: fixed error while merging cells without content +* [RTE]: fixed bug when files added from attachment button inserted in preview mode instead of attachment block # 5.11.0 - 15.11.2024 diff --git a/uui-editor/src/plugins/uploadFilePlugin/file_uploader.ts b/uui-editor/src/plugins/uploadFilePlugin/file_uploader.ts index 966e88f897..73d85dd3c0 100644 --- a/uui-editor/src/plugins/uploadFilePlugin/file_uploader.ts +++ b/uui-editor/src/plugins/uploadFilePlugin/file_uploader.ts @@ -82,14 +82,17 @@ const isValidFileType = (fileType?: string) => { const buildFragments = ( files: FileUploadResponse[], + blockType?: UploadType, ) => { return files.map((file: FileUploadResponse) => { const fileType = file.type; - const uploadType = ( - isValidFileType(fileType) ? fileType : ATTACHMENT_TYPE - ) as UploadType; + if (blockType) { + return UPLOAD_BLOCKS[blockType](file); + } else { + const blockTypeByFile = (isValidFileType(fileType) ? fileType : ATTACHMENT_TYPE) as UploadType; - return UPLOAD_BLOCKS[uploadType](file); + return UPLOAD_BLOCKS[blockTypeByFile](file); + } }); }; @@ -97,6 +100,7 @@ export const createFileUploader = (options?: UploadFileOptions) => async ( editor: PlateEditor, files: File[], + blockType: UploadType, ) => { const uploadFile = options?.uploadFile; if (!uploadFile) return; @@ -127,7 +131,7 @@ export const createFileUploader = (options?: UploadFileOptions) => } // build fragments - const fileFragments = buildFragments(res); + const fileFragments = buildFragments(res, blockType); // remove loader removeLoader(); @@ -138,14 +142,14 @@ export const createFileUploader = (options?: UploadFileOptions) => export const useFilesUploader = (editor: PlateEditor) => { return useCallback( - (files: File[], overriddenAction?: UploadType): Promise => { + (files: File[], blockType?: UploadType): Promise => { const callback = getPlugin(editor, UPLOAD_PLUGIN_KEY)?.options.uploadFiles; if (callback) { return callback( editor, files, - overriddenAction, + blockType, ); } From 9201ef3cc0e402b6213ec493048acc65b079e97f Mon Sep 17 00:00:00 2001 From: AlekseyManetov Date: Tue, 3 Dec 2024 16:15:02 +0100 Subject: [PATCH 7/8] [Docs]: change RTE initial content --- uui-docs/src/demoData/slateInitialValue.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/uui-docs/src/demoData/slateInitialValue.ts b/uui-docs/src/demoData/slateInitialValue.ts index cb6e5c5706..f58f77ca4b 100644 --- a/uui-docs/src/demoData/slateInitialValue.ts +++ b/uui-docs/src/demoData/slateInitialValue.ts @@ -972,6 +972,7 @@ export const slateInitialValue = [ rowSpan: 1, }, ], + size: 46, }, ], data: {}, @@ -982,15 +983,6 @@ export const slateInitialValue = [ 189, ], }, - { - type: 'uui-richTextEditor-header-3', - data: {}, - children: [ - { - text: '', - }, - ], - }, { type: 'uui-richTextEditor-header-3', data: {}, From 9650fbd6b21db8f80df97bc3fd29f64370b89912 Mon Sep 17 00:00:00 2001 From: Aleh Makaranka <29537473+cpoftea@users.noreply.github.com> Date: Tue, 3 Dec 2024 23:14:42 +0400 Subject: [PATCH 8/8] Fix crash when removing the sole table row `@udecode/plate-table` bug. Fixed at `v40.0.0`. Added a temporary fix to prevent the error when removing the sole row in a table. --- changelog.md | 1 + .../plugins/tablePlugin/ToolbarContent.tsx | 3 ++- .../tablePlugin/temporaryFixDeleteRow.ts | 25 +++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 uui-editor/src/plugins/tablePlugin/temporaryFixDeleteRow.ts diff --git a/changelog.md b/changelog.md index 5cb39a4247..412618ab20 100644 --- a/changelog.md +++ b/changelog.md @@ -14,6 +14,7 @@ * [RTE]: fixed scroll to the top of the editor after editor modal windows(Add image/link/video etc.) were close * [RTE]: fixed error while merging cells without content * [RTE]: fixed bug when files added from attachment button inserted in preview mode instead of attachment block +* [RTE]: fixed crash when removing the sole table row # 5.11.0 - 15.11.2024 diff --git a/uui-editor/src/plugins/tablePlugin/ToolbarContent.tsx b/uui-editor/src/plugins/tablePlugin/ToolbarContent.tsx index 04e0361382..99ff4b7aaf 100644 --- a/uui-editor/src/plugins/tablePlugin/ToolbarContent.tsx +++ b/uui-editor/src/plugins/tablePlugin/ToolbarContent.tsx @@ -14,6 +14,7 @@ import { ToolbarButton } from '../../implementation/ToolbarButton'; import { useEditorRef } from '@udecode/plate-common'; import { getTableEntries, insertTableColumn, insertTableRow, deleteRow, deleteTable, unmergeTableCells, deleteColumn } from '@udecode/plate-table'; import { TABLE_HEADER_CELL_TYPE } from './constants'; +import { temporaryFixDeleteRow } from './temporaryFixDeleteRow'; function StyledRemoveTable() { return ; @@ -72,7 +73,7 @@ export function TableToolbarContent({ canUnmerge }:{ canUnmerge:boolean }) { /> deleteRow(editor) } + onClick={ temporaryFixDeleteRow(editor, () => deleteRow(editor)) } icon={ RemoveRow } /> void) => { + return () => { + const tableElement = getBlockAbove(editor, { match: (node) => isType(editor, node, TABLE_TYPE) }); + + if (!tableElement) { + return; + } + + const [tableNode] = tableElement; + + if (tableNode.children.length <= 1) { + return; + } + + deleteRowFn(); + }; +};