From 6c03a4ad74ca93311139e8fecda8a4793c103488 Mon Sep 17 00:00:00 2001 From: bobzel Date: Mon, 14 Sep 2020 22:17:54 -0400 Subject: updated header text view. fixed dragging tree view items to unregister listeners. fixed contextMenu icon selection to ignore dashFieldViews. fixed selectOnLoadChar to not apply when a childlayoutstring is specified. fixed dropping text box on item view to only use json parseable text. --- src/client/util/CurrentUserUtils.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/client/util') diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts index b38cdabbc..6d4035b75 100644 --- a/src/client/util/CurrentUserUtils.ts +++ b/src/client/util/CurrentUserUtils.ts @@ -408,7 +408,7 @@ export class CurrentUserUtils { FormattedTextBox.SelectOnLoad = textDoc[Id]; doc.emptySlide = textDoc; } - if (doc.emptyHeader === undefined) { + if (doc.emptyHeader === undefined || (doc.emptyHeader as Doc).version !== "0") { const json = { doc: { type: "doc", @@ -428,7 +428,7 @@ export class CurrentUserUtils { selection: { type: "text", anchor: 1, head: 1 }, storedMarks: [] }; - const headerTemplate = Docs.Create.RTFDocument(new RichTextField(JSON.stringify(json), ""), { title: "header", target: doc, _headerHeight: 24, _headerFontSize: 9, _autoHeight: true, system: true, cloneFieldFilter: new List(["system"]) }, "header"); // text needs to be a space to allow templateText to be created + const headerTemplate = Docs.Create.RTFDocument(new RichTextField(JSON.stringify(json), ""), { title: "header", version: "0", target: doc, _height: 70, _headerHeight: 12, _headerFontSize: 9, _autoHeight: true, system: true, cloneFieldFilter: new List(["system"]) }, "header"); // text needs to be a space to allow templateText to be created headerTemplate[DataSym].layout = "
" + " " + @@ -1001,6 +1001,15 @@ export class CurrentUserUtils { doc["dockedBtn-undo"] && reaction(() => UndoManager.undoStack.slice(), () => Doc.GetProto(doc["dockedBtn-undo"] as Doc).opacity = UndoManager.CanUndo() ? 1 : 0.4, { fireImmediately: true }); doc["dockedBtn-redo"] && reaction(() => UndoManager.redoStack.slice(), () => Doc.GetProto(doc["dockedBtn-redo"] as Doc).opacity = UndoManager.CanRedo() ? 1 : 0.4, { fireImmediately: true }); + // uncomment this to setup a default note style that uses the custom header layout + PromiseValue(doc.emptyHeader).then(factory => { + if (Cast(doc.defaultTextLayout, Doc, null)?.version !== "0") { + const deleg = Doc.delegateDragFactory(factory as Doc); + deleg.title = "header"; + doc.defaultTextLayout = new PrefetchProxy(deleg); + Doc.AddDocToList(Cast(doc["template-notes"], Doc, null), "data", deleg); + } + }); return doc; } -- cgit v1.2.3-70-g09d2