feat: add extension property

pr675
Hufe921 2 years ago
parent 868a79148d
commit 5027d730c4

@ -22,6 +22,7 @@ interface IElement {
}; };
value: string; value: string;
valueList?: IElement[]; // Use of composite elements (hyperlinks, titles, lists, and so on). valueList?: IElement[]; // Use of composite elements (hyperlinks, titles, lists, and so on).
extension?: unknown;
// style // style
font?: string; font?: string;
size?: number; size?: number;

@ -22,6 +22,7 @@ interface IElement {
}; };
value: string; value: string;
valueList?: IElement[]; // 复合元素(超链接、标题、列表等)使用 valueList?: IElement[]; // 复合元素(超链接、标题、列表等)使用
extension?: unknown;
// 样式 // 样式
font?: string; font?: string;
size?: number; size?: number;

@ -429,6 +429,8 @@ export class RangeManager {
const redo = this.historyManager.isCanRedo() const redo = this.historyManager.isCanRedo()
// 组信息 // 组信息
const groupIds = curElement.groupIds || null const groupIds = curElement.groupIds || null
// 扩展字段
const extension = curElement.extension ?? null
const rangeStyle: IRangeStyle = { const rangeStyle: IRangeStyle = {
type, type,
undo, undo,
@ -449,7 +451,8 @@ export class RangeManager {
listType, listType,
listStyle, listStyle,
groupIds, groupIds,
textDecoration textDecoration,
extension
} }
if (rangeStyleChangeListener) { if (rangeStyleChangeListener) {
rangeStyleChangeListener(rangeStyle) rangeStyleChangeListener(rangeStyle)
@ -490,7 +493,8 @@ export class RangeManager {
listType: null, listType: null,
listStyle: null, listStyle: null,
groupIds: null, groupIds: null,
textDecoration: null textDecoration: null,
extension: null
} }
if (rangeStyleChangeListener) { if (rangeStyleChangeListener) {
rangeStyleChangeListener(rangeStyle) rangeStyleChangeListener(rangeStyle)

@ -70,7 +70,8 @@ export const EDITOR_ELEMENT_ZIP_ATTR: Array<keyof IElement> = [
'conceptId', 'conceptId',
'imgDisplay', 'imgDisplay',
'imgFloatPosition', 'imgFloatPosition',
'textDecoration' 'textDecoration',
'extension'
] ]
export const TABLE_TD_ZIP_ATTR: Array<keyof ITd> = [ export const TABLE_TD_ZIP_ATTR: Array<keyof ITd> = [

@ -16,6 +16,7 @@ export interface IElementBasic {
id?: string id?: string
type?: ElementType type?: ElementType
value: string value: string
extension?: unknown
} }
export interface IElementStyle { export interface IElementStyle {

@ -32,6 +32,7 @@ export interface IRangeStyle {
listStyle: ListStyle | null listStyle: ListStyle | null
groupIds: string[] | null groupIds: string[] | null
textDecoration: ITextDecoration | null textDecoration: ITextDecoration | null
extension?: unknown | null
} }
export type IRangeStyleChange = (payload: IRangeStyle) => void export type IRangeStyleChange = (payload: IRangeStyle) => void

Loading…
Cancel
Save