@mce/bigesj 0.15.25 → 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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const editorOptions: Partial<Mce.Options>;
|
package/dist/index.d.ts
CHANGED
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(
|
|
@@ -1885,6 +1872,26 @@ async function setupFonts(editor, api) {
|
|
|
1885
1872
|
await loadBigeFonts(api.fonts, true);
|
|
1886
1873
|
});
|
|
1887
1874
|
}
|
|
1875
|
+
const editorOptions = {
|
|
1876
|
+
checkerboard: true,
|
|
1877
|
+
checkerboardStyle: "grid",
|
|
1878
|
+
pixelGrid: true,
|
|
1879
|
+
camera: true,
|
|
1880
|
+
ruler: true,
|
|
1881
|
+
scrollbar: true,
|
|
1882
|
+
statusbar: true,
|
|
1883
|
+
frameGap: 48,
|
|
1884
|
+
frameOutline: true,
|
|
1885
|
+
zoomToFit: "width",
|
|
1886
|
+
typographyStrategy: "autoHeight",
|
|
1887
|
+
locale: { locale: "zhHans" },
|
|
1888
|
+
defaultFont: { family: "SourceHanSansCN-Normal", src: "https://bige.cdn.bcebos.com/files/202006/cBNrzOsE_rAQB.woff" },
|
|
1889
|
+
transformControls: {
|
|
1890
|
+
handleShape: "circle",
|
|
1891
|
+
handleStrategy: "point",
|
|
1892
|
+
rotator: true
|
|
1893
|
+
}
|
|
1894
|
+
};
|
|
1888
1895
|
export {
|
|
1889
1896
|
bidTidLoader,
|
|
1890
1897
|
bigeLoader,
|
|
@@ -1900,11 +1907,11 @@ export {
|
|
|
1900
1907
|
convertTextStyle,
|
|
1901
1908
|
croppingToCropRect,
|
|
1902
1909
|
plugin as default,
|
|
1910
|
+
editorOptions,
|
|
1903
1911
|
getStyle,
|
|
1904
1912
|
getTextContents,
|
|
1905
1913
|
parseAnimations,
|
|
1906
1914
|
plugin,
|
|
1907
1915
|
transformToCropRect,
|
|
1908
|
-
useFonts
|
|
1909
|
-
useSharedTextAssets
|
|
1916
|
+
useFonts
|
|
1910
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"
|