mce 0.15.10 → 0.15.12

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
@@ -892,6 +892,7 @@ const _0_context = defineMixin((editor) => {
892
892
  const drawboardPointer = ref();
893
893
  const drawboardContextMenuPointer = ref();
894
894
  const doc = ref(new Doc());
895
+ const docLoading = ref(false);
895
896
  const root = computed(() => doc.value.root);
896
897
  const nodes = ref([]);
897
898
  const nodeIndexMap = reactive(/* @__PURE__ */ new Map());
@@ -965,6 +966,7 @@ const _0_context = defineMixin((editor) => {
965
966
  camera,
966
967
  drawboardEffect,
967
968
  doc,
969
+ docLoading,
968
970
  root,
969
971
  nodes,
970
972
  nodeIndexMap,
@@ -2851,6 +2853,7 @@ const _4_3_element = defineMixin((editor) => {
2851
2853
  const _4_4_doc = defineMixin((editor, options) => {
2852
2854
  const {
2853
2855
  doc,
2856
+ docLoading,
2854
2857
  renderEngine,
2855
2858
  emit,
2856
2859
  selection,
@@ -2922,9 +2925,18 @@ const _4_4_doc = defineMixin((editor, options) => {
2922
2925
  return _doc;
2923
2926
  };
2924
2927
  const loadDoc = async (source) => {
2925
- const _doc = await setDoc(await load(source));
2926
- emit("loadDoc", _doc, source);
2927
- return _doc;
2928
+ docLoading.value = true;
2929
+ emit("docLoading", source);
2930
+ try {
2931
+ const _doc = await setDoc(await load(source));
2932
+ emit("docLoaded", source, _doc);
2933
+ docLoading.value = false;
2934
+ return _doc;
2935
+ } catch (err) {
2936
+ emit("docLoaded", source, err);
2937
+ docLoading.value = false;
2938
+ throw err;
2939
+ }
2928
2940
  };
2929
2941
  Object.assign(editor, {
2930
2942
  getDoc,
@@ -5173,7 +5185,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
5173
5185
  if (node.foreground.isValid() && node.foreground.image) {
5174
5186
  value = t("image");
5175
5187
  } else if (node.text.isValid()) {
5176
- value = node.text.innerText;
5188
+ value = node.text.textContent;
5177
5189
  }
5178
5190
  }
5179
5191
  }
@@ -32,6 +32,7 @@ declare global {
32
32
  drawboardPointer: Ref<Vector2 | undefined>;
33
33
  drawboardContextMenuPointer: Ref<Vector2 | undefined>;
34
34
  doc: Ref<Doc>;
35
+ docLoading: Ref<boolean>;
35
36
  root: ComputedRef<Node>;
36
37
  nodes: Ref<Node[]>;
37
38
  nodeIndexMap: Map<string, number>;
@@ -21,7 +21,8 @@ declare global {
21
21
  }
22
22
  interface Events {
23
23
  setDoc: [doc: Doc];
24
- loadDoc: [doc: Doc, source: any];
24
+ docLoading: [source: any];
25
+ docLoaded: [source: any, doc: Doc | Error];
25
26
  clearDoc: [];
26
27
  updateDoc: [update: Uint8Array, origin: any];
27
28
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.15.10",
4
+ "version": "0.15.12",
5
5
  "description": "The headless canvas editor framework. only the ESM.",
6
6
  "author": "wxm",
7
7
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "diff": "^8.0.2",
62
62
  "file-saver": "^2.0.5",
63
63
  "lodash-es": "^4.17.22",
64
- "modern-canvas": "^0.14.24",
64
+ "modern-canvas": "^0.14.26",
65
65
  "modern-font": "^0.4.4",
66
66
  "modern-idoc": "^0.10.8",
67
67
  "modern-text": "^1.10.7",