aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocumentDecorations.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/DocumentDecorations.tsx')
-rw-r--r--src/client/views/DocumentDecorations.tsx16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 5ef62b2c5..2193acf62 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -18,7 +18,6 @@ import { DocumentType } from '../documents/DocumentTypes';
import { Docs } from '../documents/Documents';
import { DocumentManager } from '../util/DocumentManager';
import { DragManager } from '../util/DragManager';
-import { LinkFollower } from '../util/LinkFollower';
import { SelectionManager } from '../util/SelectionManager';
import { SettingsManager } from '../util/SettingsManager';
import { SnappingManager } from '../util/SnappingManager';
@@ -112,7 +111,6 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
@action
titleBlur = () => {
- this._editingTitle = false;
if (this._accumulatedTitle.startsWith('#') || this._accumulatedTitle.startsWith('=')) {
this._titleControlString = this._accumulatedTitle;
} else if (this._titleControlString.startsWith('#')) {
@@ -616,7 +614,7 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
if (SelectionManager.Views.length === 1) {
const selected = SelectionManager.Views[0];
if (this._titleControlString.startsWith('=')) {
- return ScriptField.MakeFunction(this._titleControlString.substring(1), { doc: Doc.name })!.script.run({ self: selected.Document, this: selected.layoutDoc }, console.log).result?.toString() || '';
+ return ScriptField.MakeFunction(this._titleControlString.substring(1), { doc: Doc.name })?.script.run({ self: selected.Document, this: selected.layoutDoc }, console.log).result?.toString() || '';
}
if (this._titleControlString.startsWith('#')) {
return Field.toString(selected.Document[this._titleControlString.substring(1)] as Field) || '-unset-';
@@ -641,7 +639,12 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
const { b, r, x, y } = this.Bounds;
const seldocview = SelectionManager.Views.lastElement();
if (SnappingManager.IsDragging || r - x < 1 || x === Number.MAX_VALUE || !seldocview || this._hidden || isNaN(r) || isNaN(b) || isNaN(x) || isNaN(y)) {
- setTimeout(action(() => (this._showNothing = true)));
+ setTimeout(
+ action(() => {
+ this._editingTitle = false;
+ this._showNothing = true;
+ })
+ );
return null;
}
@@ -726,7 +729,10 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
name="dynbox"
autoComplete="on"
value={hideTitle ? '' : this._accumulatedTitle}
- onBlur={e => !hideTitle && this.titleBlur()}
+ onBlur={action((e: React.FocusEvent) => {
+ this._editingTitle = false;
+ !hideTitle && this.titleBlur();
+ })}
onChange={action(e => !hideTitle && (this._accumulatedTitle = e.target.value))}
onKeyDown={hideTitle ? emptyFunction : this.titleEntered}
onPointerDown={e => e.stopPropagation()}