@anu3ev/fabric-image-editor 0.1.62 → 0.1.63
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/main.js +32 -22
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -89,7 +89,10 @@ class R {
|
|
|
89
89
|
*/
|
|
90
90
|
_filterLockedSelection({ selected: e, e: t }) {
|
|
91
91
|
if (!(e != null && e.length) || !(t instanceof MouseEvent) || e.length === 1) return;
|
|
92
|
-
const
|
|
92
|
+
const { lockedObjects: s, unlockedObjects: n } = e.reduce(
|
|
93
|
+
(a, o) => o.locked ? (a.lockedObjects.push(o), a) : (a.unlockedObjects.push(o), a),
|
|
94
|
+
{ lockedObjects: [], unlockedObjects: [] }
|
|
95
|
+
);
|
|
93
96
|
if (s.length === 0) return;
|
|
94
97
|
if (n.length > 0) {
|
|
95
98
|
if (n.length === 1)
|
|
@@ -2357,7 +2360,7 @@ class dt {
|
|
|
2357
2360
|
copy() {
|
|
2358
2361
|
return v(this, null, function* () {
|
|
2359
2362
|
const { canvas: e, errorManager: t } = this.editor, s = e.getActiveObject();
|
|
2360
|
-
if (!s) return;
|
|
2363
|
+
if (!s || s.locked) return;
|
|
2361
2364
|
try {
|
|
2362
2365
|
const g = yield s.clone(["format"]);
|
|
2363
2366
|
this.clipboard = g, e.fire("editor:object-copied", { object: g });
|
|
@@ -2414,28 +2417,35 @@ class dt {
|
|
|
2414
2417
|
* @param event.clipboardData — данные из буфера обмена
|
|
2415
2418
|
* @param event.clipboardData.items — элементы буфера обмена
|
|
2416
2419
|
*/
|
|
2417
|
-
handlePasteEvent(
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
const d = new FileReader();
|
|
2425
|
-
d.onload = (c) => {
|
|
2426
|
-
c.target && this.editor.imageManager.importImage({ source: c.target.result });
|
|
2427
|
-
}, d.readAsDataURL(o);
|
|
2428
|
-
return;
|
|
2429
|
-
}
|
|
2430
|
-
const i = e.getData("text/html");
|
|
2431
|
-
if (i) {
|
|
2432
|
-
const c = new DOMParser().parseFromString(i, "text/html").querySelector("img");
|
|
2433
|
-
if (c != null && c.src) {
|
|
2434
|
-
t.importImage({ source: c.src });
|
|
2420
|
+
handlePasteEvent(t) {
|
|
2421
|
+
return v(this, arguments, function* ({ clipboardData: e }) {
|
|
2422
|
+
var d;
|
|
2423
|
+
if (!((d = e == null ? void 0 : e.items) != null && d.length)) return;
|
|
2424
|
+
const s = e.getData("text/plain");
|
|
2425
|
+
if (s && s.startsWith("application/image-editor:")) {
|
|
2426
|
+
this.paste();
|
|
2435
2427
|
return;
|
|
2436
2428
|
}
|
|
2437
|
-
|
|
2438
|
-
|
|
2429
|
+
const { imageManager: n } = this.editor, { items: i } = e, a = i[i.length - 1];
|
|
2430
|
+
if (a.type !== "text/html") {
|
|
2431
|
+
const c = a.getAsFile();
|
|
2432
|
+
if (!c) return;
|
|
2433
|
+
const l = new FileReader();
|
|
2434
|
+
l.onload = (h) => {
|
|
2435
|
+
h.target && this.editor.imageManager.importImage({ source: h.target.result });
|
|
2436
|
+
}, l.readAsDataURL(c);
|
|
2437
|
+
return;
|
|
2438
|
+
}
|
|
2439
|
+
const o = e.getData("text/html");
|
|
2440
|
+
if (o) {
|
|
2441
|
+
const h = new DOMParser().parseFromString(o, "text/html").querySelector("img");
|
|
2442
|
+
if (h != null && h.src) {
|
|
2443
|
+
n.importImage({ source: h.src });
|
|
2444
|
+
return;
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
this.paste();
|
|
2448
|
+
});
|
|
2439
2449
|
}
|
|
2440
2450
|
/**
|
|
2441
2451
|
* Вставка объекта
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anu3ev/fabric-image-editor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.63",
|
|
4
4
|
"description": "JavaScript image editor built on FabricJS, allowing you to create instances with an integrated montage area and providing an API to modify and manage state.",
|
|
5
5
|
"module": "dist/main.js",
|
|
6
6
|
"files": [
|