@haklex/rich-ext-gallery 0.4.1 → 0.6.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/README.md +45 -26
- package/dist/GalleryEditNode.d.ts.map +1 -1
- package/dist/GalleryEditRenderer.d.ts +1 -1
- package/dist/GalleryEditRenderer.d.ts.map +1 -1
- package/dist/GalleryNode-CKcqJG5T.js +122 -0
- package/dist/GalleryNode.d.ts +1 -1
- package/dist/GalleryNode.d.ts.map +1 -1
- package/dist/{GalleryNode-DBVAUkDV.js → GalleryRenderer-CyyWUTT0.js} +2 -113
- package/dist/GalleryRenderer.d.ts +1 -1
- package/dist/GalleryRenderer.d.ts.map +1 -1
- package/dist/augment.d.ts +9 -0
- package/dist/augment.d.ts.map +1 -0
- package/dist/edit-BQnC2MpC.js +406 -0
- package/dist/edit.d.ts +5 -0
- package/dist/edit.d.ts.map +1 -0
- package/dist/edit.mjs +2 -0
- package/dist/index.d.ts +3 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +6 -407
- package/dist/node.d.ts +7 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.mjs +5 -0
- package/dist/renderer.d.ts +3 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.mjs +2 -0
- package/dist/rich-ext-gallery.css +1 -1
- package/dist/slot.d.ts +8 -0
- package/dist/slot.d.ts.map +1 -0
- package/dist/static.d.ts +3 -5
- package/dist/static.d.ts.map +1 -1
- package/dist/static.mjs +5 -5
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +17 -5
package/README.md
CHANGED
|
@@ -10,46 +10,57 @@ pnpm add @haklex/rich-ext-gallery
|
|
|
10
10
|
|
|
11
11
|
## Peer Dependencies
|
|
12
12
|
|
|
13
|
-
| Package
|
|
14
|
-
|
|
|
15
|
-
| `lexical`
|
|
13
|
+
| Package | Version |
|
|
14
|
+
| -------------- | ---------- |
|
|
15
|
+
| `lexical` | `^0.41.0` |
|
|
16
16
|
| `lucide-react` | `^0.574.0` |
|
|
17
|
-
| `react`
|
|
18
|
-
| `react-dom`
|
|
17
|
+
| `react` | `>= 19` |
|
|
18
|
+
| `react-dom` | `>= 19` |
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
|
-
### Register nodes
|
|
22
|
+
### Register nodes
|
|
23
|
+
|
|
24
|
+
Edit (read + write):
|
|
23
25
|
|
|
24
26
|
```ts
|
|
25
|
-
import { galleryEditNodes } from '@haklex/rich-ext-gallery'
|
|
27
|
+
import { galleryEditNodes } from '@haklex/rich-ext-gallery/edit';
|
|
26
28
|
|
|
27
|
-
const editorConfig = {
|
|
28
|
-
nodes: [...galleryEditNodes],
|
|
29
|
-
}
|
|
29
|
+
const editorConfig = { nodes: [...galleryEditNodes] };
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Static / read-only:
|
|
33
33
|
|
|
34
34
|
```ts
|
|
35
|
-
import { galleryNodes } from '@haklex/rich-ext-gallery/
|
|
35
|
+
import { galleryNodes } from '@haklex/rich-ext-gallery/node';
|
|
36
36
|
|
|
37
|
-
const staticConfig = {
|
|
38
|
-
nodes: [...galleryNodes],
|
|
39
|
-
}
|
|
37
|
+
const staticConfig = { nodes: [...galleryNodes] };
|
|
40
38
|
```
|
|
41
39
|
|
|
42
40
|
### Use renderers
|
|
43
41
|
|
|
44
42
|
```tsx
|
|
45
|
-
import { GalleryEditRenderer } from '@haklex/rich-ext-gallery'
|
|
46
|
-
import { GalleryRenderer } from '@haklex/rich-ext-gallery/
|
|
43
|
+
import { GalleryEditRenderer } from '@haklex/rich-ext-gallery/edit';
|
|
44
|
+
import { GalleryRenderer } from '@haklex/rich-ext-gallery/renderer';
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Tree-shake the default renderer
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { GALLERY_NODE_KEY, galleryNodes } from '@haklex/rich-ext-gallery/node';
|
|
51
|
+
import type { RichRendererModule } from '@haklex/rich-compose';
|
|
52
|
+
|
|
53
|
+
const lightModule: RichRendererModule = {
|
|
54
|
+
name: 'gallery',
|
|
55
|
+
nodes: galleryNodes,
|
|
56
|
+
renderers: { [GALLERY_NODE_KEY]: MyLightGallery },
|
|
57
|
+
};
|
|
47
58
|
```
|
|
48
59
|
|
|
49
60
|
### Import styles
|
|
50
61
|
|
|
51
62
|
```ts
|
|
52
|
-
import '@haklex/rich-ext-gallery/style.css'
|
|
63
|
+
import '@haklex/rich-ext-gallery/style.css';
|
|
53
64
|
```
|
|
54
65
|
|
|
55
66
|
## Exports
|
|
@@ -67,18 +78,26 @@ import '@haklex/rich-ext-gallery/style.css'
|
|
|
67
78
|
- `GalleryRenderer` -- static renderer (grid/carousel display)
|
|
68
79
|
- `GalleryEditRenderer` -- edit renderer with drag-and-drop support
|
|
69
80
|
|
|
81
|
+
### Slot Key
|
|
82
|
+
|
|
83
|
+
- `GALLERY_NODE_KEY` -- `'Gallery'` constant for `RendererConfig` slot lookup
|
|
84
|
+
|
|
70
85
|
### Types
|
|
71
86
|
|
|
72
87
|
- `GalleryNodePayload` -- payload type for creating gallery nodes
|
|
73
88
|
- `SerializedGalleryNode` -- serialized gallery node type
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
| `@haklex/rich-ext-gallery
|
|
81
|
-
| `@haklex/rich-ext-gallery/
|
|
89
|
+
- `GalleryRendererProps` -- renderer props (also flowed into `RendererConfig.Gallery` via module augmentation)
|
|
90
|
+
|
|
91
|
+
## Sub-path Exports
|
|
92
|
+
|
|
93
|
+
| Path | Description |
|
|
94
|
+
| ------------------------------------ | --------------------------------------------------------- |
|
|
95
|
+
| `@haklex/rich-ext-gallery` | Full exports (node + renderer + edit) |
|
|
96
|
+
| `@haklex/rich-ext-gallery/node` | Lightweight node + slot key + types — no default renderer |
|
|
97
|
+
| `@haklex/rich-ext-gallery/renderer` | Default `GalleryRenderer` (heavy) |
|
|
98
|
+
| `@haklex/rich-ext-gallery/edit` | Edit-mode node + `GalleryEditRenderer` |
|
|
99
|
+
| `@haklex/rich-ext-gallery/static` | Convenience: node + renderer (SSR bundle) |
|
|
100
|
+
| `@haklex/rich-ext-gallery/style.css` | Stylesheet |
|
|
82
101
|
|
|
83
102
|
## Part of Haklex
|
|
84
103
|
|
|
@@ -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;
|
|
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;AAG1C,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAIjG,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryEditRenderer.d.ts","sourceRoot":"","sources":["../src/GalleryEditRenderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GalleryEditRenderer.d.ts","sourceRoot":"","sources":["../src/GalleryEditRenderer.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAiB,EAAE,EAAE,MAAM,OAAO,CAAC;AAM/C,OAAO,KAAK,EAAgB,oBAAoB,EAAE,MAAM,SAAS,CAAC;AA6RlE,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,oBAAoB,CA6DxD,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { DecoratorNode } from "lexical";
|
|
2
|
+
import { createRendererDecoration } from "@haklex/rich-editor/renderers";
|
|
3
|
+
//#region src/slot.ts
|
|
4
|
+
/**
|
|
5
|
+
* RendererConfig slot key for `@haklex/rich-ext-gallery`.
|
|
6
|
+
*
|
|
7
|
+
* Override modules should reference this constant instead of the bare string
|
|
8
|
+
* literal so renames stay searchable across the workspace.
|
|
9
|
+
*/
|
|
10
|
+
var GALLERY_NODE_KEY = "Gallery";
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region \0@oxc-project+runtime@0.127.0/helpers/typeof.js
|
|
13
|
+
function _typeof(o) {
|
|
14
|
+
"@babel/helpers - typeof";
|
|
15
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
16
|
+
return typeof o;
|
|
17
|
+
} : function(o) {
|
|
18
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
19
|
+
}, _typeof(o);
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region \0@oxc-project+runtime@0.127.0/helpers/toPrimitive.js
|
|
23
|
+
function toPrimitive(t, r) {
|
|
24
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
25
|
+
var e = t[Symbol.toPrimitive];
|
|
26
|
+
if (void 0 !== e) {
|
|
27
|
+
var i = e.call(t, r || "default");
|
|
28
|
+
if ("object" != _typeof(i)) return i;
|
|
29
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
30
|
+
}
|
|
31
|
+
return ("string" === r ? String : Number)(t);
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region \0@oxc-project+runtime@0.127.0/helpers/toPropertyKey.js
|
|
35
|
+
function toPropertyKey(t) {
|
|
36
|
+
var i = toPrimitive(t, "string");
|
|
37
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region \0@oxc-project+runtime@0.127.0/helpers/defineProperty.js
|
|
41
|
+
function _defineProperty(e, r, t) {
|
|
42
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
43
|
+
value: t,
|
|
44
|
+
enumerable: !0,
|
|
45
|
+
configurable: !0,
|
|
46
|
+
writable: !0
|
|
47
|
+
}) : e[r] = t, e;
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/GalleryNode.ts
|
|
51
|
+
var GalleryNode = class GalleryNode extends DecoratorNode {
|
|
52
|
+
static getType() {
|
|
53
|
+
return "gallery";
|
|
54
|
+
}
|
|
55
|
+
static clone(node) {
|
|
56
|
+
return new GalleryNode({
|
|
57
|
+
images: node.__images.map((img) => ({ ...img })),
|
|
58
|
+
layout: node.__layout
|
|
59
|
+
}, node.__key);
|
|
60
|
+
}
|
|
61
|
+
constructor(payload, key) {
|
|
62
|
+
super(key);
|
|
63
|
+
_defineProperty(this, "__images", void 0);
|
|
64
|
+
_defineProperty(this, "__layout", void 0);
|
|
65
|
+
this.__images = payload.images;
|
|
66
|
+
this.__layout = payload.layout || "grid";
|
|
67
|
+
}
|
|
68
|
+
createDOM(_config) {
|
|
69
|
+
const div = document.createElement("div");
|
|
70
|
+
div.className = `rich-gallery rich-gallery-${this.__layout}`;
|
|
71
|
+
return div;
|
|
72
|
+
}
|
|
73
|
+
updateDOM() {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
isInline() {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
static importJSON(serializedNode) {
|
|
80
|
+
return $createGalleryNode({
|
|
81
|
+
images: serializedNode.images,
|
|
82
|
+
layout: serializedNode.layout
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
exportJSON() {
|
|
86
|
+
return {
|
|
87
|
+
...super.exportJSON(),
|
|
88
|
+
type: "gallery",
|
|
89
|
+
images: this.__images,
|
|
90
|
+
layout: this.__layout,
|
|
91
|
+
version: 1
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
getImages() {
|
|
95
|
+
return this.getLatest().__images;
|
|
96
|
+
}
|
|
97
|
+
setImages(images) {
|
|
98
|
+
const writable = this.getWritable();
|
|
99
|
+
writable.__images = images;
|
|
100
|
+
}
|
|
101
|
+
getLayout() {
|
|
102
|
+
return this.getLatest().__layout;
|
|
103
|
+
}
|
|
104
|
+
setLayout(layout) {
|
|
105
|
+
const writable = this.getWritable();
|
|
106
|
+
writable.__layout = layout;
|
|
107
|
+
}
|
|
108
|
+
decorate(_editor, _config) {
|
|
109
|
+
return createRendererDecoration(GALLERY_NODE_KEY, void 0, {
|
|
110
|
+
images: this.__images,
|
|
111
|
+
layout: this.__layout
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
function $createGalleryNode(payload) {
|
|
116
|
+
return new GalleryNode(payload);
|
|
117
|
+
}
|
|
118
|
+
function $isGalleryNode(node) {
|
|
119
|
+
return node instanceof GalleryNode;
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
export { GALLERY_NODE_KEY as a, _defineProperty as i, $isGalleryNode as n, GalleryNode as r, $createGalleryNode as t };
|
package/dist/GalleryNode.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { GalleryImage } from '@haklex/rich-editor/renderers';
|
|
2
1
|
import { EditorConfig, LexicalEditor, LexicalNode, NodeKey, SerializedLexicalNode, Spread, DecoratorNode } from 'lexical';
|
|
3
2
|
import { ReactElement } from 'react';
|
|
3
|
+
import { GalleryImage } from './types';
|
|
4
4
|
export type SerializedGalleryNode = Spread<{
|
|
5
5
|
images: GalleryImage[];
|
|
6
6
|
layout?: 'grid' | 'masonry' | 'carousel';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryNode.d.ts","sourceRoot":"","sources":["../src/GalleryNode.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"GalleryNode.d.ts","sourceRoot":"","sources":["../src/GalleryNode.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAC;AAGnB,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,OAAO,EACP,qBAAqB,EACrB,MAAM,EACP,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAE,YAAY,EAAwB,MAAM,SAAS,CAAC;AAElE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CACxC;IACE,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;CAC1C,EACD,qBAAqB,CACtB,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;CAC1C;AAED,qBAAa,WAAY,SAAQ,aAAa,CAAC,YAAY,CAAC;IAC1D,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;IAE1C,MAAM,CAAC,OAAO,IAAI,MAAM;IAIxB,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW;gBAUhC,OAAO,EAAE,kBAAkB,EAAE,GAAG,CAAC,EAAE,OAAO;IAMtD,SAAS,CAAC,OAAO,EAAE,YAAY,GAAG,WAAW;IAM7C,SAAS,IAAI,OAAO;IAIpB,QAAQ,IAAI,OAAO;IAInB,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,qBAAqB,GAAG,WAAW;IAOrE,UAAU,IAAI,qBAAqB;IAUnC,SAAS,IAAI,YAAY,EAAE;IAI3B,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI;IAKvC,SAAS,IAAI,MAAM,GAAG,SAAS,GAAG,UAAU;IAI5C,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,IAAI;IAKxD,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY;CAOtE;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,CAE3E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,WAAW,CAExF"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { createRendererDecoration, decodeThumbHash } from "@haklex/rich-editor/renderers";
|
|
2
|
-
import { DecoratorNode } from "lexical";
|
|
3
1
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
4
2
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { decodeThumbHash } from "@haklex/rich-editor/renderers";
|
|
5
4
|
import "react-photo-view/dist/react-photo-view.css";
|
|
6
5
|
import { useInView } from "react-intersection-observer";
|
|
7
6
|
import { PhotoProvider, PhotoView } from "react-photo-view";
|
|
@@ -200,114 +199,4 @@ var GalleryFigure = memo(({ image, style }) => {
|
|
|
200
199
|
});
|
|
201
200
|
var GalleryRenderer_default = memo(GalleryRenderer);
|
|
202
201
|
//#endregion
|
|
203
|
-
|
|
204
|
-
function _typeof(o) {
|
|
205
|
-
"@babel/helpers - typeof";
|
|
206
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
207
|
-
return typeof o;
|
|
208
|
-
} : function(o) {
|
|
209
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
210
|
-
}, _typeof(o);
|
|
211
|
-
}
|
|
212
|
-
//#endregion
|
|
213
|
-
//#region \0@oxc-project+runtime@0.127.0/helpers/toPrimitive.js
|
|
214
|
-
function toPrimitive(t, r) {
|
|
215
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
216
|
-
var e = t[Symbol.toPrimitive];
|
|
217
|
-
if (void 0 !== e) {
|
|
218
|
-
var i = e.call(t, r || "default");
|
|
219
|
-
if ("object" != _typeof(i)) return i;
|
|
220
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
221
|
-
}
|
|
222
|
-
return ("string" === r ? String : Number)(t);
|
|
223
|
-
}
|
|
224
|
-
//#endregion
|
|
225
|
-
//#region \0@oxc-project+runtime@0.127.0/helpers/toPropertyKey.js
|
|
226
|
-
function toPropertyKey(t) {
|
|
227
|
-
var i = toPrimitive(t, "string");
|
|
228
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
229
|
-
}
|
|
230
|
-
//#endregion
|
|
231
|
-
//#region \0@oxc-project+runtime@0.127.0/helpers/defineProperty.js
|
|
232
|
-
function _defineProperty(e, r, t) {
|
|
233
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
234
|
-
value: t,
|
|
235
|
-
enumerable: !0,
|
|
236
|
-
configurable: !0,
|
|
237
|
-
writable: !0
|
|
238
|
-
}) : e[r] = t, e;
|
|
239
|
-
}
|
|
240
|
-
//#endregion
|
|
241
|
-
//#region src/GalleryNode.ts
|
|
242
|
-
var GalleryNode = class GalleryNode extends DecoratorNode {
|
|
243
|
-
static getType() {
|
|
244
|
-
return "gallery";
|
|
245
|
-
}
|
|
246
|
-
static clone(node) {
|
|
247
|
-
return new GalleryNode({
|
|
248
|
-
images: node.__images.map((img) => ({ ...img })),
|
|
249
|
-
layout: node.__layout
|
|
250
|
-
}, node.__key);
|
|
251
|
-
}
|
|
252
|
-
constructor(payload, key) {
|
|
253
|
-
super(key);
|
|
254
|
-
_defineProperty(this, "__images", void 0);
|
|
255
|
-
_defineProperty(this, "__layout", void 0);
|
|
256
|
-
this.__images = payload.images;
|
|
257
|
-
this.__layout = payload.layout || "grid";
|
|
258
|
-
}
|
|
259
|
-
createDOM(_config) {
|
|
260
|
-
const div = document.createElement("div");
|
|
261
|
-
div.className = `rich-gallery rich-gallery-${this.__layout}`;
|
|
262
|
-
return div;
|
|
263
|
-
}
|
|
264
|
-
updateDOM() {
|
|
265
|
-
return false;
|
|
266
|
-
}
|
|
267
|
-
isInline() {
|
|
268
|
-
return false;
|
|
269
|
-
}
|
|
270
|
-
static importJSON(serializedNode) {
|
|
271
|
-
return $createGalleryNode({
|
|
272
|
-
images: serializedNode.images,
|
|
273
|
-
layout: serializedNode.layout
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
exportJSON() {
|
|
277
|
-
return {
|
|
278
|
-
...super.exportJSON(),
|
|
279
|
-
type: "gallery",
|
|
280
|
-
images: this.__images,
|
|
281
|
-
layout: this.__layout,
|
|
282
|
-
version: 1
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
getImages() {
|
|
286
|
-
return this.getLatest().__images;
|
|
287
|
-
}
|
|
288
|
-
setImages(images) {
|
|
289
|
-
const writable = this.getWritable();
|
|
290
|
-
writable.__images = images;
|
|
291
|
-
}
|
|
292
|
-
getLayout() {
|
|
293
|
-
return this.getLatest().__layout;
|
|
294
|
-
}
|
|
295
|
-
setLayout(layout) {
|
|
296
|
-
const writable = this.getWritable();
|
|
297
|
-
writable.__layout = layout;
|
|
298
|
-
}
|
|
299
|
-
decorate(_editor, _config) {
|
|
300
|
-
return createRendererDecoration("Gallery", GalleryRenderer, {
|
|
301
|
-
images: this.__images,
|
|
302
|
-
layout: this.__layout
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
function $createGalleryNode(payload) {
|
|
307
|
-
return new GalleryNode(payload);
|
|
308
|
-
}
|
|
309
|
-
function $isGalleryNode(node) {
|
|
310
|
-
return node instanceof GalleryNode;
|
|
311
|
-
}
|
|
312
|
-
//#endregion
|
|
313
|
-
export { galleryImageList as A, galleryHeaderClose as C, galleryImageDragHandle as D, galleryImageDeleteBtn as E, galleryImageThumbPlaceholder as M, galleryImageFields as O, galleryHeaderActions as S, galleryImageCard as T, galleryEmptyState as _, GalleryRenderer as a, galleryFooterBtnSave as b, galleryDialogBody as c, galleryDialogHeader as d, galleryDialogPopup as f, galleryEditOverlay as g, galleryEditLabel as h, _defineProperty as i, galleryImageThumb as j, galleryImageInput as k, galleryDialogEmpty as l, galleryEditContainer as m, $isGalleryNode as n, GalleryRenderer_default as o, galleryDialogTitle as p, GalleryNode as r, galleryAddBtn as s, $createGalleryNode as t, galleryDialogFooter as u, galleryFooterActions as v, galleryImageActions as w, galleryFooterInfo as x, galleryFooterBtnCancel as y };
|
|
202
|
+
export { galleryImageDragHandle as C, galleryImageThumb as D, galleryImageList as E, galleryImageThumbPlaceholder as O, galleryImageDeleteBtn as S, galleryImageInput as T, galleryFooterInfo as _, galleryDialogEmpty as a, galleryImageActions as b, galleryDialogPopup as c, galleryEditLabel as d, galleryEditOverlay as f, galleryFooterBtnSave as g, galleryFooterBtnCancel as h, galleryDialogBody as i, galleryDialogTitle as l, galleryFooterActions as m, GalleryRenderer_default as n, galleryDialogFooter as o, galleryEmptyState as p, galleryAddBtn as r, galleryDialogHeader as s, GalleryRenderer as t, galleryEditContainer as u, galleryHeaderActions as v, galleryImageFields as w, galleryImageCard as x, galleryHeaderClose as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GalleryRendererProps } from '@haklex/rich-editor/renderers';
|
|
2
1
|
import { ComponentType } from 'react';
|
|
2
|
+
import { GalleryRendererProps } from './types';
|
|
3
3
|
export declare const GalleryRenderer: ComponentType<GalleryRendererProps>;
|
|
4
4
|
declare const _default: import('react').NamedExoticComponent<GalleryRendererProps>;
|
|
5
5
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryRenderer.d.ts","sourceRoot":"","sources":["../src/GalleryRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"GalleryRenderer.d.ts","sourceRoot":"","sources":["../src/GalleryRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,4CAA4C,CAAC;AAIpD,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,OAAO,CAAC;AAM3D,OAAO,KAAK,EAAgB,oBAAoB,EAAE,MAAM,SAAS,CAAC;AA+BlE,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC,oBAAoB,CAuL/D,CAAC;;AAuBF,wBAAqC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { GalleryRendererProps } from './types';
|
|
3
|
+
declare module '@haklex/rich-editor' {
|
|
4
|
+
interface RendererConfig {
|
|
5
|
+
Gallery?: ComponentType<GalleryRendererProps>;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=augment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"augment.d.ts","sourceRoot":"","sources":["../src/augment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,cAAc;QACtB,OAAO,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;KAC/C;CACF;AAED,OAAO,EAAE,CAAC"}
|