wip fix
This commit is contained in:
parent
c83e459a4c
commit
0bcbac81d4
|
|
@ -125,7 +125,7 @@ export const SyncActions = {
|
||||||
prop_name: string;
|
prop_name: string;
|
||||||
value: Uint8Array;
|
value: Uint8Array;
|
||||||
}
|
}
|
||||||
) => ({}) as boolean | ParsedScope,
|
) => ({}) as boolean | ParsedScope | string,
|
||||||
parse: async (code: string | Record<string, string>) =>
|
parse: async (code: string | Record<string, string>) =>
|
||||||
({}) as Record<string, ReturnType<typeof parseJs>>,
|
({}) as Record<string, ReturnType<typeof parseJs>>,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ export const code_edit: SAction["code"]["edit"] = async function (
|
||||||
|
|
||||||
if (mitem) {
|
if (mitem) {
|
||||||
if (arg.type === "adv") {
|
if (arg.type === "adv") {
|
||||||
|
try {
|
||||||
const res = await transform(`render(${src})`, {
|
const res = await transform(`render(${src})`, {
|
||||||
jsx: "transform",
|
jsx: "transform",
|
||||||
format: "cjs",
|
format: "cjs",
|
||||||
|
|
@ -76,6 +77,9 @@ export const code_edit: SAction["code"]["edit"] = async function (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} catch (e: any) {
|
||||||
|
return e.message.toString();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const mprop = mitem
|
const mprop = mitem
|
||||||
.get("component")
|
.get("component")
|
||||||
|
|
@ -94,7 +98,9 @@ export const code_edit: SAction["code"]["edit"] = async function (
|
||||||
mprop.set("value", src);
|
mprop.set("value", src);
|
||||||
mprop.set("valueBuilt", res.code.substring(6));
|
mprop.set("valueBuilt", res.code.substring(6));
|
||||||
});
|
});
|
||||||
} catch (e) {}
|
} catch (e: any) {
|
||||||
|
return e.message.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -134,8 +140,8 @@ export const code_edit: SAction["code"]["edit"] = async function (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e: any) {
|
||||||
g.log.error(e);
|
return e.message.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ export const EdBase = () => {
|
||||||
|
|
||||||
edRoute(p);
|
edRoute(p);
|
||||||
|
|
||||||
if (p.status === "post-init") {
|
if (p.status === "load-site") {
|
||||||
return <Loading note={`page-${p.status}`} />;
|
return <Loading note={`page-${p.status}`} />;
|
||||||
}
|
}
|
||||||
if (p.status === "site-not-found" || p.status === "page-not-found") {
|
if (p.status === "site-not-found" || p.status === "page-not-found") {
|
||||||
|
|
@ -47,7 +47,12 @@ export const EdBase = () => {
|
||||||
<EdPane type="left" min_size={200} />
|
<EdPane type="left" min_size={200} />
|
||||||
<div className="flex flex-1 flex-col items-stretch">
|
<div className="flex flex-1 flex-col items-stretch">
|
||||||
<EdMid />
|
<EdMid />
|
||||||
<div className="flex flex-1 items-stretch">
|
<div
|
||||||
|
className={cx(
|
||||||
|
"flex flex-1 items-stretch",
|
||||||
|
p.mode === "mobile" ? mobileCSS : "bg-white"
|
||||||
|
)}
|
||||||
|
>
|
||||||
<EdMain />
|
<EdMain />
|
||||||
<EdPane type="right" min_size={240} />
|
<EdPane type="right" min_size={240} />
|
||||||
<EdRight />
|
<EdRight />
|
||||||
|
|
@ -138,3 +143,18 @@ const style = css`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const mobileCSS = css`
|
||||||
|
background-color: white;
|
||||||
|
background-image: linear-gradient(45deg, #fafafa 25%, transparent 25%),
|
||||||
|
linear-gradient(-45deg, #fafafa 25%, transparent 25%),
|
||||||
|
linear-gradient(45deg, transparent 75%, #fafafa 75%),
|
||||||
|
linear-gradient(-45deg, transparent 75%, #fafafa 75%);
|
||||||
|
|
||||||
|
background-size: 20px 20px;
|
||||||
|
background-position:
|
||||||
|
0 0,
|
||||||
|
0 10px,
|
||||||
|
10px -10px,
|
||||||
|
-10px 0px;
|
||||||
|
`;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ export const EdRight = () => {
|
||||||
css`
|
css`
|
||||||
width: ${p.ui.layout.right}px;
|
width: ${p.ui.layout.right}px;
|
||||||
`,
|
`,
|
||||||
"border-l flex flex-col"
|
"border-l flex flex-col bg-white"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{!meta ? (
|
{!meta ? (
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ export const EDGlobal = {
|
||||||
clients: {} as Record<string, { id: string; username: string }>,
|
clients: {} as Record<string, { id: string; username: string }>,
|
||||||
status: "init" as
|
status: "init" as
|
||||||
| "init"
|
| "init"
|
||||||
| "post-init"
|
| "load-site"
|
||||||
| "reload"
|
| "reload"
|
||||||
| "site-not-found"
|
| "site-not-found"
|
||||||
| "page-not-found"
|
| "page-not-found"
|
||||||
|
|
@ -228,6 +228,8 @@ export const EDGlobal = {
|
||||||
prop_kind: "" as PropFieldKind,
|
prop_kind: "" as PropFieldKind,
|
||||||
prop_name: "",
|
prop_name: "",
|
||||||
on_close: () => {},
|
on_close: () => {},
|
||||||
|
typings: { status: "ok" as "ok" | "loading" | "error", err_msg: "" },
|
||||||
|
wb_render: () => {},
|
||||||
},
|
},
|
||||||
site: null as null | ((site_id: string) => void | Promise<void>),
|
site: null as null | ((site_id: string) => void | Promise<void>),
|
||||||
site_form: null as null | {
|
site_form: null as null | {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import { treeRebuild } from "./tree/build";
|
||||||
export const edRoute = async (p: PG) => {
|
export const edRoute = async (p: PG) => {
|
||||||
if (p.status === "ready" || p.status === "init") {
|
if (p.status === "ready" || p.status === "init") {
|
||||||
if (!p.site.domain && !p.site.name) {
|
if (!p.site.domain && !p.site.name) {
|
||||||
p.status = "post-init";
|
p.status = "load-site";
|
||||||
const site = await p.sync.site.load(p.site.id);
|
const site = await p.sync.site.load(p.site.id);
|
||||||
if (!site) {
|
if (!site) {
|
||||||
p.status = "site-not-found";
|
p.status = "site-not-found";
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,9 @@ export const ResponsiveToggle = () => {
|
||||||
const c = useGlobal(EDGlobal, "EDITOR");
|
const c = useGlobal(EDGlobal, "EDITOR");
|
||||||
const mode = c.mode;
|
const mode = c.mode;
|
||||||
const activeModeClassName = "border-b-2 border-blue-500";
|
const activeModeClassName = "border-b-2 border-blue-500";
|
||||||
return (
|
|
||||||
<ToolbarBox
|
const box = {
|
||||||
className="flex"
|
mobile: {
|
||||||
items={[
|
|
||||||
{
|
|
||||||
onClick() {
|
onClick() {
|
||||||
c.mode = "mobile";
|
c.mode = "mobile";
|
||||||
w.isMobile = true;
|
w.isMobile = true;
|
||||||
|
|
@ -37,7 +35,7 @@ export const ResponsiveToggle = () => {
|
||||||
</svg>
|
</svg>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
desktop: {
|
||||||
onClick() {
|
onClick() {
|
||||||
c.mode = "desktop";
|
c.mode = "desktop";
|
||||||
w.isMobile = false;
|
w.isMobile = false;
|
||||||
|
|
@ -63,7 +61,16 @@ export const ResponsiveToggle = () => {
|
||||||
</svg>
|
</svg>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
]}
|
};
|
||||||
/>
|
const items: any[] = [];
|
||||||
);
|
if (c.site.responsive === "mobile-only") {
|
||||||
|
items.push(box.mobile);
|
||||||
|
} else if (c.site.responsive === "desktop-only") {
|
||||||
|
items.push(box.desktop);
|
||||||
|
} else {
|
||||||
|
items.push(box.mobile);
|
||||||
|
items.push(box.desktop);
|
||||||
|
}
|
||||||
|
|
||||||
|
return <ToolbarBox className="flex" items={items} />;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,9 @@ export const mainPerItemVisit = (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if (parts.props.className && !parts.props.className.includes("el-active")) {
|
||||||
|
parts.props.className += " el-active";
|
||||||
|
}
|
||||||
|
|
||||||
prop.onInput = (e) => {
|
prop.onInput = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
@ -160,10 +163,6 @@ export const mainPerItemVisit = (
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
function getCaret(el: any) {
|
|
||||||
return getSelectionOffset(el);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setCaret(el: any, offset: any) {
|
function setCaret(el: any, offset: any) {
|
||||||
setSelectionOffset(el, offset[0], offset[1]);
|
setSelectionOffset(el, offset[0], offset[1]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,9 +60,7 @@ export const EdMain = () => {
|
||||||
<div
|
<div
|
||||||
className={cx(
|
className={cx(
|
||||||
"flex flex-1 relative overflow-auto",
|
"flex flex-1 relative overflow-auto",
|
||||||
css`
|
p.mode === "mobile" ? "flex-col items-center" : ""
|
||||||
contain: content;
|
|
||||||
`
|
|
||||||
)}
|
)}
|
||||||
ref={(el) => {
|
ref={(el) => {
|
||||||
if (el) {
|
if (el) {
|
||||||
|
|
@ -75,23 +73,39 @@ export const EdMain = () => {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{meta && <div className={mainStyle(p, meta, local)}>{local.cache}</div>}
|
<div className={mainStyle(p, meta)}>{local.cache}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const mainStyle = (
|
const mainStyle = (p: PG, meta?: IMeta) => {
|
||||||
p: PG,
|
|
||||||
meta: IMeta,
|
|
||||||
local: { width: number; height: number }
|
|
||||||
) => {
|
|
||||||
let is_active = meta ? isMetaActive(p, meta) : false;
|
let is_active = meta ? isMetaActive(p, meta) : false;
|
||||||
|
|
||||||
const scale = parseInt(p.ui.zoom.replace("%", "")) / 100;
|
const scale = parseInt(p.ui.zoom.replace("%", "")) / 100;
|
||||||
|
|
||||||
|
let width = `${(1 / scale) * 100}%`;
|
||||||
|
if (p.mode === "mobile") {
|
||||||
|
width = `${(1 / scale) * 375}px`;
|
||||||
|
}
|
||||||
|
|
||||||
return cx(
|
return cx(
|
||||||
"absolute inset-0 flex",
|
"absolute flex",
|
||||||
css`
|
css`
|
||||||
width: ${(1 / scale) * 100}%;
|
contain: content;
|
||||||
|
`,
|
||||||
|
p.mode === "mobile"
|
||||||
|
? css`
|
||||||
|
border-left: 1px solid #ccc;
|
||||||
|
border-right: 1px solid #ccc;
|
||||||
|
background: white;
|
||||||
|
top: 0px;
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
bottom: 0px;
|
||||||
|
`
|
||||||
|
: "inset-0",
|
||||||
|
css`
|
||||||
|
width: ${width};
|
||||||
transform: scale(${scale});
|
transform: scale(${scale});
|
||||||
transform-origin: 0% 0% 0px;
|
transform-origin: 0% 0% 0px;
|
||||||
`,
|
`,
|
||||||
|
|
|
||||||
|
|
@ -288,6 +288,8 @@ export const EdScriptMonaco: FC<{}> = () => {
|
||||||
}
|
}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
const stype = p.ui.popup.script.type;
|
const stype = p.ui.popup.script.type;
|
||||||
|
p.ui.popup.script.typings.status = "loading";
|
||||||
|
p.ui.popup.script.wb_render();
|
||||||
if ((value || "").includes(IMPORT_SEPARATOR)) {
|
if ((value || "").includes(IMPORT_SEPARATOR)) {
|
||||||
const valparts = (value || "").split(IMPORT_SEPARATOR + "\n");
|
const valparts = (value || "").split(IMPORT_SEPARATOR + "\n");
|
||||||
if (valparts.length === 2) local.value = valparts[1];
|
if (valparts.length === 2) local.value = valparts[1];
|
||||||
|
|
@ -318,6 +320,8 @@ export const EdScriptMonaco: FC<{}> = () => {
|
||||||
arg.page_id = p.page.cur.id;
|
arg.page_id = p.page.cur.id;
|
||||||
}
|
}
|
||||||
let scope: boolean | ParsedScope = false;
|
let scope: boolean | ParsedScope = false;
|
||||||
|
p.ui.popup.script.typings.status = "ok";
|
||||||
|
p.ui.popup.script.typings.err_msg = "";
|
||||||
if (stype === "prop-master") {
|
if (stype === "prop-master") {
|
||||||
p.sync.code.edit({
|
p.sync.code.edit({
|
||||||
type: "prop-master",
|
type: "prop-master",
|
||||||
|
|
@ -327,7 +331,7 @@ export const EdScriptMonaco: FC<{}> = () => {
|
||||||
...arg,
|
...arg,
|
||||||
});
|
});
|
||||||
} else if (stype === "prop-instance") {
|
} else if (stype === "prop-instance") {
|
||||||
scope = await p.sync.code.edit({
|
const code_result = await p.sync.code.edit({
|
||||||
type: "prop-instance",
|
type: "prop-instance",
|
||||||
mode: mode,
|
mode: mode,
|
||||||
prop_name: p.ui.popup.script.prop_name,
|
prop_name: p.ui.popup.script.prop_name,
|
||||||
|
|
@ -335,18 +339,32 @@ export const EdScriptMonaco: FC<{}> = () => {
|
||||||
value: compress(encode.encode(value || "")),
|
value: compress(encode.encode(value || "")),
|
||||||
...arg,
|
...arg,
|
||||||
});
|
});
|
||||||
|
if (typeof code_result === "string") {
|
||||||
|
p.ui.popup.script.typings.status = "error";
|
||||||
|
p.ui.popup.script.typings.err_msg = code_result;
|
||||||
|
} else if (typeof code_result === "object") {
|
||||||
|
scope = code_result;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
scope = await p.sync.code.edit({
|
const code_result = await p.sync.code.edit({
|
||||||
type: "adv",
|
type: "adv",
|
||||||
mode: mode,
|
mode: mode,
|
||||||
item_id: active.item_id,
|
item_id: active.item_id,
|
||||||
value: compress(encode.encode(value || "")),
|
value: compress(encode.encode(value || "")),
|
||||||
...arg,
|
...arg,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (typeof code_result === "string") {
|
||||||
|
p.ui.popup.script.typings.status = "error";
|
||||||
|
p.ui.popup.script.typings.err_msg = code_result;
|
||||||
|
} else if (typeof code_result === "object") {
|
||||||
|
scope = code_result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (typeof scope === "object") {
|
if (typeof scope === "object") {
|
||||||
meta.item.script = scope;
|
meta.item.script = scope;
|
||||||
}
|
}
|
||||||
|
p.ui.popup.script.wb_render();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
p.ui.popup.script.on_close = () => {
|
p.ui.popup.script.on_close = () => {
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,12 @@ import { EdScriptMonaco } from "./monaco";
|
||||||
import { EdScriptSnippet } from "./snippet";
|
import { EdScriptSnippet } from "./snippet";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { Loading } from "../../../../../utils/ui/loading";
|
import { Loading } from "../../../../../utils/ui/loading";
|
||||||
|
import { Tooltip } from "../../../../../utils/ui/tooltip";
|
||||||
|
|
||||||
export const EdScriptWorkbench = () => {
|
export const EdScriptWorkbench = () => {
|
||||||
const p = useGlobal(EDGlobal, "EDITOR");
|
const p = useGlobal(EDGlobal, "EDITOR");
|
||||||
const local = useLocal({ active_id: "" });
|
const local = useLocal({ active_id: "" });
|
||||||
|
p.ui.popup.script.wb_render = local.render;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!local.active_id) {
|
if (!local.active_id) {
|
||||||
|
|
@ -27,10 +29,19 @@ export const EdScriptWorkbench = () => {
|
||||||
canBack: active.script_nav.list.length > 0,
|
canBack: active.script_nav.list.length > 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const is_error =
|
||||||
|
p.ui.popup.script.typings.status === "error" &&
|
||||||
|
p.ui.popup.script.mode === "js";
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-1 items-stretch">
|
<div className="flex flex-1 items-stretch">
|
||||||
<div className="flex flex-1 flex-col ">
|
<div className="flex flex-1 flex-col ">
|
||||||
<div className="flex border-b items-stretch">
|
<div
|
||||||
|
className={cx(
|
||||||
|
"flex border-b items-stretch justify-between",
|
||||||
|
is_error && "bg-red-100"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div className={cx("flex items-stretch")}>
|
||||||
<div className="border-r px-2 flex items-center">
|
<div className="border-r px-2 flex items-center">
|
||||||
<div
|
<div
|
||||||
className={cx(
|
className={cx(
|
||||||
|
|
@ -84,7 +95,9 @@ export const EdScriptWorkbench = () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{p.ui.popup.script.type === "prop-master" && <CompTitleMaster />}
|
{p.ui.popup.script.type === "prop-master" && <CompTitleMaster />}
|
||||||
{p.ui.popup.script.type === "prop-instance" && <CompTitleInstance />}
|
{p.ui.popup.script.type === "prop-instance" && (
|
||||||
|
<CompTitleInstance />
|
||||||
|
)}
|
||||||
{p.ui.popup.script.type === "item" && (
|
{p.ui.popup.script.type === "item" && (
|
||||||
<>
|
<>
|
||||||
<div className="flex p-2 space-x-1">
|
<div className="flex p-2 space-x-1">
|
||||||
|
|
@ -124,6 +137,36 @@ export const EdScriptWorkbench = () => {
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex items-center text-xs pr-2">
|
||||||
|
{p.ui.popup.script.mode === "js" && (
|
||||||
|
<div>
|
||||||
|
{
|
||||||
|
(
|
||||||
|
{
|
||||||
|
ok: <div className="text-green-700">Typings: OK</div>,
|
||||||
|
loading: <div className="text-slate-500">Loading ⌛</div>,
|
||||||
|
error: (
|
||||||
|
<Tooltip
|
||||||
|
content={
|
||||||
|
<div className="font-mono whitespace-pre-wrap text-[11px]">
|
||||||
|
{p.ui.popup.script.typings.err_msg}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
delay={0}
|
||||||
|
>
|
||||||
|
<div className="text-red-700 border-red-700 border bg-white bg-opacity-80 p-1">
|
||||||
|
⚠️ Typings: ERROR
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
|
),
|
||||||
|
} as any
|
||||||
|
)[p.ui.popup.script.typings.status]
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="relative flex flex-1">
|
<div className="relative flex flex-1">
|
||||||
{local.active_id === active.item_id ? (
|
{local.active_id === active.item_id ? (
|
||||||
<EdScriptMonaco />
|
<EdScriptMonaco />
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,15 @@ export const edActionDelete = async (p: PG, item: IContent) => {
|
||||||
if (meta) {
|
if (meta) {
|
||||||
const mitem = meta.mitem;
|
const mitem = meta.mitem;
|
||||||
if (mitem) {
|
if (mitem) {
|
||||||
|
mitem.doc?.transact(() => {
|
||||||
mitem.parent.forEach((e, k) => {
|
mitem.parent.forEach((e, k) => {
|
||||||
if (e == mitem) {
|
if (e == mitem) {
|
||||||
deleteByParent(p, mitem, k);
|
deleteByParent(p, mitem, k);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
await treeRebuild(p);
|
||||||
|
p.render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -23,17 +27,19 @@ export const edActionDeleteById = async (p: PG, id: string) => {
|
||||||
if (meta) {
|
if (meta) {
|
||||||
const mitem = meta.mitem;
|
const mitem = meta.mitem;
|
||||||
if (mitem) {
|
if (mitem) {
|
||||||
|
mitem.doc?.transact(() => {
|
||||||
mitem.parent.forEach((e, k) => {
|
mitem.parent.forEach((e, k) => {
|
||||||
if (e == mitem) {
|
if (e == mitem) {
|
||||||
deleteByParent(p, mitem, k);
|
deleteByParent(p, mitem, k);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
await treeRebuild(p);
|
||||||
|
p.render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteByParent = (p: PG, mitem: MItem, index: number) => {
|
const deleteByParent = (p: PG, mitem: MItem, index: number) => {
|
||||||
const mchild = mitem.parent.get(index);
|
|
||||||
mitem.parent.delete(index);
|
mitem.parent.delete(index);
|
||||||
treeRebuild(p);
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -122,12 +122,14 @@ export const nodeRender: NodeRender<IMeta> = (node, prm) => {
|
||||||
active.item_id = item.id;
|
active.item_id = item.id;
|
||||||
p.ui.tree.search = "";
|
p.ui.tree.search = "";
|
||||||
p.render();
|
p.render();
|
||||||
|
|
||||||
if ((item as IContent).type === "text") {
|
if ((item as IContent).type === "text") {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (document.activeElement?.tagName === "INPUT") {
|
if (document.activeElement?.tagName === "INPUT") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const el_active = document.querySelector(".el-active") as any;
|
const el_active = document.querySelector(".el-active") as any;
|
||||||
|
|
||||||
if (el_active) {
|
if (el_active) {
|
||||||
setEndOfContenteditable(el_active);
|
setEndOfContenteditable(el_active);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue