@mce/openxml 0.24.3 → 0.25.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/dist/index.js +6 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { definePlugin } from "mce";
|
|
2
|
-
import { docToDocx, docToPptx, docToXlsx, docxToDoc, pptxToDoc, xlsxToDoc } from "modern-openxml";
|
|
3
2
|
//#region src/plugin.ts
|
|
4
3
|
function plugin() {
|
|
5
4
|
return definePlugin((editor) => {
|
|
@@ -33,7 +32,7 @@ function plugin() {
|
|
|
33
32
|
return false;
|
|
34
33
|
},
|
|
35
34
|
load: async (source) => {
|
|
36
|
-
const presetShapeDefinitions = await import("modern-openxml/presetShapeDefinitions").then((rep) => rep.default);
|
|
35
|
+
const [{ pptxToDoc }, presetShapeDefinitions] = await Promise.all([import("modern-openxml"), import("modern-openxml/presetShapeDefinitions").then((rep) => rep.default)]);
|
|
37
36
|
const doc = await pptxToDoc(await source.arrayBuffer(), {
|
|
38
37
|
presetShapeDefinitions,
|
|
39
38
|
upload: async (input, meta) => {
|
|
@@ -73,6 +72,7 @@ function plugin() {
|
|
|
73
72
|
return false;
|
|
74
73
|
},
|
|
75
74
|
load: async (source) => {
|
|
75
|
+
const { xlsxToDoc } = await import("modern-openxml");
|
|
76
76
|
const doc = await xlsxToDoc(await source.arrayBuffer());
|
|
77
77
|
doc.name = source.name;
|
|
78
78
|
doc.meta.inEditorIs = "Doc";
|
|
@@ -88,6 +88,7 @@ function plugin() {
|
|
|
88
88
|
return false;
|
|
89
89
|
},
|
|
90
90
|
load: async (source) => {
|
|
91
|
+
const { docxToDoc } = await import("modern-openxml");
|
|
91
92
|
const doc = await docxToDoc(await source.arrayBuffer());
|
|
92
93
|
doc.name = source.name;
|
|
93
94
|
doc.meta.inEditorIs = "Doc";
|
|
@@ -100,6 +101,7 @@ function plugin() {
|
|
|
100
101
|
name: "pptx",
|
|
101
102
|
saveAs: true,
|
|
102
103
|
handle: async (options) => {
|
|
104
|
+
const { docToPptx } = await import("modern-openxml");
|
|
103
105
|
const { pptx: pptxOptions, ...jsonOptions } = options;
|
|
104
106
|
const doc = await to("json", jsonOptions);
|
|
105
107
|
doc.children?.reverse();
|
|
@@ -118,6 +120,7 @@ function plugin() {
|
|
|
118
120
|
name: "xlsx",
|
|
119
121
|
saveAs: true,
|
|
120
122
|
handle: async (options) => {
|
|
123
|
+
const { docToXlsx } = await import("modern-openxml");
|
|
121
124
|
const { xlsx: xlsxOptions, ...jsonOptions } = options;
|
|
122
125
|
const doc = await to("json", jsonOptions);
|
|
123
126
|
const xlsx = await docToXlsx({
|
|
@@ -134,6 +137,7 @@ function plugin() {
|
|
|
134
137
|
name: "docx",
|
|
135
138
|
saveAs: true,
|
|
136
139
|
handle: async (options) => {
|
|
140
|
+
const { docToDocx } = await import("modern-openxml");
|
|
137
141
|
const { docx: docxOptions, ...jsonOptions } = options;
|
|
138
142
|
const doc = await to("json", jsonOptions);
|
|
139
143
|
const docx = await docToDocx({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mce/openxml",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.25.0",
|
|
5
5
|
"description": "Openxml plugin for mce",
|
|
6
6
|
"author": "wxm",
|
|
7
7
|
"license": "MIT",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"modern-openxml": "^1.12.4"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"mce": "0.
|
|
52
|
+
"mce": "0.25.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"mce": "^0"
|