From 1f07aa2821d8dab3da58cb69efbe84fc6c2bd634 Mon Sep 17 00:00:00 2001 From: jianglinjun Date: Wed, 13 Mar 2024 20:42:17 +0800 Subject: [PATCH 1/8] =?UTF-8?q?update:=E6=9B=B4=E6=96=B0=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E6=8F=92=E5=85=A5=E8=A1=A8=E6=A0=BC=E6=97=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=8C=87=E5=AE=9A=E7=B1=BB=E5=90=8D=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/editor/html/wang-editor/wang-editor.scss | 27 ++++++++++++++++++++ src/editor/html/wang-editor/wang-editor.tsx | 10 ++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/editor/html/wang-editor/wang-editor.scss b/src/editor/html/wang-editor/wang-editor.scss index 702b4a3e7..738fbd47b 100644 --- a/src/editor/html/wang-editor/wang-editor.scss +++ b/src/editor/html/wang-editor/wang-editor.scss @@ -54,6 +54,33 @@ $html: ( background-color: getCssVar(color, bg, 0); } } + + .table-container { + table { + width: 100%; + } + } +} + +.rich-html-table { + width: 100% !important; + border-collapse: collapse; + + th { + height: 49px; + min-height: 49px; + padding: 8px; + background-color: #F3F3F3; + border: 1px solid lightgray; + } + + td { + height: 49px; + min-height: 49px; + padding: 8px; + empty-cells: show; + border: 1px solid lightgray; + } } @include b('html-editor-readonly') { diff --git a/src/editor/html/wang-editor/wang-editor.tsx b/src/editor/html/wang-editor/wang-editor.tsx index fed297d7c..ddccf7a85 100644 --- a/src/editor/html/wang-editor/wang-editor.tsx +++ b/src/editor/html/wang-editor/wang-editor.tsx @@ -255,7 +255,7 @@ const IBizHtml = defineComponent({ // console.log('change:', editor.getHtml()); const html = editor.getHtml(); // wangEditor初始值抛空字符串给后台 - const emitValue = html === '


' ? '' : html; + let emitValue = html === '


' ? '' : html; if ( emitValue === props.value || (emitValue === '' && isNil(props.value)) @@ -264,6 +264,9 @@ const IBizHtml = defineComponent({ } // 修复初始化有值编辑器也会抛值导致表单脏值检查异常问题 if (!hasEnableEdit.value && editor.isFocused()) { + emitValue = emitValue + .replaceAll('class="rich-html-table"', "") + .replace(/ { readonlyState.value = true; editorRef.value.disable(); - emit('change', valueHtml.value); + const value = valueHtml.value + .replaceAll('class="rich-html-table"', "") + .replace(/
Date: Wed, 13 Mar 2024 20:48:19 +0800 Subject: [PATCH 2/8] =?UTF-8?q?update:=E6=9B=B4=E6=96=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4801a549d..b77ed2119 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ ## [Unreleased] +- 更新富文本在插入表格时,自动给表格添加class类名,统一控制富文本内表格的样式 + ### Added - 下拉列表支持代码表背景样式、样式表 -- Gitee From d289453d8c57c8013f00d2c2666a53523316f6c4 Mon Sep 17 00:00:00 2001 From: jianglinjun Date: Thu, 14 Mar 2024 15:49:11 +0800 Subject: [PATCH 3/8] =?UTF-8?q?update:=E6=9B=B4=E6=96=B0=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E5=86=85html=E5=AE=B9=E5=AD=98=E5=9C=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=9D=97=E6=97=B6=EF=BC=8C=E5=AF=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=9D=97=E8=BF=9B=E8=A1=8C=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + package.json | 1 + pnpm-lock.yaml | 3 +++ src/common/rawitem/rawitem.tsx | 25 +++++++++++++++++++++++-- src/shims-vue.d.ts | 1 + 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b77ed2119..9d11829fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ## [Unreleased] +- 更新直接内容类型为HTML时,对html字符串里存在的代码块进行格式化 - 更新富文本在插入表格时,自动给表格添加class类名,统一控制富文本内表格的样式 ### Added diff --git a/package.json b/package.json index 6d9534327..05efb796d 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "monaco-editor": "^0.45.0", "nprogress": "^0.2.0", "pinia": "^2.1.7", + "prismjs": "^1.29.0", "pluralize": "^8.0.0", "qs": "^6.11.2", "qx-util": "^0.4.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 322aa440b..a27f904de 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -86,6 +86,9 @@ dependencies: pluralize: specifier: ^8.0.0 version: 8.0.0 + prismjs: + specifier: ^1.29.0 + version: 1.29.0 qs: specifier: ^6.11.2 version: 6.11.2 diff --git a/src/common/rawitem/rawitem.tsx b/src/common/rawitem/rawitem.tsx index 16f9fba6f..239ecbeaf 100644 --- a/src/common/rawitem/rawitem.tsx +++ b/src/common/rawitem/rawitem.tsx @@ -1,5 +1,5 @@ import { useNamespace } from '@ibiz-template/vue3-util'; -import { defineComponent, PropType, Ref, ref, watch } from 'vue'; +import { defineComponent, nextTick, PropType, Ref, ref, watch } from 'vue'; import { createUUID } from 'qx-util'; import { IHtmlItem, @@ -7,6 +7,13 @@ import { IRawItemContainer, ITextItem, } from '@ibiz/model-core'; +import Prism from 'prismjs'; +import 'prismjs/themes/prism.min.css'; +import 'prismjs/plugins/line-numbers/prism-line-numbers.min.css'; +import 'prismjs/plugins/line-numbers/prism-line-numbers.min.js'; +import 'prismjs/plugins/toolbar/prism-toolbar'; +import 'prismjs/plugins/toolbar/prism-toolbar.css'; +import 'prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js'; import './rawitem.scss'; export const IBizRawItem = defineComponent({ @@ -169,6 +176,17 @@ export const IBizRawItem = defineComponent({ } }; + + /** + * @description 解析格式化代码块 + * @author 姜林君 + * @date 2024/03/14 15:03:03 + */ + const parseCodeBlock = async () => { + await nextTick(); + Prism.highlightAll(); // 切换更新内容则重新调用这个方法 + }; + convertValue(); watch( @@ -177,6 +195,9 @@ export const IBizRawItem = defineComponent({ if (newVal !== oldVal) { rawItemContent.value = newVal as string | number; convertValue(); + if (rawItemType.value === 'HTML') { + parseCodeBlock() + } } }, { @@ -230,7 +251,7 @@ export const IBizRawItem = defineComponent({ } if (this.rawItemType === 'HTML') { return ( -
+
); } if (this.rawItemType === 'VIDEO') { diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts index 0ce62c39b..27d7a0dd7 100644 --- a/src/shims-vue.d.ts +++ b/src/shims-vue.d.ts @@ -7,3 +7,4 @@ declare module '*.vue' { declare module 'element-plus/dist/locale/zh-cn.mjs'; declare module '@ibiz-template-plugin/gantt'; +declare module 'prismjs'; -- Gitee From af6c0105a455cf530f3dc92a0a4d0db1f4e3a359 Mon Sep 17 00:00:00 2001 From: jianglinjun Date: Fri, 15 Mar 2024 19:24:59 +0800 Subject: [PATCH 4/8] =?UTF-8?q?update:=E7=A7=BB=E9=99=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=9D=97=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - pnpm-lock.yaml | 3 --- src/common/rawitem/rawitem.tsx | 23 +---------------------- 3 files changed, 1 insertion(+), 26 deletions(-) diff --git a/package.json b/package.json index 05efb796d..6d9534327 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "monaco-editor": "^0.45.0", "nprogress": "^0.2.0", "pinia": "^2.1.7", - "prismjs": "^1.29.0", "pluralize": "^8.0.0", "qs": "^6.11.2", "qx-util": "^0.4.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a27f904de..322aa440b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -86,9 +86,6 @@ dependencies: pluralize: specifier: ^8.0.0 version: 8.0.0 - prismjs: - specifier: ^1.29.0 - version: 1.29.0 qs: specifier: ^6.11.2 version: 6.11.2 diff --git a/src/common/rawitem/rawitem.tsx b/src/common/rawitem/rawitem.tsx index 239ecbeaf..5b0e53b95 100644 --- a/src/common/rawitem/rawitem.tsx +++ b/src/common/rawitem/rawitem.tsx @@ -7,13 +7,6 @@ import { IRawItemContainer, ITextItem, } from '@ibiz/model-core'; -import Prism from 'prismjs'; -import 'prismjs/themes/prism.min.css'; -import 'prismjs/plugins/line-numbers/prism-line-numbers.min.css'; -import 'prismjs/plugins/line-numbers/prism-line-numbers.min.js'; -import 'prismjs/plugins/toolbar/prism-toolbar'; -import 'prismjs/plugins/toolbar/prism-toolbar.css'; -import 'prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js'; import './rawitem.scss'; export const IBizRawItem = defineComponent({ @@ -176,17 +169,6 @@ export const IBizRawItem = defineComponent({ } }; - - /** - * @description 解析格式化代码块 - * @author 姜林君 - * @date 2024/03/14 15:03:03 - */ - const parseCodeBlock = async () => { - await nextTick(); - Prism.highlightAll(); // 切换更新内容则重新调用这个方法 - }; - convertValue(); watch( @@ -195,9 +177,6 @@ export const IBizRawItem = defineComponent({ if (newVal !== oldVal) { rawItemContent.value = newVal as string | number; convertValue(); - if (rawItemType.value === 'HTML') { - parseCodeBlock() - } } }, { @@ -251,7 +230,7 @@ export const IBizRawItem = defineComponent({ } if (this.rawItemType === 'HTML') { return ( -
+
); } if (this.rawItemType === 'VIDEO') { -- Gitee From 1882e12bd67fd874679dcb1a42fe5c6b9ab29a44 Mon Sep 17 00:00:00 2001 From: jianglinjun Date: Fri, 15 Mar 2024 19:26:04 +0800 Subject: [PATCH 5/8] =?UTF-8?q?update:=E6=9B=B4=E6=96=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d11829fc..b77ed2119 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,6 @@ ## [Unreleased] -- 更新直接内容类型为HTML时,对html字符串里存在的代码块进行格式化 - 更新富文本在插入表格时,自动给表格添加class类名,统一控制富文本内表格的样式 ### Added -- Gitee From cb89460484647fe6db705fd146201af2162b8cc7 Mon Sep 17 00:00:00 2001 From: jianglinjun Date: Fri, 15 Mar 2024 19:28:37 +0800 Subject: [PATCH 6/8] =?UTF-8?q?update=EF=BC=9A=E7=A7=BB=E9=99=A4=E5=86=97?= =?UTF-8?q?=E4=BD=99=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/rawitem/rawitem.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/rawitem/rawitem.tsx b/src/common/rawitem/rawitem.tsx index 5b0e53b95..16f9fba6f 100644 --- a/src/common/rawitem/rawitem.tsx +++ b/src/common/rawitem/rawitem.tsx @@ -1,5 +1,5 @@ import { useNamespace } from '@ibiz-template/vue3-util'; -import { defineComponent, nextTick, PropType, Ref, ref, watch } from 'vue'; +import { defineComponent, PropType, Ref, ref, watch } from 'vue'; import { createUUID } from 'qx-util'; import { IHtmlItem, -- Gitee From db4ca1ddc5492a1dab66d45114b2f2275f3bde7c Mon Sep 17 00:00:00 2001 From: jianglinjun Date: Fri, 15 Mar 2024 19:29:28 +0800 Subject: [PATCH 7/8] =?UTF-8?q?update=EF=BC=9A=E7=A7=BB=E9=99=A4=E5=86=97?= =?UTF-8?q?=E4=BD=99=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shims-vue.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts index 27d7a0dd7..0ce62c39b 100644 --- a/src/shims-vue.d.ts +++ b/src/shims-vue.d.ts @@ -7,4 +7,3 @@ declare module '*.vue' { declare module 'element-plus/dist/locale/zh-cn.mjs'; declare module '@ibiz-template-plugin/gantt'; -declare module 'prismjs'; -- Gitee From 2b4c0f502d761e35d3d39d8d96a7a6ca72de2c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8A=A0=E4=BA=86=E8=9B=8B=E7=82=92=E9=A5=AD=E7=9A=84?= =?UTF-8?q?=E8=91=B1=E8=8A=B1?= <2878709960@qq.com> Date: Sat, 16 Mar 2024 18:21:47 +0800 Subject: [PATCH 8/8] =?UTF-8?q?update:=E6=9B=B4=E6=96=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b77ed2119..4801a549d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,6 @@ ## [Unreleased] -- 更新富文本在插入表格时,自动给表格添加class类名,统一控制富文本内表格的样式 - ### Added - 下拉列表支持代码表背景样式、样式表 -- Gitee