From a6eccc7a78569e881d80c745f8a77455b91df0ad Mon Sep 17 00:00:00 2001 From: Hufe921 Date: Wed, 1 Jan 2025 16:14:58 +0800 Subject: [PATCH] feat: add table tool disabled option #954 --- docs/en/guide/schema.md | 1 + docs/guide/schema.md | 1 + src/editor/core/draw/particle/table/TableTool.ts | 6 ++++-- src/editor/interface/Element.ts | 6 +++++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/en/guide/schema.md b/docs/en/guide/schema.md index 1dceb0113..f60d712af 100644 --- a/docs/en/guide/schema.md +++ b/docs/en/guide/schema.md @@ -77,6 +77,7 @@ interface IElement { }[]; borderType?: TableBorder; borderColor?: string; + tableToolDisabled?: boolean; // Hyperlinks url?: string; // Superscript and subscript diff --git a/docs/guide/schema.md b/docs/guide/schema.md index 338f032ae..1babe1e64 100644 --- a/docs/guide/schema.md +++ b/docs/guide/schema.md @@ -77,6 +77,7 @@ interface IElement { }[]; borderType?: TableBorder; borderColor?: string; + tableToolDisabled?: boolean; // 超链接 url?: string; // 上下标 diff --git a/src/editor/core/draw/particle/table/TableTool.ts b/src/editor/core/draw/particle/table/TableTool.ts index aa74279c5..0a13b967e 100644 --- a/src/editor/core/draw/particle/table/TableTool.ts +++ b/src/editor/core/draw/particle/table/TableTool.ts @@ -87,11 +87,13 @@ export class TableTool { if (!isTable) return // 销毁之前工具 this.dispose() - // 渲染所需数据 - const { scale } = this.options const elementList = this.draw.getOriginalElementList() const positionList = this.position.getOriginalPositionList() const element = elementList[index!] + // 表格工具配置禁用又非设计模式时不渲染 + if (element.tableToolDisabled && !this.draw.isDesignMode()) return + // 渲染所需数据 + const { scale } = this.options const position = positionList[index!] const { colgroup, trList } = element const { diff --git a/src/editor/interface/Element.ts b/src/editor/interface/Element.ts index ba1d89d4e..cf6b8df60 100644 --- a/src/editor/interface/Element.ts +++ b/src/editor/interface/Element.ts @@ -66,6 +66,10 @@ export interface ITableAttr { borderColor?: string } +export interface ITableRule { + tableToolDisabled?: boolean +} + export interface ITableElement { tdId?: string trId?: string @@ -75,7 +79,7 @@ export interface ITableElement { pagingIndex?: number // 拆分的表格索引 } -export type ITable = ITableAttr & ITableElement +export type ITable = ITableAttr & ITableRule & ITableElement export interface IHyperlinkElement { valueList?: IElement[]