@qwanyx/ai-editor 1.3.9 → 1.3.10
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.
|
@@ -19,6 +19,7 @@ export interface ImagePayload {
|
|
|
19
19
|
captionVerticalAlign?: CaptionVerticalAlignType;
|
|
20
20
|
captionSize?: CaptionSizeType;
|
|
21
21
|
showFileName?: boolean;
|
|
22
|
+
showAltText?: boolean;
|
|
22
23
|
borderWidth?: number;
|
|
23
24
|
borderColor?: string;
|
|
24
25
|
borderRadius?: number;
|
|
@@ -41,6 +42,7 @@ export type SerializedImageNode = Spread<{
|
|
|
41
42
|
captionVerticalAlign?: CaptionVerticalAlignType;
|
|
42
43
|
captionSize?: CaptionSizeType;
|
|
43
44
|
showFileName?: boolean;
|
|
45
|
+
showAltText?: boolean;
|
|
44
46
|
borderWidth?: number;
|
|
45
47
|
borderColor?: string;
|
|
46
48
|
borderRadius?: number;
|
|
@@ -63,6 +65,7 @@ export declare class ImageNode extends DecoratorNode<React.ReactElement> {
|
|
|
63
65
|
__captionVerticalAlign?: CaptionVerticalAlignType;
|
|
64
66
|
__captionSize?: CaptionSizeType;
|
|
65
67
|
__showFileName?: boolean;
|
|
68
|
+
__showAltText?: boolean;
|
|
66
69
|
__borderWidth?: number;
|
|
67
70
|
__borderColor?: string;
|
|
68
71
|
__borderRadius?: number;
|
|
@@ -72,7 +75,7 @@ export declare class ImageNode extends DecoratorNode<React.ReactElement> {
|
|
|
72
75
|
__shadowColor?: string;
|
|
73
76
|
static getType(): string;
|
|
74
77
|
static clone(node: ImageNode): ImageNode;
|
|
75
|
-
constructor(src: string, altText?: string, width?: number, height?: number, copyright?: string, photographer?: string, comment?: string, float?: ImageFloatType, captionPosition?: CaptionPositionType, captionAlign?: CaptionAlignType, captionVerticalAlign?: CaptionVerticalAlignType, captionSize?: CaptionSizeType, showFileName?: boolean, borderWidth?: number, borderColor?: string, borderRadius?: number, shadowOffsetX?: number, shadowOffsetY?: number, shadowBlur?: number, shadowColor?: string, key?: NodeKey);
|
|
78
|
+
constructor(src: string, altText?: string, width?: number, height?: number, copyright?: string, photographer?: string, comment?: string, float?: ImageFloatType, captionPosition?: CaptionPositionType, captionAlign?: CaptionAlignType, captionVerticalAlign?: CaptionVerticalAlignType, captionSize?: CaptionSizeType, showFileName?: boolean, showAltText?: boolean, borderWidth?: number, borderColor?: string, borderRadius?: number, shadowOffsetX?: number, shadowOffsetY?: number, shadowBlur?: number, shadowColor?: string, key?: NodeKey);
|
|
76
79
|
createDOM(): HTMLElement;
|
|
77
80
|
updateDOM(): false;
|
|
78
81
|
setSrc(src: string): void;
|
|
@@ -101,6 +104,8 @@ export declare class ImageNode extends DecoratorNode<React.ReactElement> {
|
|
|
101
104
|
getCaptionSize(): CaptionSizeType | undefined;
|
|
102
105
|
setShowFileName(showFileName: boolean | undefined): void;
|
|
103
106
|
getShowFileName(): boolean | undefined;
|
|
107
|
+
setShowAltText(showAltText: boolean | undefined): void;
|
|
108
|
+
getShowAltText(): boolean | undefined;
|
|
104
109
|
setBorderWidth(borderWidth: number | undefined): void;
|
|
105
110
|
getBorderWidth(): number | undefined;
|
|
106
111
|
setBorderColor(borderColor: string | undefined): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageNode.d.ts","sourceRoot":"","sources":["../../src/nodes/ImageNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,OAAO,EACP,qBAAqB,EACrB,MAAM,EAUP,MAAM,SAAS,CAAA;AAIhB,OAAO,KAAmD,MAAM,OAAO,CAAA;AAGvE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AACtD,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAA;AAChE,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;AAC1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AAG,SAAS;IAItC,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAKnD,aAAa,IAAI,MAAM,GAAG,SAAS;IAInC,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAKrD,cAAc,IAAI,MAAM,GAAG,SAAS;IAIpC,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,mBAAmB,GAAG,SAAS;IAKjE,UAAU,IAAI,mBAAmB;IA4BjC,SAAS,IAAI,eAAe;IAS5B,MAAM,CAAC,SAAS,IAAI,gBAAgB,GAAG,IAAI;IAgB3C,QAAQ,IAAI,KAAK,CAAC,YAAY;CA4B/B;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,YAAY,GAAG,SAAS,CAwBjE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,SAAS,CAEpF"}
|
package/dist/nodes/ImageNode.js
CHANGED
|
@@ -17,7 +17,7 @@ const CAPTION_FONT_SIZES = {
|
|
|
17
17
|
medium: { base: 16, alt: 18 },
|
|
18
18
|
large: { base: 24, alt: 26 }
|
|
19
19
|
};
|
|
20
|
-
function ImageComponent({ src, altText, width, height, copyright: initialCopyright, photographer: initialPhotographer, comment: initialComment, float: initialFloat, captionPosition: initialCaptionPosition, captionAlign: initialCaptionAlign, captionVerticalAlign: initialCaptionVerticalAlign, captionSize: initialCaptionSize, showFileName: initialShowFileName, borderWidth: initialBorderWidth, borderColor: initialBorderColor, borderRadius: initialBorderRadius, shadowOffsetX: initialShadowOffsetX, shadowOffsetY: initialShadowOffsetY, shadowBlur: initialShadowBlur, shadowColor: initialShadowColor, nodeKey, }) {
|
|
20
|
+
function ImageComponent({ src, altText, width, height, copyright: initialCopyright, photographer: initialPhotographer, comment: initialComment, float: initialFloat, captionPosition: initialCaptionPosition, captionAlign: initialCaptionAlign, captionVerticalAlign: initialCaptionVerticalAlign, captionSize: initialCaptionSize, showFileName: initialShowFileName, showAltText: initialShowAltText, borderWidth: initialBorderWidth, borderColor: initialBorderColor, borderRadius: initialBorderRadius, shadowOffsetX: initialShadowOffsetX, shadowOffsetY: initialShadowOffsetY, shadowBlur: initialShadowBlur, shadowColor: initialShadowColor, nodeKey, }) {
|
|
21
21
|
const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
|
|
22
22
|
const { isViewer } = (0, EditorModeContext_1.useEditorMode)();
|
|
23
23
|
const containerRef = (0, react_1.useRef)(null);
|
|
@@ -38,6 +38,7 @@ function ImageComponent({ src, altText, width, height, copyright: initialCopyrig
|
|
|
38
38
|
const [displayCaptionVerticalAlign, setDisplayCaptionVerticalAlign] = (0, react_1.useState)(initialCaptionVerticalAlign || 'middle');
|
|
39
39
|
const [displayCaptionSize, setDisplayCaptionSize] = (0, react_1.useState)(initialCaptionSize || 'small');
|
|
40
40
|
const [displayShowFileName, setDisplayShowFileName] = (0, react_1.useState)(initialShowFileName || false);
|
|
41
|
+
const [displayShowAltText, setDisplayShowAltText] = (0, react_1.useState)(initialShowAltText !== false);
|
|
41
42
|
const [displayBorderWidth, setDisplayBorderWidth] = (0, react_1.useState)(initialBorderWidth || 0);
|
|
42
43
|
const [displayBorderColor, setDisplayBorderColor] = (0, react_1.useState)(initialBorderColor || '#000000');
|
|
43
44
|
const [displayBorderRadius, setDisplayBorderRadius] = (0, react_1.useState)(initialBorderRadius || 0);
|
|
@@ -57,6 +58,7 @@ function ImageComponent({ src, altText, width, height, copyright: initialCopyrig
|
|
|
57
58
|
const [editCaptionVerticalAlign, setEditCaptionVerticalAlign] = (0, react_1.useState)('middle');
|
|
58
59
|
const [editCaptionSize, setEditCaptionSize] = (0, react_1.useState)('small');
|
|
59
60
|
const [editShowFileName, setEditShowFileName] = (0, react_1.useState)(false);
|
|
61
|
+
const [editShowAltText, setEditShowAltText] = (0, react_1.useState)(true);
|
|
60
62
|
const [editBorderWidth, setEditBorderWidth] = (0, react_1.useState)(0);
|
|
61
63
|
const [editBorderColor, setEditBorderColor] = (0, react_1.useState)('#000000');
|
|
62
64
|
const [editBorderRadius, setEditBorderRadius] = (0, react_1.useState)(0);
|
|
@@ -173,6 +175,7 @@ function ImageComponent({ src, altText, width, height, copyright: initialCopyrig
|
|
|
173
175
|
setEditCaptionVerticalAlign(node.getCaptionVerticalAlign() || 'middle');
|
|
174
176
|
setEditCaptionSize(node.getCaptionSize() || 'small');
|
|
175
177
|
setEditShowFileName(node.getShowFileName() || false);
|
|
178
|
+
setEditShowAltText(node.getShowAltText() !== false);
|
|
176
179
|
setEditBorderWidth(node.getBorderWidth() || 0);
|
|
177
180
|
setEditBorderColor(node.getBorderColor() || '#000000');
|
|
178
181
|
setEditBorderRadius(node.getBorderRadius() || 0);
|
|
@@ -220,6 +223,7 @@ function ImageComponent({ src, altText, width, height, copyright: initialCopyrig
|
|
|
220
223
|
node.setCaptionVerticalAlign(editCaptionVerticalAlign);
|
|
221
224
|
node.setCaptionSize(editCaptionSize);
|
|
222
225
|
node.setShowFileName(editShowFileName);
|
|
226
|
+
node.setShowAltText(editShowAltText);
|
|
223
227
|
node.setBorderWidth(editBorderWidth || undefined);
|
|
224
228
|
node.setBorderColor(editBorderColor || undefined);
|
|
225
229
|
node.setBorderRadius(editBorderRadius || undefined);
|
|
@@ -239,6 +243,7 @@ function ImageComponent({ src, altText, width, height, copyright: initialCopyrig
|
|
|
239
243
|
setDisplayCaptionVerticalAlign(editCaptionVerticalAlign);
|
|
240
244
|
setDisplayCaptionSize(editCaptionSize);
|
|
241
245
|
setDisplayShowFileName(editShowFileName);
|
|
246
|
+
setDisplayShowAltText(editShowAltText);
|
|
242
247
|
setDisplayBorderWidth(editBorderWidth);
|
|
243
248
|
setDisplayBorderColor(editBorderColor);
|
|
244
249
|
setDisplayBorderRadius(editBorderRadius);
|
|
@@ -247,7 +252,7 @@ function ImageComponent({ src, altText, width, height, copyright: initialCopyrig
|
|
|
247
252
|
setDisplayShadowBlur(editShadowBlur);
|
|
248
253
|
setDisplayShadowColor(editShadowColor);
|
|
249
254
|
setShowMetadataEditor(false);
|
|
250
|
-
}, [editor, nodeKey, editSrc, editAltText, editCopyright, editPhotographer, editComment, editFloat, editCaptionPosition, editCaptionAlign, editCaptionVerticalAlign, editCaptionSize, editShowFileName, editBorderWidth, editBorderColor, editBorderRadius, editShadowOffsetX, editShadowOffsetY, editShadowBlur, editShadowColor]);
|
|
255
|
+
}, [editor, nodeKey, editSrc, editAltText, editCopyright, editPhotographer, editComment, editFloat, editCaptionPosition, editCaptionAlign, editCaptionVerticalAlign, editCaptionSize, editShowFileName, editShowAltText, editBorderWidth, editBorderColor, editBorderRadius, editShadowOffsetX, editShadowOffsetY, editShadowBlur, editShadowColor]);
|
|
251
256
|
// Get float styles
|
|
252
257
|
const getFloatStyles = () => {
|
|
253
258
|
if (displayFloat === 'left') {
|
|
@@ -269,7 +274,7 @@ function ImageComponent({ src, altText, width, height, copyright: initialCopyrig
|
|
|
269
274
|
const copyrightEl = displayCopyright && ((0, jsx_runtime_1.jsxs)("span", { style: { display: 'flex', alignItems: 'center', gap: '3px', fontSize: `${fontSize.base}px` }, children: [(0, jsx_runtime_1.jsx)("span", { className: "material-icons", style: { fontSize: `${iconSize}px` }, children: "copyright" }), displayCopyright] }, "copyright"));
|
|
270
275
|
const photographerEl = displayPhotographer && ((0, jsx_runtime_1.jsxs)("span", { style: { display: 'flex', alignItems: 'center', gap: '3px', fontSize: `${fontSize.base}px` }, children: [(0, jsx_runtime_1.jsx)("span", { className: "material-icons", style: { fontSize: `${iconSize}px` }, children: "photo_camera" }), displayPhotographer] }, "photographer"));
|
|
271
276
|
const fileNameEl = fileName && ((0, jsx_runtime_1.jsxs)("span", { style: { display: 'flex', alignItems: 'center', gap: '3px', fontSize: `${fontSize.base}px`, fontStyle: 'italic' }, children: [(0, jsx_runtime_1.jsx)("span", { className: "material-icons", style: { fontSize: `${iconSize}px` }, children: "insert_drive_file" }), fileName] }, "fileName"));
|
|
272
|
-
const altTextEl = altText && ((0, jsx_runtime_1.jsx)("span", { style: { display: 'block', fontWeight: 'bold', fontSize: `${fontSize.alt}px` }, children: altText }, "altText"));
|
|
277
|
+
const altTextEl = altText && displayShowAltText && ((0, jsx_runtime_1.jsx)("span", { style: { display: 'block', fontWeight: 'bold', fontSize: `${fontSize.alt}px` }, children: altText }, "altText"));
|
|
273
278
|
const commentEl = displayComment && ((0, jsx_runtime_1.jsx)("span", { style: { display: 'block', fontSize: `${fontSize.base}px` }, children: displayComment }, "comment"));
|
|
274
279
|
if (position === 'beside') {
|
|
275
280
|
// Beside order: altText (bold) → comment → fileName → copyright → photographer
|
|
@@ -281,7 +286,7 @@ function ImageComponent({ src, altText, width, height, copyright: initialCopyrig
|
|
|
281
286
|
}
|
|
282
287
|
};
|
|
283
288
|
// Check if there's any metadata to display
|
|
284
|
-
const hasMetadata = displayCopyright || displayPhotographer || displayComment || altText || (displayShowFileName && src);
|
|
289
|
+
const hasMetadata = displayCopyright || displayPhotographer || displayComment || (altText && displayShowAltText) || (displayShowFileName && src);
|
|
285
290
|
// Get vertical alignment for beside mode
|
|
286
291
|
const getVerticalAlign = () => {
|
|
287
292
|
switch (displayCaptionVerticalAlign) {
|
|
@@ -656,19 +661,31 @@ function ImageComponent({ src, altText, width, height, copyright: initialCopyrig
|
|
|
656
661
|
alignItems: 'center',
|
|
657
662
|
justifyContent: 'center',
|
|
658
663
|
gap: '2px',
|
|
659
|
-
}, title: "Grand (24px)", children: [(0, jsx_runtime_1.jsx)("span", { style: { fontSize: '18px', fontWeight: 500 }, children: "Aa" }), (0, jsx_runtime_1.jsx)("span", { style: { fontSize: '9px' }, children: "Grand" })] })] })] })), editCaptionPosition !== 'overlay' && ((0, jsx_runtime_1.
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
664
|
+
}, title: "Grand (24px)", children: [(0, jsx_runtime_1.jsx)("span", { style: { fontSize: '18px', fontWeight: 500 }, children: "Aa" }), (0, jsx_runtime_1.jsx)("span", { style: { fontSize: '9px' }, children: "Grand" })] })] })] })), editCaptionPosition !== 'overlay' && ((0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: '24px', display: 'flex', flexDirection: 'column', gap: '12px' }, children: [(0, jsx_runtime_1.jsxs)("label", { style: {
|
|
665
|
+
display: 'flex',
|
|
666
|
+
alignItems: 'center',
|
|
667
|
+
gap: '10px',
|
|
668
|
+
fontSize: '14px',
|
|
669
|
+
fontWeight: 500,
|
|
670
|
+
color: '#374151',
|
|
671
|
+
cursor: 'pointer',
|
|
672
|
+
}, children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", checked: editShowAltText, onChange: (e) => setEditShowAltText(e.target.checked), style: {
|
|
673
|
+
width: '18px',
|
|
674
|
+
height: '18px',
|
|
675
|
+
cursor: 'pointer',
|
|
676
|
+
} }), (0, jsx_runtime_1.jsx)("span", { className: "material-icons", style: { fontSize: '18px', color: '#6b7280' }, children: "description" }), "Afficher le texte alternatif"] }), (0, jsx_runtime_1.jsxs)("label", { style: {
|
|
677
|
+
display: 'flex',
|
|
678
|
+
alignItems: 'center',
|
|
679
|
+
gap: '10px',
|
|
680
|
+
fontSize: '14px',
|
|
681
|
+
fontWeight: 500,
|
|
682
|
+
color: '#374151',
|
|
683
|
+
cursor: 'pointer',
|
|
684
|
+
}, children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", checked: editShowFileName, onChange: (e) => setEditShowFileName(e.target.checked), style: {
|
|
685
|
+
width: '18px',
|
|
686
|
+
height: '18px',
|
|
687
|
+
cursor: 'pointer',
|
|
688
|
+
} }), (0, jsx_runtime_1.jsx)("span", { className: "material-icons", style: { fontSize: '18px', color: '#6b7280' }, children: "insert_drive_file" }), "Afficher le nom du fichier"] })] })), (0, jsx_runtime_1.jsx)("hr", { style: { border: 'none', borderTop: '1px solid #e5e7eb', margin: '20px 0' } }), (0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: '16px' }, children: [(0, jsx_runtime_1.jsxs)("label", { style: { display: 'flex', alignItems: 'center', gap: '8px', marginBottom: '6px', fontSize: '14px', fontWeight: 500, color: '#374151' }, children: [(0, jsx_runtime_1.jsx)("span", { className: "material-icons", style: { fontSize: '18px', color: '#6b7280' }, children: "crop_square" }), "Bordure"] }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', gap: '12px', alignItems: 'center' }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsx)("label", { style: { fontSize: '12px', color: '#6b7280', marginBottom: '4px', display: 'block' }, children: "\u00C9paisseur (px)" }), (0, jsx_runtime_1.jsx)("input", { type: "number", min: "0", max: "20", value: editBorderWidth, onChange: (e) => setEditBorderWidth(parseInt(e.target.value) || 0), style: {
|
|
672
689
|
width: '100%',
|
|
673
690
|
padding: '8px 10px',
|
|
674
691
|
border: '1px solid #d1d5db',
|
|
@@ -787,9 +804,9 @@ class ImageNode extends lexical_1.DecoratorNode {
|
|
|
787
804
|
return 'image';
|
|
788
805
|
}
|
|
789
806
|
static clone(node) {
|
|
790
|
-
return new ImageNode(node.__src, node.__altText, node.__width, node.__height, node.__copyright, node.__photographer, node.__comment, node.__float, node.__captionPosition, node.__captionAlign, node.__captionVerticalAlign, node.__captionSize, node.__showFileName, node.__borderWidth, node.__borderColor, node.__borderRadius, node.__shadowOffsetX, node.__shadowOffsetY, node.__shadowBlur, node.__shadowColor, node.__key);
|
|
807
|
+
return new ImageNode(node.__src, node.__altText, node.__width, node.__height, node.__copyright, node.__photographer, node.__comment, node.__float, node.__captionPosition, node.__captionAlign, node.__captionVerticalAlign, node.__captionSize, node.__showFileName, node.__showAltText, node.__borderWidth, node.__borderColor, node.__borderRadius, node.__shadowOffsetX, node.__shadowOffsetY, node.__shadowBlur, node.__shadowColor, node.__key);
|
|
791
808
|
}
|
|
792
|
-
constructor(src, altText = '', width, height, copyright, photographer, comment, float, captionPosition, captionAlign, captionVerticalAlign, captionSize, showFileName, borderWidth, borderColor, borderRadius, shadowOffsetX, shadowOffsetY, shadowBlur, shadowColor, key) {
|
|
809
|
+
constructor(src, altText = '', width, height, copyright, photographer, comment, float, captionPosition, captionAlign, captionVerticalAlign, captionSize, showFileName, showAltText, borderWidth, borderColor, borderRadius, shadowOffsetX, shadowOffsetY, shadowBlur, shadowColor, key) {
|
|
793
810
|
super(key);
|
|
794
811
|
this.__src = src;
|
|
795
812
|
this.__altText = altText;
|
|
@@ -804,6 +821,7 @@ class ImageNode extends lexical_1.DecoratorNode {
|
|
|
804
821
|
this.__captionVerticalAlign = captionVerticalAlign;
|
|
805
822
|
this.__captionSize = captionSize;
|
|
806
823
|
this.__showFileName = showFileName;
|
|
824
|
+
this.__showAltText = showAltText;
|
|
807
825
|
this.__borderWidth = borderWidth;
|
|
808
826
|
this.__borderColor = borderColor;
|
|
809
827
|
this.__borderRadius = borderRadius;
|
|
@@ -911,6 +929,13 @@ class ImageNode extends lexical_1.DecoratorNode {
|
|
|
911
929
|
getShowFileName() {
|
|
912
930
|
return this.__showFileName;
|
|
913
931
|
}
|
|
932
|
+
setShowAltText(showAltText) {
|
|
933
|
+
const writable = this.getWritable();
|
|
934
|
+
writable.__showAltText = showAltText;
|
|
935
|
+
}
|
|
936
|
+
getShowAltText() {
|
|
937
|
+
return this.__showAltText;
|
|
938
|
+
}
|
|
914
939
|
setBorderWidth(borderWidth) {
|
|
915
940
|
const writable = this.getWritable();
|
|
916
941
|
writable.__borderWidth = borderWidth;
|
|
@@ -961,8 +986,8 @@ class ImageNode extends lexical_1.DecoratorNode {
|
|
|
961
986
|
return this.__shadowColor;
|
|
962
987
|
}
|
|
963
988
|
static importJSON(serializedNode) {
|
|
964
|
-
const { src, altText, width, height, copyright, photographer, comment, float, captionPosition, captionAlign, captionVerticalAlign, captionSize, showFileName, borderWidth, borderColor, borderRadius, shadowOffsetX, shadowOffsetY, shadowBlur, shadowColor } = serializedNode;
|
|
965
|
-
return $createImageNode({ src, altText, width, height, copyright, photographer, comment, float, captionPosition, captionAlign, captionVerticalAlign, captionSize, showFileName, borderWidth, borderColor, borderRadius, shadowOffsetX, shadowOffsetY, shadowBlur, shadowColor });
|
|
989
|
+
const { src, altText, width, height, copyright, photographer, comment, float, captionPosition, captionAlign, captionVerticalAlign, captionSize, showFileName, showAltText, borderWidth, borderColor, borderRadius, shadowOffsetX, shadowOffsetY, shadowBlur, shadowColor } = serializedNode;
|
|
990
|
+
return $createImageNode({ src, altText, width, height, copyright, photographer, comment, float, captionPosition, captionAlign, captionVerticalAlign, captionSize, showFileName, showAltText, borderWidth, borderColor, borderRadius, shadowOffsetX, shadowOffsetY, shadowBlur, shadowColor });
|
|
966
991
|
}
|
|
967
992
|
exportJSON() {
|
|
968
993
|
return {
|
|
@@ -981,6 +1006,7 @@ class ImageNode extends lexical_1.DecoratorNode {
|
|
|
981
1006
|
captionVerticalAlign: this.__captionVerticalAlign,
|
|
982
1007
|
captionSize: this.__captionSize,
|
|
983
1008
|
showFileName: this.__showFileName,
|
|
1009
|
+
showAltText: this.__showAltText,
|
|
984
1010
|
borderWidth: this.__borderWidth,
|
|
985
1011
|
borderColor: this.__borderColor,
|
|
986
1012
|
borderRadius: this.__borderRadius,
|
|
@@ -1016,12 +1042,12 @@ class ImageNode extends lexical_1.DecoratorNode {
|
|
|
1016
1042
|
};
|
|
1017
1043
|
}
|
|
1018
1044
|
decorate() {
|
|
1019
|
-
return ((0, jsx_runtime_1.jsx)(ImageComponent, { src: this.__src, altText: this.__altText, width: this.__width, height: this.__height, copyright: this.__copyright, photographer: this.__photographer, comment: this.__comment, float: this.__float, captionPosition: this.__captionPosition, captionAlign: this.__captionAlign, captionVerticalAlign: this.__captionVerticalAlign, captionSize: this.__captionSize, showFileName: this.__showFileName, borderWidth: this.__borderWidth, borderColor: this.__borderColor, borderRadius: this.__borderRadius, shadowOffsetX: this.__shadowOffsetX, shadowOffsetY: this.__shadowOffsetY, shadowBlur: this.__shadowBlur, shadowColor: this.__shadowColor, nodeKey: this.__key }));
|
|
1045
|
+
return ((0, jsx_runtime_1.jsx)(ImageComponent, { src: this.__src, altText: this.__altText, width: this.__width, height: this.__height, copyright: this.__copyright, photographer: this.__photographer, comment: this.__comment, float: this.__float, captionPosition: this.__captionPosition, captionAlign: this.__captionAlign, captionVerticalAlign: this.__captionVerticalAlign, captionSize: this.__captionSize, showFileName: this.__showFileName, showAltText: this.__showAltText, borderWidth: this.__borderWidth, borderColor: this.__borderColor, borderRadius: this.__borderRadius, shadowOffsetX: this.__shadowOffsetX, shadowOffsetY: this.__shadowOffsetY, shadowBlur: this.__shadowBlur, shadowColor: this.__shadowColor, nodeKey: this.__key }));
|
|
1020
1046
|
}
|
|
1021
1047
|
}
|
|
1022
1048
|
exports.ImageNode = ImageNode;
|
|
1023
1049
|
function $createImageNode(payload) {
|
|
1024
|
-
return new ImageNode(payload.src, payload.altText || '', payload.width, payload.height, payload.copyright, payload.photographer, payload.comment, payload.float, payload.captionPosition, payload.captionAlign, payload.captionVerticalAlign, payload.captionSize, payload.showFileName, payload.borderWidth, payload.borderColor, payload.borderRadius, payload.shadowOffsetX, payload.shadowOffsetY, payload.shadowBlur, payload.shadowColor);
|
|
1050
|
+
return new ImageNode(payload.src, payload.altText || '', payload.width, payload.height, payload.copyright, payload.photographer, payload.comment, payload.float, payload.captionPosition, payload.captionAlign, payload.captionVerticalAlign, payload.captionSize, payload.showFileName, payload.showAltText, payload.borderWidth, payload.borderColor, payload.borderRadius, payload.shadowOffsetX, payload.shadowOffsetY, payload.shadowBlur, payload.shadowColor);
|
|
1025
1051
|
}
|
|
1026
1052
|
function $isImageNode(node) {
|
|
1027
1053
|
return node instanceof ImageNode;
|