aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-08-27 19:59:14 -0400
committerbobzel <zzzman@gmail.com>2020-08-27 19:59:14 -0400
commit2e0e34df0db385acfcd4079fae6e01fd4a2234fa (patch)
tree3cf83489ce62b374538f88e243e269d9ae33a997 /src
parentf738601ac9b497334e17835535f7572c961ee373 (diff)
added undo for deleting presentation view items. fixed scroll height of mainView sidebar.
Diffstat (limited to 'src')
-rw-r--r--src/client/views/AntimodeMenu.tsx2
-rw-r--r--src/client/views/MainView.scss2
-rw-r--r--src/client/views/MainView.tsx13
-rw-r--r--src/client/views/collections/CollectionMenu.tsx6
-rw-r--r--src/client/views/collections/collectionFreeForm/FormatShapePane.tsx4
-rw-r--r--src/client/views/collections/collectionFreeForm/MarqueeView.tsx2
-rw-r--r--src/client/views/nodes/formattedText/RichTextMenu.tsx2
-rw-r--r--src/client/views/presentationview/PresElementBox.tsx2
8 files changed, 17 insertions, 16 deletions
diff --git a/src/client/views/AntimodeMenu.tsx b/src/client/views/AntimodeMenu.tsx
index 32fb24b32..3b0c56adc 100644
--- a/src/client/views/AntimodeMenu.tsx
+++ b/src/client/views/AntimodeMenu.tsx
@@ -86,7 +86,7 @@ export abstract class AntimodeMenu<T extends AntimodeMenuProps> extends React.Co
@action
protected togglePin = (e: React.MouseEvent) => {
- this.Pinned = !this.Pinned;
+ runInAction(() => this.Pinned = !this.Pinned);
}
protected dragStart = (e: React.PointerEvent) => {
diff --git a/src/client/views/MainView.scss b/src/client/views/MainView.scss
index aebb7a19a..05a8b5c80 100644
--- a/src/client/views/MainView.scss
+++ b/src/client/views/MainView.scss
@@ -23,7 +23,7 @@
// add nodes menu. Note that the + button is actually an input label, not an actual button.
.mainView-docButtons {
position: absolute;
- bottom: 35px;
+ bottom: 10px;
left: calc(100% + 5px);
z-index: 1;
}
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index d107b74f0..0bdfa0cdd 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -94,7 +94,7 @@ export class MainView extends React.Component {
} else { return undefined; }
}
- propertiesWidth = () => Math.max(0, Math.min(this._panelWidth - 50, CurrentUserUtils.propertiesWidth));
+ propertiesWidth = () => Math.max(0, Math.min(this._panelWidth - 50, CurrentUserUtils.propertiesWidth || 0));
@computed get propertiesIcon() {
if (this.propertiesWidth() < 10) {
@@ -147,8 +147,6 @@ export class MainView extends React.Component {
CurrentUserUtils._urlState = HistoryUtil.parseUrl(window.location) || {} as any;
// causes errors to be generated when modifying an observable outside of an action
- CurrentUserUtils.propertiesWidth = 0;
-
configure({ enforceActions: "observed" });
if (window.location.pathname !== "/home") {
const pathname = window.location.pathname.substr(1).split("/");
@@ -352,7 +350,7 @@ export class MainView extends React.Component {
TraceMobx();
const mainContainer = this.mainContainer;
const width = this.flyoutWidth + this.propertiesWidth();
- return <div className="mainContent-div" onDrop={this.onDrop} style={{ width: `calc(100% - ${width}px)`, height: `calc(100% - ${SEARCH_PANEL_HEIGHT})` }}>
+ return <div className="mainContent-div" onDrop={this.onDrop} style={{ width: `calc(100% - ${width}px)`, height: "100%" }}>
{!mainContainer ? (null) : this.mainDocView}
</div>;
}
@@ -383,6 +381,7 @@ export class MainView extends React.Component {
}
}
+ @computed get topOffset() { return (CollectionMenu.Instance?.Pinned ? 35 : 0) + Number(SEARCH_PANEL_HEIGHT.replace("px", "")); }
flyoutWidthFunc = () => this.flyoutWidth;
addDocTabFunc = (doc: Doc, where: string, libraryPath?: Doc[]): boolean => {
return where === "close" ? CollectionDockingView.CloseRightSplit(doc) :
@@ -395,7 +394,7 @@ export class MainView extends React.Component {
@computed get flyout() {
if (!this.sidebarContent) return null;
return <div className="mainView-libraryFlyout">
- <div className="mainView-contentArea" style={{ position: "relative", height: `calc(100% - ${SEARCH_PANEL_HEIGHT})`, width: "100%", overflow: "visible" }}>
+ <div className="mainView-contentArea" style={{ position: "relative", height: "100%", width: "100%", overflow: "visible" }}>
{/* {this.flyoutWidth > 0 ? <div className="mainView-libraryFlyout-close"
onPointerDown={this.closeFlyout}>
<FontAwesomeIcon icon="times" color="black" size="lg" />
@@ -575,8 +574,8 @@ export class MainView extends React.Component {
}
@computed get mainContent() {
- const n = (CollectionMenu.Instance?.Pinned ? 1 : 0);
- const height = `calc(100% - ${n * Number(ANTIMODEMENU_HEIGHT.replace("px", ""))}px)`;
+ const height = `calc(100% - ${this.topOffset}px)`;
+ console.log("Height = " + height);
const pinned = FormatShapePane.Instance?.Pinned;
const innerContent = this.mainInnerContent;
return !this.userDoc ? (null) : (
diff --git a/src/client/views/collections/CollectionMenu.tsx b/src/client/views/collections/CollectionMenu.tsx
index 6f93bd12a..f5d64ba0d 100644
--- a/src/client/views/collections/CollectionMenu.tsx
+++ b/src/client/views/collections/CollectionMenu.tsx
@@ -36,7 +36,7 @@ import { PresBox } from "../nodes/PresBox";
@observer
export class CollectionMenu extends AntimodeMenu<AntimodeMenuProps> {
- static Instance: CollectionMenu;
+ @observable static Instance: CollectionMenu;
@observable SelectedCollection: DocumentView | undefined;
@observable FieldKey: string;
@@ -44,9 +44,9 @@ export class CollectionMenu extends AntimodeMenu<AntimodeMenuProps> {
constructor(props: any) {
super(props);
this.FieldKey = "";
- CollectionMenu.Instance = this;
+ runInAction(() => CollectionMenu.Instance = this);
this._canFade = false; // don't let the inking menu fade away
- this.Pinned = Cast(Doc.UserDoc()["menuCollections-pinned"], "boolean", true);
+ runInAction(() => this.Pinned = Cast(Doc.UserDoc()["menuCollections-pinned"], "boolean", true));
this.jumpTo(300, 300);
}
diff --git a/src/client/views/collections/collectionFreeForm/FormatShapePane.tsx b/src/client/views/collections/collectionFreeForm/FormatShapePane.tsx
index 91efe139e..e6ec274f0 100644
--- a/src/client/views/collections/collectionFreeForm/FormatShapePane.tsx
+++ b/src/client/views/collections/collectionFreeForm/FormatShapePane.tsx
@@ -1,7 +1,7 @@
import React = require("react");
import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { action, computed, observable } from "mobx";
+import { action, computed, observable, runInAction } from "mobx";
import { observer } from "mobx-react";
import { Doc, Field, Opt } from "../../../../fields/Doc";
import { Document } from "../../../../fields/documentSchemas";
@@ -91,7 +91,7 @@ export class FormatShapePane extends AntimodeMenu<AntimodeMenuProps> {
super(props);
FormatShapePane.Instance = this;
this._canFade = false;
- this.Pinned = BoolCast(Doc.UserDoc()["menuFormatShape-pinned"]);
+ runInAction(() => this.Pinned = BoolCast(Doc.UserDoc()["menuFormatShape-pinned"]));
}
@action
diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
index 00ddebfd2..f2934f0e6 100644
--- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
+++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
@@ -783,7 +783,7 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque
render() {
return <div className="marqueeView"
- style={{ overflow: StrCast(this.props.Document._overflow), cursor: MarqueeView.DragMarquee && this ? "crosshair" : "hand" }}
+ style={{ overflow: this.props.renderDepth < 2 ? "visible" : StrCast(this.props.Document._overflow), cursor: MarqueeView.DragMarquee && this ? "crosshair" : "hand" }}
onDragOver={e => e.preventDefault()}
onScroll={(e) => e.currentTarget.scrollTop = e.currentTarget.scrollLeft = 0} onClick={this.onClick} onPointerDown={this.onPointerDown}>
{this._visible ? this.marqueeDiv : null}
diff --git a/src/client/views/nodes/formattedText/RichTextMenu.tsx b/src/client/views/nodes/formattedText/RichTextMenu.tsx
index a0e2d4351..3812e878f 100644
--- a/src/client/views/nodes/formattedText/RichTextMenu.tsx
+++ b/src/client/views/nodes/formattedText/RichTextMenu.tsx
@@ -75,7 +75,7 @@ export class RichTextMenu extends AntimodeMenu<AntimodeMenuProps> {
RichTextMenu.Instance = this;
this._canFade = false;
//this.Pinned = BoolCast(Doc.UserDoc()["menuRichText-pinned"]);
- this.Pinned = true;
+ runInAction(() => this.Pinned = true);
this.fontSizeOptions = [
{ mark: schema.marks.pFontSize.create({ fontSize: 7 }), title: "Set font size", label: "7pt", command: this.changeFontSize },
diff --git a/src/client/views/presentationview/PresElementBox.tsx b/src/client/views/presentationview/PresElementBox.tsx
index e965ac656..e1b97887a 100644
--- a/src/client/views/presentationview/PresElementBox.tsx
+++ b/src/client/views/presentationview/PresElementBox.tsx
@@ -20,6 +20,7 @@ import { DocumentType } from "../../documents/DocumentTypes";
import { Tooltip } from "@material-ui/core";
import { DragManager } from "../../util/DragManager";
import { CurrentUserUtils } from "../../util/CurrentUserUtils";
+import { undoBatch } from "../../util/UndoManager";
export const presSchema = createSchema({
presentationTargetDoc: Doc,
@@ -206,6 +207,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps, PresDoc
}
}
+ @undoBatch
@action
removeItem = (e: React.MouseEvent) => {
this.props.removeDocument?.(this.rootDoc);