@hailin-zheng/editor-core 1.1.17 → 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.
@@ -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
@@ -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, docCtx: EditorContext): ElementEvent | null;
154
+ static invokeEvent(type: EventTypes, sourceElement: Element, event: ElementEvent, eventStage: EventStage): ElementEvent | null;
155
155
  /**
156
156
  * 发布当前的点击信息
157
157
  */
@@ -357,4 +357,8 @@ export interface ICreateRenderData {
357
357
  options: ViewOptions;
358
358
  renderCtx: RenderContextType;
359
359
  }
360
+ export interface FontBoundingBox {
361
+ fontBoundingBoxAscent: number;
362
+ fontBoundingBoxDescent: number;
363
+ }
360
364
  export {};
@@ -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;
@@ -163,7 +165,6 @@ export declare class DataEleBaseProps extends INotifyPropertyChanged {
163
165
  editable: boolean;
164
166
  deleteable: boolean;
165
167
  minLength: number;
166
- type: DataEleTypes;
167
168
  underline: boolean;
168
169
  expression: string;
169
170
  hidden: boolean;
@@ -219,13 +220,21 @@ export declare class CommProps extends INotifyPropertyChanged {
219
220
  markType: "start" | "end";
220
221
  };
221
222
  }
223
+ export declare const trueChar = "\u2713";
224
+ export declare const falseChar = "\u00D7";
222
225
  export declare class DataEleCheckProps extends DataEleBaseProps {
223
226
  constructor();
227
+ border: boolean;
224
228
  size: number;
225
229
  checked: boolean;
226
230
  checkedValue: string;
227
231
  groupName: string;
228
232
  multiSelect: boolean;
233
+ drawStateChar: boolean;
234
+ trueChar: string;
235
+ falseChar: string;
236
+ trueStateColor: string;
237
+ falseStateColor: string;
229
238
  clone(dest: DataEleCheckProps | null): DataEleCheckProps;
230
239
  getSerializeProps(options: ViewOptions): any;
231
240
  updateProps(props: DataEleCheckProps): void;
@@ -241,7 +250,6 @@ export declare class DataEleImageProps extends DataEleBaseProps {
241
250
  updateProps(props: DataEleImageProps): void;
242
251
  }
243
252
  export declare class DataEleDateProps extends DataEleBaseTextProps {
244
- constructor();
245
253
  minValue?: Date;
246
254
  maxValue?: Date;
247
255
  format?: string;
@@ -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
- measureText2(text: string, font: {
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,7 +1,7 @@
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, TextAlign, ViewOptions } from './framework/element-define';
4
+ import { BranchElement, Element, ICancelTokenFn, LeafElement, MarginProps, OrientType, PageLayoutMode, Position, Rect, ViewOptions } from './framework/element-define';
5
5
  import { DataElementInlineGroup, DataElementLeaf, DocumentElement, ParagraphElement, TableCellElement, TableElement, TableRowElement } from './framework/impl';
6
6
  import { CellDiagonal, ParagraphNumberType, ParagraphProps, TextProps } from './framework/element-props';
7
7
  import { EditorContext } from './framework/document-context';
@@ -185,10 +185,10 @@ export declare class CanvasTextEditor extends AbsolutePanel {
185
185
  */
186
186
  enableFormatBrush(): ICancelTokenFn | null;
187
187
  /**
188
- * 设置段落对齐
189
- * @param align
188
+ * 设置段落样式
189
+ * @param newProps
190
190
  */
191
- switchParaAlign(align: TextAlign): void;
191
+ setParaStyle(newProps: Partial<ParagraphProps>): void;
192
192
  combineCell(): void;
193
193
  /**
194
194
  * 切换当前段落项目符号状态
@@ -381,7 +381,6 @@ export declare class CanvasTextEditor extends AbsolutePanel {
381
381
  * @param insertRowIndex
382
382
  */
383
383
  insertNewRow(tb: TableElement, insertRowIndex: number): TableRowElement;
384
- private generatorDoc;
385
384
  }
386
385
  export interface IReaderManager {
387
386
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "hailin-zheng",
5
5
  "private": false,
6
6
  "license": "ISC",
7
- "version": "1.1.17",
7
+ "version": "1.1.18",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "bwip-js": "^3.0.5",