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.tsx21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 5ef62b2c5..e9c4d9cc5 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,10 +111,12 @@ 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('#')) {
+ if (this._accumulatedTitle.startsWith('-->#')) {
+ SelectionManager.Docs.forEach(doc => (doc[DocData].onViewMounted = ScriptField.MakeScript(`updateTagsCollection(this)`)));
+ }
const titleFieldKey = this._titleControlString.substring(1);
UndoManager.RunInBatch(
() =>
@@ -285,7 +286,7 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
} else {
var openDoc = selectedDocs[0].Document;
if (openDoc.layout_fieldKey === 'layout_icon') {
- openDoc = DocListCast(openDoc.proto_embeddings).find(embedding => !embedding.embedContainer) ?? Doc.MakeEmbedding(openDoc);
+ openDoc = Doc.GetEmbeddings(openDoc).find(embedding => !embedding.embedContainer) ?? Doc.MakeEmbedding(openDoc);
Doc.deiconifyView(openDoc);
}
LightboxView.Instance.SetLightboxDoc(
@@ -616,7 +617,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 +642,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 +732,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()}