diff options
author | bobzel <zzzman@gmail.com> | 2020-08-26 00:07:20 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2020-08-26 00:07:20 -0400 |
commit | a2fb0c0483b77730a43f91e8a967f216bde51144 (patch) | |
tree | 6d73960611aa961ab3485baae7c01e22e47ae508 | |
parent | 0e4da0ffd9ff7eaf571451d8b267c7e708e152d7 (diff) |
fixed immediate Title Editing of tree views
-rw-r--r-- | src/client/views/collections/CollectionTreeView.tsx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx index 5a80541be..a7c414bcc 100644 --- a/src/client/views/collections/CollectionTreeView.tsx +++ b/src/client/views/collections/CollectionTreeView.tsx @@ -135,7 +135,7 @@ class TreeView extends React.Component<TreeViewProps> { const openScript = ScriptField.MakeScript(`openOnRight(self)`); const treeOpenScript = ScriptField.MakeScript(`self.treeViewOpen = !self.treeViewOpen`); this._editTitleScript = !Doc.IsSystem(this.props.document) ? titleScript && (() => titleScript) : treeOpenScript && (() => treeOpenScript); - this._openScript = !Doc.IsSystem(this.props.document) && !this.props.treeViewDoc.treeViewOutlineMode ? openScript && (() => openScript) : undefined; + this._openScript = !Doc.IsSystem(this.props.document) ? openScript && (() => openScript) : undefined; if (Doc.GetT(this.doc, "editTitle", "string", true) === "*") Doc.SetInPlace(this.doc, "editTitle", this._uniqueId, false); } @@ -199,7 +199,7 @@ class TreeView extends React.Component<TreeViewProps> { }} OnTab={undoBatch((shift?: boolean) => { shift ? this.props.outdentDocument?.() : this.props.indentDocument?.(); - setTimeout(() => Doc.SetInPlace(this.doc, "editTitle", "*", false), 250); + setTimeout(() => Doc.SetInPlace(this.doc, "editTitle", "*", false), 0); })} />) @@ -417,7 +417,7 @@ class TreeView extends React.Component<TreeViewProps> { truncateTitleWidth = () => NumCast(this.props.treeViewDoc.treeViewTruncateTitleWidth, 0); showTitleEdit = () => ["*", this._uniqueId].includes(Doc.GetT(this.doc, "editTitle", "string", true) || ""); onChildClick = () => this.props.onChildClick?.() ?? (this._editTitleScript?.() || ScriptCast(this.doc.treeChildClick)); - onChildDoubleClick = () => this._openScript?.() || ScriptCast(this.doc.treeChildDoubleClick); + onChildDoubleClick = () => (!this.props.treeViewDoc.treeViewOutlineMode && this._openScript?.()) || ScriptCast(this.doc.treeChildDoubleClick); /** * Renders the EditableView title element for placement into the tree. */ |