aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocumentDecorations.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/DocumentDecorations.tsx')
-rw-r--r--src/client/views/DocumentDecorations.tsx149
1 files changed, 66 insertions, 83 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index a6b2db8f3..74cf58c7b 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -6,12 +6,13 @@ import { action, computed, observable, reaction } from 'mobx';
import { observer } from 'mobx-react';
import { FaUndo } from 'react-icons/fa';
import { DateField } from '../../fields/DateField';
-import { AclAdmin, AclAugment, AclEdit, Doc, DocListCast, Field, HeightSym, WidthSym } from '../../fields/Doc';
+import { AclAdmin, AclEdit, DataSym, Doc, DocListCast, Field, HeightSym, WidthSym } from '../../fields/Doc';
+import { Document } from '../../fields/documentSchemas';
import { InkField } from '../../fields/InkField';
import { RichTextField } from '../../fields/RichTextField';
import { ScriptField } from '../../fields/ScriptField';
import { Cast, NumCast, StrCast } from '../../fields/Types';
-import { GetEffectiveAcl, normalizeEmail } from '../../fields/util';
+import { GetEffectiveAcl } from '../../fields/util';
import { aggregateBounds, emptyFunction, numberValue, returnFalse, setupMoveUpEvents, Utils } from '../../Utils';
import { Docs } from '../documents/Documents';
import { DocumentType } from '../documents/DocumentTypes';
@@ -20,7 +21,7 @@ import { DragManager } from '../util/DragManager';
import { LinkFollower } from '../util/LinkFollower';
import { SelectionManager } from '../util/SelectionManager';
import { SnappingManager } from '../util/SnappingManager';
-import { undoBatch, UndoManager } from '../util/UndoManager';
+import { UndoManager } from '../util/UndoManager';
import { CollectionDockingView } from './collections/CollectionDockingView';
import { CollectionFreeFormView } from './collections/collectionFreeForm';
import { DocumentButtonBar } from './DocumentButtonBar';
@@ -34,7 +35,8 @@ import { FormattedTextBox } from './nodes/formattedText/FormattedTextBox';
import { ImageBox } from './nodes/ImageBox';
import React = require('react');
import _ = require('lodash');
-import { SettingsManager } from '../util/SettingsManager';
+import { DocumentManager } from '../util/DocumentManager';
+import { isUndefined } from 'lodash';
@observer
export class DocumentDecorations extends React.Component<{ PanelWidth: number; PanelHeight: number; boundsLeft: number; boundsTop: number }, { value: string }> {
@@ -120,7 +122,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
titleFieldKey &&
SelectionManager.Views().forEach(d => {
if (titleFieldKey === 'title') {
- d.dataDoc['title-custom'] = !this._accumulatedTitle.startsWith('-');
+ d.dataDoc.title_custom = !this._accumulatedTitle.startsWith('-');
if (StrCast(d.rootDoc.title).startsWith('@') && !this._accumulatedTitle.startsWith('@')) {
Doc.RemoveDocFromList(Doc.MyPublishedDocs, undefined, d.rootDoc);
}
@@ -137,19 +139,19 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
if (curKey !== title) {
if (title) {
if (d.dataDoc[title] === undefined || d.dataDoc[title] instanceof RichTextField || typeof d.dataDoc[title] === 'string') {
- d.rootDoc.layoutKey = `layout_${title}`;
+ d.rootDoc.layout_fieldKey = `layout_${title}`;
d.rootDoc[`layout_${title}`] = FormattedTextBox.LayoutString(title);
- d.rootDoc[`${title}-nativeWidth`] = d.rootDoc[`${title}-nativeHeight`] = 0;
+ d.rootDoc[`${title}_nativeWidth`] = d.rootDoc[`${title}_nativeHeight`] = 0;
}
} else {
- d.rootDoc.layoutKey = undefined;
+ d.rootDoc.layout_fieldKey = undefined;
}
}
} else {
Doc.SetInPlace(d.rootDoc, titleFieldKey, titleField, true);
}
}),
- 'title blur'
+ 'edit title'
);
}
};
@@ -198,7 +200,9 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
@action
onBackgroundMove = (dragTitle: boolean, e: PointerEvent): boolean => {
const dragDocView = SelectionManager.Views()[0];
- if (DocListCast(Doc.MyOverlayDocs.data).includes(dragDocView.rootDoc)) return false;
+ const containers = new Set<Doc | undefined>();
+ SelectionManager.Views().forEach(v => containers.add(DocCast(v.rootDoc.embedContainer)));
+ if (containers.size > 1) return false;
const { left, top } = dragDocView.getBounds() || { left: 0, top: 0 };
const dragData = new DragManager.DocumentDragData(
SelectionManager.Views().map(dv => dv.props.Document),
@@ -234,11 +238,6 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
.filter(v => v && v.props.renderDepth > 0);
if (forceDeleteOrIconify === false && this._iconifyBatch) return;
this._deleteAfterIconify = forceDeleteOrIconify || this._iconifyBatch ? true : false;
- if (!this._iconifyBatch) {
- this._iconifyBatch = UndoManager.StartBatch('iconifying');
- } else {
- forceDeleteOrIconify = false; // can't force immediate close in the middle of iconifying -- have to wait until iconifying completes
- }
var iconifyingCount = views.length;
const finished = action((force?: boolean) => {
if ((force || --iconifyingCount === 0) && this._iconifyBatch) {
@@ -257,6 +256,12 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
this._iconifyBatch = undefined;
}
});
+ if (!this._iconifyBatch) {
+ this._iconifyBatch = UndoManager.StartBatch(forceDeleteOrIconify ? 'delete selected docs' : 'iconifying');
+ } else {
+ forceDeleteOrIconify = false; // can't force immediate close in the middle of iconifying -- have to wait until iconifying completes
+ }
+
if (forceDeleteOrIconify) finished(forceDeleteOrIconify);
else if (!this._deleteAfterIconify) views.forEach(dv => dv.iconify(finished));
};
@@ -279,28 +284,28 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
const selectedDocs = SelectionManager.Views();
if (selectedDocs.length) {
if (e.ctrlKey) {
- // open an alias in a new tab with Ctrl Key
- CollectionDockingView.AddSplit(Doc.BestAlias(selectedDocs[0].props.Document), OpenWhereMod.right);
+ // open an embedding in a new tab with Ctrl Key
+ CollectionDockingView.AddSplit(Doc.BestEmbedding(selectedDocs[0].rootDoc), OpenWhereMod.right);
} else if (e.shiftKey) {
// open centered in a new workspace with Shift Key
- const alias = Doc.MakeAlias(selectedDocs[0].props.Document);
- alias.context = undefined;
- alias.x = -alias[WidthSym]() / 2;
- alias.y = -alias[HeightSym]() / 2;
- CollectionDockingView.AddSplit(Docs.Create.FreeformDocument([alias], { title: 'Tab for ' + alias.title }), OpenWhereMod.right);
+ const embedding = Doc.MakeEmbedding(selectedDocs[0].rootDoc);
+ embedding.embedContainer = undefined;
+ embedding.x = -embedding[Width]() / 2;
+ embedding.y = -embedding[Height]() / 2;
+ CollectionDockingView.AddSplit(Docs.Create.FreeformDocument([embedding], { title: 'Tab for ' + embedding.title }), OpenWhereMod.right);
} else if (e.altKey) {
// open same document in new tab
- CollectionDockingView.ToggleSplit(selectedDocs[0].props.Document, OpenWhereMod.right);
+ CollectionDockingView.ToggleSplit(selectedDocs[0].rootDoc, OpenWhereMod.right);
} else {
- var openDoc = selectedDocs[0].props.Document;
- if (openDoc.layoutKey === 'layout_icon') {
- openDoc = DocListCast(openDoc.aliases).find(alias => !alias.context) ?? Doc.MakeAlias(openDoc);
+ var openDoc = selectedDocs[0].rootDoc;
+ if (openDoc.layout_fieldKey === 'layout_icon') {
+ openDoc = DocListCast(openDoc.proto_embeddings).find(embedding => !embedding.embedContainer) ?? Doc.MakeEmbedding(openDoc);
Doc.deiconifyView(openDoc);
}
LightboxView.SetLightboxDoc(
openDoc,
undefined,
- selectedDocs.slice(1).map(view => view.props.Document)
+ selectedDocs.slice(1).map(view => view.rootDoc)
);
}
}
@@ -337,7 +342,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
const docMax = Math.min(NumCast(doc.width) / 2, NumCast(doc.height) / 2);
const ratio = dist / maxDist;
const radius = Math.min(1, ratio) * docMax;
- doc.borderRounding = `${radius}px`;
+ doc.layout_borderRounding = `${radius}px`;
});
return false;
}, // moveEvent
@@ -375,8 +380,8 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
const newloccentern = seldocview.props.ScreenToLocalTransform().transformPoint(rotCenter[0], rotCenter[1]);
const newlocenter = [newloccentern[0] - NumCast(seldocview.layoutDoc._width) / 2, newloccentern[1] - NumCast(seldocview.layoutDoc._height) / 2];
const final = Utils.rotPt(newlocenter[0], newlocenter[1], -(NumCast(seldocview.rootDoc._rotation) / 180) * Math.PI);
- seldocview.rootDoc.rotateCenterX = final.x / NumCast(seldocview.layoutDoc._width);
- seldocview.rootDoc.rotateCenterY = final.y / NumCast(seldocview.layoutDoc._height);
+ seldocview.rootDoc.rotation_centerX = final.x / NumCast(seldocview.layoutDoc._width);
+ seldocview.rootDoc.rotation_centerY = final.y / NumCast(seldocview.layoutDoc._height);
};
@action
@@ -393,8 +398,8 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
action(action(() => (this._isRotating = false))), // upEvent
action((e, doubleTap) => {
if (doubleTap) {
- seldocview.rootDoc.rotateCenterX = 0.5;
- seldocview.rootDoc.rotateCenterY = 0.5;
+ seldocview.rootDoc.rotation_centerX = 0.5;
+ seldocview.rootDoc.rotation_centerY = 0.5;
}
})
);
@@ -404,7 +409,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
onRotateDown = (e: React.PointerEvent): void => {
this._isRotating = true;
const rcScreen = { X: this.rotCenter[0], Y: this.rotCenter[1] };
- const rotateUndo = UndoManager.StartBatch('rotatedown');
+ const rotateUndo = UndoManager.StartBatch('drag rotation');
const selectedInk = SelectionManager.Views().filter(i => i.ComponentView instanceof InkingStroke);
const centerPoint = this.rotCenter.slice();
const infos = new Map<Doc, { unrotatedDocPos: { x: number; y: number }; startRotCtr: { x: number; y: number }; accumRot: number }>();
@@ -472,7 +477,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
const bounds = e.currentTarget.getBoundingClientRect();
this._offX = this._resizeHdlId.toLowerCase().includes('left') ? bounds.right - e.clientX : bounds.left - e.clientX;
this._offY = this._resizeHdlId.toLowerCase().includes('top') ? bounds.bottom - e.clientY : bounds.top - e.clientY;
- this._resizeUndo = UndoManager.StartBatch('DocDecs resize');
+ this._resizeUndo = UndoManager.StartBatch('drag resizing');
this._snapX = e.pageX;
this._snapY = e.pageY;
const ffviewSet = new Set<CollectionFreeFormView>();
@@ -595,7 +600,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
let dW = docwidth * (dWin / refWidth);
let dH = docheight * (dHin / refHeight);
const scale = docView.props.ScreenToLocalTransform().Scale;
- const modifyNativeDim = (e.ctrlKey || doc.forceReflow) && doc.nativeDimModifiable && ((!dragBottom && !dragTop) || e.ctrlKey || doc.nativeHeightUnfrozen);
+ const modifyNativeDim = (e.ctrlKey && doc.nativeDimModifiable) || (doc.layout_forceReflow && !dragBottom && !dragTop) || (doc.nativeHeightUnfrozen && (dragBottom || dragTop || e.ctrlKey));
if (nwidth && nheight) {
if (nwidth / nheight !== docwidth / docheight && !dragBottom && !dragTop) {
docheight = (nheight / nwidth) * docwidth;
@@ -611,7 +616,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
let dX = !dWin ? 0 : scale * refCent[0] * (1 - (1 + dWin / refWidth));
let dY = !dHin ? 0 : scale * refCent[1] * (1 - (1 + dHin / refHeight));
const preserveNativeDim = doc._nativeHeightUnfrozen === false && doc._nativeDimModifiable === false;
- const fixedAspect = nwidth && nheight && (!doc._fitWidth || preserveNativeDim || e.ctrlKey || doc.nativeHeightUnfrozen || doc.nativeDimModifiable);
+ const fixedAspect = nwidth && nheight && (!doc._layout_fitWidth || preserveNativeDim || e.ctrlKey || doc.nativeHeightUnfrozen || doc.nativeDimModifiable);
if (fixedAspect) {
if ((Math.abs(dW) > Math.abs(dH) && ((!dragBottom && !dragTop) || !modifyNativeDim)) || dragRight) {
if (dragRight && modifyNativeDim) {
@@ -619,7 +624,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
doc._nativeWidth = (actualdW / (docwidth || 1)) * Doc.NativeWidth(doc);
}
} else {
- if (!doc._fitWidth || preserveNativeDim) {
+ if (!doc._layout_fitWidth || preserveNativeDim) {
actualdH = (nheight / nwidth) * actualdW;
doc._height = actualdH;
} else if (!modifyNativeDim || dragBotRight) {
@@ -628,14 +633,14 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
}
doc._width = actualdW;
} else {
- if ((dragBottom || dragTop) && (modifyNativeDim || (docView.layoutDoc.nativeHeightUnfrozen && docView.layoutDoc._fitWidth))) {
+ if ((dragBottom || dragTop) && (modifyNativeDim || (docView.layoutDoc.nativeHeightUnfrozen && docView.layoutDoc._layout_fitWidth))) {
// frozen web pages, PDFs, and some RTFS have frozen nativewidth/height. But they are marked to allow their nativeHeight
// to be explicitly modified with fitWidth and vertical resizing. (ie, with fitWidth they can't grow horizontally to match
// a vertical resize so it makes more sense to change their nativeheight even if the ctrl key isn't used)
doc._nativeHeight = (actualdH / (docheight || 1)) * Doc.NativeHeight(doc);
- doc._autoHeight = false;
+ doc._layout_autoHeight = false;
} else {
- if (!doc._fitWidth || preserveNativeDim) {
+ if (!doc._layout_fitWidth || preserveNativeDim) {
actualdW = (nwidth / nheight) * actualdH;
doc._width = actualdW;
} else if (!modifyNativeDim || dragBotRight) {
@@ -643,17 +648,18 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
}
}
if (!modifyNativeDim) {
- actualdH = Math.min((nheight / nwidth) * docwidth, actualdH);
+ actualdH = (nheight / nwidth) * docwidth; //, actualdH);
}
doc._height = actualdH;
}
} else {
const rotCtr = [docwidth / 2, docheight / 2];
const tlRotated = Utils.rotPt(-rotCtr[0], -rotCtr[1], (NumCast(doc._rotation) / 180) * Math.PI);
+
const maxHeight = doc.nativeHeightUnfrozen || !nheight ? 0 : Math.max(nheight, NumCast(doc.scrollHeight, NumCast(doc[docView.LayoutFieldKey + '-scrollHeight']))) * docView.NativeDimScaling();
dH && (doc._height = actualdH > maxHeight && maxHeight ? maxHeight : actualdH);
dW && (doc._width = actualdW);
- dH && (doc._autoHeight = false);
+ dH && (doc._layout_autoHeight = false);
const rotCtr2 = [NumCast(doc._width) / 2, NumCast(doc._height) / 2];
const tlRotated2 = Utils.rotPt(-rotCtr2[0], -rotCtr2[1], (NumCast(doc._rotation) / 180) * Math.PI);
@@ -662,7 +668,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
}
doc.x = NumCast(doc.x) + dX;
doc.y = NumCast(doc.y) + dY;
- doc._lastModified = new DateField();
+ doc._layout_modificationDate = new DateField();
}
const val = this._dragHeights.get(docView.layoutDoc);
if (val) this._dragHeights.set(docView.layoutDoc, { start: val.start, lowest: Math.min(val.lowest, NumCast(docView.layoutDoc._height)) });
@@ -678,11 +684,11 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
this._resizeUndo?.end();
SnappingManager.clearSnapLines();
- // detect autoHeight gesture and apply
+ // detect layout_autoHeight gesture and apply
SelectionManager.Views()
.map(docView => ({ doc: docView.layoutDoc, hgts: this._dragHeights.get(docView.layoutDoc) }))
.filter(pair => pair.hgts && pair.hgts.lowest < pair.hgts.start && pair.hgts.lowest <= 20)
- .forEach(pair => (pair.doc._autoHeight = true));
+ .forEach(pair => (pair.doc._layout_autoHeight = true));
//need to change points for resize, or else rotation/control points will fail.
this._inkDragDocs
.map(oldbds => ({ oldbds, inkPts: Cast(oldbds.doc.data, InkField)?.inkData || [] }))
@@ -721,7 +727,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
}
@computed get hasIcons() {
- return SelectionManager.Views().some(docView => docView.rootDoc.layoutKey === 'layout_icon');
+ return SelectionManager.Views().some(docView => docView.rootDoc.layout_fieldKey === 'layout_icon');
}
@observable _showRotCenter = false;
@@ -730,8 +736,8 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
if (SelectionManager.Views().length) {
const seldocview = SelectionManager.Views()[0];
const loccenter = Utils.rotPt(
- NumCast(seldocview.rootDoc.rotateCenterX) * NumCast(seldocview.layoutDoc._width),
- NumCast(seldocview.rootDoc.rotateCenterY) * NumCast(seldocview.layoutDoc._height),
+ NumCast(seldocview.rootDoc.rotation_centerX) * NumCast(seldocview.layoutDoc._width),
+ NumCast(seldocview.rootDoc.rotation_centerY) * NumCast(seldocview.layoutDoc._height),
(NumCast(seldocview.rootDoc._rotation) / 180) * Math.PI
);
return seldocview.props
@@ -781,15 +787,15 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
// hide the decorations if the parent chooses to hide it or if the document itself hides it
const hideDecorations = seldocview.props.hideDecorations || seldocview.rootDoc.hideDecorations;
- const hideResizers = hideDecorations || seldocview.props.hideResizeHandles || seldocview.rootDoc.hideResizeHandles || this._isRounding || this._isRotating;
- const hideTitle = hideDecorations || seldocview.props.hideDecorationTitle || seldocview.rootDoc.hideDecorationTitle || this._isRounding || this._isRotating;
- const hideDocumentButtonBar = hideDecorations || seldocview.props.hideDocumentButtonBar || seldocview.rootDoc.hideDocumentButtonBar || this._isRounding || this._isRotating;
+ const hideResizers = hideDecorations || seldocview.props.hideResizeHandles || seldocview.rootDoc.layout_hideResizeHandles || this._isRounding || this._isRotating;
+ const hideTitle = hideDecorations || seldocview.props.hideDecorationTitle || seldocview.rootDoc.layout_hideDecorationTitle || this._isRounding || this._isRotating;
+ const hideDocumentButtonBar = hideDecorations || seldocview.props.hideDocumentButtonBar || seldocview.rootDoc.layout_hideDocumentButtonBar || this._isRounding || this._isRotating;
// if multiple documents have been opened at the same time, then don't show open button
const hideOpenButton =
hideDecorations ||
seldocview.props.hideOpenButton ||
- seldocview.rootDoc.hideOpenButton ||
- SelectionManager.Views().some(docView => docView.props.Document._stayInCollection || docView.props.Document.isGroup || docView.props.Document.hideOpenButton) ||
+ seldocview.rootDoc.layout_hideOpenButton ||
+ SelectionManager.Views().some(docView => docView.rootDoc._stayInCollection || docView.rootDoc.isGroup || docView.rootDoc.layout_hideOpenButton) ||
this._isRounding ||
this._isRotating;
const hideDeleteButton =
@@ -799,27 +805,12 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
seldocview.props.hideDeleteButton ||
seldocview.rootDoc.hideDeleteButton ||
SelectionManager.Views().some(docView => {
- // const collectionAcl = docView.props.docViewPath()?.lastElement() ? GetEffectiveAcl(docView.props.docViewPath().lastElement().rootDoc[DataSym]) : AclEdit;
- // return docView.rootDoc.stayInCollection || (collectionAcl !== AclAdmin && collectionAcl !== AclEdit && GetEffectiveAcl(docView.rootDoc) !== AclAdmin);
- const effectiveAcl = GetEffectiveAcl(Doc.GetProto(seldocview.rootDoc));
- return docView.rootDoc.stayInCollection || (effectiveAcl !== AclAdmin && GetEffectiveAcl(docView.rootDoc) !== AclAdmin && effectiveAcl !== AclEdit && GetEffectiveAcl(docView.rootDoc) !== AclEdit);
+ const collectionAcl = docView.props.docViewPath()?.lastElement() ? GetEffectiveAcl(docView.props.docViewPath().lastElement().rootDoc[DataSym]) : AclEdit;
+ return docView.rootDoc.stayInCollection || (collectionAcl !== AclAdmin && collectionAcl !== AclEdit && GetEffectiveAcl(docView.rootDoc) !== AclAdmin);
});
const topBtn = (key: string, icon: string, pointerDown: undefined | ((e: React.PointerEvent) => void), click: undefined | ((e: any) => void), title: string) => (
<Tooltip key={key} title={<div className="dash-tooltip">{title}</div>} placement="top">
- <div
- className={`documentDecorations-${key}Button`}
- onContextMenu={e => e.preventDefault()}
- onPointerDown={
- pointerDown ??
- (e =>
- setupMoveUpEvents(
- this,
- e,
- returnFalse,
- emptyFunction,
- undoBatch(e => click!(e))
- ))
- }>
+ <div className={`documentDecorations-${key}Button`} onContextMenu={e => e.preventDefault()} onPointerDown={pointerDown ?? (e => setupMoveUpEvents(this, e, returnFalse, emptyFunction, e => click!(e)))}>
<FontAwesomeIcon icon={icon as any} />
</div>
</Tooltip>
@@ -842,7 +833,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
const resizerScheme = colorScheme ? 'documentDecorations-resizer' + colorScheme : '';
// Radius constants
- const useRounding = seldocview.ComponentView instanceof ImageBox || seldocview.ComponentView instanceof FormattedTextBox;
+ const useRounding = seldocview.ComponentView instanceof ImageBox || seldocview.ComponentView instanceof FormattedTextBox || seldocview.ComponentView instanceof CollectionFreeFormView;
const borderRadius = numberValue(StrCast(seldocview.rootDoc.borderRounding));
const docMax = Math.min(NumCast(seldocview.rootDoc.width) / 2, NumCast(seldocview.rootDoc.height) / 2);
const maxDist = Math.min((this.Bounds.r - this.Bounds.x) / 2, (this.Bounds.b - this.Bounds.y) / 2);
@@ -905,18 +896,10 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
width: bounds.r - bounds.x + this._resizeBorderWidth + 'px',
height: bounds.b - bounds.y + this._resizeBorderWidth + this._titleHeight + 'px',
}}>
- <div className="documentDecorations-topbar" onPointerDown={this.onContainerDown}>
- {hideDeleteButton ? <div /> : topBtn('close', 'times', undefined, e => this.onCloseClick(true), 'Close')}
- {hideResizers || hideDeleteButton ? <div /> : topBtn('minimize', 'window-maximize', undefined, e => this.onCloseClick(undefined), 'Minimize')}
+ <div className="documentDecorations-topbar" style={{ display: hideDeleteButton && hideTitle && hideOpenButton ? 'none' : undefined }} onPointerDown={this.onContainerDown}>
+ {hideDeleteButton ? null : topBtn('close', 'times', undefined, e => this.onCloseClick(true), 'Close')}
+ {hideResizers || hideDeleteButton ? null : topBtn('minimize', 'window-maximize', undefined, e => this.onCloseClick(undefined), 'Minimize')}
{hideTitle ? null : titleArea}
- {sharingMenu}
- {hideOpenButton ? (
- <div />
- ) : seldocview.rootDoc._lockedPosition ? (
- topBtn('lock', 'lock', this.onLockDown, undefined, 'Toggle ability to interact with document')
- ) : (
- topBtn('lock', 'unlock', this.onLockDown, undefined, 'Toggle ability to interact with document')
- )}
{hideOpenButton ? <div /> : topBtn('open', 'external-link-alt', this.onMaximizeDown, undefined, 'Open in Lightbox (ctrl: as alias, shift: in new collection)')}
</div>
{hideResizers ? null : (