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