@wanghe1995/docx-editor-ui-lite 1.0.0 → 1.0.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wanghe1995/docx-editor-ui-lite",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "DocxEditor 精简版UI库(Lite)",
|
|
5
5
|
"author": "wanghe",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"clean": "node -e \"const fs = require('fs'); if(fs.existsSync('dist')) fs.rmSync('dist', {recursive: true})\"",
|
|
29
29
|
"build": "npm run clean && tsc && vite build --config vite.config.ts --mode lib",
|
|
30
30
|
"build:ui": "vite build --config vite.config.deploy.ts",
|
|
31
|
-
"preview:ui": "vite preview --config vite.config.deploy.ts",
|
|
32
31
|
"lint": "eslint .",
|
|
33
32
|
"type:check": "tsc --noEmit"
|
|
34
33
|
},
|
package/dist/docx-editor-lite.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
var o = Object.defineProperty;
|
|
2
|
-
var s = (e, t, i) => t in e ? o(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
|
|
3
|
-
var n = (e, t, i) => s(e, typeof t != "symbol" ? t + "" : t, i);
|
|
4
|
-
import h from "@wanghe1995/docx-editor-core";
|
|
5
|
-
export * from "@wanghe1995/docx-editor-core";
|
|
6
|
-
const a = (e) => {
|
|
7
|
-
if (typeof e == "string") {
|
|
8
|
-
const t = document.querySelector(e);
|
|
9
|
-
if (!t)
|
|
10
|
-
throw new Error(`Mount target not found: ${e}`);
|
|
11
|
-
return t;
|
|
12
|
-
}
|
|
13
|
-
if (!e)
|
|
14
|
-
throw new Error("Mount target is required");
|
|
15
|
-
return e;
|
|
16
|
-
};
|
|
17
|
-
class u {
|
|
18
|
-
constructor(t) {
|
|
19
|
-
n(this, "config");
|
|
20
|
-
n(this, "editor", null);
|
|
21
|
-
n(this, "_container");
|
|
22
|
-
var i;
|
|
23
|
-
this.config = t, this._container = a(t.container), this.editor = new h(this._container, t.data || { main: [] }, t.options || {}), this._bindListeners(), (i = t.onReady) == null || i.call(t, this.editor);
|
|
24
|
-
}
|
|
25
|
-
_bindListeners() {
|
|
26
|
-
this.editor && (this.config.onChange && (this.editor.listener.contentChange = this.config.onChange), this.config.onPageChange && (this.editor.listener.pageSizeChange = this.config.onPageChange), this.config.onScaleChange && (this.editor.listener.pageScaleChange = this.config.onScaleChange));
|
|
27
|
-
}
|
|
28
|
-
get command() {
|
|
29
|
-
var t;
|
|
30
|
-
return (t = this.editor) == null ? void 0 : t.command;
|
|
31
|
-
}
|
|
32
|
-
get listener() {
|
|
33
|
-
var t;
|
|
34
|
-
return (t = this.editor) == null ? void 0 : t.listener;
|
|
35
|
-
}
|
|
36
|
-
get container() {
|
|
37
|
-
return this._container;
|
|
38
|
-
}
|
|
39
|
-
executeCommand(t, ...i) {
|
|
40
|
-
if (!this.editor)
|
|
41
|
-
return;
|
|
42
|
-
const r = this.editor.command[t];
|
|
43
|
-
if (typeof r == "function")
|
|
44
|
-
return r(...i);
|
|
45
|
-
}
|
|
46
|
-
destroy() {
|
|
47
|
-
this.editor && (this.editor.destroy(), this.editor = null);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
export {
|
|
51
|
-
u as WordEditor
|
|
52
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(t,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@wanghe1995/docx-editor-core")):typeof define=="function"&&define.amd?define(["exports","@wanghe1995/docx-editor-core"],i):(t=typeof globalThis<"u"?globalThis:t||self,i(t["docx-editor-lite"]={},t.DocxEditorCore))})(this,function(t,i){"use strict";var a=Object.defineProperty;var c=(t,i,r)=>i in t?a(t,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[i]=r;var s=(t,i,r)=>c(t,typeof i!="symbol"?i+"":i,r);const r=n=>{if(typeof n=="string"){const e=document.querySelector(n);if(!e)throw new Error(`Mount target not found: ${n}`);return e}if(!n)throw new Error("Mount target is required");return n};class h{constructor(e){s(this,"config");s(this,"editor",null);s(this,"_container");var o;this.config=e,this._container=r(e.container),this.editor=new i(this._container,e.data||{main:[]},e.options||{}),this._bindListeners(),(o=e.onReady)==null||o.call(e,this.editor)}_bindListeners(){this.editor&&(this.config.onChange&&(this.editor.listener.contentChange=this.config.onChange),this.config.onPageChange&&(this.editor.listener.pageSizeChange=this.config.onPageChange),this.config.onScaleChange&&(this.editor.listener.pageScaleChange=this.config.onScaleChange))}get command(){var e;return(e=this.editor)==null?void 0:e.command}get listener(){var e;return(e=this.editor)==null?void 0:e.listener}get container(){return this._container}executeCommand(e,...o){if(!this.editor)return;const d=this.editor.command[e];if(typeof d=="function")return d(...o)}destroy(){this.editor&&(this.editor.destroy(),this.editor=null)}}t.WordEditor=h,Object.keys(i).forEach(n=>{n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:()=>i[n]})}),Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import DocxEditor from '@wanghe1995/docx-editor-core';
|
|
2
|
-
import type { IEditorData, IElement, IEditorOption } from '@wanghe1995/docx-editor-core';
|
|
3
|
-
export interface WordEditorOptions {
|
|
4
|
-
container: string | HTMLElement;
|
|
5
|
-
data?: IEditorData | IElement[];
|
|
6
|
-
options?: IEditorOption;
|
|
7
|
-
onReady?: (editor: DocxEditor) => void;
|
|
8
|
-
onChange?: () => void;
|
|
9
|
-
onPageChange?: (pageNo: number) => void;
|
|
10
|
-
onScaleChange?: (scale: number) => void;
|
|
11
|
-
}
|
|
12
|
-
export declare class WordEditor {
|
|
13
|
-
private config;
|
|
14
|
-
private editor;
|
|
15
|
-
private _container;
|
|
16
|
-
constructor(config: WordEditorOptions);
|
|
17
|
-
private _bindListeners;
|
|
18
|
-
get command(): import("@wanghe1995/docx-editor-core").Command | undefined;
|
|
19
|
-
get listener(): import("@wanghe1995/docx-editor-core").Listener | undefined;
|
|
20
|
-
get container(): HTMLDivElement;
|
|
21
|
-
executeCommand(command: string, ...args: any[]): any;
|
|
22
|
-
destroy(): void;
|
|
23
|
-
}
|