@agile_jy/word-editor 0.0.1-beta.20 → 0.0.1-beta.21

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.
@@ -1,8 +1,5 @@
1
1
  import { CommandAdapt } from './CommandAdapt';
2
- import type { IImportDocxOption } from '../../interface/Editor';
3
2
  export declare class Command {
4
- /** 由 docxPlugin 挂载后可用 */
5
- executeImportDocx?: (options: IImportDocxOption) => void;
6
3
  executeMode: CommandAdapt['mode'];
7
4
  executeCut: CommandAdapt['cut'];
8
5
  executeCopy: CommandAdapt['copy'];
@@ -101,6 +98,7 @@ export declare class Command {
101
98
  executeWordTool: CommandAdapt['wordTool'];
102
99
  executeSetHTML: CommandAdapt['setHTML'];
103
100
  executeSetHtmlDocx: CommandAdapt['setHtmlDocx'];
101
+ executeImportDocx: CommandAdapt['importDocx'];
104
102
  executeSetGroup: CommandAdapt['setGroup'];
105
103
  executeDeleteGroup: CommandAdapt['deleteGroup'];
106
104
  executeLocationGroup: CommandAdapt['locationGroup'];
@@ -10,7 +10,7 @@ import { ICatalog } from '../../interface/Catalog';
10
10
  import { DeepRequired } from '../../interface/Common';
11
11
  import { IGetControlValueOption, IGetControlValueResult, ILocationControlOption, IRemoveControlOption, ISetControlExtensionOption, ISetControlHighlightOption, ISetControlProperties, ISetControlValueOption } from '../../interface/Control';
12
12
  import { IAppendElementListOption, IDrawImagePayload, IForceUpdateOption, IGetImageOption, IGetValueOption, IPainterOption } from '../../interface/Draw';
13
- import { IEditorData, IEditorHTML, IEditorOption, IEditorResult, IEditorText, IFocusOption, ISetHtmlDocxOption, ISetValueOption, IUpdateOption } from '../../interface/Editor';
13
+ import { IEditorData, IEditorHTML, IEditorOption, IEditorResult, IEditorText, IFocusOption, IImportDocxOption, ISetHtmlDocxOption, ISetValueOption, IUpdateOption } from '../../interface/Editor';
14
14
  import { IDeleteElementByIdOption, IElement, IElementPosition, IGetElementByIdOption, IImageCaption, IImageCrop, IInsertElementListOption, IUpdateElementByIdOption } from '../../interface/Element';
15
15
  import { ICopyOption, IPasteOption, IPositionContextByEventOption, IPositionContextByEventResult } from '../../interface/Event';
16
16
  import { IMargin } from '../../interface/Margin';
@@ -161,6 +161,10 @@ export declare class CommandAdapt {
161
161
  * 解析 docx-preview 已挂载 DOM:纸张/页边距 + 段落版式,section 间插分页符
162
162
  */
163
163
  setHtmlDocx(payload: ISetHtmlDocxOption): void;
164
+ /**
165
+ * 导入 Word/HTML 字符串:挂载临时 DOM 后走 setHtmlDocx
166
+ */
167
+ importDocx(payload: IImportDocxOption): void;
164
168
  setGroup(): string | null;
165
169
  deleteGroup(groupId: string): void;
166
170
  getGroupIds(): Promise<string[]>;
@@ -17,3 +17,8 @@ export declare function parseDocxPaperMeta(section: HTMLElement): IDocxPaperMeta
17
17
  * - 多 section 拼接,section 之间插入分页符以尽量保留原分页
18
18
  */
19
19
  export declare function parseDocxDom(container: HTMLElement): IParseDocxDomResult;
20
+ /**
21
+ * 将 HTML 字符串挂到临时 DOM,供 setHtmlDocx / importDocx 解析
22
+ * (缩进 / 段距 / 行距 / 分页符 / 纸张)
23
+ */
24
+ export declare function mountHtmlForDocx(html: string, margins?: IMargin): HTMLElement;
@@ -1,4 +1,2 @@
1
- import { Command } from '../../editor/core/command/Command';
2
- import type { IImportDocxOption } from '../../editor/interface/Editor';
3
- export type { IImportDocxOption };
4
- export default function (command: Command): (options: IImportDocxOption) => void;
1
+ /** @deprecated 逻辑已迁至 editor/utils/docxHtml + CommandAdapt.importDocx */
2
+ export type { IImportDocxOption } from '../../editor/interface/Editor';
@@ -1,5 +1,8 @@
1
1
  import type Editor from '../../editor';
2
2
  export type { IImportDocxOption } from '../../editor/interface/Editor';
3
- /** Word / HTML 导入插件:挂载后可用 command.executeImportDocx */
4
- export default function docxPlugin(editor: Editor): void;
3
+ /**
4
+ * 兼容旧用法:executeImportDocx 已内置到 Command,无需再挂载。
5
+ * 保留插件导出,避免旧代码 instance.use(docxPlugin) 报错。
6
+ */
7
+ export default function docxPlugin(_editor: Editor): void;
5
8
  export { docxPlugin };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@agile_jy/word-editor",
3
3
  "author": "JIANGYONG",
4
4
  "license": "MIT",
5
- "version": "0.0.1-beta.20",
5
+ "version": "0.0.1-beta.21",
6
6
  "description": "rich text editor by canvas/svg",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/",