@mce/bigesj 0.15.26 → 0.15.27
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
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useEditor, definePlugin } from "mce";
|
|
2
2
|
import { assets } from "modern-canvas";
|
|
3
3
|
import { ref, onBeforeUnmount } from "vue";
|
|
4
|
-
import { createSharedComposable } from "@vueuse/core";
|
|
5
4
|
import { idGenerator, isGradient, normalizeCRLF, isGradientFill, normalizeGradientFill } from "modern-idoc";
|
|
6
5
|
import { OoxmlNode, parsePresetShapeDefinition } from "modern-openxml";
|
|
7
6
|
import { gunzipSync } from "fflate";
|
|
@@ -24,13 +23,14 @@ function levenshteinDistance(a, b) {
|
|
|
24
23
|
}
|
|
25
24
|
function useFonts() {
|
|
26
25
|
const {
|
|
26
|
+
http,
|
|
27
27
|
loadFont: baseLoadFont
|
|
28
28
|
} = useEditor();
|
|
29
29
|
const fontPromises = ref(/* @__PURE__ */ new Map());
|
|
30
30
|
async function loadBigeFonts(url, init = false) {
|
|
31
31
|
let result = bigeFonts.value;
|
|
32
32
|
if (!init || !result.length) {
|
|
33
|
-
result = await
|
|
33
|
+
result = await http.request({ url, responseType: "json" }).then((res) => res.data.datalist);
|
|
34
34
|
bigeFonts.value = result;
|
|
35
35
|
}
|
|
36
36
|
return result;
|
|
@@ -110,23 +110,6 @@ function useFonts() {
|
|
|
110
110
|
loadFont
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
const useSharedTextAssets = createSharedComposable(() => {
|
|
114
|
-
const requests = /* @__PURE__ */ new Map();
|
|
115
|
-
function baseFetch(url, handle) {
|
|
116
|
-
let rep = requests.get(url);
|
|
117
|
-
if (!rep) {
|
|
118
|
-
rep = fetch(url).then(handle);
|
|
119
|
-
requests.set(url, rep);
|
|
120
|
-
}
|
|
121
|
-
return rep;
|
|
122
|
-
}
|
|
123
|
-
async function fetchToText(url) {
|
|
124
|
-
return baseFetch(url, (rep) => rep.text());
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
fetchToText
|
|
128
|
-
};
|
|
129
|
-
});
|
|
130
113
|
const animations = {
|
|
131
114
|
easing: {
|
|
132
115
|
匀速: "linear",
|
|
@@ -1730,16 +1713,20 @@ async function convertDoc(doc, gap = 0) {
|
|
|
1730
1713
|
};
|
|
1731
1714
|
}
|
|
1732
1715
|
function bidTidLoader(editor, api) {
|
|
1733
|
-
const {
|
|
1716
|
+
const {
|
|
1717
|
+
config,
|
|
1718
|
+
http
|
|
1719
|
+
} = editor;
|
|
1734
1720
|
return {
|
|
1735
1721
|
name: "bigesj:bidTid",
|
|
1736
1722
|
test: (source) => typeof source === "object" && source && !!(source.bid || source.tid),
|
|
1737
1723
|
load: async (source) => {
|
|
1738
1724
|
const text = source.bid ?? source.tid ?? "";
|
|
1739
1725
|
const load = async (id) => {
|
|
1740
|
-
return await
|
|
1741
|
-
(source.bid ? api.bid : api.tid).replace("%d", id)
|
|
1742
|
-
|
|
1726
|
+
return await http.request({
|
|
1727
|
+
url: (source.bid ? api.bid : api.tid).replace("%d", id),
|
|
1728
|
+
responseType: "json"
|
|
1729
|
+
}).then((res) => res.data);
|
|
1743
1730
|
};
|
|
1744
1731
|
let maxTime = 0;
|
|
1745
1732
|
const docs = await Promise.all(
|
|
@@ -1926,6 +1913,5 @@ export {
|
|
|
1926
1913
|
parseAnimations,
|
|
1927
1914
|
plugin,
|
|
1928
1915
|
transformToCropRect,
|
|
1929
|
-
useFonts
|
|
1930
|
-
useSharedTextAssets
|
|
1916
|
+
useFonts
|
|
1931
1917
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mce/bigesj",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.15.
|
|
4
|
+
"version": "0.15.27",
|
|
5
5
|
"description": "Plugin for mce",
|
|
6
6
|
"author": "wxm",
|
|
7
7
|
"license": "MIT",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"modern-openxml": "^1.10.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"mce": "0.15.
|
|
52
|
+
"mce": "0.15.27"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"mce": "^0"
|