@mce/bigesj 0.12.4 → 0.13.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 +15 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useEditor, definePlugin } from "mce";
|
|
2
|
-
import { assets, Element2D } from "modern-canvas";
|
|
3
2
|
import { ref, onBeforeUnmount } from "vue";
|
|
4
3
|
import { createSharedComposable } from "@vueuse/core";
|
|
5
4
|
import { idGenerator, normalizeCRLF, isGradient } from "modern-idoc";
|
|
5
|
+
import { assets } from "modern-canvas";
|
|
6
6
|
import { gunzipSync } from "fflate";
|
|
7
7
|
const bigeFonts = ref([]);
|
|
8
8
|
function levenshteinDistance(a, b) {
|
|
@@ -1320,11 +1320,18 @@ function bidTidLoader(editor, api) {
|
|
|
1320
1320
|
const bigeDoc = await load(id);
|
|
1321
1321
|
const { content: _content, ...raw } = bigeDoc;
|
|
1322
1322
|
const content = JSON.parse(_content);
|
|
1323
|
-
|
|
1324
|
-
|
|
1323
|
+
const version = Number(content.version ?? 1);
|
|
1324
|
+
let doc2;
|
|
1325
|
+
if (version > 1) {
|
|
1326
|
+
doc2 = content;
|
|
1327
|
+
doc2.meta.raw = raw;
|
|
1328
|
+
} else {
|
|
1329
|
+
if (included !== void 0) {
|
|
1330
|
+
content.layouts = content.layouts.filter((_, index) => included.includes(index));
|
|
1331
|
+
}
|
|
1332
|
+
doc2 = await convertDoc(content);
|
|
1333
|
+
doc2.meta.raw = raw;
|
|
1325
1334
|
}
|
|
1326
|
-
const doc2 = await convertDoc(content);
|
|
1327
|
-
doc2.meta.raw = raw;
|
|
1328
1335
|
maxTime = Math.max(maxTime, doc2.meta?.maxTime ?? 0);
|
|
1329
1336
|
return doc2;
|
|
1330
1337
|
})
|
|
@@ -1399,14 +1406,15 @@ async function setupFonts(editor, api) {
|
|
|
1399
1406
|
const {
|
|
1400
1407
|
on,
|
|
1401
1408
|
off,
|
|
1402
|
-
root
|
|
1409
|
+
root,
|
|
1410
|
+
isElement
|
|
1403
1411
|
} = editor;
|
|
1404
1412
|
const {
|
|
1405
1413
|
loadBigeFonts,
|
|
1406
1414
|
loadFont
|
|
1407
1415
|
} = useFonts();
|
|
1408
1416
|
function preloadNode(node) {
|
|
1409
|
-
if (node
|
|
1417
|
+
if (isElement(node)) {
|
|
1410
1418
|
if (node.style.fontFamily) {
|
|
1411
1419
|
loadFont(node.style.fontFamily).then(() => node.text.update());
|
|
1412
1420
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mce/bigesj",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.13.0",
|
|
5
5
|
"description": "Plugin for mce",
|
|
6
6
|
"author": "wxm",
|
|
7
7
|
"license": "MIT",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"fflate": "^0.8.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"mce": "0.
|
|
51
|
+
"mce": "0.13.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"mce": "^0"
|