diff options
| author | bobzel <zzzman@gmail.com> | 2020-09-14 22:17:54 -0400 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2020-09-14 22:17:54 -0400 |
| commit | 6c03a4ad74ca93311139e8fecda8a4793c103488 (patch) | |
| tree | 6baa66f82e72e757ffd6d053ec847243ccb663da /src/client/views/collections/CollectionMenu.tsx | |
| parent | 1af6500a4b87fa25506a9b51d8fa7dbc0d68878b (diff) | |
updated header text view. fixed dragging tree view items to unregister listeners. fixed contextMenu icon selection to ignore dashFieldViews. fixed selectOnLoadChar to not apply when a childlayoutstring is specified. fixed dropping text box on item view to only use json parseable text.
Diffstat (limited to 'src/client/views/collections/CollectionMenu.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionMenu.tsx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/client/views/collections/CollectionMenu.tsx b/src/client/views/collections/CollectionMenu.tsx index 8342c5b12..9e67faed5 100644 --- a/src/client/views/collections/CollectionMenu.tsx +++ b/src/client/views/collections/CollectionMenu.tsx @@ -123,8 +123,10 @@ export class CollectionViewBaseChrome extends React.Component<CollectionMenuProp params: ["target", "source"], title: "item view", script: "self.target.childLayoutTemplate = getDocTemplate(self.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); + let formatStr = source.length && Cast(source[0].text, RichTextField, null)?.Text; + try { formatStr && JSON.parse(formatStr); } catch (e) { formatStr = ""; } + if (source.length === 1 && formatStr) { + Doc.SetInPlace(this.target, "childLayoutString", formatStr, false); } else if (source.length) { this.target.childLayoutTemplate = Doc.getDocTemplate(source?.[0]); } else { |
