@agile_jy/word-editor 0.0.1

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.
Files changed (230) hide show
  1. package/CHANGELOG.md +2543 -0
  2. package/LICENSE +21 -0
  3. package/README.md +110 -0
  4. package/dist/canvas-editor.es.js +25197 -0
  5. package/dist/canvas-editor.es.js.map +1 -0
  6. package/dist/canvas-editor.umd.js +97 -0
  7. package/dist/canvas-editor.umd.js.map +1 -0
  8. package/dist/src/editor/core/actuator/Actuator.d.ts +7 -0
  9. package/dist/src/editor/core/actuator/handlers/positionContextChange.d.ts +3 -0
  10. package/dist/src/editor/core/command/Command.d.ts +147 -0
  11. package/dist/src/editor/core/command/CommandAdapt.d.ts +190 -0
  12. package/dist/src/editor/core/contextmenu/ContextMenu.d.ts +31 -0
  13. package/dist/src/editor/core/contextmenu/menus/controlMenus.d.ts +2 -0
  14. package/dist/src/editor/core/contextmenu/menus/globalMenus.d.ts +2 -0
  15. package/dist/src/editor/core/contextmenu/menus/hyperlinkMenus.d.ts +2 -0
  16. package/dist/src/editor/core/contextmenu/menus/imageMenus.d.ts +2 -0
  17. package/dist/src/editor/core/contextmenu/menus/tableMenus.d.ts +2 -0
  18. package/dist/src/editor/core/cursor/Cursor.d.ts +41 -0
  19. package/dist/src/editor/core/cursor/CursorAgent.d.ts +16 -0
  20. package/dist/src/editor/core/draw/Draw.d.ts +252 -0
  21. package/dist/src/editor/core/draw/control/Control.d.ts +73 -0
  22. package/dist/src/editor/core/draw/control/checkbox/CheckboxControl.d.ts +16 -0
  23. package/dist/src/editor/core/draw/control/date/DateControl.d.ts +24 -0
  24. package/dist/src/editor/core/draw/control/interactive/ControlSearch.d.ts +20 -0
  25. package/dist/src/editor/core/draw/control/number/Calculator.d.ts +16 -0
  26. package/dist/src/editor/core/draw/control/number/NumberControl.d.ts +13 -0
  27. package/dist/src/editor/core/draw/control/radio/RadioControl.d.ts +5 -0
  28. package/dist/src/editor/core/draw/control/richtext/Border.d.ts +10 -0
  29. package/dist/src/editor/core/draw/control/select/SelectControl.d.ts +28 -0
  30. package/dist/src/editor/core/draw/control/text/TextControl.d.ts +18 -0
  31. package/dist/src/editor/core/draw/frame/Background.d.ts +11 -0
  32. package/dist/src/editor/core/draw/frame/Badge.d.ts +14 -0
  33. package/dist/src/editor/core/draw/frame/Footer.d.ts +27 -0
  34. package/dist/src/editor/core/draw/frame/Header.d.ts +27 -0
  35. package/dist/src/editor/core/draw/frame/LineNumber.d.ts +7 -0
  36. package/dist/src/editor/core/draw/frame/Margin.d.ts +7 -0
  37. package/dist/src/editor/core/draw/frame/PageBorder.d.ts +9 -0
  38. package/dist/src/editor/core/draw/frame/PageNumber.d.ts +9 -0
  39. package/dist/src/editor/core/draw/frame/Placeholder.d.ts +20 -0
  40. package/dist/src/editor/core/draw/frame/Watermark.d.ts +10 -0
  41. package/dist/src/editor/core/draw/graffiti/Graffiti.d.ts +19 -0
  42. package/dist/src/editor/core/draw/interactive/Area.d.ts +27 -0
  43. package/dist/src/editor/core/draw/interactive/Group.d.ts +18 -0
  44. package/dist/src/editor/core/draw/interactive/Search.d.ts +30 -0
  45. package/dist/src/editor/core/draw/particle/CheckboxParticle.d.ts +18 -0
  46. package/dist/src/editor/core/draw/particle/HyperlinkParticle.d.ts +17 -0
  47. package/dist/src/editor/core/draw/particle/ImageParticle.d.ts +23 -0
  48. package/dist/src/editor/core/draw/particle/LabelParticle.d.ts +8 -0
  49. package/dist/src/editor/core/draw/particle/LineBreakParticle.d.ts +10 -0
  50. package/dist/src/editor/core/draw/particle/ListParticle.d.ts +20 -0
  51. package/dist/src/editor/core/draw/particle/PageBreakParticle.d.ts +9 -0
  52. package/dist/src/editor/core/draw/particle/RadioParticle.d.ts +18 -0
  53. package/dist/src/editor/core/draw/particle/SeparatorParticle.d.ts +7 -0
  54. package/dist/src/editor/core/draw/particle/SubscriptParticle.d.ts +5 -0
  55. package/dist/src/editor/core/draw/particle/SuperscriptParticle.d.ts +5 -0
  56. package/dist/src/editor/core/draw/particle/TextParticle.d.ts +29 -0
  57. package/dist/src/editor/core/draw/particle/WhiteSpaceParticle.d.ts +7 -0
  58. package/dist/src/editor/core/draw/particle/block/BlockParticle.d.ts +14 -0
  59. package/dist/src/editor/core/draw/particle/block/modules/BaseBlock.d.ts +33 -0
  60. package/dist/src/editor/core/draw/particle/block/modules/IFrameBlock.d.ts +9 -0
  61. package/dist/src/editor/core/draw/particle/block/modules/VideoBlock.d.ts +8 -0
  62. package/dist/src/editor/core/draw/particle/date/DateParticle.d.ts +13 -0
  63. package/dist/src/editor/core/draw/particle/date/DatePicker.d.ts +64 -0
  64. package/dist/src/editor/core/draw/particle/latex/LaTexParticle.d.ts +7 -0
  65. package/dist/src/editor/core/draw/particle/latex/utils/LaTexUtils.d.ts +47 -0
  66. package/dist/src/editor/core/draw/particle/latex/utils/hershey.d.ts +10 -0
  67. package/dist/src/editor/core/draw/particle/latex/utils/symbols.d.ts +8 -0
  68. package/dist/src/editor/core/draw/particle/previewer/Previewer.d.ts +47 -0
  69. package/dist/src/editor/core/draw/particle/table/TableOperate.d.ts +32 -0
  70. package/dist/src/editor/core/draw/particle/table/TableParticle.d.ts +24 -0
  71. package/dist/src/editor/core/draw/particle/table/TableTool.d.ts +31 -0
  72. package/dist/src/editor/core/draw/richtext/AbstractRichText.d.ts +11 -0
  73. package/dist/src/editor/core/draw/richtext/Highlight.d.ts +7 -0
  74. package/dist/src/editor/core/draw/richtext/Strikeout.d.ts +7 -0
  75. package/dist/src/editor/core/draw/richtext/Underline.d.ts +10 -0
  76. package/dist/src/editor/core/event/CanvasEvent.d.ts +52 -0
  77. package/dist/src/editor/core/event/GlobalEvent.d.ts +26 -0
  78. package/dist/src/editor/core/event/eventbus/EventBus.d.ts +9 -0
  79. package/dist/src/editor/core/event/handlers/click.d.ts +11 -0
  80. package/dist/src/editor/core/event/handlers/composition.d.ts +8 -0
  81. package/dist/src/editor/core/event/handlers/copy.d.ts +3 -0
  82. package/dist/src/editor/core/event/handlers/cut.d.ts +2 -0
  83. package/dist/src/editor/core/event/handlers/drag.d.ts +6 -0
  84. package/dist/src/editor/core/event/handlers/drop.d.ts +2 -0
  85. package/dist/src/editor/core/event/handlers/input.d.ts +3 -0
  86. package/dist/src/editor/core/event/handlers/keydown/backspace.d.ts +2 -0
  87. package/dist/src/editor/core/event/handlers/keydown/delete.d.ts +2 -0
  88. package/dist/src/editor/core/event/handlers/keydown/enter.d.ts +2 -0
  89. package/dist/src/editor/core/event/handlers/keydown/index.d.ts +2 -0
  90. package/dist/src/editor/core/event/handlers/keydown/left.d.ts +2 -0
  91. package/dist/src/editor/core/event/handlers/keydown/right.d.ts +2 -0
  92. package/dist/src/editor/core/event/handlers/keydown/tab.d.ts +2 -0
  93. package/dist/src/editor/core/event/handlers/keydown/updown.d.ts +2 -0
  94. package/dist/src/editor/core/event/handlers/mousedown.d.ts +7 -0
  95. package/dist/src/editor/core/event/handlers/mouseleave.d.ts +2 -0
  96. package/dist/src/editor/core/event/handlers/mousemove.d.ts +2 -0
  97. package/dist/src/editor/core/event/handlers/mouseup.d.ts +2 -0
  98. package/dist/src/editor/core/event/handlers/paste.d.ts +8 -0
  99. package/dist/src/editor/core/history/HistoryManager.d.ts +15 -0
  100. package/dist/src/editor/core/i18n/I18n.d.ts +12 -0
  101. package/dist/src/editor/core/listener/Listener.d.ts +15 -0
  102. package/dist/src/editor/core/observer/ImageObserver.d.ts +7 -0
  103. package/dist/src/editor/core/observer/MouseObserver.d.ts +13 -0
  104. package/dist/src/editor/core/observer/ScrollObserver.d.ts +20 -0
  105. package/dist/src/editor/core/observer/SelectionObserver.d.ts +22 -0
  106. package/dist/src/editor/core/override/Override.d.ts +8 -0
  107. package/dist/src/editor/core/plugin/Plugin.d.ts +7 -0
  108. package/dist/src/editor/core/position/Position.d.ts +37 -0
  109. package/dist/src/editor/core/range/RangeManager.d.ts +45 -0
  110. package/dist/src/editor/core/register/Register.d.ts +20 -0
  111. package/dist/src/editor/core/shortcut/Shortcut.d.ts +16 -0
  112. package/dist/src/editor/core/shortcut/keys/listKeys.d.ts +2 -0
  113. package/dist/src/editor/core/shortcut/keys/richtextKeys.d.ts +2 -0
  114. package/dist/src/editor/core/shortcut/keys/titleKeys.d.ts +2 -0
  115. package/dist/src/editor/core/worker/WorkerManager.d.ts +16 -0
  116. package/dist/src/editor/core/worker/works/catalog.d.ts +1 -0
  117. package/dist/src/editor/core/worker/works/group.d.ts +1 -0
  118. package/dist/src/editor/core/worker/works/value.d.ts +1 -0
  119. package/dist/src/editor/core/worker/works/wordCount.d.ts +1 -0
  120. package/dist/src/editor/core/zone/Zone.d.ts +21 -0
  121. package/dist/src/editor/core/zone/ZoneTip.d.ts +17 -0
  122. package/dist/src/editor/dataset/constant/Background.d.ts +2 -0
  123. package/dist/src/editor/dataset/constant/Badge.d.ts +2 -0
  124. package/dist/src/editor/dataset/constant/Checkbox.d.ts +2 -0
  125. package/dist/src/editor/dataset/constant/Common.d.ts +21 -0
  126. package/dist/src/editor/dataset/constant/ContextMenu.d.ts +60 -0
  127. package/dist/src/editor/dataset/constant/Control.d.ts +2 -0
  128. package/dist/src/editor/dataset/constant/Cursor.d.ts +3 -0
  129. package/dist/src/editor/dataset/constant/Editor.d.ts +6 -0
  130. package/dist/src/editor/dataset/constant/Element.d.ts +21 -0
  131. package/dist/src/editor/dataset/constant/Footer.d.ts +2 -0
  132. package/dist/src/editor/dataset/constant/Graffiti.d.ts +2 -0
  133. package/dist/src/editor/dataset/constant/Group.d.ts +2 -0
  134. package/dist/src/editor/dataset/constant/Header.d.ts +2 -0
  135. package/dist/src/editor/dataset/constant/ImgCaption.d.ts +2 -0
  136. package/dist/src/editor/dataset/constant/Label.d.ts +2 -0
  137. package/dist/src/editor/dataset/constant/LineBreak.d.ts +2 -0
  138. package/dist/src/editor/dataset/constant/LineNumber.d.ts +2 -0
  139. package/dist/src/editor/dataset/constant/List.d.ts +6 -0
  140. package/dist/src/editor/dataset/constant/PageBorder.d.ts +2 -0
  141. package/dist/src/editor/dataset/constant/PageBreak.d.ts +2 -0
  142. package/dist/src/editor/dataset/constant/PageNumber.d.ts +6 -0
  143. package/dist/src/editor/dataset/constant/Placeholder.d.ts +2 -0
  144. package/dist/src/editor/dataset/constant/Radio.d.ts +2 -0
  145. package/dist/src/editor/dataset/constant/Regular.d.ts +10 -0
  146. package/dist/src/editor/dataset/constant/Separator.d.ts +2 -0
  147. package/dist/src/editor/dataset/constant/Shortcut.d.ts +3 -0
  148. package/dist/src/editor/dataset/constant/Table.d.ts +2 -0
  149. package/dist/src/editor/dataset/constant/Title.d.ts +6 -0
  150. package/dist/src/editor/dataset/constant/Watermark.d.ts +2 -0
  151. package/dist/src/editor/dataset/constant/WhiteSpace.d.ts +2 -0
  152. package/dist/src/editor/dataset/constant/Zone.d.ts +2 -0
  153. package/dist/src/editor/dataset/enum/Area.d.ts +5 -0
  154. package/dist/src/editor/dataset/enum/Background.d.ts +10 -0
  155. package/dist/src/editor/dataset/enum/Block.d.ts +4 -0
  156. package/dist/src/editor/dataset/enum/Common.d.ts +26 -0
  157. package/dist/src/editor/dataset/enum/Control.d.ts +32 -0
  158. package/dist/src/editor/dataset/enum/Editor.d.ts +44 -0
  159. package/dist/src/editor/dataset/enum/Element.d.ts +21 -0
  160. package/dist/src/editor/dataset/enum/ElementStyle.d.ts +12 -0
  161. package/dist/src/editor/dataset/enum/Event.d.ts +5 -0
  162. package/dist/src/editor/dataset/enum/KeyMap.d.ts +83 -0
  163. package/dist/src/editor/dataset/enum/LineNumber.d.ts +4 -0
  164. package/dist/src/editor/dataset/enum/List.d.ts +20 -0
  165. package/dist/src/editor/dataset/enum/Observer.d.ts +6 -0
  166. package/dist/src/editor/dataset/enum/Row.d.ts +7 -0
  167. package/dist/src/editor/dataset/enum/Text.d.ts +12 -0
  168. package/dist/src/editor/dataset/enum/Title.d.ts +8 -0
  169. package/dist/src/editor/dataset/enum/VerticalAlign.d.ts +5 -0
  170. package/dist/src/editor/dataset/enum/Watermark.d.ts +4 -0
  171. package/dist/src/editor/dataset/enum/table/Table.d.ts +17 -0
  172. package/dist/src/editor/dataset/enum/table/TableTool.d.ts +4 -0
  173. package/dist/src/editor/index.d.ts +59 -0
  174. package/dist/src/editor/interface/Area.d.ts +55 -0
  175. package/dist/src/editor/interface/Background.d.ts +8 -0
  176. package/dist/src/editor/interface/Badge.d.ts +15 -0
  177. package/dist/src/editor/interface/Block.d.ts +15 -0
  178. package/dist/src/editor/interface/Catalog.d.ts +9 -0
  179. package/dist/src/editor/interface/Checkbox.d.ts +15 -0
  180. package/dist/src/editor/interface/Command.d.ts +3 -0
  181. package/dist/src/editor/interface/Common.d.ts +14 -0
  182. package/dist/src/editor/interface/Control.d.ts +198 -0
  183. package/dist/src/editor/interface/Cursor.d.ts +7 -0
  184. package/dist/src/editor/interface/Draw.d.ts +74 -0
  185. package/dist/src/editor/interface/Editor.d.ts +143 -0
  186. package/dist/src/editor/interface/Element.d.ts +234 -0
  187. package/dist/src/editor/interface/Event.d.ts +22 -0
  188. package/dist/src/editor/interface/EventBus.d.ts +26 -0
  189. package/dist/src/editor/interface/Footer.d.ts +8 -0
  190. package/dist/src/editor/interface/Graffiti.d.ts +13 -0
  191. package/dist/src/editor/interface/Group.d.ts +8 -0
  192. package/dist/src/editor/interface/Header.d.ts +8 -0
  193. package/dist/src/editor/interface/Label.d.ts +7 -0
  194. package/dist/src/editor/interface/LineBreak.d.ts +5 -0
  195. package/dist/src/editor/interface/LineNumber.d.ts +9 -0
  196. package/dist/src/editor/interface/Listener.d.ts +66 -0
  197. package/dist/src/editor/interface/Margin.d.ts +1 -0
  198. package/dist/src/editor/interface/PageBorder.d.ts +7 -0
  199. package/dist/src/editor/interface/PageBreak.d.ts +5 -0
  200. package/dist/src/editor/interface/PageNumber.d.ts +15 -0
  201. package/dist/src/editor/interface/Placeholder.d.ts +7 -0
  202. package/dist/src/editor/interface/Plugin.d.ts +3 -0
  203. package/dist/src/editor/interface/Position.d.ts +103 -0
  204. package/dist/src/editor/interface/Previewer.d.ts +13 -0
  205. package/dist/src/editor/interface/Radio.d.ts +15 -0
  206. package/dist/src/editor/interface/Range.d.ts +44 -0
  207. package/dist/src/editor/interface/Row.d.ts +23 -0
  208. package/dist/src/editor/interface/Search.d.ts +30 -0
  209. package/dist/src/editor/interface/Separator.d.ts +4 -0
  210. package/dist/src/editor/interface/Text.d.ts +13 -0
  211. package/dist/src/editor/interface/Title.d.ts +26 -0
  212. package/dist/src/editor/interface/Watermark.d.ts +15 -0
  213. package/dist/src/editor/interface/WhiteSpace.d.ts +5 -0
  214. package/dist/src/editor/interface/Zone.d.ts +3 -0
  215. package/dist/src/editor/interface/contextmenu/ContextMenu.d.ts +73 -0
  216. package/dist/src/editor/interface/i18n/I18n.d.ts +6 -0
  217. package/dist/src/editor/interface/shortcut/Shortcut.d.ts +13 -0
  218. package/dist/src/editor/interface/table/Colgroup.d.ts +4 -0
  219. package/dist/src/editor/interface/table/Table.d.ts +8 -0
  220. package/dist/src/editor/interface/table/Td.d.ts +35 -0
  221. package/dist/src/editor/interface/table/Tr.d.ts +10 -0
  222. package/dist/src/editor/utils/clipboard.d.ts +13 -0
  223. package/dist/src/editor/utils/element.d.ts +57 -0
  224. package/dist/src/editor/utils/hotkey.d.ts +1 -0
  225. package/dist/src/editor/utils/index.d.ts +34 -0
  226. package/dist/src/editor/utils/option.d.ts +3 -0
  227. package/dist/src/editor/utils/paragraph.d.ts +8 -0
  228. package/dist/src/editor/utils/print.d.ts +7 -0
  229. package/dist/src/editor/utils/ua.d.ts +4 -0
  230. package/package.json +77 -0
