From 29a87a807831559719449370a16d41708d3f3751 Mon Sep 17 00:00:00 2001 From: Takagi <1103069291@qq.com> Date: Thu, 18 Jan 2024 16:40:08 +0800 Subject: [PATCH] pref: add additional attributes and colgroup for tables (#5176) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /kind improvmenet /area editor /milestone 2.12.x 为默认编辑器 table 组件渲染后的结果中增加 `colgroup`,并为 table 增加 `width` 与 `minWidth` 属性。 用于解决渲染完成之后的 table html 宽度与编辑时不一致的问题。 拖拽修改默认编辑器表格列宽,查看生成后的 html 列宽是否同样发生了变化,并且查看生成的 html 结构下是否具有 `colgroup` html 元素。 Fixes #5138 ```release-note 为默认富文本编辑器 table 组件渲染后的 html 增加 colgroup 元素与 width 属性 ``` feat: add search and replace feat: add search and replace feat: add search and replace feat: add search and replace feat: add search and replace feat: add search and replace --- console/packages/editor/package.json | 2 +- .../search-and-replace/SearchAndReplace.vue | 39 ++--- .../SearchAndReplacePlugin.ts | 154 ++++++++++-------- .../extensions/search-and-replace/index.ts | 78 ++++++--- .../editor/src/extensions/table/index.ts | 39 ++++- console/pnpm-lock.yaml | 8 +- .../src/components/editor/DefaultEditor.vue | 2 + 7 files changed, 207 insertions(+), 115 deletions(-) diff --git a/console/packages/editor/package.json b/console/packages/editor/package.json index 956402965dc..0245ad9127e 100644 --- a/console/packages/editor/package.json +++ b/console/packages/editor/package.json @@ -68,7 +68,7 @@ "@tiptap/extension-strike": "^2.1.15", "@tiptap/extension-subscript": "^2.1.15", "@tiptap/extension-superscript": "^2.1.15", - "@tiptap/extension-table": "^2.1.15", + "@tiptap/extension-table": "2.2.0-rc.8", "@tiptap/extension-table-row": "^2.1.15", "@tiptap/extension-task-item": "^2.1.15", "@tiptap/extension-task-list": "^2.1.15", diff --git a/console/packages/editor/src/extensions/search-and-replace/SearchAndReplace.vue b/console/packages/editor/src/extensions/search-and-replace/SearchAndReplace.vue index 53aaaf8deb3..f6ff0cf8d98 100644 --- a/console/packages/editor/src/extensions/search-and-replace/SearchAndReplace.vue +++ b/console/packages/editor/src/extensions/search-and-replace/SearchAndReplace.vue @@ -50,12 +50,10 @@ const findState = computed(() => { }; }); -// 查找下一个搜索结果 const findNextSearchResult = () => { props.editor.commands.findNext(); }; -// 查找上一个搜索结果 const findPreviousSearchResult = () => { props.editor.commands.findPrevious(); }; @@ -71,7 +69,6 @@ const updateSearchReplace = (value: any) => { flag.value = !flag.value; }; -// 替换当前搜索结果 const replace = () => { props.editor.commands.replace(); flag.value = !flag.value; @@ -153,7 +150,7 @@ watch(