@8btc/xcanvas 0.0.14-beta.6 → 0.0.14-beta.8
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 +8 -3
- package/dist/index.umd.cjs +8 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
3
3
|
import { Excalidraw, convertToExcalidrawElements, exportToCanvas } from "@8btc/excalidraw";
|
|
4
4
|
import { useEffect } from "react";
|
|
5
|
-
const version = "0.0.14-beta.
|
|
5
|
+
const version = "0.0.14-beta.8";
|
|
6
6
|
const packageJson = {
|
|
7
7
|
version
|
|
8
8
|
};
|
|
@@ -315,8 +315,13 @@ function ApiFactory() {
|
|
|
315
315
|
throw "没有选中任何元素";
|
|
316
316
|
}
|
|
317
317
|
const files = excalidrawAPI.getFiles();
|
|
318
|
-
if (selectedElements.length === 1 && selectedElements[0].type === "image" && selectedElements[0].fileId) {
|
|
319
|
-
if (selectedElements[0].fileId.startsWith("http")
|
|
318
|
+
if (selectedElements.length === 1 && selectedElements[0].type === "image" && selectedElements[0].fileId && !selectedElements[0].crop) {
|
|
319
|
+
if (selectedElements[0].fileId.startsWith("http")) {
|
|
320
|
+
return selectedElements[0].fileId;
|
|
321
|
+
}
|
|
322
|
+
if (/^([a-zA-Z]:[\\/]|\\\\[^\\/]+[\\/][^\\/]+)([^:*?"<>|\\/]+[\\/]?)*$/.test(
|
|
323
|
+
selectedElements[0].fileId
|
|
324
|
+
)) {
|
|
320
325
|
return selectedElements[0].fileId;
|
|
321
326
|
}
|
|
322
327
|
return files[selectedElements[0].fileId].dataURL;
|
package/dist/index.umd.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("jotai"), require("@8btc/excalidraw"), require("react")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "jotai", "@8btc/excalidraw", "react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.XCanvas = {}, global.jsxRuntime, global.Jotai, global.Excalidraw, global.React));
|
|
3
3
|
})(this, (function(exports2, jsxRuntime, jotai, excalidraw, react) {
|
|
4
4
|
"use strict";
|
|
5
|
-
const version = "0.0.14-beta.
|
|
5
|
+
const version = "0.0.14-beta.8";
|
|
6
6
|
const packageJson = {
|
|
7
7
|
version
|
|
8
8
|
};
|
|
@@ -315,8 +315,13 @@
|
|
|
315
315
|
throw "没有选中任何元素";
|
|
316
316
|
}
|
|
317
317
|
const files = excalidrawAPI.getFiles();
|
|
318
|
-
if (selectedElements.length === 1 && selectedElements[0].type === "image" && selectedElements[0].fileId) {
|
|
319
|
-
if (selectedElements[0].fileId.startsWith("http")
|
|
318
|
+
if (selectedElements.length === 1 && selectedElements[0].type === "image" && selectedElements[0].fileId && !selectedElements[0].crop) {
|
|
319
|
+
if (selectedElements[0].fileId.startsWith("http")) {
|
|
320
|
+
return selectedElements[0].fileId;
|
|
321
|
+
}
|
|
322
|
+
if (/^([a-zA-Z]:[\\/]|\\\\[^\\/]+[\\/][^\\/]+)([^:*?"<>|\\/]+[\\/]?)*$/.test(
|
|
323
|
+
selectedElements[0].fileId
|
|
324
|
+
)) {
|
|
320
325
|
return selectedElements[0].fileId;
|
|
321
326
|
}
|
|
322
327
|
return files[selectedElements[0].fileId].dataURL;
|