From 318a45b6b428a459ade553fef7fd8c26e485eccb Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 12 Aug 2020 09:09:53 -0400 Subject: fixed dragging of icons from Tools panel to side menu panel - no aliases are created so items can now be moved around sensibly --- src/client/util/DropConverter.ts | 2 +- src/client/views/MainView.scss | 4 ++-- src/client/views/MainView.tsx | 14 ++++++-------- src/client/views/globalCssVariables.scss | 2 ++ src/client/views/globalCssVariables.scss.d.ts | 1 + src/client/views/nodes/LinkDocPreview.tsx | 11 +++-------- 6 files changed, 15 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/client/util/DropConverter.ts b/src/client/util/DropConverter.ts index d0acf14c3..f1848f7e5 100644 --- a/src/client/util/DropConverter.ts +++ b/src/client/util/DropConverter.ts @@ -58,7 +58,7 @@ export function convertDropDataToButtons(data: DragManager.DocumentDragData) { let dbox = doc; // bcz: isButtonBar is intended to allow a collection of linear buttons to be dropped and nested into another collection of buttons... it's not being used yet, and isn't very elegant if (doc.type === DocumentType.FONTICON || StrCast(Doc.Layout(doc).layout).includes("FontIconBox")) { - dbox = Doc.MakeAlias(doc); + //dbox = Doc.MakeAlias(doc); // don't need to do anything if dropping an icon doc onto an icon bar since there should be no layout data for an icon } else if (!doc.onDragStart && !doc.isButtonBar) { const layoutDoc = doc.layout instanceof Doc && doc.layout.isTemplateForField ? doc.layout : doc; if (layoutDoc.type !== DocumentType.FONTICON) { diff --git a/src/client/views/MainView.scss b/src/client/views/MainView.scss index f3fba82bc..44c756b63 100644 --- a/src/client/views/MainView.scss +++ b/src/client/views/MainView.scss @@ -157,7 +157,7 @@ width: 60px; background-color: #121721; - height: calc(100% - 32px); + height: calc(100% - $searchpanel-height); //overflow-y: scroll; //overflow-x: hidden; @@ -215,7 +215,7 @@ .mainView-searchPanel { width: 100%; - height: 32px; + height: $searchpanel-height; background-color: black; color: white; text-align: center; diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index 5ee10f7a6..a5d2f2fa1 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -41,7 +41,7 @@ import { ContextMenu } from './ContextMenu'; import { DictationOverlay } from './DictationOverlay'; import { DocumentDecorations } from './DocumentDecorations'; import GestureOverlay from './GestureOverlay'; -import { ANTIMODEMENU_HEIGHT } from './globalCssVariables.scss'; +import { ANTIMODEMENU_HEIGHT, SEARCH_PANEL_HEIGHT } from './globalCssVariables.scss'; import KeyManager from './GlobalKeyHandler'; import { LinkMenu } from './linking/LinkMenu'; import "./MainView.scss"; @@ -50,7 +50,6 @@ import { AudioBox } from './nodes/AudioBox'; import { DocumentLinksButton } from './nodes/DocumentLinksButton'; import { DocumentView } from './nodes/DocumentView'; import { FormattedTextBox } from './nodes/formattedText/FormattedTextBox'; -import RichTextMenu from './nodes/formattedText/RichTextMenu'; import { LinkDescriptionPopup } from './nodes/LinkDescriptionPopup'; import { LinkDocPreview } from './nodes/LinkDocPreview'; import { RadialMenu } from './nodes/RadialMenu'; @@ -59,10 +58,10 @@ import { OverlayView } from './OverlayView'; import PDFMenu from './pdf/PDFMenu'; import { PreviewCursor } from './PreviewCursor'; import { Hypothesis } from '../util/HypothesisUtils'; -import { undoBatch } from '../util/UndoManager'; import { WebBox } from './nodes/WebBox'; import * as ReactDOM from 'react-dom'; import { SearchBox } from './search/SearchBox'; +import RichTextMenu from './nodes/formattedText/RichTextMenu'; @observer export class MainView extends React.Component { @@ -402,7 +401,7 @@ export class MainView extends React.Component { TraceMobx(); const mainContainer = this.mainContainer; const width = this.flyoutWidth + this.propertiesWidth(); - return
+ return
{!mainContainer ? (null) : this.mainDocView}
; } @@ -439,15 +438,14 @@ export class MainView extends React.Component { doc.dockingConfig ? this.openWorkspace(doc) : CollectionDockingView.AddRightSplit(doc, libraryPath); } - sidebarScreenToLocal = () => new Transform(0, (CollectionMenu.Instance.Pinned ? -35 : 0), 1); - //sidebarScreenToLocal = () => new Transform(0, (RichTextMenu.Instance.Pinned ? -35 : 0) + (CollectionMenu.Instance.Pinned ? -35 : 0), 1); + sidebarScreenToLocal = () => new Transform(0, (CollectionMenu.Instance.Pinned ? -35 : 0) - Number(SEARCH_PANEL_HEIGHT.replace("px", "")), 1); mainContainerXf = () => this.sidebarScreenToLocal().translate(-55, -this._buttonBarHeight); @computed get closePosition() { return 55 + this.flyoutWidth; } @computed get flyout() { if (!this.sidebarContent) return null; return
-
+
{/* {this.flyoutWidth > 0 ?
@@ -819,8 +817,8 @@ export class MainView extends React.Component { {this.search} -
+ {LinkDescriptionPopup.descriptionPopup ? : null} {DocumentLinksButton.EditLink ? : (null)} {LinkDocPreview.LinkInfo ? string; + backgroundColor: (doc: Doc, renderDepth: number) => string; addDocTab: (document: Doc, where: string) => boolean; location: number[]; } -- cgit v1.2.3-70-g09d2 From e976cf57176b5ba8d758ccfd63d443c291781b4f Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 12 Aug 2020 10:41:02 -0400 Subject: changed iconifying (or setting templates on) readonly documents to work by setting the layout on the layout oducment --- src/fields/Doc.ts | 3 ++- src/fields/util.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index b535fea5a..00ffe399e 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -806,7 +806,8 @@ export namespace Doc { target[targetKey] = new PrefetchProxy(templateDoc); } else { titleTarget && (Doc.GetProto(target).title = titleTarget); - Doc.GetProto(target)[targetKey] = new PrefetchProxy(templateDoc); + const setDoc = [AclAdmin, AclEdit].includes(GetEffectiveAcl(Doc.GetProto(target))) ? Doc.GetProto(target) : target; + setDoc[targetKey] = new PrefetchProxy(templateDoc); } } return target; diff --git a/src/fields/util.ts b/src/fields/util.ts index 4c71572db..4edaea264 100644 --- a/src/fields/util.ts +++ b/src/fields/util.ts @@ -162,7 +162,7 @@ export function GetEffectiveAcl(target: any, in_prop?: string | symbol | number) // if the current user is the author of the document / the current user is a member of the admin group // but not if the doc in question is an alias - the current user will be the author of their alias rather than the original author - if ((Doc.CurrentUserEmail === (target.__fields?.author || target.author) && !(target.aliasOf || target.__fields?.aliasOf)) || currentUserGroups.includes("admin")) return AclAdmin; + if (Doc.CurrentUserEmail === (target.__fields?.author || target.author) || currentUserGroups.includes("admin")) return AclAdmin; // if the ACL is being overriden or the property being modified is one of the playground fields (which can be freely modified) if (_overrideAcl || (in_prop && DocServer.PlaygroundFields?.includes(in_prop.toString()))) return AclEdit; -- cgit v1.2.3-70-g09d2