@@ -0,0 +1,30 @@
1
+ import { EditorContext } from '../dataset/enum/Editor';
2
+ import { IElementPosition } from './Element';
3
+ import { IRange } from './Range';
4
+ export interface ISearchResultBasic {
5
+ type: EditorContext;
6
+ index: number;
7
+ groupId: string;
8
+ }
9
+ export interface ISearchResultRestArgs {
10
+ tableId?: string;
11
+ tableIndex?: number;
12
+ trIndex?: number;
13
+ tdIndex?: number;
14
+ tdId?: string;
15
+ startIndex?: number;
16
+ }
17
+ export type ISearchResult = ISearchResultBasic & ISearchResultRestArgs;
18
+ export interface ISearchResultContext {
19
+ range: IRange;
20
+ startPosition: IElementPosition;
21
+ endPosition: IElementPosition;
22
+ }
23
+ export interface IReplaceOption {
24
+ index?: number;
25
+ }
26
+ export interface ISearchOption {
27
+ isRegEnable?: boolean;
28
+ isIgnoreCase?: boolean;
29
+ isLimitSelection?: boolean;
30
+ }
@@ -0,0 +1,4 @@
1
+ export interface ISeparatorOption {
2
+ strokeStyle?: string;
3
+ lineWidth?: number;
4
+ }
@@ -0,0 +1,13 @@
1
+ import { TextDecorationStyle } from '../dataset/enum/Text';
2
+ export interface ITextMetrics {
3
+ width: number;
4
+ actualBoundingBoxAscent: number;
5
+ actualBoundingBoxDescent: number;
6
+ actualBoundingBoxLeft: number;
7
+ actualBoundingBoxRight: number;
8
+ fontBoundingBoxAscent: number;
9
+ fontBoundingBoxDescent: number;
10
+ }
11
+ export interface ITextDecoration {
12
+ style?: TextDecorationStyle;
13
+ }
@@ -0,0 +1,26 @@
1
+ import { EditorZone } from '../dataset/enum/Editor';
2
+ import { IElement } from './Element';
3
+ export interface ITitleSizeOption {
4
+ defaultFirstSize?: number;
5
+ defaultSecondSize?: number;
6
+ defaultThirdSize?: number;
7
+ defaultFourthSize?: number;
8
+ defaultFifthSize?: number;
9
+ defaultSixthSize?: number;
10
+ }
11
+ export type ITitleOption = ITitleSizeOption & {};
12
+ export interface ITitleRule {
13
+ deletable?: boolean;
14
+ disabled?: boolean;
15
+ }
16
+ export type ITitle = ITitleRule & {
17
+ conceptId?: string;
18
+ };
19
+ export interface IGetTitleValueOption {
20
+ conceptId: string;
21
+ }
22
+ export type IGetTitleValueResult = (ITitle & {
23
+ value: string | null;
24
+ elementList: IElement[];
25
+ zone: EditorZone;
26
+ })[];
@@ -0,0 +1,15 @@
1
+ import { NumberType } from '../dataset/enum/Common';
2
+ import { WatermarkType } from '../dataset/enum/Watermark';
3
+ export interface IWatermark {
4
+ data: string;
5
+ type?: WatermarkType;
6
+ width?: number;
7
+ height?: number;
8
+ color?: string;
9
+ opacity?: number;
10
+ size?: number;
11
+ font?: string;
12
+ repeat?: boolean;
13
+ numberType?: NumberType;
14
+ gap?: [horizontal: number, vertical: number];
15
+ }
@@ -0,0 +1,5 @@
1
+ export interface IWhiteSpaceOption {
2
+ disabled?: boolean;
3
+ color?: string;
4
+ radius?: number;
5
+ }
@@ -0,0 +1,3 @@
1
+ export interface IZoneOption {
2
+ tipDisabled?: boolean;
3
+ }
@@ -0,0 +1,73 @@
1
+ import { Command } from '../../core/command/Command';
2
+ import { EditorZone } from '../../dataset/enum/Editor';
3
+ import { DeepRequired } from '../Common';
4
+ import { IEditorOption } from '../Editor';
5
+ import { IElement } from '../Element';
6
+ export interface IContextMenuContext {
7
+ startElement: IElement | null;
8
+ endElement: IElement | null;
9
+ isReadonly: boolean;
10
+ editorHasSelection: boolean;
11
+ editorTextFocus: boolean;
12
+ isInTable: boolean;
13
+ isCrossRowCol: boolean;
14
+ zone: EditorZone;
15
+ trIndex: number | null;
16
+ tdIndex: number | null;
17
+ tableElement: IElement | null;
18
+ options: DeepRequired<IEditorOption>;
19
+ }
20
+ export interface IRegisterContextMenu {
21
+ key?: string;
22
+ i18nPath?: string;
23
+ isDivider?: boolean;
24
+ icon?: string;
25
+ name?: string;
26
+ shortCut?: string;
27
+ disable?: boolean;
28
+ when?: (payload: IContextMenuContext) => boolean;
29
+ callback?: (command: Command, context: IContextMenuContext) => void;
30
+ childMenus?: IRegisterContextMenu[];
31
+ }
32
+ export interface IContextmenuLang {
33
+ global: {
34
+ cut: string;
35
+ copy: string;
36
+ paste: string;
37
+ selectAll: string;
38
+ print: string;
39
+ };
40
+ control: {
41
+ delete: string;
42
+ };
43
+ hyperlink: {
44
+ delete: string;
45
+ cancel: string;
46
+ edit: string;
47
+ };
48
+ image: {
49
+ change: string;
50
+ saveAs: string;
51
+ textWrap: string;
52
+ textWrapType: {
53
+ embed: string;
54
+ upDown: string;
55
+ surround: string;
56
+ floatTop: string;
57
+ floatBottom: string;
58
+ };
59
+ };
60
+ table: {
61
+ insertRowCol: string;
62
+ insertTopRow: string;
63
+ insertBottomRow: string;
64
+ insertLeftCol: string;
65
+ insertRightCol: string;
66
+ deleteRowCol: string;
67
+ deleteRow: string;
68
+ deleteCol: string;
69
+ deleteTable: string;
70
+ mergeCell: string;
71
+ mergeCancelCell: string;
72
+ };
73
+ }
@@ -0,0 +1,6 @@
1
+ import { IDatePickerLang } from '../../core/draw/particle/date/DatePicker';
2
+ import { IContextmenuLang } from '../contextmenu/ContextMenu';
3
+ export interface ILang {
4
+ contextmenu: IContextmenuLang;
5
+ datePicker: IDatePickerLang;
6
+ }
@@ -0,0 +1,13 @@
1
+ import { Command } from '../../core/command/Command';
2
+ import { KeyMap } from '../../dataset/enum/KeyMap';
3
+ export interface IRegisterShortcut {
4
+ key: KeyMap;
5
+ ctrl?: boolean;
6
+ meta?: boolean;
7
+ mod?: boolean;
8
+ shift?: boolean;
9
+ alt?: boolean;
10
+ isGlobal?: boolean;
11
+ callback?: (command: Command) => void;
12
+ disable?: boolean;
13
+ }
@@ -0,0 +1,4 @@
1
+ export interface IColgroup {
2
+ id?: string;
3
+ width: number;
4
+ }
@@ -0,0 +1,8 @@
1
+ import { IPadding } from '../Common';
2
+ export interface ITableOption {
3
+ tdPadding?: IPadding;
4
+ defaultTrMinHeight?: number;
5
+ defaultColMinWidth?: number;
6
+ defaultBorderColor?: string;
7
+ overflow?: boolean;
8
+ }
@@ -0,0 +1,35 @@
1
+ import { VerticalAlign } from '../../dataset/enum/VerticalAlign';
2
+ import { TdBorder, TdSlash } from '../../dataset/enum/table/Table';
3
+ import { IElement, IElementPosition } from '../Element';
4
+ import { IRow } from '../Row';
5
+ export interface ITd {
6
+ conceptId?: string;
7
+ id?: string;
8
+ extension?: unknown;
9
+ externalId?: string;
10
+ x?: number;
11
+ y?: number;
12
+ width?: number;
13
+ height?: number;
14
+ colspan: number;
15
+ rowspan: number;
16
+ value: IElement[];
17
+ trIndex?: number;
18
+ tdIndex?: number;
19
+ isLastRowTd?: boolean;
20
+ isLastColTd?: boolean;
21
+ isLastTd?: boolean;
22
+ rowIndex?: number;
23
+ colIndex?: number;
24
+ rowList?: IRow[];
25
+ positionList?: IElementPosition[];
26
+ verticalAlign?: VerticalAlign;
27
+ backgroundColor?: string;
28
+ borderTypes?: TdBorder[];
29
+ slashTypes?: TdSlash[];
30
+ mainHeight?: number;
31
+ realHeight?: number;
32
+ realMinHeight?: number;
33
+ disabled?: boolean;
34
+ deletable?: boolean;
35
+ }
@@ -0,0 +1,10 @@
1
+ import { ITd } from './Td';
2
+ export interface ITr {
3
+ id?: string;
4
+ extension?: unknown;
5
+ externalId?: string;
6
+ height: number;
7
+ tdList: ITd[];
8
+ minHeight?: number;
9
+ pagingRepeat?: boolean;
10
+ }
@@ -0,0 +1,13 @@
1
+ import { DeepRequired } from '../interface/Common';
2
+ import { IEditorOption } from '../interface/Editor';
3
+ import { IElement } from '../interface/Element';
4
+ export interface IClipboardData {
5
+ text: string;
6
+ elementList: IElement[];
7
+ }
8
+ export declare function setClipboardData(data: IClipboardData): void;
9
+ export declare function getClipboardData(): IClipboardData | null;
10
+ export declare function removeClipboardData(): void;
11
+ export declare function writeClipboardItem(text: string, html: string, elementList: IElement[]): Promise<void>;
12
+ export declare function writeElementList(elementList: IElement[], options: DeepRequired<IEditorOption>): Promise<void>;
13
+ export declare function getIsClipboardContainFile(clipboardData: DataTransfer): boolean;
@@ -0,0 +1,57 @@
1
+ import { LocationPosition } from '../dataset/enum/Common';
2
+ import { RowFlex } from '../dataset/enum/Row';
3
+ import { DeepRequired } from '../interface/Common';
4
+ import { IEditorOption } from '../interface/Editor';
5
+ import { IElement } from '../interface/Element';
6
+ export declare function unzipElementList(elementList: IElement[]): IElement[];
7
+ interface IFormatElementListOption {
8
+ isHandleFirstElement?: boolean;
9
+ isForceCompensation?: boolean;
10
+ editorOptions: DeepRequired<IEditorOption>;
11
+ }
12
+ export declare function formatElementList(elementList: IElement[], options: IFormatElementListOption): void;
13
+ export declare function isSameElementExceptValue(source: IElement, target: IElement): boolean;
14
+ interface IPickElementOption {
15
+ extraPickAttrs?: Array<keyof IElement>;
16
+ }
17
+ export declare function pickElementAttr(payload: IElement, option?: IPickElementOption): IElement;
18
+ interface IZipElementListOption {
19
+ extraPickAttrs?: Array<keyof IElement>;
20
+ isClassifyArea?: boolean;
21
+ isClone?: boolean;
22
+ }
23
+ export declare function zipElementList(payload: IElement[], options?: IZipElementListOption): IElement[];
24
+ export declare function convertTextAlignToRowFlex(node: HTMLElement): RowFlex;
25
+ export declare function convertRowFlexToTextAlign(rowFlex: RowFlex): RowFlex.LEFT | RowFlex.CENTER | RowFlex.RIGHT | RowFlex.JUSTIFY | "justify";
26
+ export declare function convertRowFlexToJustifyContent(rowFlex: RowFlex): "center" | "flex-start" | "flex-end" | "space-between";
27
+ export declare function isTextLikeElement(element: IElement): boolean;
28
+ export declare function isTextElement(element: IElement): boolean;
29
+ export declare function getElementListText(elementList: IElement[]): string;
30
+ export declare function getAnchorElement(elementList: IElement[], anchorIndex: number): IElement | null;
31
+ export interface IFormatElementContextOption {
32
+ isBreakWhenWrap?: boolean;
33
+ ignoreContextKeys?: Array<keyof IElement>;
34
+ editorOptions?: DeepRequired<IEditorOption>;
35
+ }
36
+ export declare function formatElementContext(sourceElementList: IElement[], formatElementList: IElement[], anchorIndex: number, options?: IFormatElementContextOption): void;
37
+ export declare function convertElementToDom(element: IElement, options: DeepRequired<IEditorOption>): HTMLElement;
38
+ export declare function splitListElement(elementList: IElement[]): Map<number, IElement[]>;
39
+ export interface IElementListGroupRowFlex {
40
+ rowFlex: RowFlex | null;
41
+ data: IElement[];
42
+ }
43
+ export declare function groupElementListByRowFlex(elementList: IElement[]): IElementListGroupRowFlex[];
44
+ export declare function createDomFromElementList(elementList: IElement[], options?: IEditorOption): HTMLDivElement;
45
+ export declare function convertTextNodeToElement(textNode: Element | Node): IElement | null;
46
+ export interface IGetElementListByHTMLOption {
47
+ innerWidth: number;
48
+ }
49
+ export declare function getElementListByHTML(htmlText: string, options: IGetElementListByHTMLOption): IElement[];
50
+ export declare function getTextFromElementList(elementList: IElement[]): string;
51
+ export declare function getSlimCloneElementList(elementList: IElement[]): IElement[];
52
+ export declare function getIsBlockElement(element?: IElement): boolean;
53
+ export declare function replaceHTMLElementTag(oldDom: HTMLElement, tagName: keyof HTMLElementTagNameMap): HTMLElement;
54
+ export declare function pickSurroundElementList(elementList: IElement[]): IElement[];
55
+ export declare function deleteSurroundElementList(elementList: IElement[], pageNo: number): void;
56
+ export declare function getNonHideElementIndex(elementList: IElement[], index: number, position?: LocationPosition): number;
57
+ export {};
@@ -0,0 +1 @@
1
+ export declare function isMod(evt: KeyboardEvent | MouseEvent): boolean;
@@ -0,0 +1,34 @@
1
+ import { IElementFillRect } from '../interface/Element';
2
+ export declare function debounce<T extends unknown[]>(func: (...arg: T) => unknown, delay: number): (this: unknown, ...args: T) => void;
3
+ export declare function throttle<T extends unknown[]>(func: (...arg: T) => unknown, delay: number): (this: unknown, ...args: T) => void;
4
+ export declare function deepCloneOmitKeys<T, K>(obj: T, omitKeys: (keyof K)[]): T;
5
+ export declare function deepClone<T>(obj: T): T;
6
+ export declare function isBody(node: Element): boolean;
7
+ export declare function findParent(node: Element, filterFn: Function, includeSelf: boolean): Element | null;
8
+ export declare function getUUID(): string;
9
+ export declare function splitText(text: string): string[];
10
+ export declare function downloadFile(href: string, fileName: string): void;
11
+ export declare function threeClick(dom: HTMLElement, fn: (evt: MouseEvent) => void): void;
12
+ export declare function isObject(type: unknown): type is Record<string, unknown>;
13
+ export declare function isArray(type: unknown): type is Array<unknown>;
14
+ export declare function isNumber(type: unknown): type is number;
15
+ export declare function isString(type: unknown): type is string;
16
+ export declare function mergeObject<T>(source: T, target: T): T;
17
+ export declare function nextTick(fn: Function): void;
18
+ export declare function convertNumberToChinese(num: number): string;
19
+ export declare function cloneProperty<T>(properties: (keyof T)[], sourceElement: T, targetElement: T): void;
20
+ export declare function deleteProperty<T>(sourceKeys: T[], deleteKeys: T[]): void;
21
+ export declare function pickObject<T>(object: T, pickKeys: (keyof T)[]): T;
22
+ export declare function omitObject<T>(object: T, omitKeys: (keyof T)[]): T;
23
+ export declare function convertStringToBase64(input: string): string;
24
+ export declare function findScrollContainer(element: HTMLElement): HTMLElement;
25
+ export declare function isArrayEqual(arr1: unknown[], arr2: unknown[]): boolean;
26
+ export declare function isObjectEqual(obj1: unknown, obj2: unknown): boolean;
27
+ export declare function isRectIntersect(rect1: IElementFillRect, rect2: IElementFillRect): boolean;
28
+ export declare function isNonValue(value: unknown): boolean;
29
+ export declare function normalizeLineBreak(text: string): string;
30
+ export declare function indexOf(source: string, search: string | RegExp, fromIndex?: number): {
31
+ index: number;
32
+ length: number;
33
+ };
34
+ export declare function scrollIntoView(container: HTMLElement, selected: HTMLElement): void;
@@ -0,0 +1,3 @@
1
+ import { DeepRequired } from '../interface/Common';
2
+ import { IEditorOption } from '../interface/Editor';
3
+ export declare function mergeOption(options?: IEditorOption): DeepRequired<IEditorOption>;
@@ -0,0 +1,8 @@
1
+ import { IElement } from '../interface/Element';
2
+ /**
3
+ * 获取段落索引
4
+ * @param elementList - 元素列表
5
+ * @param index - 目标索引
6
+ * @returns 段落索引
7
+ */
8
+ export declare function getParagraphNo(elementList: IElement[], index: number): number;
@@ -0,0 +1,7 @@
1
+ import { PaperDirection } from '../dataset/enum/Editor';
2
+ export interface IPrintImageBase64Option {
3
+ width: number;
4
+ height: number;
5
+ direction?: PaperDirection;
6
+ }
7
+ export declare function printImageBase64(base64List: string[], options: IPrintImageBase64Option): void;
@@ -0,0 +1,4 @@
1
+ export declare const isApple: boolean;
2
+ export declare const isIOS: boolean;
3
+ export declare const isMobile: boolean;
4
+ export declare const isFirefox: boolean;
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@agile_jy/word-editor",
3
+ "author": "JIANGYONG",
4
+ "license": "MIT",
5
+ "version": "0.0.1",
6
+ "description": "rich text editor by canvas/svg",
7
+ "publishConfig": {
8
+ "registry": "https://registry.npmjs.org/",
9
+ "access": "public"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "README.md",
14
+ "CHANGELOG.md",
15
+ "LICENSE",
16
+ "package.json"
17
+ ],
18
+ "typings": "./dist/src/editor/index.d.ts",
19
+ "main": "./dist/canvas-editor.umd.js",
20
+ "module": "./dist/canvas-editor.es.js",
21
+ "homepage": "https://github.com/Hufe921/canvas-editor",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/Hufe921/canvas-editor.git"
25
+ },
26
+ "keywords": [
27
+ "canvas-editor",
28
+ "editor",
29
+ "wysiwyg",
30
+ "emr"
31
+ ],
32
+ "engines": {
33
+ "node": ">=16.9.1"
34
+ },
35
+ "type": "module",
36
+ "scripts": {
37
+ "dev": "vite",
38
+ "lib": "npm run lint && tsc && vite build --mode lib",
39
+ "build": "npm run lint && tsc && vite build --mode app",
40
+ "serve": "vite preview",
41
+ "lint": "eslint .",
42
+ "cypress:open": "cypress open",
43
+ "cypress:run": "cypress run",
44
+ "type:check": "tsc --noEmit",
45
+ "docs:dev": "vitepress dev docs",
46
+ "docs:build": "vitepress build docs",
47
+ "docs:preview": "vitepress preview docs",
48
+ "postinstall": "simple-git-hooks",
49
+ "release": "node scripts/release.js"
50
+ },
51
+ "devDependencies": {
52
+ "@rollup/plugin-typescript": "^10.0.1",
53
+ "@types/node": "16.18.96",
54
+ "@types/prismjs": "^1.26.0",
55
+ "@typescript-eslint/eslint-plugin": "5.62.0",
56
+ "@typescript-eslint/parser": "5.62.0",
57
+ "cypress": "13.6.0",
58
+ "cypress-file-upload": "^5.0.8",
59
+ "eslint": "7.32.0",
60
+ "simple-git-hooks": "^2.8.1",
61
+ "typescript": "4.9.5",
62
+ "vite": "^2.4.2",
63
+ "vite-plugin-css-injected-by-js": "^2.1.1",
64
+ "vitepress": "1.0.0-beta.6",
65
+ "@types/color": "^3.0.4"
66
+ },
67
+ "dependencies": {
68
+ "color": "^4.2.3",
69
+ "prismjs": "^1.27.0",
70
+ "docx": "^8.2.2",
71
+ "mammoth": "^1.6.0"
72
+ },
73
+ "simple-git-hooks": {
74
+ "pre-commit": "npm run lint && npm run type:check",
75
+ "commit-msg": "node scripts/verifyCommit.js"
76
+ }
77
+ }