aboutsummaryrefslogtreecommitdiff
path: root/src/client/documents/Documents.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r--src/client/documents/Documents.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 40527964a..2e9484db4 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -1233,7 +1233,7 @@ export namespace DocUtils {
return ctor ? ctor(path, options) : undefined;
}
- export function addDocumentCreatorMenuItems(docTextAdder: (d: Doc) => void, docAdder: (d: Doc) => void, x: number, y: number, simpleMenu: boolean = false): void {
+ export function addDocumentCreatorMenuItems(docTextAdder: (d: Doc) => void, docAdder: (d: Doc) => void, x: number, y: number, simpleMenu: boolean = false, pivotField?: string, pivotValue?: string): void {
!simpleMenu && ContextMenu.Instance.addItem({
description: "Quick Notes",
subitems: DocListCast((Doc.UserDoc()["template-notes"] as Doc).data).map((note, i) => ({
@@ -1241,10 +1241,13 @@ export namespace DocUtils {
event: undoBatch((args: { x: number, y: number }) => {
const textDoc = Docs.Create.TextDocument("", {
_width: 200, x, y, _autoHeight: note._autoHeight !== false,
- title: StrCast(note.title) + "#" + (note.aliasCount = NumCast(note.aliasCount) + 1)
+ title: StrCast(note.title) + "#" + (note.aliasCount = NumCast(note.aliasCount) + 1),
});
textDoc.layoutKey = "layout_" + note.title;
textDoc[textDoc.layoutKey] = note;
+ if (pivotField) {
+ textDoc[pivotField] = pivotValue
+ }
docTextAdder(textDoc);
}),
icon: StrCast(note.icon) as IconProp
@@ -1261,6 +1264,9 @@ export namespace DocUtils {
created.width = 300;
created.height = 35;
EquationBox.SelectOnLoad = created[Id];
+ if (pivotField) {
+ created[pivotField] = pivotValue
+ }
docAdder?.(created);
}
}, icon: "calculator"
@@ -1274,6 +1280,9 @@ export namespace DocUtils {
newDoc.x = x;
newDoc.y = y;
if (newDoc.type === DocumentType.RTF) FormattedTextBox.SelectOnLoad = newDoc[Id];
+ if (pivotField) {
+ newDoc[pivotField] = pivotValue
+ }
docAdder?.(newDoc);
}
}),