aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/util/DragManager.ts3
-rw-r--r--src/client/views/DocumentButtonBar.tsx3
-rw-r--r--src/client/views/DocumentDecorations.tsx12
-rw-r--r--src/client/views/collections/CollectionMenu.tsx3
4 files changed, 14 insertions, 7 deletions
diff --git a/src/client/util/DragManager.ts b/src/client/util/DragManager.ts
index 0169b07fc..3a0f306f3 100644
--- a/src/client/util/DragManager.ts
+++ b/src/client/util/DragManager.ts
@@ -129,6 +129,7 @@ export namespace DragManager {
treeViewDoc?: Doc;
dontHideOnDrop?: boolean;
offset: number[];
+ canEmbed?: boolean;
userDropAction: dropActionType; // the user requested drop action -- this will be honored as specified by modifier keys
defaultDropAction?: dropActionType; // an optionally specified default drop action when there is no user drop actionl - this will be honored if there is no user drop action
dropAction: dropActionType; // a drop action request by the initiating code. the actual drop action may be different -- eg, if the request is 'alias', but the document is dropped within the same collection, the drop action will be switched to 'move'
@@ -324,7 +325,7 @@ export namespace DragManager {
if (dragData.dropAction === "none") return;
const batch = UndoManager.StartBatch("dragging");
eles = eles.filter(e => e);
- CanEmbed = false;
+ CanEmbed = dragData.canEmbed || false;
if (!dragDiv) {
dragDiv = document.createElement("div");
dragDiv.className = "dragManager-dragDiv";
diff --git a/src/client/views/DocumentButtonBar.tsx b/src/client/views/DocumentButtonBar.tsx
index bca3c6ce9..fff410267 100644
--- a/src/client/views/DocumentButtonBar.tsx
+++ b/src/client/views/DocumentButtonBar.tsx
@@ -283,6 +283,7 @@ export class DocumentButtonBar extends React.Component<{ views: () => (DocumentV
const dragData = new DragManager.DocumentDragData([dragDocView.props.Document]);
const [left, top] = dragDocView.props.ScreenToLocalTransform().inverse().transformPoint(0, 0);
dragData.defaultDropAction = "alias";
+ dragData.canEmbed = true;
DragManager.StartDocumentDrag([dragDocView.ContentDiv!], dragData, left, top, { hideSource: false });
return true;
}
@@ -299,7 +300,7 @@ export class DocumentButtonBar extends React.Component<{ views: () => (DocumentV
Array.from(["Caption", "Title", "TitleHover"]).map(template =>
templates.set(template, views.reduce((checked, doc) => checked || doc?.props.Document["_show" + template] ? true : false, false as boolean)));
return !view0 ? (null) :
- <Tooltip title={<div className="dash-tooltip">CustomizeLayout</div>} open={this._tooltipOpen} onClose={action(() => this._tooltipOpen = false)} placement="bottom">
+ <Tooltip title={<div className="dash-tooltip">Tap to Customize Layout. Drag an embeddable alias</div>} open={this._tooltipOpen} onClose={action(() => this._tooltipOpen = false)} placement="bottom">
<div className="documentButtonBar-linkFlyout" ref={this._dragRef}
onPointerEnter={action(() => !this._ref.current?.getBoundingClientRect().width && (this._tooltipOpen = true))} >
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 9432d1ffb..fa7220e7d 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -119,7 +119,7 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
}
}
@action onTitleDown = (e: React.PointerEvent): void => {
- setupMoveUpEvents(this, e, this.onBackgroundMove, (e) => { }, this.onTitleClick);
+ setupMoveUpEvents(this, e, e => this.onBackgroundMove(true, e), (e) => { }, this.onTitleClick);
}
@action onTitleClick = (e: PointerEvent): void => {
!this._edtingTitle && (this._accumulatedTitle = this._titleControlString.startsWith("#") ? this.selectionTitle : this._titleControlString);
@@ -128,22 +128,26 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
}
onBackgroundDown = (e: React.PointerEvent): void => {
- setupMoveUpEvents(this, e, this.onBackgroundMove, (e) => { }, (e) => { });
+ setupMoveUpEvents(this, e, e => this.onBackgroundMove(false, e), (e) => { }, (e) => { });
}
@action
- onBackgroundMove = (e: PointerEvent, down: number[]): boolean => {
+ onBackgroundMove = (dragTitle: boolean, e: PointerEvent): boolean => {
const dragDocView = SelectionManager.SelectedDocuments()[0];
const dragData = new DragManager.DocumentDragData(SelectionManager.SelectedDocuments().map(dv => dv.props.Document));
const [left, top] = dragDocView.props.ScreenToLocalTransform().scale(dragDocView.props.ContentScaling()).inverse().transformPoint(0, 0);
dragData.offset = dragDocView.props.ScreenToLocalTransform().scale(dragDocView.props.ContentScaling()).transformDirection(e.x - left, e.y - top);
dragData.moveDocument = dragDocView.props.moveDocument;
dragData.isSelectionMove = true;
+ dragData.canEmbed = dragTitle;
dragData.dropAction = dragDocView.props.dropAction;
this.Interacting = true;
this._hidden = true;
DragManager.StartDocumentDrag(SelectionManager.SelectedDocuments().map(dv => dv.ContentDiv!), dragData, e.x, e.y, {
- dragComplete: action(e => this._hidden = this.Interacting = false),
+ dragComplete: action(e => {
+ dragData.canEmbed && SelectionManager.DeselectAll();
+ this._hidden = this.Interacting = false;
+ }),
hideSource: true
});
return true;
diff --git a/src/client/views/collections/CollectionMenu.tsx b/src/client/views/collections/CollectionMenu.tsx
index 7464f7cd3..51d1d5559 100644
--- a/src/client/views/collections/CollectionMenu.tsx
+++ b/src/client/views/collections/CollectionMenu.tsx
@@ -442,6 +442,7 @@ export class CollectionViewBaseChrome extends React.Component<CollectionMenuProp
const dragData = new DragManager.DocumentDragData([this.selectedDocumentView!.props.Document]);
const offset = [e.clientX - contentDiv.getBoundingClientRect().x, e.clientY - contentDiv.getBoundingClientRect().y];
dragData.defaultDropAction = "alias";
+ dragData.canEmbed = true;
DragManager.StartDocumentDrag([contentDiv], dragData, e.clientX, e.clientY, {
offsetX: offset[0],
offsetY: offset[1],
@@ -456,7 +457,7 @@ export class CollectionViewBaseChrome extends React.Component<CollectionMenuProp
get aliasButton() {
const targetDoc = this.selectedDoc;
return !targetDoc ? (null) : <Tooltip title={<div className="dash-tooltip">{"Tap or Drag to create an alias"}</div>} placement="top">
- <button className="antimodeMenu-button" onPointerDown={this.onAliasButtonDown} onClick={this.onAlias} style={{ cursor: "copy" }}>
+ <button className="antimodeMenu-button" onPointerDown={this.onAliasButtonDown} onClick={this.onAlias} style={{ cursor: "drag" }}>
<FontAwesomeIcon className="documentdecorations-icon" icon="copy" size="lg" />
</button>
</Tooltip>;