Skip to content

Commit

Permalink
feat: add table tool disabled option #954
Browse files Browse the repository at this point in the history
  • Loading branch information
Hufe921 committed Jan 1, 2025
1 parent 951de97 commit a6eccc7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/en/guide/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ interface IElement {
}[];
borderType?: TableBorder;
borderColor?: string;
tableToolDisabled?: boolean;
// Hyperlinks
url?: string;
// Superscript and subscript
Expand Down
1 change: 1 addition & 0 deletions docs/guide/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ interface IElement {
}[];
borderType?: TableBorder;
borderColor?: string;
tableToolDisabled?: boolean;
// 超链接
url?: string;
// 上下标
Expand Down
6 changes: 4 additions & 2 deletions src/editor/core/draw/particle/table/TableTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 5 additions & 1 deletion src/editor/interface/Element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ export interface ITableAttr {
borderColor?: string
}

export interface ITableRule {
tableToolDisabled?: boolean
}

export interface ITableElement {
tdId?: string
trId?: string
Expand All @@ -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[]
Expand Down

0 comments on commit a6eccc7

Please sign in to comment.