docx-vue-viewer 0.4.9 → 0.5.0
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/README.md +2 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.js +17 -12
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
[Live demo](https://christophervr.github.io/ooxml/docx/demo/) | [npm](https://www.npmjs.com/package/docx-vue-viewer) | [Full docs](https://christophervr.github.io/ooxml/docx/) | [Source](https://github.com/ChristopherVR/ooxml/tree/main/viewers/docx)
|
|
10
10
|
|
|
11
|
+
Part of [ooxml](https://github.com/ChristopherVR/ooxml#readme): [Office](https://github.com/ChristopherVR/ooxml#ooxml-office-the-whole-suite-in-one-app) · **[Word](https://github.com/ChristopherVR/ooxml/tree/main/viewers/docx#readme)** · [Excel](https://github.com/ChristopherVR/ooxml/tree/main/viewers/xlsx#readme) · [PowerPoint](https://github.com/ChristopherVR/ooxml/tree/main/viewers/pptx#readme) · [Visio](https://github.com/ChristopherVR/ooxml/tree/main/viewers/visio#readme) · [OpenTeams](https://github.com/ChristopherVR/ooxml/tree/main/viewers/teams#readme) · [Core](https://github.com/ChristopherVR/ooxml/tree/main/src/core#readme)
|
|
12
|
+
|
|
11
13
|
## Install
|
|
12
14
|
|
|
13
15
|
```bash
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as vue from 'vue';
|
|
|
2
2
|
import { PropType } from 'vue';
|
|
3
3
|
import { DocumentModel } from 'docx-core';
|
|
4
4
|
export * from 'docx-core';
|
|
5
|
-
import { EditorThemeMode, RibbonActionInput, DocxEditorElement, EditorLocaleInput, PageChangeDetail } from 'ooxml-ui/docx';
|
|
5
|
+
import { EditorThemeMode, RibbonActionInput, RibbonAddInTab, DocxEditorElement, EditorLocaleInput, PageChangeDetail, RibbonAddInCommandDetail } from 'ooxml-ui/docx';
|
|
6
6
|
export * from 'ooxml-ui/docx';
|
|
7
7
|
export { DocumentFormat, detectDocumentFormat, loadDocument } from 'ooxml-core/docx/load';
|
|
8
8
|
|
|
@@ -17,9 +17,10 @@ declare const WordEditor: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
17
17
|
default: boolean;
|
|
18
18
|
};
|
|
19
19
|
hiddenActions: PropType<readonly RibbonActionInput[]>;
|
|
20
|
+
ribbonAddIns: PropType<readonly RibbonAddInTab[]>;
|
|
20
21
|
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
21
22
|
[key: string]: any;
|
|
22
|
-
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("document-change" | "document-error" | "page-change" | "dirty-change")[], "document-change" | "document-error" | "page-change" | "dirty-change", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
23
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("document-change" | "document-error" | "page-change" | "dirty-change" | "office-ribbon-add-in")[], "document-change" | "document-error" | "page-change" | "dirty-change" | "office-ribbon-add-in", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
23
24
|
documentModel: PropType<DocumentModel>;
|
|
24
25
|
readOnly: BooleanConstructor;
|
|
25
26
|
locale: StringConstructor;
|
|
@@ -30,11 +31,13 @@ declare const WordEditor: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
30
31
|
default: boolean;
|
|
31
32
|
};
|
|
32
33
|
hiddenActions: PropType<readonly RibbonActionInput[]>;
|
|
34
|
+
ribbonAddIns: PropType<readonly RibbonAddInTab[]>;
|
|
33
35
|
}>> & Readonly<{
|
|
34
36
|
"onDocument-change"?: (...args: any[]) => any;
|
|
35
37
|
"onDocument-error"?: (...args: any[]) => any;
|
|
36
38
|
"onPage-change"?: (...args: any[]) => any;
|
|
37
39
|
"onDirty-change"?: (...args: any[]) => any;
|
|
40
|
+
"onOffice-ribbon-add-in"?: (...args: any[]) => any;
|
|
38
41
|
}>, {
|
|
39
42
|
readOnly: boolean;
|
|
40
43
|
showThumbnails: boolean;
|
|
@@ -55,6 +58,8 @@ interface EditorProps {
|
|
|
55
58
|
showToolbar?: boolean | undefined;
|
|
56
59
|
/** Ribbon controls to hide, by stable id (`RIBBON_ACTION_IDS`). Old English labels still work but warn. */
|
|
57
60
|
hiddenActions?: readonly RibbonActionInput[] | undefined;
|
|
61
|
+
/** Tabs the host adds after Word's own, as an Office add-in does. */
|
|
62
|
+
ribbonAddIns?: readonly RibbonAddInTab[] | undefined;
|
|
58
63
|
}
|
|
59
64
|
/** Editor callbacks; each is the framework-neutral form of one entry in `EDITOR_EVENT_NAMES`. */
|
|
60
65
|
interface EditorEventOptions {
|
|
@@ -62,6 +67,8 @@ interface EditorEventOptions {
|
|
|
62
67
|
onDocumentError?: ((error: Error) => void) | undefined;
|
|
63
68
|
onPageChange?: ((detail: PageChangeDetail) => void) | undefined;
|
|
64
69
|
onDirtyChange?: ((dirty: boolean) => void) | undefined;
|
|
70
|
+
/** A command of a host tab (`ribbonAddIns`) was chosen. */
|
|
71
|
+
onRibbonAddIn?: ((detail: RibbonAddInCommandDetail) => void) | undefined;
|
|
65
72
|
}
|
|
66
73
|
interface EditorOptions extends EditorProps, EditorEventOptions {
|
|
67
74
|
}
|
package/dist/index.js
CHANGED
|
@@ -28,12 +28,14 @@ var _ = [
|
|
|
28
28
|
"theme",
|
|
29
29
|
"showThumbnails",
|
|
30
30
|
"showToolbar",
|
|
31
|
-
"hiddenActions"
|
|
31
|
+
"hiddenActions",
|
|
32
|
+
"ribbonAddIns"
|
|
32
33
|
], v = [
|
|
33
34
|
"document-change",
|
|
34
35
|
"document-error",
|
|
35
36
|
"page-change",
|
|
36
|
-
"dirty-change"
|
|
37
|
+
"dirty-change",
|
|
38
|
+
"office-ribbon-add-in"
|
|
37
39
|
];
|
|
38
40
|
function y(e, t) {
|
|
39
41
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
@@ -51,19 +53,20 @@ function S(e) {
|
|
|
51
53
|
onDocumentChange: e["document-change"],
|
|
52
54
|
onDocumentError: e["document-error"],
|
|
53
55
|
onPageChange: e["page-change"],
|
|
54
|
-
onDirtyChange: e["dirty-change"]
|
|
56
|
+
onDirtyChange: e["dirty-change"],
|
|
57
|
+
onRibbonAddIn: e["office-ribbon-add-in"]
|
|
55
58
|
};
|
|
56
59
|
}
|
|
57
60
|
function C(e, t = {}) {
|
|
58
61
|
(0, h.registerDocxEditor)();
|
|
59
|
-
let n = e.ownerDocument.createElement("docx-editor"), r = {}, i, a, o = !1,
|
|
62
|
+
let n = e.ownerDocument.createElement("docx-editor"), r = {}, i, a, o, s = !1, c = (e) => {
|
|
60
63
|
a = e.detail, r.onDocumentChange?.(a);
|
|
61
|
-
},
|
|
62
|
-
n.addEventListener("document-change",
|
|
63
|
-
let
|
|
64
|
+
}, l = (e) => r.onDocumentError?.(e.detail), u = (e) => r.onPageChange?.(e.detail), d = (e) => r.onDirtyChange?.(e.detail), f = (e) => r.onRibbonAddIn?.(e.detail);
|
|
65
|
+
n.addEventListener("document-change", c), n.addEventListener("document-error", l), n.addEventListener("page-change", u), n.addEventListener("dirty-change", d), n.addEventListener("office-ribbon-add-in", f);
|
|
66
|
+
let p = {
|
|
64
67
|
element: n,
|
|
65
68
|
update(e) {
|
|
66
|
-
|
|
69
|
+
s || (r = e, n.locale = e.locale ?? "en", n.readOnly = e.readOnly ?? !1, n.theme = e.theme ?? "auto", n.showThumbnails = e.showThumbnails ?? !1, n.showToolbar = e.showToolbar ?? !0, y(n.hiddenActions, (0, h.normalizeRibbonActions)(e.hiddenActions ?? []).ids) || (n.hiddenActions = e.hiddenActions ?? []), e.ribbonAddIns !== o && (n.ribbonAddIns = e.ribbonAddIns ?? []), o = e.ribbonAddIns, e.documentModel && e.documentModel !== i && e.documentModel !== a && (n.documentModel = e.documentModel), i = e.documentModel);
|
|
67
70
|
},
|
|
68
71
|
load: (e) => n.load(e),
|
|
69
72
|
save: () => n.save(),
|
|
@@ -73,10 +76,10 @@ function C(e, t = {}) {
|
|
|
73
76
|
return n.dirty;
|
|
74
77
|
},
|
|
75
78
|
destroy() {
|
|
76
|
-
|
|
79
|
+
s || (s = !0, n.removeEventListener("document-change", c), n.removeEventListener("document-error", l), n.removeEventListener("page-change", u), n.removeEventListener("dirty-change", d), n.removeEventListener("office-ribbon-add-in", f), n.remove());
|
|
77
80
|
}
|
|
78
81
|
};
|
|
79
|
-
return
|
|
82
|
+
return p.update(t), e.append(n), p;
|
|
80
83
|
}
|
|
81
84
|
//#endregion
|
|
82
85
|
//#region packages/bindings/src/vue.ts
|
|
@@ -92,7 +95,8 @@ var w = e({
|
|
|
92
95
|
type: Boolean,
|
|
93
96
|
default: !0
|
|
94
97
|
},
|
|
95
|
-
hiddenActions: Array
|
|
98
|
+
hiddenActions: Array,
|
|
99
|
+
ribbonAddIns: Array
|
|
96
100
|
},
|
|
97
101
|
emits: [...v],
|
|
98
102
|
setup(e, { emit: o, expose: s }) {
|
|
@@ -102,7 +106,8 @@ var w = e({
|
|
|
102
106
|
"document-change": (e) => o("document-change", e),
|
|
103
107
|
"document-error": (e) => o("document-error", e),
|
|
104
108
|
"page-change": (e) => o("page-change", e),
|
|
105
|
-
"dirty-change": (e) => o("dirty-change", e)
|
|
109
|
+
"dirty-change": (e) => o("dirty-change", e),
|
|
110
|
+
"office-ribbon-add-in": (e) => o("office-ribbon-add-in", e)
|
|
106
111
|
})
|
|
107
112
|
});
|
|
108
113
|
return r(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docx-vue-viewer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Vue 3 component for the DOCX editor. Self-contained: includes the editor, layout engine and legacy .doc reader.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"doc",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"docx-core": "^0.1.
|
|
44
|
-
"ooxml-core": "^1.
|
|
45
|
-
"ooxml-ui": "^1.
|
|
43
|
+
"docx-core": "^0.1.13",
|
|
44
|
+
"ooxml-core": "^1.8.0",
|
|
45
|
+
"ooxml-ui": "^1.8.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"vue": "^3.5.0"
|