aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionMenu.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-09-07 15:27:34 -0400
committerbobzel <zzzman@gmail.com>2020-09-07 15:27:34 -0400
commit157faac6a3c8a7c2347baf78e1796ff0aa3e0312 (patch)
tree1a708f8f4cd7d26af7d7434e10cd351716f480f5 /src/client/views/collections/CollectionMenu.tsx
parentceb892fe906c5936f5b5b4e65ea3a4e1c05aa289 (diff)
fixed childLayoutString templates whch broke somewhere along the way.
Diffstat (limited to 'src/client/views/collections/CollectionMenu.tsx')
-rw-r--r--src/client/views/collections/CollectionMenu.tsx12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/client/views/collections/CollectionMenu.tsx b/src/client/views/collections/CollectionMenu.tsx
index 4b8075f06..cb989d348 100644
--- a/src/client/views/collections/CollectionMenu.tsx
+++ b/src/client/views/collections/CollectionMenu.tsx
@@ -33,6 +33,7 @@ import { PresBox } from "../nodes/PresBox";
import "./CollectionMenu.scss";
import { CollectionViewType, COLLECTION_BORDER_WIDTH } from "./CollectionView";
import { TabDocView } from "./TabDocView";
+import { RichTextField } from "../../../fields/RichTextField";
@observer
export class CollectionMenu extends AntimodeMenu<AntimodeMenuProps> {
@@ -121,7 +122,16 @@ export class CollectionViewBaseChrome extends React.Component<CollectionMenuProp
_templateCommand = {
params: ["target", "source"], title: "item view",
script: "self.target.childLayoutTemplate = getDocTemplate(self.source?.[0])",
- immediate: undoBatch((source: Doc[]) => source.length && (this.target.childLayoutTemplate = Doc.getDocTemplate(source?.[0]))),
+ immediate: undoBatch((source: Doc[]) => {
+ if (source.length === 1 && source[0].type === DocumentType.RTF && Cast(source[0].text, RichTextField, null)?.Text) {
+ Doc.SetInPlace(this.target, "childLayoutString", Cast(source[0].text, RichTextField, null)?.Text, false);
+ } else if (source.length) {
+ this.target.childLayoutTemplate = Doc.getDocTemplate(source?.[0]);
+ } else {
+ Doc.SetInPlace(this.target, "childLayoutString", undefined, true);
+ Doc.SetInPlace(this.target, "childLayoutTemplate", undefined, true);
+ }
+ }),
initialize: emptyFunction,
};
_narrativeCommand = {