diff options
author | bobzel <zzzman@gmail.com> | 2022-04-06 11:44:02 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2022-04-06 11:44:02 -0400 |
commit | aeb636371275ed056d7812447984f71ff90b39e0 (patch) | |
tree | bddced730d7c398d99bcf96d3b347162ccc8fd2b | |
parent | 27d37f7c50978da6f3eca87e1aa5bfea786b19c6 (diff) |
set publsihed documents to automatically display a title region
-rw-r--r-- | src/client/views/nodes/formattedText/FormattedTextBox.tsx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx index dcb312980..18be30a88 100644 --- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx +++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx @@ -1443,6 +1443,14 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp } catch (e: any) { console.log(e.message); } this._lastText = curText; } + if (StrCast(this.rootDoc.title).startsWith("@") && !this.dataDoc["title-custom"]) { + UndoManager.RunInBatch(() => { + this.dataDoc["title-custom"] = true; + this.dataDoc.showTitle = "title"; + const tr = this._editorView!.state.tr; + this._editorView?.dispatch(tr.setSelection(new TextSelection(tr.doc.resolve(0), tr.doc.resolve(StrCast(this.rootDoc.title).length + 2))).deleteSelection()); + }, "titler"); + } } onKeyDown = (e: React.KeyboardEvent) => { // single line text boxes need to pass through tab/enter/backspace so that their containers can respond (eg, an outline container) |