From daf6c3eb00bec549947db9c5fdbcec09a9251bf0 Mon Sep 17 00:00:00 2001 From: bobzel Date: Mon, 14 Sep 2020 13:16:29 -0400 Subject: added a default user color and used it within custom note template --- src/client/util/CurrentUserUtils.ts | 5 +++-- src/client/util/SettingsManager.tsx | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts index 17f1146b1..44cd1f8c0 100644 --- a/src/client/util/CurrentUserUtils.ts +++ b/src/client/util/CurrentUserUtils.ts @@ -409,10 +409,10 @@ export class CurrentUserUtils { doc.emptySlide = textDoc; } if (doc.emptyHeader === undefined) { - const headerTemplate = Docs.Create.TextDocument(" ", { title: "header", _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.TextDocument(" ", { title: "header", target: doc, _autoHeight: true, system: true, cloneFieldFilter: new List(["system"]) }, "header"); // text needs to be a space to allow templateText to be created headerTemplate[DataSym].layout = "
" + - " " + + " " + " " + "
"; (headerTemplate.proto as Doc).isTemplateDoc = makeTemplate(headerTemplate.proto as Doc, true, "headerView"); @@ -943,6 +943,7 @@ export class CurrentUserUtils { doc.system = true; doc.noviceMode = doc.noviceMode === undefined ? "true" : doc.noviceMode; doc.title = Doc.CurrentUserEmail; + doc.userColor = "orange"; doc.activeInkPen = doc; doc.activeInkColor = StrCast(doc.activeInkColor, "rgb(0, 0, 0)"); doc.activeInkWidth = StrCast(doc.activeInkWidth, "1"); diff --git a/src/client/util/SettingsManager.tsx b/src/client/util/SettingsManager.tsx index c9605c620..d4c92b20f 100644 --- a/src/client/util/SettingsManager.tsx +++ b/src/client/util/SettingsManager.tsx @@ -55,7 +55,8 @@ export class SettingsManager extends React.Component<{}> { @undoBatch changeShowTitle = action((e: React.ChangeEvent) => Doc.UserDoc().showTitle = (e.currentTarget as any).value); @undoBatch changeFontFamily = action((e: React.ChangeEvent) => Doc.UserDoc().fontFamily = (e.currentTarget as any).value); @undoBatch changeFontSize = action((e: React.ChangeEvent) => Doc.UserDoc().fontSize = (e.currentTarget as any).value); - @undoBatch switchColor = action((color: ColorState) => Doc.UserDoc().activeCollectionBackground = String(color.hex)); + @undoBatch switchActiveBackgroundColor = action((color: ColorState) => Doc.UserDoc().activeCollectionBackground = String(color.hex)); + @undoBatch switchUserColor = action((color: ColorState) => Doc.UserDoc().userColor = String(color.hex)); @undoBatch playgroundModeToggle = action(() => { this.playgroundMode = !this.playgroundMode; @@ -67,13 +68,20 @@ export class SettingsManager extends React.Component<{}> { }); @computed get preferencesContent() { - const colorBox = void) => ; const colorFlyout =
- + +
e.stopPropagation()} > + +
+
+
; + const userColorFlyout =
+
e.stopPropagation()} >
@@ -88,6 +96,10 @@ export class SettingsManager extends React.Component<{}> {
Back. Color
{colorFlyout}
+
+
User Color
+ {userColorFlyout} +
Font