@hailin-zheng/editor-core 1.1.16 → 1.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index-cjs.js +5456 -5230
- package/index-cjs.js.map +1 -1
- package/index.js +5454 -5231
- package/index.js.map +1 -1
- package/med_editor/framework/document-change.d.ts +2 -1
- package/med_editor/framework/document-context.d.ts +2 -1
- package/med_editor/framework/document-event.d.ts +1 -1
- package/med_editor/framework/element-define.d.ts +4 -0
- package/med_editor/framework/element-event-define.d.ts +4 -1
- package/med_editor/framework/element-props.d.ts +12 -3
- package/med_editor/framework/impl/picture/RectEle.d.ts +49 -0
- package/med_editor/framework/impl/table/table-cell-impl.d.ts +5 -0
- package/med_editor/framework/impl/table/table-util.d.ts +9 -1
- package/med_editor/framework/impl/text/text-impl.d.ts +2 -1
- package/med_editor/framework/paragraph-arrange.d.ts +4 -1
- package/med_editor/framework/render-context.d.ts +12 -2
- package/med_editor/texteditor.d.ts +75 -12
- package/package.json +1 -1
@@ -48,7 +48,7 @@ export declare class DocumentChange {
|
|
48
48
|
*/
|
49
49
|
newInputTrackChanges(data: InputData, startControl: LeafElement, startOffset: number): void;
|
50
50
|
/**
|
51
|
-
*
|
51
|
+
* 创建新留痕块,并返回留痕块输入定位文本
|
52
52
|
* @param startControl
|
53
53
|
* @param startOffset
|
54
54
|
* @param trackType
|
@@ -218,6 +218,7 @@ export declare class DocumentChange {
|
|
218
218
|
static setTextStyle(ss: SelectionState, setterFunc: (text: TextGroupElement) => void): void;
|
219
219
|
private static recursionSetRangeTextStyle;
|
220
220
|
static setParaAlign(ss: SelectionState, setterFunc: (tp: ParagraphProps) => void): void;
|
221
|
+
static setParaStyle(ss: SelectionState, setterFunc: (tp: ParagraphProps) => void): void;
|
221
222
|
/**
|
222
223
|
* 复制
|
223
224
|
* @param evt
|
@@ -92,7 +92,7 @@ export declare class DocumentContext {
|
|
92
92
|
* 获取留痕块元素列表
|
93
93
|
*/
|
94
94
|
getTrackElements(): Array<TrackRunElement>;
|
95
|
-
|
95
|
+
getTrackElementById(id: string): TrackRunElement | null;
|
96
96
|
/**
|
97
97
|
* 获取留痕块内数据
|
98
98
|
*/
|
@@ -107,6 +107,7 @@ export declare class DocumentContext {
|
|
107
107
|
/**
|
108
108
|
* 当前上下文执行默认绑定
|
109
109
|
* @param data
|
110
|
+
* @param predicateKey
|
110
111
|
*/
|
111
112
|
bindDataValues(data: string | Object | Array<{
|
112
113
|
key: string;
|
@@ -151,7 +151,7 @@ export declare class DocumentEvent {
|
|
151
151
|
* @param eventStage
|
152
152
|
* @param docCtx
|
153
153
|
*/
|
154
|
-
static invokeEvent(type: EventTypes, sourceElement: Element, event: ElementEvent, eventStage: EventStage
|
154
|
+
static invokeEvent(type: EventTypes, sourceElement: Element, event: ElementEvent, eventStage: EventStage): ElementEvent | null;
|
155
155
|
/**
|
156
156
|
* 发布当前的点击信息
|
157
157
|
*/
|
@@ -3,7 +3,7 @@ import { LeafRenderObject, RenderObject } from "./render-define";
|
|
3
3
|
import { EditorContext } from "./document-context";
|
4
4
|
import { TrackRunTypeEnum } from "./impl/text/track-run-impl";
|
5
5
|
export declare type EventStage = 'All' | 'Capture' | 'Bubbling';
|
6
|
-
export declare type EventTypes = 'ElementMousedown' | 'ElementMousemove' | 'ElementClick' | 'ElementDblClick' | 'ElementMouseEnter' | 'ElementMouseLeave' | 'BackspaceKey' | 'DeleteKey' | 'ElementShown' | 'ElementContextMenu' | 'GotCursor' | 'LostCursor' | 'ElementKeyDown' | 'ElementDrop' | 'ElementTabKey' | 'GetTrackTips';
|
6
|
+
export declare type EventTypes = 'ElementMousedown' | 'ElementMousemove' | 'ElementClick' | 'ElementDblClick' | 'ElementMouseEnter' | 'ElementMouseLeave' | 'BackspaceKey' | 'DeleteKey' | 'ElementShown' | 'ElementContextMenu' | 'GotCursor' | 'LostCursor' | 'ElementKeyDown' | 'ElementDrop' | 'ElementTabKey' | 'GetTrackTips' | 'ElementInput';
|
7
7
|
export declare type HitRegion = 'header' | 'body' | 'footer' | 'review';
|
8
8
|
export interface HitEventInfo {
|
9
9
|
relativeRect: Rect;
|
@@ -57,6 +57,9 @@ export declare class ContentMenuItem {
|
|
57
57
|
*/
|
58
58
|
export declare class MouseElementEvent extends ElementEvent {
|
59
59
|
}
|
60
|
+
export declare class InputElementEvent extends ElementEvent {
|
61
|
+
data: string;
|
62
|
+
}
|
60
63
|
export declare class MousedownElementEvent extends ElementEvent {
|
61
64
|
}
|
62
65
|
export declare class KeyboradElementEvent extends ElementEvent {
|
@@ -79,6 +79,8 @@ export declare class CheckBoxProps extends INotifyPropertyChanged {
|
|
79
79
|
size: number;
|
80
80
|
isChecked: boolean;
|
81
81
|
groupName: string | null;
|
82
|
+
trueChar: string;
|
83
|
+
falseChar: string;
|
82
84
|
clone(dest: CheckBoxProps): CheckBoxProps;
|
83
85
|
getSerializeProps(viewOptions: ViewOptions): {
|
84
86
|
size: number;
|
@@ -120,6 +122,7 @@ export declare type CellMergeType = 'col-merge' | 'row-merge';
|
|
120
122
|
export declare type VMergeType = 'restart' | 'continue';
|
121
123
|
export declare type HMergeType = 'restart' | 'continue';
|
122
124
|
export declare type VerticalAlign = 'top' | 'middle' | 'bottom';
|
125
|
+
export declare type CellDiagonal = 'main' | 'sub' | 'all' | null;
|
123
126
|
export declare class TableCellProps extends INotifyPropertyChanged {
|
124
127
|
vMerge: VMergeType | null;
|
125
128
|
hMerge: HMergeType | null;
|
@@ -128,7 +131,7 @@ export declare class TableCellProps extends INotifyPropertyChanged {
|
|
128
131
|
/**
|
129
132
|
* 对角线
|
130
133
|
*/
|
131
|
-
diagonal:
|
134
|
+
diagonal: CellDiagonal;
|
132
135
|
clone(dest: TableCellProps): TableCellProps;
|
133
136
|
getSerializeProps(options: ViewOptions): any;
|
134
137
|
}
|
@@ -162,7 +165,6 @@ export declare class DataEleBaseProps extends INotifyPropertyChanged {
|
|
162
165
|
editable: boolean;
|
163
166
|
deleteable: boolean;
|
164
167
|
minLength: number;
|
165
|
-
type: DataEleTypes;
|
166
168
|
underline: boolean;
|
167
169
|
expression: string;
|
168
170
|
hidden: boolean;
|
@@ -218,13 +220,21 @@ export declare class CommProps extends INotifyPropertyChanged {
|
|
218
220
|
markType: "start" | "end";
|
219
221
|
};
|
220
222
|
}
|
223
|
+
export declare const trueChar = "\u2713";
|
224
|
+
export declare const falseChar = "\u00D7";
|
221
225
|
export declare class DataEleCheckProps extends DataEleBaseProps {
|
222
226
|
constructor();
|
227
|
+
border: boolean;
|
223
228
|
size: number;
|
224
229
|
checked: boolean;
|
225
230
|
checkedValue: string;
|
226
231
|
groupName: string;
|
227
232
|
multiSelect: boolean;
|
233
|
+
drawStateChar: boolean;
|
234
|
+
trueChar: string;
|
235
|
+
falseChar: string;
|
236
|
+
trueStateColor: string;
|
237
|
+
falseStateColor: string;
|
228
238
|
clone(dest: DataEleCheckProps | null): DataEleCheckProps;
|
229
239
|
getSerializeProps(options: ViewOptions): any;
|
230
240
|
updateProps(props: DataEleCheckProps): void;
|
@@ -240,7 +250,6 @@ export declare class DataEleImageProps extends DataEleBaseProps {
|
|
240
250
|
updateProps(props: DataEleImageProps): void;
|
241
251
|
}
|
242
252
|
export declare class DataEleDateProps extends DataEleBaseTextProps {
|
243
|
-
constructor();
|
244
253
|
minValue?: Date;
|
245
254
|
maxValue?: Date;
|
246
255
|
format?: string;
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { ElementFactory, ICreateRenderData, LeafElement, readElementProps, SerializeProps, ViewOptions } from "../../element-define";
|
2
|
+
import { IRenderData, LeafRenderObject, RenderObject } from "../../render-define";
|
3
|
+
interface RectProps {
|
4
|
+
width: number;
|
5
|
+
height: number;
|
6
|
+
bgColor: string;
|
7
|
+
}
|
8
|
+
export declare class RectElement extends LeafElement<RectProps> {
|
9
|
+
constructor();
|
10
|
+
/**
|
11
|
+
* 克隆方法,支持复制操作等
|
12
|
+
* @param data
|
13
|
+
*/
|
14
|
+
clone(data: boolean): RectElement;
|
15
|
+
/**
|
16
|
+
* 创建渲染元素
|
17
|
+
* @param data
|
18
|
+
*/
|
19
|
+
createRenderObject(data: ICreateRenderData): RenderObject | null;
|
20
|
+
/**
|
21
|
+
* 序列化
|
22
|
+
* @param viewOptions
|
23
|
+
*/
|
24
|
+
serialize(viewOptions: ViewOptions): SerializeProps | null;
|
25
|
+
}
|
26
|
+
export declare class RectRenderObject extends LeafRenderObject<RectElement> {
|
27
|
+
/**
|
28
|
+
* 克隆当前对象
|
29
|
+
*/
|
30
|
+
clone(): RenderObject;
|
31
|
+
/**
|
32
|
+
* 渲染绘制到视图
|
33
|
+
* @param e
|
34
|
+
*/
|
35
|
+
render(e: IRenderData): void;
|
36
|
+
}
|
37
|
+
export declare class RectElementFactory extends ElementFactory<RectProps> {
|
38
|
+
/**
|
39
|
+
* 读取并创建元素
|
40
|
+
* @param data
|
41
|
+
*/
|
42
|
+
createElement(data: readElementProps<RectProps>): RectElement;
|
43
|
+
/**
|
44
|
+
* 是否匹配当前工程处理
|
45
|
+
* @param type
|
46
|
+
*/
|
47
|
+
match(type: string): boolean;
|
48
|
+
}
|
49
|
+
export {};
|
@@ -20,6 +20,11 @@ export declare class TableCellElement extends BlockContainerElement<TableCellPro
|
|
20
20
|
}
|
21
21
|
export declare class TableCellRenderObject extends InlineMuiltBlockLineRenderObject {
|
22
22
|
render(e: IRenderData): void;
|
23
|
+
/**
|
24
|
+
* 绘制对角线
|
25
|
+
* @private
|
26
|
+
*/
|
27
|
+
private renderDiagonal;
|
23
28
|
clone(): RenderObject;
|
24
29
|
}
|
25
30
|
export declare class TableCellFactory extends ElementFactory<TableCellProps> {
|
@@ -2,6 +2,7 @@ import { SelectionState } from "../../document-selection";
|
|
2
2
|
import { TableCellElement } from "./table-cell-impl";
|
3
3
|
import { TableElement } from "./table-impl";
|
4
4
|
import { TableRowElement } from "./table-row-impl";
|
5
|
+
import { CellDiagonal } from "../../element-props";
|
5
6
|
export declare class TableUtil {
|
6
7
|
static canDeleteTable(ss: SelectionState): boolean;
|
7
8
|
/**
|
@@ -92,6 +93,12 @@ export declare class TableUtil {
|
|
92
93
|
* @param insertRowIndex
|
93
94
|
*/
|
94
95
|
static insertRow(ss: SelectionState, insertRowIndex: number): TableRowElement;
|
96
|
+
/**
|
97
|
+
* 在指定位置插入新行
|
98
|
+
* @param tb
|
99
|
+
* @param insertRowIndex
|
100
|
+
*/
|
101
|
+
static insertNewRow(tb: TableElement, insertRowIndex: number): TableRowElement;
|
95
102
|
/**
|
96
103
|
* 在下方插入行
|
97
104
|
*/
|
@@ -133,7 +140,7 @@ export declare class TableUtil {
|
|
133
140
|
* @param diagonal
|
134
141
|
* @returns
|
135
142
|
*/
|
136
|
-
static setTableCellDiagonal(ss: SelectionState, diagonal:
|
143
|
+
static setTableCellDiagonal(ss: SelectionState, diagonal: CellDiagonal): void;
|
137
144
|
/**
|
138
145
|
* 将当前表格截断成两个相邻的表格
|
139
146
|
* @param tb
|
@@ -153,6 +160,7 @@ export declare class TableUtil {
|
|
153
160
|
* 计算表格列,用于新增表格的时候生成列
|
154
161
|
*/
|
155
162
|
static calcTableColsWidth(cols: Array<string | number>, tbWidth: number): Array<number>;
|
163
|
+
static setTableCellBgColorAtSelection(ss: SelectionState, bgColor: string): void;
|
156
164
|
}
|
157
165
|
export interface ITableSelectedRegion {
|
158
166
|
startRow: number;
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import { TextProps } from "../../element-props";
|
2
2
|
import { IRenderData, LeafRenderObject, RenderObject } from "../../render-define";
|
3
|
-
import { LeafElement, ElementFactory, Element, SerializeProps, ViewOptions, ICreateRenderData } from "../../element-define";
|
3
|
+
import { LeafElement, ElementFactory, Element, SerializeProps, ViewOptions, ICreateRenderData, FontBoundingBox } from "../../element-define";
|
4
4
|
import { TextUnits } from "../../render-context";
|
5
5
|
export declare class TextGroupElement extends LeafElement<TextProps> {
|
6
6
|
textMeasures: Array<TextUnits>;
|
7
|
+
fontBoundingBox: FontBoundingBox;
|
7
8
|
isMeasure: boolean;
|
8
9
|
constructor();
|
9
10
|
set text(val: string);
|
@@ -35,17 +35,19 @@ export declare class ParagraphMeasure {
|
|
35
35
|
private arrangeInlineItems;
|
36
36
|
arrangeLeafElement(parentLine: MeasureLine, ele: LeafElement): void;
|
37
37
|
arrangeLeafRender(parentLine: MeasureLine, render: LeafRenderObject): void;
|
38
|
-
cutTextRender(render: TextGroupRenderObject, limitWidth: number, lineEmpty: boolean): ICutLineData;
|
38
|
+
cutTextRender(render: TextGroupRenderObject, limitWidth: number, lineEmpty: boolean, isCloseToBody: any): ICutLineData;
|
39
39
|
/**
|
40
40
|
* 处理前置标点,前置标点不能出现在末尾
|
41
41
|
* @param render
|
42
42
|
* @param i
|
43
|
+
* @param lineEmpty
|
43
44
|
*/
|
44
45
|
private patchHandleLeadingPunctuation;
|
45
46
|
/**
|
46
47
|
* 处理后置标点,后置标点不能出现在行首
|
47
48
|
* @param render
|
48
49
|
* @param i
|
50
|
+
* @param inCloseBody
|
49
51
|
* @param lineEmpty
|
50
52
|
*/
|
51
53
|
private patchHandlePostPunctuation;
|
@@ -77,6 +79,7 @@ interface MeasureLine {
|
|
77
79
|
applyNewLine(): void;
|
78
80
|
applyNewPara(): void;
|
79
81
|
parent: MeasureLine | null;
|
82
|
+
isCloseToBody: boolean;
|
80
83
|
arrange(): void;
|
81
84
|
}
|
82
85
|
interface ICutLineData {
|
@@ -54,13 +54,23 @@ export declare class PaintContent {
|
|
54
54
|
clear(): void;
|
55
55
|
drawText(text: string, textProps: TextProps, x: number, y: number, width: number, height: number): void;
|
56
56
|
fillCircular(x: number, y: number, r: number, color?: string): void;
|
57
|
-
drawTextUnits(textGroupRender: TextGroupRenderObject, x: number, y: number): void;
|
57
|
+
drawTextUnits(textGroupRender: TextGroupRenderObject, x: number, y: number, baseLine: number): void;
|
58
|
+
drawText2(str: string, font: string, color: string, x: number, y: number, width: number, height: number): void;
|
58
59
|
getParaLineHeight(textEle: TextGroupElement): number;
|
59
60
|
measureText(text: string, textProps: TextProps): {
|
60
61
|
width: number;
|
61
62
|
height: number;
|
62
63
|
};
|
63
|
-
|
64
|
+
measureTextMetrics(font: string, str?: string): {
|
65
|
+
fontBoundingBoxAscent: number;
|
66
|
+
fontBoundingBoxDescent: number;
|
67
|
+
width: number;
|
68
|
+
actualBoundingBoxAscent: number;
|
69
|
+
actualBoundingBoxDescent: number;
|
70
|
+
actualBoundingBoxLeft: number;
|
71
|
+
actualBoundingBoxRight: number;
|
72
|
+
};
|
73
|
+
measureTextWidth(text: string, font: {
|
64
74
|
fontSize: number;
|
65
75
|
fontName: string;
|
66
76
|
}): number;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { ContentMenuItem } from './framework/element-event-define';
|
2
2
|
import { ElementReader } from './framework/element-reader';
|
3
3
|
import { SelectionState } from './framework/document-selection';
|
4
|
-
import { BranchElement, Element, ICancelTokenFn, LeafElement, MarginProps, OrientType, PageLayoutMode, Position, Rect,
|
5
|
-
import { DataElementInlineGroup, DataElementLeaf, DocumentElement } from './framework/impl';
|
6
|
-
import { ParagraphNumberType, ParagraphProps, TextProps } from './framework/element-props';
|
4
|
+
import { BranchElement, Element, ICancelTokenFn, LeafElement, MarginProps, OrientType, PageLayoutMode, Position, Rect, ViewOptions } from './framework/element-define';
|
5
|
+
import { DataElementInlineGroup, DataElementLeaf, DocumentElement, ParagraphElement, TableCellElement, TableElement, TableRowElement } from './framework/impl';
|
6
|
+
import { CellDiagonal, ParagraphNumberType, ParagraphProps, TextProps } from './framework/element-props';
|
7
7
|
import { EditorContext } from './framework/document-context';
|
8
8
|
import { ElementTrackManage } from './framework/element-trace-manage';
|
9
9
|
import { Subject } from './framework/event-subject';
|
@@ -185,10 +185,10 @@ export declare class CanvasTextEditor extends AbsolutePanel {
|
|
185
185
|
*/
|
186
186
|
enableFormatBrush(): ICancelTokenFn | null;
|
187
187
|
/**
|
188
|
-
*
|
189
|
-
* @param
|
188
|
+
* 设置段落样式
|
189
|
+
* @param newProps
|
190
190
|
*/
|
191
|
-
|
191
|
+
setParaStyle(newProps: Partial<ParagraphProps>): void;
|
192
192
|
combineCell(): void;
|
193
193
|
/**
|
194
194
|
* 切换当前段落项目符号状态
|
@@ -308,16 +308,79 @@ export declare class CanvasTextEditor extends AbsolutePanel {
|
|
308
308
|
* @private
|
309
309
|
*/
|
310
310
|
private drawCaret;
|
311
|
-
private generatorDoc;
|
312
311
|
/**
|
313
|
-
*
|
314
|
-
* 匹配用户输入的关键字,回调到应用业务中处理
|
312
|
+
* 获取当前光标位置所在的段落
|
315
313
|
*/
|
316
|
-
|
314
|
+
getParagraphAtCursor(): ParagraphElement | null;
|
317
315
|
/**
|
318
|
-
*
|
316
|
+
* 获取当前光标位置的表格
|
319
317
|
*/
|
320
|
-
|
318
|
+
getTableAtCursor(): TableElement | null;
|
319
|
+
/**
|
320
|
+
* 获取当前光标位置的表格行
|
321
|
+
*/
|
322
|
+
getTableRowAtCursor(): TableRowElement | null;
|
323
|
+
/**
|
324
|
+
* 获取当前光标位置的单元格
|
325
|
+
*/
|
326
|
+
getTableCellAtCursor(): TableCellElement | null;
|
327
|
+
/**
|
328
|
+
* 当前光标处上方插入新行
|
329
|
+
*/
|
330
|
+
insertRowAboveAtCursor(): void;
|
331
|
+
/**
|
332
|
+
* 当前光标处下方插入新行
|
333
|
+
*/
|
334
|
+
insertRowBelowAtCursor(): void;
|
335
|
+
/**
|
336
|
+
* 当前光标处右方插入新列
|
337
|
+
*/
|
338
|
+
insertColToRightAtCursor(): void;
|
339
|
+
/**
|
340
|
+
* 当前光标处左方插入新列
|
341
|
+
*/
|
342
|
+
insertColToLeftAtCursor(): void;
|
343
|
+
/**
|
344
|
+
* 移除当前光标处的行
|
345
|
+
*/
|
346
|
+
removeCurrRowAtCursor(): void;
|
347
|
+
/**
|
348
|
+
* 移除当前光标处的列
|
349
|
+
*/
|
350
|
+
removeCurrColAtCursor(): void;
|
351
|
+
/**
|
352
|
+
* 合并单元格
|
353
|
+
*/
|
354
|
+
mergeCellsBySelection(): void;
|
355
|
+
/**
|
356
|
+
* 拆分单元格
|
357
|
+
* @param rows
|
358
|
+
* @param cols
|
359
|
+
*/
|
360
|
+
splitCell(rows: number, cols: number): void;
|
361
|
+
/**
|
362
|
+
* 删除当前光标所在的表格
|
363
|
+
*/
|
364
|
+
removeTableAtCursor(): void;
|
365
|
+
/**
|
366
|
+
* 设置单元格对角线
|
367
|
+
* @param diagonal
|
368
|
+
*/
|
369
|
+
setCellDiagonal(diagonal: CellDiagonal): void;
|
370
|
+
/**
|
371
|
+
* 设置选区范围内的单元格背景颜色
|
372
|
+
*/
|
373
|
+
setTableCellBgColorAtSelection(color: string): void;
|
374
|
+
/**
|
375
|
+
* 还原光标处已合并的单元格
|
376
|
+
*/
|
377
|
+
restoreMergeCellsAtCursor(): void;
|
378
|
+
/**
|
379
|
+
* 表格在指定位置插入新行
|
380
|
+
* @param tb
|
381
|
+
* @param insertRowIndex
|
382
|
+
*/
|
383
|
+
insertNewRow(tb: TableElement, insertRowIndex: number): TableRowElement;
|
321
384
|
}
|
322
385
|
export interface IReaderManager {
|
323
386
|
}
|