aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgeireann <60007097+geireann@users.noreply.github.com>2020-08-24 20:06:22 +0800
committergeireann <60007097+geireann@users.noreply.github.com>2020-08-24 20:06:22 +0800
commit3769283f04a0029e38d45b2611138f600e4748ef (patch)
tree052095949c90f740ce2ee3663fb97f1ea56aaad7 /src
parent31fac41cb8a3bd19b02dddc116b11c962f3339d3 (diff)
merge fixes + pinDoc bug fix
Diffstat (limited to 'src')
-rw-r--r--src/client/util/CurrentUserUtils.ts12
-rw-r--r--src/client/views/DocumentButtonBar.tsx2
-rw-r--r--src/client/views/EditableView.tsx1
-rw-r--r--src/client/views/MainView.tsx7
4 files changed, 5 insertions, 17 deletions
diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index c65b5b53c..821bb917a 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -756,18 +756,6 @@ export class CurrentUserUtils {
return doc.myDashboards as any as Doc;
}
- static async addToPresList(doc: Doc, pres: Doc) {
- await doc.myPresentations;
- if (doc.myPresentations === undefined) {
- doc.myPresentations = new PrefetchProxy(Docs.Create.TreeDocument([], {
- title: "PRESENTATION TRAILS", _height: 100, forceActive: true, boxShadow: "0 0", lockedPosition: true, treeViewOpen: true, system: true
- }));
- }
- const myPresentations = doc.myPresentations as Doc;
- doc.activePresentation = pres;
- Doc.AddDocToList(myPresentations, "data", pres);
- }
-
static async setupPresentations(doc: Doc) {
await doc.myPresentations;
if (doc.myPresentations === undefined) {
diff --git a/src/client/views/DocumentButtonBar.tsx b/src/client/views/DocumentButtonBar.tsx
index e5f419558..17ed211dd 100644
--- a/src/client/views/DocumentButtonBar.tsx
+++ b/src/client/views/DocumentButtonBar.tsx
@@ -25,6 +25,7 @@ import { DocumentLinksButton } from './nodes/DocumentLinksButton';
import { Tooltip } from '@material-ui/core';
import SharingManager from '../util/SharingManager';
import { CurrentUserUtils } from '../util/CurrentUserUtils';
+import { SelectionManager } from '../util/SelectionManager';
const higflyout = require("@hig/flyout");
export const { anchorPoints } = higflyout;
export const Flyout = higflyout.default;
@@ -198,6 +199,7 @@ export class DocumentButtonBar extends React.Component<{ views: () => (DocumentV
get pinButton() {
const targetDoc = this.view0?.props.Document;
let isPinned = targetDoc && Doc.isDocPinned(targetDoc);
+ // More than 1 document selected then all must be in presentation for isPinned to be true (then it will unpin all)
if (SelectionManager.SelectedDocuments().length > 1) {
SelectionManager.SelectedDocuments().forEach((docView: DocumentView) => {
if (Doc.isDocPinned(docView.props.Document)) isPinned = true;
diff --git a/src/client/views/EditableView.tsx b/src/client/views/EditableView.tsx
index b96802f06..a4b059482 100644
--- a/src/client/views/EditableView.tsx
+++ b/src/client/views/EditableView.tsx
@@ -8,6 +8,7 @@ import "./EditableView.scss";
import { DragManager } from '../util/DragManager';
import { ComputedField } from '../../fields/ScriptField';
import { FieldValue } from '../../fields/Types';
+import { PresBox } from './nodes/PresBox';
export interface EditableProps {
/**
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index 979866eaa..3b10c0e6b 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -8,7 +8,6 @@ import "normalize.css";
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import Measure from 'react-measure';
-import * as rp from 'request-promise';
import { Doc, DocListCast, Field, Opt } from '../../fields/Doc';
import { Id } from '../../fields/FieldSymbols';
import { List } from '../../fields/List';
@@ -21,15 +20,12 @@ import GoogleAuthenticationManager from '../apis/GoogleAuthenticationManager';
import { DocServer } from '../DocServer';
import { Docs, DocumentOptions } from '../documents/Documents';
import { DocumentType } from '../documents/DocumentTypes';
-import { Networking } from '../Network';
import { CurrentUserUtils } from '../util/CurrentUserUtils';
import { DocumentManager } from '../util/DocumentManager';
import GroupManager from '../util/GroupManager';
import { HistoryUtil } from '../util/History';
import { Hypothesis } from '../util/HypothesisUtils';
-import { LinkManager } from '../util/LinkManager';
import { Scripting } from '../util/Scripting';
-import { SearchUtil } from '../util/SearchUtil';
import { SelectionManager } from '../util/SelectionManager';
import SettingsManager from '../util/SettingsManager';
import SharingManager from '../util/SharingManager';
@@ -68,7 +64,6 @@ import { SearchUtil } from '../util/SearchUtil';
import { Networking } from '../Network';
import * as rp from 'request-promise';
import { LinkManager } from '../util/LinkManager';
-import RichTextMenu from './nodes/formattedText/RichTextMenu';
import { PrefetchProxy } from '../../fields/Proxy';
@observer
@@ -291,6 +286,8 @@ export class MainView extends React.Component {
const freeformDoc = CurrentUserUtils.GuestTarget || Docs.Create.FreeformDocument([], freeformOptions);
const dashboardDoc = Docs.Create.StandardCollectionDockingDocument([{ doc: freeformDoc, initialWidth: 600, path: [myCatalog] }], { title: `Dashboard ${dashboardCount}` }, id, "row");
Doc.AddDocToList(myCatalog, "data", freeformDoc);
+ Doc.AddDocToList(myCatalog, "data", presentation);
+ Doc.UserDoc().activePresentation = presentation;
const toggleTheme = ScriptField.MakeScript(`self.darkScheme = !self.darkScheme`);
const toggleComic = ScriptField.MakeScript(`toggleComicMode()`);
const copyDashboard = ScriptField.MakeScript(`copyDashboard()`);