From a7fa847b198010cc5c7b8af9c860a04fe1c4250d Mon Sep 17 00:00:00 2001 From: Hufe921 Date: Wed, 28 Feb 2024 20:42:44 +0800 Subject: [PATCH] feat: add textDecoration property to the rangeStyleChange event --- src/editor/core/range/RangeManager.ts | 7 +++++-- src/editor/interface/Listener.ts | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/editor/core/range/RangeManager.ts b/src/editor/core/range/RangeManager.ts index 76b14ed..3ff6b4f 100644 --- a/src/editor/core/range/RangeManager.ts +++ b/src/editor/core/range/RangeManager.ts @@ -382,6 +382,7 @@ export class RangeManager { const level = curElement.level || null const listType = curElement.listType || null const listStyle = curElement.listStyle || null + const textDecoration = underline ? curElement.textDecoration || null : null // 菜单 const painter = !!this.draw.getPainterStyle() const undo = this.historyManager.isCanUndo() @@ -407,7 +408,8 @@ export class RangeManager { level, listType, listStyle, - groupIds + groupIds, + textDecoration } if (rangeStyleChangeListener) { rangeStyleChangeListener(rangeStyle) @@ -447,7 +449,8 @@ export class RangeManager { level: null, listType: null, listStyle: null, - groupIds: null + groupIds: null, + textDecoration: null } if (rangeStyleChangeListener) { rangeStyleChangeListener(rangeStyle) diff --git a/src/editor/interface/Listener.ts b/src/editor/interface/Listener.ts index 2d473ae..55aec0a 100644 --- a/src/editor/interface/Listener.ts +++ b/src/editor/interface/Listener.ts @@ -9,6 +9,7 @@ import { import { RowFlex } from '../dataset/enum/Row' import { IControl } from './Control' import { IEditorResult } from './Editor' +import { ITextDecoration } from './Text' export interface IRangeStyle { type: ElementType | null @@ -30,6 +31,7 @@ export interface IRangeStyle { listType: ListType | null listStyle: ListStyle | null groupIds: string[] | null + textDecoration: ITextDecoration | null } export type IRangeStyleChange = (payload: IRangeStyle) => void