@hufe921/canvas-editor 0.9.93 → 0.9.94

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.
@@ -101,6 +101,7 @@ export declare class Command {
101
101
  getHTML: CommandAdapt['getHTML'];
102
102
  getText: CommandAdapt['getText'];
103
103
  getWordCount: CommandAdapt['getWordCount'];
104
+ getCursorPosition: CommandAdapt['getCursorPosition'];
104
105
  getRange: CommandAdapt['getRange'];
105
106
  getRangeText: CommandAdapt['getRangeText'];
106
107
  getRangeContext: CommandAdapt['getRangeContext'];
@@ -10,7 +10,7 @@ import { DeepRequired } from '../../interface/Common';
10
10
  import { IGetControlValueOption, IGetControlValueResult, ILocationControlOption, ISetControlExtensionOption, ISetControlHighlightOption, ISetControlProperties, ISetControlValueOption } from '../../interface/Control';
11
11
  import { IAppendElementListOption, IDrawImagePayload, IForceUpdateOption, IGetImageOption, IGetValueOption, IPainterOption } from '../../interface/Draw';
12
12
  import { IEditorData, IEditorHTML, IEditorOption, IEditorResult, IEditorText, IFocusOption, ISetValueOption, IUpdateOption } from '../../interface/Editor';
13
- import { IElement, IUpdateElementByIdOption } from '../../interface/Element';
13
+ import { IElement, IElementPosition, IUpdateElementByIdOption } from '../../interface/Element';
14
14
  import { IPasteOption, IPositionContextByEvent } from '../../interface/Event';
15
15
  import { IMargin } from '../../interface/Margin';
16
16
  import { IRange, RangeContext } from '../../interface/Range';
@@ -106,6 +106,7 @@ export declare class CommandAdapt {
106
106
  getHTML(): IEditorHTML;
107
107
  getText(): IEditorText;
108
108
  getWordCount(): Promise<number>;
109
+ getCursorPosition(): IElementPosition | null;
109
110
  getRange(): IRange;
110
111
  getRangeText(): string;
111
112
  getRangeContext(): RangeContext | null;
@@ -6,6 +6,7 @@ export declare class TableTool {
6
6
  private readonly ROW_COL_QUICK_OFFSET;
7
7
  private readonly ROW_COL_QUICK_POSITION;
8
8
  private readonly BORDER_VALUE;
9
+ private readonly TABLE_SELECT_OFFSET;
9
10
  private draw;
10
11
  private canvas;
11
12
  private options;
@@ -14,6 +15,7 @@ export declare class TableTool {
14
15
  private toolRowContainer;
15
16
  private toolRowAddBtn;
16
17
  private toolColAddBtn;
18
+ private toolTableSelectBtn;
17
19
  private toolColContainer;
18
20
  private toolBorderContainer;
19
21
  private anchorLine;
@@ -32,6 +32,7 @@ import { LETTER_CLASS } from './dataset/constant/Common';
32
32
  import { INTERNAL_CONTEXT_MENU_KEY } from './dataset/constant/ContextMenu';
33
33
  import { IRange } from './interface/Range';
34
34
  import { splitText } from './utils';
35
+ import { createDomFromElementList } from './utils/element';
35
36
  import { BackgroundRepeat, BackgroundSize } from './dataset/enum/Background';
36
37
  import { TextDecorationStyle } from './dataset/enum/Text';
37
38
  import { LineNumberType } from './dataset/enum/LineNumber';
@@ -45,7 +46,7 @@ export default class Editor {
45
46
  use: UsePlugin;
46
47
  constructor(container: HTMLDivElement, data: IEditorData | IElement[], options?: IEditorOption);
47
48
  }
48
- export { splitText };
49
+ export { splitText, createDomFromElementList };
49
50
  export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY };
50
51
  export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, PageMode, RenderMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder, TdBorder, TdSlash, MaxHeightRatio, NumberType, TitleLevel, ListType, ListStyle, WordBreak, ControlIndentation, BackgroundRepeat, BackgroundSize, TextDecorationStyle, LineNumberType, LocationPosition };
51
52
  export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRange, IRangeStyle };
@@ -106,11 +106,12 @@ export type IGetControlValueResult = (Omit<IControl, 'value'> & {
106
106
  value: string | null;
107
107
  innerText: string | null;
108
108
  zone: EditorZone;
109
+ elementList?: IElement[];
109
110
  })[];
110
111
  export interface ISetControlValueOption {
111
112
  id?: string;
112
113
  conceptId?: string;
113
- value: string;
114
+ value: string | IElement[];
114
115
  }
115
116
  export interface ISetControlExtensionOption {
116
117
  id?: string;
@@ -3,4 +3,5 @@ export interface IFooter {
3
3
  bottom?: number;
4
4
  maxHeightRadio?: MaxHeightRatio;
5
5
  disabled?: boolean;
6
+ editable?: boolean;
6
7
  }
@@ -3,4 +3,5 @@ export interface IHeader {
3
3
  top?: number;
4
4
  maxHeightRadio?: MaxHeightRatio;
5
5
  disabled?: boolean;
6
+ editable?: boolean;
6
7
  }
@@ -4,4 +4,6 @@ export interface IWatermark {
4
4
  opacity?: number;
5
5
  size?: number;
6
6
  font?: string;
7
+ repeat?: boolean;
8
+ gap?: [horizontal: number, vertical: number];
7
9
  }
@@ -33,7 +33,7 @@ export interface IElementListGroupRowFlex {
33
33
  data: IElement[];
34
34
  }
35
35
  export declare function groupElementListByRowFlex(elementList: IElement[]): IElementListGroupRowFlex[];
36
- export declare function createDomFromElementList(elementList: IElement[], options: DeepRequired<IEditorOption>): HTMLDivElement;
36
+ export declare function createDomFromElementList(elementList: IElement[], options?: IEditorOption): HTMLDivElement;
37
37
  export declare function convertTextNodeToElement(textNode: Element | Node): IElement | null;
38
38
  interface IGetElementListByHTMLOption {
39
39
  innerWidth: number;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@hufe921/canvas-editor",
3
3
  "author": "Hufe",
4
4
  "license": "MIT",
5
- "version": "0.9.93",
5
+ "version": "0.9.94",
6
6
  "description": "rich text editor by canvas/svg",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/",