aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/util/CurrentUserUtils.ts33
-rw-r--r--src/client/views/MainView.tsx1
2 files changed, 21 insertions, 13 deletions
diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index cce853b2d..a99d9451b 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -512,18 +512,18 @@ export class CurrentUserUtils {
static setupMenuPanel(doc: Doc) {
if (doc.menuStack === undefined) {
- const buttons = CurrentUserUtils.menuBtnDescriptions();
- const menuBtns = buttons.map(({ title, icon, click }) => Docs.Create.FontIconDocument({
- icon,
- iconShape: "square",
- title,
- _backgroundColor: "black",
- stayInCollection: true,
- childDropAction: "same",
- _width: 60,
- _height: 60,
- onClick: ScriptField.MakeScript(click, { scriptContext: "any" }),
- }));
+ const menuBtns = CurrentUserUtils.menuBtnDescriptions().map(({ title, icon, click }) =>
+ Docs.Create.FontIconDocument({
+ icon,
+ iconShape: "square",
+ title,
+ _backgroundColor: "black",
+ stayInCollection: true,
+ childDropAction: "same",
+ _width: 60,
+ _height: 60,
+ onClick: ScriptField.MakeScript(click, { scriptContext: "any" }),
+ }));
const userDoc = menuBtns[menuBtns.length - 1];
userDoc.target = doc;
userDoc.hidden = ComputedField.MakeFunction("self.target.noviceMode");
@@ -537,6 +537,15 @@ export class CurrentUserUtils {
_yPadding: 0, _xMargin: 0, _autoHeight: false, _width: 60, _columnWidth: 60, lockedPosition: true, _chromeStatus: "disabled",
}));
}
+ // this resets all sidebar buttons to being deactivated
+ PromiseValue(Cast(doc.menuStack, Doc)).then(stack => {
+ stack && PromiseValue(stack.data).then(btns => {
+ DocListCastAsync(btns).then(bts => bts?.forEach(btn => {
+ btn.color = "white";
+ btn._backgroundColor = "";
+ }));
+ })
+ });
return doc.menuStack as Doc;
}
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index 1589ac7e0..0bfbc41ca 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -445,7 +445,6 @@ export class MainView extends React.Component {
}
@computed get menuPanel() {
- setTimeout(() => DocListCast((Doc.UserDoc().menuStack as Doc).data).forEach(action(doc => { doc.color = "white"; doc._backgroundColor = ""; })), 1000);
return <div className="mainView-menuPanel">
<DocumentView
Document={Doc.UserDoc().menuStack as Doc}