fix macem2
This commit is contained in:
parent
b4911b9a56
commit
18f6c9b313
|
|
@ -64,6 +64,12 @@ export const EdMain = () => {
|
||||||
p.render();
|
p.render();
|
||||||
p.page.render();
|
p.page.render();
|
||||||
},
|
},
|
||||||
|
text(item, className) {
|
||||||
|
return <div
|
||||||
|
className={className}
|
||||||
|
contentEditable
|
||||||
|
dangerouslySetInnerHTML={{ __html: item.html }}></div>
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { ReactElement } from "react";
|
import { ReactElement, ReactNode } from "react";
|
||||||
import { IContent } from "../../../utils/types/general";
|
import { IContent } from "../../../utils/types/general";
|
||||||
import { EdMeta, PG } from "../../ed/logic/ed-global";
|
import { IText } from "../../../utils/types/text";
|
||||||
import { IRoot } from "../../../utils/types/root";
|
import { EdMeta } from "../../ed/logic/ed-global";
|
||||||
|
|
||||||
export const ViewGlobal = {
|
export const ViewGlobal = {
|
||||||
mode: "" as "desktop" | "mobile",
|
mode: "" as "desktop" | "mobile",
|
||||||
|
|
@ -12,7 +12,7 @@ export const ViewGlobal = {
|
||||||
entry: [] as string[],
|
entry: [] as string[],
|
||||||
body_cache: null as null | ReactElement,
|
body_cache: null as null | ReactElement,
|
||||||
component: {
|
component: {
|
||||||
load: async (id_comp: string) => {},
|
load: async (id_comp: string) => { },
|
||||||
},
|
},
|
||||||
script: {
|
script: {
|
||||||
api_url: "",
|
api_url: "",
|
||||||
|
|
@ -23,7 +23,11 @@ export const ViewGlobal = {
|
||||||
hidden: undefined as undefined | ((item: IContent) => boolean),
|
hidden: undefined as undefined | ((item: IContent) => boolean),
|
||||||
active: undefined as
|
active: undefined as
|
||||||
| undefined
|
| undefined
|
||||||
| { get: (item: IContent) => boolean; set: (id: string) => void },
|
| {
|
||||||
|
get: (item: IContent) => boolean;
|
||||||
|
set: (id: string) => void;
|
||||||
|
text?: (item: IText, className: string) => ReactNode
|
||||||
|
},
|
||||||
hover: undefined as
|
hover: undefined as
|
||||||
| undefined
|
| undefined
|
||||||
| { get: (item: IContent) => boolean; set: (id: string) => void },
|
| { get: (item: IContent) => boolean; set: (id: string) => void },
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { FC, ReactNode } from "react";
|
import { FC, Fragment, ReactNode } from "react";
|
||||||
import { useGlobal } from "web-utils";
|
import { useGlobal } from "web-utils";
|
||||||
import { IItem } from "../../../../utils/types/item";
|
import { IItem } from "../../../../utils/types/item";
|
||||||
import { ISection } from "../../../../utils/types/section";
|
import { ISection } from "../../../../utils/types/section";
|
||||||
|
|
@ -20,9 +20,18 @@ export const ViewMetaChildren: FC<{ item: IItem | IText | ISection }> = ({
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (item.id) {
|
if (item.id) {
|
||||||
children[item.id] = <span key={item.id}
|
|
||||||
dangerouslySetInnerHTML={{ __html: item.html }
|
if (v.view.active?.text && v.view.active?.get(item)) {
|
||||||
}></span >;
|
children[item.id] = <Fragment key={item.id}>
|
||||||
|
{v.view.active.text(item)}
|
||||||
|
</Fragment>;
|
||||||
|
} else {
|
||||||
|
children[item.id] = <span
|
||||||
|
key={item.id}
|
||||||
|
dangerouslySetInnerHTML={{ __html: item.html }
|
||||||
|
}>
|
||||||
|
</span >;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { FC, Suspense } from "react";
|
import { FC, ReactNode, Suspense } from "react";
|
||||||
import { useGlobal } from "web-utils";
|
import { useGlobal } from "web-utils";
|
||||||
import { IContent } from "../../utils/types/general";
|
import { IContent } from "../../utils/types/general";
|
||||||
|
import { IText } from "../../utils/types/text";
|
||||||
import { Loading } from "../../utils/ui/loading";
|
import { Loading } from "../../utils/ui/loading";
|
||||||
import { ViewGlobal } from "./logic/global";
|
import { ViewGlobal } from "./logic/global";
|
||||||
import { vInit } from "./logic/init";
|
import { vInit } from "./logic/init";
|
||||||
|
|
@ -23,7 +24,11 @@ type ViewProp = {
|
||||||
bind?: (arg: { render: () => void }) => void;
|
bind?: (arg: { render: () => void }) => void;
|
||||||
hidden?: (item: IContent) => boolean;
|
hidden?: (item: IContent) => boolean;
|
||||||
hover?: { get: (item: IContent) => boolean; set: (id: string) => void };
|
hover?: { get: (item: IContent) => boolean; set: (id: string) => void };
|
||||||
active?: { get: (item: IContent) => boolean; set: (id: string) => void };
|
active?: {
|
||||||
|
get: (item: IContent) => boolean;
|
||||||
|
set: (id: string) => void;
|
||||||
|
text?: (item: IText, className: string) => ReactNode
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const View: FC<ViewProp> = (props) => {
|
export const View: FC<ViewProp> = (props) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue