@hufe921/canvas-editor 0.9.93 → 0.9.95
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/CHANGELOG.md +53 -0
- package/dist/canvas-editor.es.js +485 -341
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +35 -35
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/command/Command.d.ts +2 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +4 -1
- package/dist/src/editor/core/draw/control/Control.d.ts +2 -1
- package/dist/src/editor/core/draw/particle/table/TableTool.d.ts +2 -0
- package/dist/src/editor/index.d.ts +3 -2
- package/dist/src/editor/interface/Control.d.ts +11 -1
- package/dist/src/editor/interface/Footer.d.ts +1 -0
- package/dist/src/editor/interface/Header.d.ts +1 -0
- package/dist/src/editor/interface/Search.d.ts +7 -0
- package/dist/src/editor/interface/Watermark.d.ts +2 -0
- package/dist/src/editor/utils/element.d.ts +2 -2
- package/package.json +1 -1
|
@@ -101,12 +101,14 @@ 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'];
|
|
107
108
|
getRangeRow: CommandAdapt['getRangeRow'];
|
|
108
109
|
getRangeParagraph: CommandAdapt['getRangeParagraph'];
|
|
109
110
|
getKeywordRangeList: CommandAdapt['getKeywordRangeList'];
|
|
111
|
+
getKeywordContext: CommandAdapt['getKeywordContext'];
|
|
110
112
|
getPaperMargin: CommandAdapt['getPaperMargin'];
|
|
111
113
|
getSearchNavigateInfo: CommandAdapt['getSearchNavigateInfo'];
|
|
112
114
|
getLocale: CommandAdapt['getLocale'];
|
|
@@ -10,10 +10,11 @@ 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';
|
|
17
|
+
import { ISearchResultContext } from '../../interface/Search';
|
|
17
18
|
import { ITextDecoration } from '../../interface/Text';
|
|
18
19
|
import { IGetTitleValueOption, IGetTitleValueResult } from '../../interface/Title';
|
|
19
20
|
import { IWatermark } from '../../interface/Watermark';
|
|
@@ -106,12 +107,14 @@ export declare class CommandAdapt {
|
|
|
106
107
|
getHTML(): IEditorHTML;
|
|
107
108
|
getText(): IEditorText;
|
|
108
109
|
getWordCount(): Promise<number>;
|
|
110
|
+
getCursorPosition(): IElementPosition | null;
|
|
109
111
|
getRange(): IRange;
|
|
110
112
|
getRangeText(): string;
|
|
111
113
|
getRangeContext(): RangeContext | null;
|
|
112
114
|
getRangeRow(): IElement[] | null;
|
|
113
115
|
getRangeParagraph(): IElement[] | null;
|
|
114
116
|
getKeywordRangeList(payload: string): IRange[];
|
|
117
|
+
getKeywordContext(payload: string): ISearchResultContext[] | null;
|
|
115
118
|
pageMode(payload: PageMode): void;
|
|
116
119
|
pageScaleRecovery(): void;
|
|
117
120
|
pageScaleMinus(): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IControlContext, IControlHighlight, IControlInitOption, IControlInstance, IGetControlValueOption, IGetControlValueResult, IInitNextControlOption, INextControlContext, IRepaintControlOption, ISetControlExtensionOption, ISetControlProperties, ISetControlValueOption } from '../../../interface/Control';
|
|
1
|
+
import { IControlContext, IControlHighlight, IControlInitOption, IControlInstance, IGetControlValueOption, IGetControlValueResult, IInitNextControlOption, INextControlContext, IRepaintControlOption, ISetControlExtensionOption, ISetControlProperties, ISetControlRowFlexOption, ISetControlValueOption } from '../../../interface/Control';
|
|
2
2
|
import { IElement, IElementPosition } from '../../../interface/Element';
|
|
3
3
|
import { IRange } from '../../../interface/Range';
|
|
4
4
|
import { Draw } from '../Draw';
|
|
@@ -55,5 +55,6 @@ export declare class Control {
|
|
|
55
55
|
getPreControlContext(): INextControlContext | null;
|
|
56
56
|
getNextControlContext(): INextControlContext | null;
|
|
57
57
|
initNextControl(option?: IInitNextControlOption): void;
|
|
58
|
+
setMinWidthControlInfo(option: ISetControlRowFlexOption): void;
|
|
58
59
|
}
|
|
59
60
|
export {};
|
|
@@ -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, getElementListByHTML, getTextFromElementList, type IGetElementListByHTMLOption } 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, getElementListByHTML, getTextFromElementList };
|
|
49
50
|
export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY };
|
|
50
|
-
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
|
+
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, IGetElementListByHTMLOption };
|
|
51
52
|
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRange, IRangeStyle };
|
|
@@ -2,10 +2,12 @@ import { LocationPosition } from '../dataset/enum/Common';
|
|
|
2
2
|
import { ControlType, ControlIndentation } from '../dataset/enum/Control';
|
|
3
3
|
import { EditorZone } from '../dataset/enum/Editor';
|
|
4
4
|
import { MoveDirection } from '../dataset/enum/Observer';
|
|
5
|
+
import { RowFlex } from '../dataset/enum/Row';
|
|
5
6
|
import { IDrawOption } from './Draw';
|
|
6
7
|
import { IElement } from './Element';
|
|
7
8
|
import { IPositionContext } from './Position';
|
|
8
9
|
import { IRange } from './Range';
|
|
10
|
+
import { IRow, IRowElement } from './Row';
|
|
9
11
|
export interface IValueSet {
|
|
10
12
|
value: string;
|
|
11
13
|
code: string;
|
|
@@ -53,6 +55,7 @@ export interface IControlBasic {
|
|
|
53
55
|
border?: boolean;
|
|
54
56
|
extension?: unknown;
|
|
55
57
|
indentation?: ControlIndentation;
|
|
58
|
+
rowFlex?: RowFlex;
|
|
56
59
|
}
|
|
57
60
|
export interface IControlStyle {
|
|
58
61
|
font?: string;
|
|
@@ -106,11 +109,12 @@ export type IGetControlValueResult = (Omit<IControl, 'value'> & {
|
|
|
106
109
|
value: string | null;
|
|
107
110
|
innerText: string | null;
|
|
108
111
|
zone: EditorZone;
|
|
112
|
+
elementList?: IElement[];
|
|
109
113
|
})[];
|
|
110
114
|
export interface ISetControlValueOption {
|
|
111
115
|
id?: string;
|
|
112
116
|
conceptId?: string;
|
|
113
|
-
value: string;
|
|
117
|
+
value: string | IElement[];
|
|
114
118
|
}
|
|
115
119
|
export interface ISetControlExtensionOption {
|
|
116
120
|
id?: string;
|
|
@@ -134,3 +138,9 @@ export interface IInitNextControlOption {
|
|
|
134
138
|
export interface ILocationControlOption {
|
|
135
139
|
position: LocationPosition;
|
|
136
140
|
}
|
|
141
|
+
export interface ISetControlRowFlexOption {
|
|
142
|
+
row: IRow;
|
|
143
|
+
rowElement: IRowElement;
|
|
144
|
+
availableWidth: number;
|
|
145
|
+
controlRealWidth: number;
|
|
146
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { EditorContext } from '../dataset/enum/Editor';
|
|
2
|
+
import { IElementPosition } from './Element';
|
|
3
|
+
import { IRange } from './Range';
|
|
2
4
|
export interface ISearchResultBasic {
|
|
3
5
|
type: EditorContext;
|
|
4
6
|
index: number;
|
|
@@ -13,3 +15,8 @@ export interface ISearchResultRestArgs {
|
|
|
13
15
|
startIndex?: number;
|
|
14
16
|
}
|
|
15
17
|
export type ISearchResult = ISearchResultBasic & ISearchResultRestArgs;
|
|
18
|
+
export interface ISearchResultContext {
|
|
19
|
+
range: IRange;
|
|
20
|
+
startPosition: IElementPosition;
|
|
21
|
+
endPosition: IElementPosition;
|
|
22
|
+
}
|
|
@@ -33,9 +33,9 @@ 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
|
|
36
|
+
export declare function createDomFromElementList(elementList: IElement[], options?: IEditorOption): HTMLDivElement;
|
|
37
37
|
export declare function convertTextNodeToElement(textNode: Element | Node): IElement | null;
|
|
38
|
-
interface IGetElementListByHTMLOption {
|
|
38
|
+
export interface IGetElementListByHTMLOption {
|
|
39
39
|
innerWidth: number;
|
|
40
40
|
}
|
|
41
41
|
export declare function getElementListByHTML(htmlText: string, options: IGetElementListByHTMLOption): IElement[];
|