@particle-academy/fancy-cms-ui 0.0.1-dev.16 → 0.0.1-dev.17
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/editor.cjs +14 -13
- package/dist/editor.cjs.map +1 -1
- package/dist/editor.js +14 -13
- package/dist/editor.js.map +1 -1
- package/package.json +1 -1
package/dist/editor.cjs
CHANGED
|
@@ -834,7 +834,7 @@ function NodeInspector({
|
|
|
834
834
|
}) {
|
|
835
835
|
const base = node.style.base ?? {};
|
|
836
836
|
const setT = (patch) => onTransform({ ...transform, ...patch });
|
|
837
|
-
const handled = /* @__PURE__ */ new Set(["content", "label"]);
|
|
837
|
+
const handled = /* @__PURE__ */ new Set(["content", "label", "html"]);
|
|
838
838
|
const extraKeys = Object.keys(node.props).filter(
|
|
839
839
|
(k) => !handled.has(k) && (["string", "number", "boolean"].includes(typeof node.props[k]) || isBinding(node.props[k]))
|
|
840
840
|
);
|
|
@@ -849,14 +849,11 @@ function NodeInspector({
|
|
|
849
849
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: iconBtn, title: "Close", onClick: onClose, children: "\u2715" })
|
|
850
850
|
] }),
|
|
851
851
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: body, children: [
|
|
852
|
-
"content" in node.props ? /* @__PURE__ */ jsxRuntime.
|
|
853
|
-
"
|
|
854
|
-
{
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
onChange: (e) => onProps({ content: e.target.value })
|
|
858
|
-
}
|
|
859
|
-
) }) : null,
|
|
852
|
+
"content" in node.props || node.type === "richtext" ? /* @__PURE__ */ jsxRuntime.jsxs("p", { style: { fontSize: 11, color: "var(--fg-3, #94a3b8)", margin: "0 0 12px", lineHeight: 1.45, paddingBottom: 12, borderBottom: "1px solid #1e293b" }, children: [
|
|
853
|
+
"\u270E Edit the text ",
|
|
854
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "directly on the page" }),
|
|
855
|
+
" \u2014 click in and type. This panel is for layout, style, and bindings."
|
|
856
|
+
] }) : null,
|
|
860
857
|
"label" in node.props ? /* @__PURE__ */ jsxRuntime.jsx(Group, { label: "Label", children: /* @__PURE__ */ jsxRuntime.jsx("input", { style: input2, value: String(node.props.label ?? ""), onChange: (e) => onProps({ label: e.target.value }) }) }) : null,
|
|
861
858
|
extraKeys.length ? /* @__PURE__ */ jsxRuntime.jsx(Group, { label: "Properties", children: extraKeys.map((k) => /* @__PURE__ */ jsxRuntime.jsx(PropField, { name: k, value: node.props[k], onChange: (v) => onProps({ [k]: v }) }, k)) }) : null,
|
|
862
859
|
/* @__PURE__ */ jsxRuntime.jsxs(Group, { label: "Position & size", children: [
|
|
@@ -1264,13 +1261,17 @@ function EditablePage({
|
|
|
1264
1261
|
};
|
|
1265
1262
|
}, [measureBox, ed.state.doc]);
|
|
1266
1263
|
react.useEffect(() => {
|
|
1267
|
-
|
|
1268
|
-
const
|
|
1269
|
-
if (!
|
|
1264
|
+
const t = selNode?.type;
|
|
1265
|
+
const editable = t === "text" || t === "heading" || t === "richtext";
|
|
1266
|
+
if (!editing || !selection || !pageRef.current || !editable) return;
|
|
1267
|
+
const wrapper = pageRef.current.querySelector(`[data-cms="${cssEscape2(selection)}"]`);
|
|
1268
|
+
if (!wrapper) return;
|
|
1269
|
+
const isRich = t === "richtext";
|
|
1270
|
+
const el = (isRich ? wrapper.firstElementChild : wrapper) ?? wrapper;
|
|
1270
1271
|
el.setAttribute("contenteditable", "true");
|
|
1271
1272
|
el.style.outline = "none";
|
|
1272
1273
|
el.focus();
|
|
1273
|
-
const commit = () => ed.apply({ t: "set_props", id: selection, patch: { content: el.innerText } });
|
|
1274
|
+
const commit = () => ed.apply({ t: "set_props", id: selection, patch: isRich ? { html: el.innerHTML } : { content: el.innerText } });
|
|
1274
1275
|
el.addEventListener("blur", commit);
|
|
1275
1276
|
return () => {
|
|
1276
1277
|
el.removeEventListener("blur", commit);
|