@sustaina/shared-ui 1.9.2 → 1.9.4
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 +69 -50
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +69 -50
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4321,7 +4321,7 @@ function DialogContent({
|
|
|
4321
4321
|
{
|
|
4322
4322
|
"data-slot": "dialog-content",
|
|
4323
4323
|
className: cn(
|
|
4324
|
-
"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",
|
|
4324
|
+
"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",
|
|
4325
4325
|
className
|
|
4326
4326
|
),
|
|
4327
4327
|
...props,
|
|
@@ -4773,7 +4773,7 @@ var GridSettingsModal = ({
|
|
|
4773
4773
|
}
|
|
4774
4774
|
}
|
|
4775
4775
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-xl border-0 p-0 overflow-hidden", children: [
|
|
4776
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col
|
|
4776
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
4777
4777
|
/* @__PURE__ */ jsxs(
|
|
4778
4778
|
"div",
|
|
4779
4779
|
{
|
|
@@ -4808,7 +4808,7 @@ var GridSettingsModal = ({
|
|
|
4808
4808
|
)
|
|
4809
4809
|
] }),
|
|
4810
4810
|
/* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "mt-6 flex flex-col justify-between", children: [
|
|
4811
|
-
/* @__PURE__ */ jsx("div", { className: "px-16 my-10", children: /* @__PURE__ */ jsxs("div", { className: "space-y-3 max-h-60
|
|
4811
|
+
/* @__PURE__ */ jsx("div", { className: "px-16 my-10", children: /* @__PURE__ */ jsxs("div", { className: "space-y-3 max-h-60 pr-4", children: [
|
|
4812
4812
|
/* @__PURE__ */ jsx(
|
|
4813
4813
|
SortableRow,
|
|
4814
4814
|
{
|
|
@@ -4866,7 +4866,7 @@ var GridSettingsModal = ({
|
|
|
4866
4866
|
}
|
|
4867
4867
|
) })
|
|
4868
4868
|
] }) }),
|
|
4869
|
-
/* @__PURE__ */ jsx(DialogFooter, { className: "-mx-6 mt-6 px-6", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between w-full
|
|
4869
|
+
/* @__PURE__ */ jsx(DialogFooter, { className: "-mx-6 mt-6 px-6", children: /* @__PURE__ */ jsxs("div", { className: "flex px-4 justify-between w-full", children: [
|
|
4870
4870
|
/* @__PURE__ */ jsx(
|
|
4871
4871
|
Button,
|
|
4872
4872
|
{
|
|
@@ -5430,7 +5430,6 @@ var theme = {
|
|
|
5430
5430
|
var nodes = [HeadingNode, QuoteNode, ListNode, ListItemNode, LinkNode, CodeNode, ImageNode];
|
|
5431
5431
|
var INSERT_IMAGE_COMMAND = createCommand("INSERT_IMAGE_COMMAND");
|
|
5432
5432
|
var DEFAULT_IMAGE_ACCEPT = "image/*";
|
|
5433
|
-
var defaultPlaceholder = "Start writing\u2026";
|
|
5434
5433
|
function parseSerializedEditorState(raw) {
|
|
5435
5434
|
if (!raw) {
|
|
5436
5435
|
return void 0;
|
|
@@ -5478,6 +5477,18 @@ function ToolbarButton({ label, icon: Icon2, onClick, active, disabled }) {
|
|
|
5478
5477
|
}
|
|
5479
5478
|
);
|
|
5480
5479
|
}
|
|
5480
|
+
function placeCaretAfterImage(imageNode) {
|
|
5481
|
+
const nextSibling = imageNode.getNextSibling();
|
|
5482
|
+
if (!nextSibling || $isImageNode(nextSibling)) {
|
|
5483
|
+
const paragraph = $createParagraphNode();
|
|
5484
|
+
const textNode = $createTextNode("");
|
|
5485
|
+
paragraph.append(textNode);
|
|
5486
|
+
imageNode.insertAfter(paragraph);
|
|
5487
|
+
textNode.select(0, 0);
|
|
5488
|
+
return;
|
|
5489
|
+
}
|
|
5490
|
+
imageNode.selectNext(0, 0);
|
|
5491
|
+
}
|
|
5481
5492
|
function ToolbarPlugin({
|
|
5482
5493
|
disabled,
|
|
5483
5494
|
onImageUpload,
|
|
@@ -5893,7 +5904,7 @@ function ToolbarPlugin({
|
|
|
5893
5904
|
existingNode.setSrc(payload.src);
|
|
5894
5905
|
existingNode.setAltText(payload.altText ?? "");
|
|
5895
5906
|
existingNode.setDimensions(payload.width ?? "inherit", payload.height ?? "inherit");
|
|
5896
|
-
existingNode
|
|
5907
|
+
placeCaretAfterImage(existingNode);
|
|
5897
5908
|
return;
|
|
5898
5909
|
}
|
|
5899
5910
|
}
|
|
@@ -5904,7 +5915,7 @@ function ToolbarPlugin({
|
|
|
5904
5915
|
} else {
|
|
5905
5916
|
$insertNodes([imageNode]);
|
|
5906
5917
|
}
|
|
5907
|
-
imageNode
|
|
5918
|
+
placeCaretAfterImage(imageNode);
|
|
5908
5919
|
});
|
|
5909
5920
|
closeImageDialog();
|
|
5910
5921
|
});
|
|
@@ -6155,48 +6166,55 @@ function ToolbarPlugin({
|
|
|
6155
6166
|
}
|
|
6156
6167
|
)
|
|
6157
6168
|
] }),
|
|
6158
|
-
/* @__PURE__ */ jsx(Dialog, { open: isLinkDialogOpen, onOpenChange: handleLinkDialogOpenChange, children: /* @__PURE__ */ jsx(
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6169
|
+
/* @__PURE__ */ jsx(Dialog, { open: isLinkDialogOpen, onOpenChange: handleLinkDialogOpenChange, children: /* @__PURE__ */ jsx(
|
|
6170
|
+
DialogContent,
|
|
6171
|
+
{
|
|
6172
|
+
className: "min-w-[70vw] max-w-7xl",
|
|
6173
|
+
header: editingExistingLink ? "Edit link" : "Insert link",
|
|
6174
|
+
children: /* @__PURE__ */ jsx(Form, { ...linkForm, children: /* @__PURE__ */ jsxs("form", { className: "grid gap-4 p-6", onSubmit: handleLinkSubmit, children: [
|
|
6175
|
+
/* @__PURE__ */ jsx(
|
|
6176
|
+
FormField,
|
|
6177
|
+
{
|
|
6178
|
+
control: linkForm.control,
|
|
6179
|
+
name: "url",
|
|
6180
|
+
rules: { required: "Please enter a URL." },
|
|
6181
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
6182
|
+
/* @__PURE__ */ jsx(FormLabel, { children: "URL" }),
|
|
6183
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { placeholder: "https://example.com", ...field }) }),
|
|
6184
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
6185
|
+
] })
|
|
6186
|
+
}
|
|
6187
|
+
),
|
|
6188
|
+
/* @__PURE__ */ jsx(
|
|
6189
|
+
FormField,
|
|
6190
|
+
{
|
|
6191
|
+
control: linkForm.control,
|
|
6192
|
+
name: "label",
|
|
6193
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
6194
|
+
/* @__PURE__ */ jsx(FormLabel, { children: "Link label" }),
|
|
6195
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { placeholder: "Display text", ...field }) }),
|
|
6196
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
6197
|
+
] })
|
|
6198
|
+
}
|
|
6199
|
+
),
|
|
6200
|
+
/* @__PURE__ */ jsxs(DialogFooter, { className: "pt-2", children: [
|
|
6201
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "cancel", onClick: closeLinkDialog, children: "Cancel" }),
|
|
6202
|
+
editingExistingLink ? /* @__PURE__ */ jsx(
|
|
6203
|
+
Button,
|
|
6204
|
+
{
|
|
6205
|
+
type: "button",
|
|
6206
|
+
variant: "ghost",
|
|
6207
|
+
onClick: handleRemoveLink,
|
|
6208
|
+
className: "text-destructive",
|
|
6209
|
+
children: "Remove link"
|
|
6210
|
+
}
|
|
6211
|
+
) : null,
|
|
6212
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", children: "Save link" })
|
|
6181
6213
|
] })
|
|
6182
|
-
}
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
editingExistingLink ? /* @__PURE__ */ jsx(
|
|
6187
|
-
Button,
|
|
6188
|
-
{
|
|
6189
|
-
type: "button",
|
|
6190
|
-
variant: "ghost",
|
|
6191
|
-
onClick: handleRemoveLink,
|
|
6192
|
-
className: "text-destructive",
|
|
6193
|
-
children: "Remove link"
|
|
6194
|
-
}
|
|
6195
|
-
) : null,
|
|
6196
|
-
/* @__PURE__ */ jsx(Button, { type: "submit", children: "Save link" })
|
|
6197
|
-
] })
|
|
6198
|
-
] }) }) }) }),
|
|
6199
|
-
/* @__PURE__ */ jsx(Dialog, { open: isImageDialogOpen, onOpenChange: handleImageDialogOpenChange, children: /* @__PURE__ */ jsx(DialogContent, { header: editingExistingImage ? "Edit image" : "Insert image", children: /* @__PURE__ */ jsx(Form, { ...imageForm, children: /* @__PURE__ */ jsxs("form", { className: "grid gap-4", onSubmit: handleImageSubmit, children: [
|
|
6214
|
+
] }) })
|
|
6215
|
+
}
|
|
6216
|
+
) }),
|
|
6217
|
+
/* @__PURE__ */ jsx(Dialog, { open: isImageDialogOpen, onOpenChange: handleImageDialogOpenChange, children: /* @__PURE__ */ jsx(DialogContent, { header: editingExistingImage ? "Edit image" : "Insert image", children: /* @__PURE__ */ jsx(Form, { ...imageForm, children: /* @__PURE__ */ jsxs("form", { className: "grid gap-4 p-6", onSubmit: handleImageSubmit, children: [
|
|
6200
6218
|
/* @__PURE__ */ jsx(
|
|
6201
6219
|
FormField,
|
|
6202
6220
|
{
|
|
@@ -6311,6 +6329,7 @@ function ImagesPlugin() {
|
|
|
6311
6329
|
editor.update(() => {
|
|
6312
6330
|
const imageNode = $createImageNode(payload);
|
|
6313
6331
|
$insertNodes([imageNode]);
|
|
6332
|
+
placeCaretAfterImage(imageNode);
|
|
6314
6333
|
});
|
|
6315
6334
|
return true;
|
|
6316
6335
|
},
|
|
@@ -6324,7 +6343,7 @@ var RichText = forwardRef(function RichText2({
|
|
|
6324
6343
|
defaultValue,
|
|
6325
6344
|
onChange,
|
|
6326
6345
|
onHtmlChange,
|
|
6327
|
-
placeholder: placeholder3
|
|
6346
|
+
placeholder: placeholder3,
|
|
6328
6347
|
readOnly,
|
|
6329
6348
|
disabled,
|
|
6330
6349
|
editorClassName,
|
|
@@ -6412,7 +6431,7 @@ var RichText = forwardRef(function RichText2({
|
|
|
6412
6431
|
)
|
|
6413
6432
|
}
|
|
6414
6433
|
),
|
|
6415
|
-
placeholder: /* @__PURE__ */ jsx(Placeholder, { placeholder: placeholder3 }),
|
|
6434
|
+
placeholder: /* @__PURE__ */ jsx(Placeholder, { placeholder: placeholder3 || "" }),
|
|
6416
6435
|
ErrorBoundary: LexicalErrorBoundary
|
|
6417
6436
|
}
|
|
6418
6437
|
),
|