@haklex/rich-ext-gallery 0.25.1 → 0.26.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryEditNode.d.ts","sourceRoot":"","sources":["../src/GalleryEditNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"GalleryEditNode.d.ts","sourceRoot":"","sources":["../src/GalleryEditNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGjG,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,MAAM,CAAC,YAAY,EAAE,iBAAiB,EAAE,CAetC;IAEF,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,eAAe,GAAG,eAAe;gBAUxC,OAAO,EAAE,kBAAkB,EAAE,GAAG,CAAC,EAAE,OAAO;IAItD,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,qBAAqB,GAAG,eAAe;IAOzE,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY;CAoBrE;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,kBAAkB,GAAG,eAAe,CAEnF;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,eAAe,CAEhG"}
|
|
@@ -3,7 +3,6 @@ import { i as _defineProperty, r as GalleryNode } from "./GalleryNode-CvAj_vjz.j
|
|
|
3
3
|
import { $getNodeByKey, $insertNodes } from "lexical";
|
|
4
4
|
import { GripVertical, ImageIcon, Images, Pencil, Plus, Trash2, X } from "lucide-react";
|
|
5
5
|
import { createElement, useCallback, useRef, useState } from "react";
|
|
6
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import { DndContext, DragOverlay, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
|
|
8
7
|
import { SortableContext, arrayMove, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
9
8
|
import { CSS } from "@dnd-kit/utilities";
|
|
@@ -11,68 +10,7 @@ import { useColorScheme } from "@haklex/rich-editor/static";
|
|
|
11
10
|
import { SegmentedControl, presentDialog } from "@haklex/rich-editor-ui";
|
|
12
11
|
import { usePortalTheme, vars } from "@haklex/rich-style-token";
|
|
13
12
|
import { createPortal } from "react-dom";
|
|
14
|
-
|
|
15
|
-
var GalleryEditNode = class GalleryEditNode extends GalleryNode {
|
|
16
|
-
static clone(node) {
|
|
17
|
-
return new GalleryEditNode({
|
|
18
|
-
images: node.__images.map((img) => ({ ...img })),
|
|
19
|
-
layout: node.__layout
|
|
20
|
-
}, node.__key);
|
|
21
|
-
}
|
|
22
|
-
constructor(payload, key) {
|
|
23
|
-
super(payload, key);
|
|
24
|
-
}
|
|
25
|
-
static importJSON(serializedNode) {
|
|
26
|
-
return new GalleryEditNode({
|
|
27
|
-
images: serializedNode.images,
|
|
28
|
-
layout: serializedNode.layout
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
decorate(editor, _config) {
|
|
32
|
-
const nodeKey = this.__key;
|
|
33
|
-
return createElement(GalleryRenderer, {
|
|
34
|
-
images: this.__images,
|
|
35
|
-
layout: this.__layout,
|
|
36
|
-
onImagesChange: (images) => {
|
|
37
|
-
editor.update(() => {
|
|
38
|
-
const node = $getNodeByKey(nodeKey);
|
|
39
|
-
if (node) node.setImages(images);
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
onLayoutChange: (layout) => {
|
|
43
|
-
editor.update(() => {
|
|
44
|
-
const node = $getNodeByKey(nodeKey);
|
|
45
|
-
if (node) node.setLayout(layout);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
_defineProperty(GalleryEditNode, "commandItems", [{
|
|
52
|
-
title: "Gallery",
|
|
53
|
-
icon: createElement(Images, { size: 20 }),
|
|
54
|
-
description: "Image gallery grid",
|
|
55
|
-
keywords: [
|
|
56
|
-
"gallery",
|
|
57
|
-
"images",
|
|
58
|
-
"grid"
|
|
59
|
-
],
|
|
60
|
-
section: "MEDIA",
|
|
61
|
-
placement: ["slash", "toolbar"],
|
|
62
|
-
group: "insert",
|
|
63
|
-
onSelect: (editor) => {
|
|
64
|
-
editor.update(() => {
|
|
65
|
-
$insertNodes([$createGalleryEditNode({ images: [] })]);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}]);
|
|
69
|
-
function $createGalleryEditNode(payload) {
|
|
70
|
-
return new GalleryEditNode(payload);
|
|
71
|
-
}
|
|
72
|
-
function $isGalleryEditNode(node) {
|
|
73
|
-
return node instanceof GalleryEditNode;
|
|
74
|
-
}
|
|
75
|
-
//#endregion
|
|
13
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
76
14
|
//#region src/GalleryEditRenderer.tsx
|
|
77
15
|
var layoutItems = [
|
|
78
16
|
{
|
|
@@ -400,7 +338,69 @@ var GalleryEditRenderer = ({ images, layout, onImagesChange, onLayoutChange }) =
|
|
|
400
338
|
});
|
|
401
339
|
};
|
|
402
340
|
//#endregion
|
|
341
|
+
//#region src/GalleryEditNode.ts
|
|
342
|
+
var GalleryEditNode = class GalleryEditNode extends GalleryNode {
|
|
343
|
+
static clone(node) {
|
|
344
|
+
return new GalleryEditNode({
|
|
345
|
+
images: node.__images.map((img) => ({ ...img })),
|
|
346
|
+
layout: node.__layout
|
|
347
|
+
}, node.__key);
|
|
348
|
+
}
|
|
349
|
+
constructor(payload, key) {
|
|
350
|
+
super(payload, key);
|
|
351
|
+
}
|
|
352
|
+
static importJSON(serializedNode) {
|
|
353
|
+
return new GalleryEditNode({
|
|
354
|
+
images: serializedNode.images,
|
|
355
|
+
layout: serializedNode.layout
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
decorate(editor, _config) {
|
|
359
|
+
const nodeKey = this.__key;
|
|
360
|
+
return createElement(GalleryEditRenderer, {
|
|
361
|
+
images: this.__images,
|
|
362
|
+
layout: this.__layout,
|
|
363
|
+
onImagesChange: (images) => {
|
|
364
|
+
editor.update(() => {
|
|
365
|
+
const node = $getNodeByKey(nodeKey);
|
|
366
|
+
if (node) node.setImages(images);
|
|
367
|
+
});
|
|
368
|
+
},
|
|
369
|
+
onLayoutChange: (layout) => {
|
|
370
|
+
editor.update(() => {
|
|
371
|
+
const node = $getNodeByKey(nodeKey);
|
|
372
|
+
if (node) node.setLayout(layout);
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
_defineProperty(GalleryEditNode, "commandItems", [{
|
|
379
|
+
title: "Gallery",
|
|
380
|
+
icon: createElement(Images, { size: 20 }),
|
|
381
|
+
description: "Image gallery grid",
|
|
382
|
+
keywords: [
|
|
383
|
+
"gallery",
|
|
384
|
+
"images",
|
|
385
|
+
"grid"
|
|
386
|
+
],
|
|
387
|
+
section: "MEDIA",
|
|
388
|
+
placement: ["slash", "toolbar"],
|
|
389
|
+
group: "insert",
|
|
390
|
+
onSelect: (editor) => {
|
|
391
|
+
editor.update(() => {
|
|
392
|
+
$insertNodes([$createGalleryEditNode({ images: [] })]);
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
}]);
|
|
396
|
+
function $createGalleryEditNode(payload) {
|
|
397
|
+
return new GalleryEditNode(payload);
|
|
398
|
+
}
|
|
399
|
+
function $isGalleryEditNode(node) {
|
|
400
|
+
return node instanceof GalleryEditNode;
|
|
401
|
+
}
|
|
402
|
+
//#endregion
|
|
403
403
|
//#region src/edit.ts
|
|
404
404
|
var galleryEditNodes = [GalleryEditNode];
|
|
405
405
|
//#endregion
|
|
406
|
-
export {
|
|
406
|
+
export { GalleryEditRenderer as a, GalleryEditNode as i, $createGalleryEditNode as n, $isGalleryEditNode as r, galleryEditNodes as t };
|
package/dist/edit.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as __augmentLoaded_gallery } from "./augment-DgwFVGf9.js";
|
|
2
|
-
import { a as
|
|
2
|
+
import { a as GalleryEditRenderer, i as GalleryEditNode, n as $createGalleryEditNode, r as $isGalleryEditNode, t as galleryEditNodes } from "./edit-U3YtpHCm.js";
|
|
3
3
|
export { $createGalleryEditNode, $isGalleryEditNode, GalleryEditNode, GalleryEditRenderer, __augmentLoaded_gallery, galleryEditNodes };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __augmentLoaded_gallery } from "./augment-DgwFVGf9.js";
|
|
2
2
|
import { t as GalleryRenderer } from "./GalleryRenderer-CiHBgw2X.js";
|
|
3
|
+
import { a as GalleryEditRenderer, i as GalleryEditNode, n as $createGalleryEditNode, r as $isGalleryEditNode, t as galleryEditNodes } from "./edit-U3YtpHCm.js";
|
|
3
4
|
import { a as GALLERY_NODE_KEY, n as $isGalleryNode, r as GalleryNode, t as $createGalleryNode } from "./GalleryNode-CvAj_vjz.js";
|
|
4
|
-
import { a as GalleryEditNode, i as $isGalleryEditNode, n as GalleryEditRenderer, r as $createGalleryEditNode, t as galleryEditNodes } from "./edit-CrTPy6pZ.js";
|
|
5
5
|
import { galleryNodes } from "./node.mjs";
|
|
6
6
|
import "./renderer.mjs";
|
|
7
7
|
export { $createGalleryEditNode, $createGalleryNode, $isGalleryEditNode, $isGalleryNode, GALLERY_NODE_KEY, GalleryEditNode, GalleryEditRenderer, GalleryNode, GalleryRenderer, __augmentLoaded_gallery, galleryEditNodes, galleryNodes };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-ext-gallery",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.1",
|
|
4
4
|
"description": "Image gallery extension with drag-and-drop",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"lucide-react": "^1.0.0",
|
|
61
61
|
"react": ">=19",
|
|
62
62
|
"react-dom": ">=19",
|
|
63
|
-
"@haklex/rich-editor": "0.
|
|
64
|
-
"@haklex/rich-editor
|
|
65
|
-
"@haklex/rich-style-token": "0.
|
|
63
|
+
"@haklex/rich-editor-ui": "0.26.1",
|
|
64
|
+
"@haklex/rich-editor": "0.26.1",
|
|
65
|
+
"@haklex/rich-style-token": "0.26.1"
|
|
66
66
|
},
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|