@hufe921/canvas-editor 1.0.2 → 1.0.4

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.
@@ -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;
@@ -70,6 +70,7 @@ export declare class DatePicker {
70
70
  private _updateMonthView;
71
71
  private _switchView;
72
72
  private _toggleDateTimePicker;
73
+ private _createDate;
73
74
  private _setDatePick;
74
75
  private _setTimePick;
75
76
  private _preMonth;
@@ -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 };
@@ -146,6 +146,7 @@ export interface ISetControlValueOption {
146
146
  areaId?: string;
147
147
  value: string | IElement[] | null;
148
148
  isSubmitHistory?: boolean;
149
+ isOverwrite?: boolean;
149
150
  }
150
151
  export interface ISetControlExtensionOption {
151
152
  id?: string;
@@ -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.2",
5
+ "version": "1.0.4",
6
6
  "description": "A Canvas/SVG-based rich text editor",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/",
@@ -51,26 +51,26 @@
51
51
  "@eslint/js": "^10.0.1",
52
52
  "@rollup/plugin-typescript": "^12.3.0",
53
53
  "@types/jsdom": "^28.0.3",
54
- "@types/node": "^24.12.4",
54
+ "@types/node": "^24.13.6",
55
55
  "@types/prismjs": "^1.26.6",
56
- "@typescript-eslint/eslint-plugin": "^8.67.0",
57
- "@typescript-eslint/parser": "^8.67.0",
56
+ "@typescript-eslint/eslint-plugin": "^8.70.1",
57
+ "@typescript-eslint/parser": "^8.70.1",
58
58
  "@vitest/coverage-v8": "^4.1.11",
59
- "cypress": "^15.21.0",
59
+ "cypress": "^15.21.1",
60
60
  "cypress-file-upload": "^5.0.8",
61
- "eslint": "^10.8.1",
62
- "globals": "^17.11.0",
61
+ "eslint": "^10.11.0",
62
+ "globals": "^17.12.0",
63
63
  "jsdom": "^29.1.1",
64
- "simple-git-hooks": "^2.13.1",
64
+ "simple-git-hooks": "^2.14.0",
65
65
  "tslib": "^2.8.1",
66
66
  "typescript": "^6.0.3",
67
- "typescript-eslint": "^8.67.0",
68
- "vite": "^8.2.1",
67
+ "typescript-eslint": "^8.70.1",
68
+ "vite": "^8.3.0",
69
69
  "vite-plugin-css-injected-by-js": "^5.0.1",
70
70
  "vitepress": "^1.6.4",
71
71
  "vitest": "^4.1.11",
72
- "vitest-canvas-mock": "^1.1.5",
73
- "vue": "^3.5.41"
72
+ "vitest-canvas-mock": "^1.2.0",
73
+ "vue": "^3.5.43"
74
74
  },
75
75
  "simple-git-hooks": {
76
76
  "pre-commit": "npm run lint && npm run type:check",