@sustaina/shared-ui 1.9.2 → 1.9.3
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 +66 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -47
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4355,7 +4355,7 @@ function DialogContent({
|
|
|
4355
4355
|
{
|
|
4356
4356
|
"data-slot": "dialog-content",
|
|
4357
4357
|
className: cn(
|
|
4358
|
-
"fixed top-1/2 left-1/2 z-50 flex h-[90vh] w-full max-w-[80vw] translate-x-[-50%] translate-y-[-50%] flex-col rounded-lg border bg-background shadow-lg duration-200 sm:max-w-7xl",
|
|
4358
|
+
"fixed top-1/2 left-1/2 z-50 flex min-h-0 max-h-[90vh] w-full max-w-[80vw] translate-x-[-50%] translate-y-[-50%] flex-col rounded-lg border bg-background shadow-lg duration-200 sm:max-w-7xl",
|
|
4359
4359
|
className
|
|
4360
4360
|
),
|
|
4361
4361
|
...props,
|
|
@@ -5464,7 +5464,6 @@ var theme = {
|
|
|
5464
5464
|
var nodes = [richText.HeadingNode, richText.QuoteNode, list.ListNode, list.ListItemNode, link.LinkNode, code.CodeNode, ImageNode];
|
|
5465
5465
|
var INSERT_IMAGE_COMMAND = lexical.createCommand("INSERT_IMAGE_COMMAND");
|
|
5466
5466
|
var DEFAULT_IMAGE_ACCEPT = "image/*";
|
|
5467
|
-
var defaultPlaceholder = "Start writing\u2026";
|
|
5468
5467
|
function parseSerializedEditorState(raw) {
|
|
5469
5468
|
if (!raw) {
|
|
5470
5469
|
return void 0;
|
|
@@ -5512,6 +5511,18 @@ function ToolbarButton({ label, icon: Icon2, onClick, active, disabled }) {
|
|
|
5512
5511
|
}
|
|
5513
5512
|
);
|
|
5514
5513
|
}
|
|
5514
|
+
function placeCaretAfterImage(imageNode) {
|
|
5515
|
+
const nextSibling = imageNode.getNextSibling();
|
|
5516
|
+
if (!nextSibling || $isImageNode(nextSibling)) {
|
|
5517
|
+
const paragraph = lexical.$createParagraphNode();
|
|
5518
|
+
const textNode = lexical.$createTextNode("");
|
|
5519
|
+
paragraph.append(textNode);
|
|
5520
|
+
imageNode.insertAfter(paragraph);
|
|
5521
|
+
textNode.select(0, 0);
|
|
5522
|
+
return;
|
|
5523
|
+
}
|
|
5524
|
+
imageNode.selectNext(0, 0);
|
|
5525
|
+
}
|
|
5515
5526
|
function ToolbarPlugin({
|
|
5516
5527
|
disabled,
|
|
5517
5528
|
onImageUpload,
|
|
@@ -5927,7 +5938,7 @@ function ToolbarPlugin({
|
|
|
5927
5938
|
existingNode.setSrc(payload.src);
|
|
5928
5939
|
existingNode.setAltText(payload.altText ?? "");
|
|
5929
5940
|
existingNode.setDimensions(payload.width ?? "inherit", payload.height ?? "inherit");
|
|
5930
|
-
existingNode
|
|
5941
|
+
placeCaretAfterImage(existingNode);
|
|
5931
5942
|
return;
|
|
5932
5943
|
}
|
|
5933
5944
|
}
|
|
@@ -5938,7 +5949,7 @@ function ToolbarPlugin({
|
|
|
5938
5949
|
} else {
|
|
5939
5950
|
lexical.$insertNodes([imageNode]);
|
|
5940
5951
|
}
|
|
5941
|
-
imageNode
|
|
5952
|
+
placeCaretAfterImage(imageNode);
|
|
5942
5953
|
});
|
|
5943
5954
|
closeImageDialog();
|
|
5944
5955
|
});
|
|
@@ -6189,48 +6200,55 @@ function ToolbarPlugin({
|
|
|
6189
6200
|
}
|
|
6190
6201
|
)
|
|
6191
6202
|
] }),
|
|
6192
|
-
/* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isLinkDialogOpen, onOpenChange: handleLinkDialogOpenChange, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6203
|
+
/* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isLinkDialogOpen, onOpenChange: handleLinkDialogOpenChange, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6204
|
+
DialogContent,
|
|
6205
|
+
{
|
|
6206
|
+
className: "min-w-[70vw] max-w-7xl",
|
|
6207
|
+
header: editingExistingLink ? "Edit link" : "Insert link",
|
|
6208
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Form, { ...linkForm, children: /* @__PURE__ */ jsxRuntime.jsxs("form", { className: "grid gap-4 p-6", onSubmit: handleLinkSubmit, children: [
|
|
6209
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6210
|
+
FormField,
|
|
6211
|
+
{
|
|
6212
|
+
control: linkForm.control,
|
|
6213
|
+
name: "url",
|
|
6214
|
+
rules: { required: "Please enter a URL." },
|
|
6215
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { children: [
|
|
6216
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormLabel, { children: "URL" }),
|
|
6217
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsx(Input, { placeholder: "https://example.com", ...field }) }),
|
|
6218
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormMessage, {})
|
|
6219
|
+
] })
|
|
6220
|
+
}
|
|
6221
|
+
),
|
|
6222
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6223
|
+
FormField,
|
|
6224
|
+
{
|
|
6225
|
+
control: linkForm.control,
|
|
6226
|
+
name: "label",
|
|
6227
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { children: [
|
|
6228
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormLabel, { children: "Link label" }),
|
|
6229
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsx(Input, { placeholder: "Display text", ...field }) }),
|
|
6230
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormMessage, {})
|
|
6231
|
+
] })
|
|
6232
|
+
}
|
|
6233
|
+
),
|
|
6234
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { className: "pt-2", children: [
|
|
6235
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "cancel", onClick: closeLinkDialog, children: "Cancel" }),
|
|
6236
|
+
editingExistingLink ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
6237
|
+
Button,
|
|
6238
|
+
{
|
|
6239
|
+
type: "button",
|
|
6240
|
+
variant: "ghost",
|
|
6241
|
+
onClick: handleRemoveLink,
|
|
6242
|
+
className: "text-destructive",
|
|
6243
|
+
children: "Remove link"
|
|
6244
|
+
}
|
|
6245
|
+
) : null,
|
|
6246
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { type: "submit", children: "Save link" })
|
|
6215
6247
|
] })
|
|
6216
|
-
}
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
editingExistingLink ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
6221
|
-
Button,
|
|
6222
|
-
{
|
|
6223
|
-
type: "button",
|
|
6224
|
-
variant: "ghost",
|
|
6225
|
-
onClick: handleRemoveLink,
|
|
6226
|
-
className: "text-destructive",
|
|
6227
|
-
children: "Remove link"
|
|
6228
|
-
}
|
|
6229
|
-
) : null,
|
|
6230
|
-
/* @__PURE__ */ jsxRuntime.jsx(Button, { type: "submit", children: "Save link" })
|
|
6231
|
-
] })
|
|
6232
|
-
] }) }) }) }),
|
|
6233
|
-
/* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isImageDialogOpen, onOpenChange: handleImageDialogOpenChange, children: /* @__PURE__ */ jsxRuntime.jsx(DialogContent, { header: editingExistingImage ? "Edit image" : "Insert image", children: /* @__PURE__ */ jsxRuntime.jsx(Form, { ...imageForm, children: /* @__PURE__ */ jsxRuntime.jsxs("form", { className: "grid gap-4", onSubmit: handleImageSubmit, children: [
|
|
6248
|
+
] }) })
|
|
6249
|
+
}
|
|
6250
|
+
) }),
|
|
6251
|
+
/* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isImageDialogOpen, onOpenChange: handleImageDialogOpenChange, children: /* @__PURE__ */ jsxRuntime.jsx(DialogContent, { header: editingExistingImage ? "Edit image" : "Insert image", children: /* @__PURE__ */ jsxRuntime.jsx(Form, { ...imageForm, children: /* @__PURE__ */ jsxRuntime.jsxs("form", { className: "grid gap-4 p-6", onSubmit: handleImageSubmit, children: [
|
|
6234
6252
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6235
6253
|
FormField,
|
|
6236
6254
|
{
|
|
@@ -6345,6 +6363,7 @@ function ImagesPlugin() {
|
|
|
6345
6363
|
editor.update(() => {
|
|
6346
6364
|
const imageNode = $createImageNode(payload);
|
|
6347
6365
|
lexical.$insertNodes([imageNode]);
|
|
6366
|
+
placeCaretAfterImage(imageNode);
|
|
6348
6367
|
});
|
|
6349
6368
|
return true;
|
|
6350
6369
|
},
|
|
@@ -6358,7 +6377,7 @@ var RichText = React6.forwardRef(function RichText2({
|
|
|
6358
6377
|
defaultValue,
|
|
6359
6378
|
onChange,
|
|
6360
6379
|
onHtmlChange,
|
|
6361
|
-
placeholder: placeholder3
|
|
6380
|
+
placeholder: placeholder3,
|
|
6362
6381
|
readOnly,
|
|
6363
6382
|
disabled,
|
|
6364
6383
|
editorClassName,
|
|
@@ -6446,7 +6465,7 @@ var RichText = React6.forwardRef(function RichText2({
|
|
|
6446
6465
|
)
|
|
6447
6466
|
}
|
|
6448
6467
|
),
|
|
6449
|
-
placeholder: /* @__PURE__ */ jsxRuntime.jsx(Placeholder, { placeholder: placeholder3 }),
|
|
6468
|
+
placeholder: /* @__PURE__ */ jsxRuntime.jsx(Placeholder, { placeholder: placeholder3 || "" }),
|
|
6450
6469
|
ErrorBoundary: LexicalErrorBoundary.LexicalErrorBoundary
|
|
6451
6470
|
}
|
|
6452
6471
|
),
|