@hufe921/canvas-editor 1.0.2 → 1.0.3
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 +23 -0
- package/dist/assets/value-CLcLo2uw.js.map +1 -1
- package/dist/canvas-editor.js +1686 -1656
- package/dist/canvas-editor.js.map +1 -1
- package/dist/canvas-editor.umd.cjs +37 -37
- package/dist/canvas-editor.umd.cjs.map +1 -1
- package/dist/src/editor/core/command/Command.d.ts +1 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +2 -1
- package/dist/src/editor/dataset/enum/Common.d.ts +4 -0
- package/dist/src/editor/index.d.ts +2 -2
- package/dist/src/editor/interface/Control.d.ts +1 -0
- package/dist/src/editor/interface/Range.d.ts +5 -0
- package/package.json +10 -10
|
@@ -143,6 +143,7 @@ export declare class Command {
|
|
|
143
143
|
getRangeContext: CommandAdapt['getRangeContext'];
|
|
144
144
|
getRangeRow: CommandAdapt['getRangeRow'];
|
|
145
145
|
getRangeParagraph: CommandAdapt['getRangeParagraph'];
|
|
146
|
+
getSurroundElementList: CommandAdapt['getSurroundElementList'];
|
|
146
147
|
getKeywordRangeList: CommandAdapt['getKeywordRangeList'];
|
|
147
148
|
getKeywordContext: CommandAdapt['getKeywordContext'];
|
|
148
149
|
getPaperMargin: CommandAdapt['getPaperMargin'];
|
|
@@ -16,7 +16,7 @@ import { IColumnOption } from '../../interface/Column';
|
|
|
16
16
|
import { IDeleteElementByIdOption, IElement, IElementPosition, IGetElementByIdOption, IImageCaption, IImageCrop, IInsertElementListOption, IUpdateElementByIdOption } from '../../interface/Element';
|
|
17
17
|
import { ICopyOption, IPasteOption, IPositionContextByEventOption, IPositionContextByEventResult } from '../../interface/Event';
|
|
18
18
|
import { IMargin } from '../../interface/Margin';
|
|
19
|
-
import { IRange, RangeContext, RangeRect } from '../../interface/Range';
|
|
19
|
+
import { IGetSurroundElementListOption, IRange, RangeContext, RangeRect } from '../../interface/Range';
|
|
20
20
|
import { IReplaceOption, ISearchOption, ISearchResultContext } from '../../interface/Search';
|
|
21
21
|
import type { ISpellcheckRange } from '../../interface/Spellcheck';
|
|
22
22
|
import { ITextDecoration } from '../../interface/Text';
|
|
@@ -138,6 +138,7 @@ export declare class CommandAdapt {
|
|
|
138
138
|
getRangeContext(): RangeContext | null;
|
|
139
139
|
getRangeRow(): IElement[] | null;
|
|
140
140
|
getRangeParagraph(): IElement[] | null;
|
|
141
|
+
getSurroundElementList(option?: IGetSurroundElementListOption): IElement[] | null;
|
|
141
142
|
getKeywordRangeList(payload: string): IRange[];
|
|
142
143
|
getKeywordContext(payload: string): ISearchResultContext[] | null;
|
|
143
144
|
pageMode(payload: PageMode): void;
|
|
@@ -20,6 +20,10 @@ export declare enum LocationPosition {
|
|
|
20
20
|
OUTER_BEFORE = "outer-before",
|
|
21
21
|
OUTER_AFTER = "outer-after"
|
|
22
22
|
}
|
|
23
|
+
export declare enum SurroundPosition {
|
|
24
|
+
BEFORE = "before",
|
|
25
|
+
AFTER = "after"
|
|
26
|
+
}
|
|
23
27
|
export declare enum FlexDirection {
|
|
24
28
|
ROW = "row",
|
|
25
29
|
COLUMN = "column"
|
|
@@ -4,7 +4,7 @@ import { IElement } from './interface/Element';
|
|
|
4
4
|
import { Command } from './core/command/Command';
|
|
5
5
|
import { Listener } from './core/listener/Listener';
|
|
6
6
|
import { RowFlex } from './dataset/enum/Row';
|
|
7
|
-
import { FlexDirection, ImageDisplay, LocationPosition } from './dataset/enum/Common';
|
|
7
|
+
import { FlexDirection, ImageDisplay, LocationPosition, SurroundPosition } from './dataset/enum/Common';
|
|
8
8
|
import { ElementType } from './dataset/enum/Element';
|
|
9
9
|
import { Register } from './core/register/Register';
|
|
10
10
|
import { IContextMenuContext, IRegisterContextMenu } from './interface/contextmenu/ContextMenu';
|
|
@@ -56,5 +56,5 @@ export default class Editor {
|
|
|
56
56
|
}
|
|
57
57
|
export { splitText, createDomFromElementList, getElementListByHTML, getTextFromElementList };
|
|
58
58
|
export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY, INTERNAL_SHORTCUT_KEY, EDITOR_CLIPBOARD };
|
|
59
|
-
export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, PageMode, RenderMode, ImageDisplay, Command, KeyMap, BlockType, MacroType, PaperDirection, TableBorder, TdBorder, TdSlash, MaxHeightRatio, NumberType, TitleLevel, ListType, ListStyle, WordBreak, ControlIndentation, ControlComponent, BackgroundRepeat, BackgroundSize, TextDecorationStyle, LineNumberType, LocationPosition, AreaMode, ControlState, FlexDirection, WatermarkType, WatermarkLayer };
|
|
59
|
+
export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, PageMode, RenderMode, ImageDisplay, Command, KeyMap, BlockType, MacroType, PaperDirection, TableBorder, TdBorder, TdSlash, MaxHeightRatio, NumberType, TitleLevel, ListType, ListStyle, WordBreak, ControlIndentation, ControlComponent, BackgroundRepeat, BackgroundSize, TextDecorationStyle, LineNumberType, LocationPosition, SurroundPosition, AreaMode, ControlState, FlexDirection, WatermarkType, WatermarkLayer };
|
|
60
60
|
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRange, IRangeStyle, RangeRect, IBadge, IGetElementListByHTMLOption };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EditorZone } from '../dataset/enum/Editor';
|
|
2
|
+
import { SurroundPosition } from '../dataset/enum/Common';
|
|
2
3
|
import { IElement, IElementFillRect, IElementStyle } from './Element';
|
|
3
4
|
export interface IRange {
|
|
4
5
|
startIndex: number;
|
|
@@ -42,3 +43,7 @@ export interface IRangeParagraphInfo {
|
|
|
42
43
|
startIndex: number;
|
|
43
44
|
}
|
|
44
45
|
export type IRangeElementStyle = Pick<IElementStyle, 'bold' | 'color' | 'highlight' | 'font' | 'size' | 'italic' | 'underline' | 'strikeout'>;
|
|
46
|
+
export interface IGetSurroundElementListOption {
|
|
47
|
+
direction?: SurroundPosition;
|
|
48
|
+
length?: number;
|
|
49
|
+
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@hufe921/canvas-editor",
|
|
3
3
|
"author": "Hufe",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.3",
|
|
6
6
|
"description": "A Canvas/SVG-based rich text editor",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -53,24 +53,24 @@
|
|
|
53
53
|
"@types/jsdom": "^28.0.3",
|
|
54
54
|
"@types/node": "^24.12.4",
|
|
55
55
|
"@types/prismjs": "^1.26.6",
|
|
56
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
57
|
-
"@typescript-eslint/parser": "^8.
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^8.69.0",
|
|
57
|
+
"@typescript-eslint/parser": "^8.69.0",
|
|
58
58
|
"@vitest/coverage-v8": "^4.1.11",
|
|
59
|
-
"cypress": "^15.21.
|
|
59
|
+
"cypress": "^15.21.1",
|
|
60
60
|
"cypress-file-upload": "^5.0.8",
|
|
61
|
-
"eslint": "^10.
|
|
62
|
-
"globals": "^17.
|
|
61
|
+
"eslint": "^10.9.1",
|
|
62
|
+
"globals": "^17.12.0",
|
|
63
63
|
"jsdom": "^29.1.1",
|
|
64
|
-
"simple-git-hooks": "^2.
|
|
64
|
+
"simple-git-hooks": "^2.14.0",
|
|
65
65
|
"tslib": "^2.8.1",
|
|
66
66
|
"typescript": "^6.0.3",
|
|
67
|
-
"typescript-eslint": "^8.
|
|
68
|
-
"vite": "^8.2.
|
|
67
|
+
"typescript-eslint": "^8.69.0",
|
|
68
|
+
"vite": "^8.2.2",
|
|
69
69
|
"vite-plugin-css-injected-by-js": "^5.0.1",
|
|
70
70
|
"vitepress": "^1.6.4",
|
|
71
71
|
"vitest": "^4.1.11",
|
|
72
72
|
"vitest-canvas-mock": "^1.1.5",
|
|
73
|
-
"vue": "^3.5.
|
|
73
|
+
"vue": "^3.5.42"
|
|
74
74
|
},
|
|
75
75
|
"simple-git-hooks": {
|
|
76
76
|
"pre-commit": "npm run lint && npm run type:check",
|