@joai/core 4.7.0 → 4.7.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.
- package/dist/react/index.mjs +17 -12
- package/package.json +1 -1
package/dist/react/index.mjs
CHANGED
|
@@ -700,23 +700,28 @@ function ContentToolbar({ className, labels = {}, confirmPublish }) {
|
|
|
700
700
|
}
|
|
701
701
|
//#endregion
|
|
702
702
|
//#region src/react/content/content-editor.tsx
|
|
703
|
+
function EditorPanel({ title }) {
|
|
704
|
+
const { canEdit } = useContent();
|
|
705
|
+
if (!canEdit) return null;
|
|
706
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
707
|
+
className: "fixed right-4 bottom-4 z-[1000] w-[min(24rem,calc(100vw-2rem))] rounded-xl border border-slate-200 bg-white p-3 text-slate-950 shadow-xl",
|
|
708
|
+
children: [/* @__PURE__ */ jsx("strong", {
|
|
709
|
+
className: "mb-2 block text-sm font-semibold",
|
|
710
|
+
children: title
|
|
711
|
+
}), /* @__PURE__ */ jsx(ContentToolbar, { labels: {
|
|
712
|
+
edit: "Edit",
|
|
713
|
+
save: "Save draft",
|
|
714
|
+
publish: "Publish",
|
|
715
|
+
cancel: "Cancel"
|
|
716
|
+
} })]
|
|
717
|
+
});
|
|
718
|
+
}
|
|
703
719
|
function ContentEditor({ children, title = "JoAi Content", ...provider }) {
|
|
704
720
|
return /* @__PURE__ */ jsx(ContentProvider, {
|
|
705
721
|
...provider,
|
|
706
722
|
children: /* @__PURE__ */ jsxs("div", {
|
|
707
723
|
"data-joai-content-editor": "true",
|
|
708
|
-
children: [/* @__PURE__ */
|
|
709
|
-
className: "fixed right-4 bottom-4 z-[1000] w-[min(24rem,calc(100vw-2rem))] rounded-xl border border-slate-200 bg-white p-3 text-slate-950 shadow-xl",
|
|
710
|
-
children: [/* @__PURE__ */ jsx("strong", {
|
|
711
|
-
className: "mb-2 block text-sm font-semibold",
|
|
712
|
-
children: title
|
|
713
|
-
}), /* @__PURE__ */ jsx(ContentToolbar, { labels: {
|
|
714
|
-
edit: "Edit",
|
|
715
|
-
save: "Save draft",
|
|
716
|
-
publish: "Publish",
|
|
717
|
-
cancel: "Cancel"
|
|
718
|
-
} })]
|
|
719
|
-
}), children]
|
|
724
|
+
children: [/* @__PURE__ */ jsx(EditorPanel, { title }), children]
|
|
720
725
|
})
|
|
721
726
|
});
|
|
722
727
|
}
|