@hufe921/canvas-editor 0.9.94 → 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.
@@ -108,6 +108,7 @@ export declare class Command {
108
108
  getRangeRow: CommandAdapt['getRangeRow'];
109
109
  getRangeParagraph: CommandAdapt['getRangeParagraph'];
110
110
  getKeywordRangeList: CommandAdapt['getKeywordRangeList'];
111
+ getKeywordContext: CommandAdapt['getKeywordContext'];
111
112
  getPaperMargin: CommandAdapt['getPaperMargin'];
112
113
  getSearchNavigateInfo: CommandAdapt['getSearchNavigateInfo'];
113
114
  getLocale: CommandAdapt['getLocale'];
@@ -14,6 +14,7 @@ import { IElement, IElementPosition, IUpdateElementByIdOption } from '../../inte
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';
@@ -113,6 +114,7 @@ export declare class CommandAdapt {
113
114
  getRangeRow(): IElement[] | null;
114
115
  getRangeParagraph(): IElement[] | null;
115
116
  getKeywordRangeList(payload: string): IRange[];
117
+ getKeywordContext(payload: string): ISearchResultContext[] | null;
116
118
  pageMode(payload: PageMode): void;
117
119
  pageScaleRecovery(): void;
118
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 {};
@@ -32,7 +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
+ import { createDomFromElementList, getElementListByHTML, getTextFromElementList, type IGetElementListByHTMLOption } from './utils/element';
36
36
  import { BackgroundRepeat, BackgroundSize } from './dataset/enum/Background';
37
37
  import { TextDecorationStyle } from './dataset/enum/Text';
38
38
  import { LineNumberType } from './dataset/enum/LineNumber';
@@ -46,7 +46,7 @@ export default class Editor {
46
46
  use: UsePlugin;
47
47
  constructor(container: HTMLDivElement, data: IEditorData | IElement[], options?: IEditorOption);
48
48
  }
49
- export { splitText, createDomFromElementList };
49
+ export { splitText, createDomFromElementList, getElementListByHTML, getTextFromElementList };
50
50
  export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY };
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
+ 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 };
52
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;
@@ -135,3 +138,9 @@ export interface IInitNextControlOption {
135
138
  export interface ILocationControlOption {
136
139
  position: LocationPosition;
137
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
+ }
@@ -35,7 +35,7 @@ export interface IElementListGroupRowFlex {
35
35
  export declare function groupElementListByRowFlex(elementList: IElement[]): IElementListGroupRowFlex[];
36
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[];
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.94",
5
+ "version": "0.9.95",
6
6
  "description": "rich text editor by canvas/svg",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/",