diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2019-03-21 21:03:00 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2019-03-21 21:03:00 -0400 |
commit | 1cf618563838f4ce7d8a98c8a0c8d94670bc4e18 (patch) | |
tree | 442ddd083e2ca846109c0ad88f61a262d7d38947 | |
parent | 2e7d87e6deac8e69d839c852570849924b59fb1b (diff) |
changes to allow tabs to be dragged into other documents
-rw-r--r-- | src/client/views/collections/CollectionDockingView.tsx | 17 | ||||
-rw-r--r-- | src/fields/Document.ts | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx index fd0810242..950df7261 100644 --- a/src/client/views/collections/CollectionDockingView.tsx +++ b/src/client/views/collections/CollectionDockingView.tsx @@ -17,6 +17,7 @@ import { COLLECTION_BORDER_WIDTH } from "./CollectionView"; import React = require("react"); import { SubCollectionViewProps } from "./CollectionViewBase"; import { ServerUtils } from "../../../server/ServerUtil"; +import { DragManager } from "../../util/DragManager"; @observer export class CollectionDockingView extends React.Component<SubCollectionViewProps> { @@ -190,6 +191,21 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp @action onPointerDown = (e: React.PointerEvent): void => { var className = (e.target as any).className; + if ((className == "lm_title" || className == "lm_tab lm_active") && e.ctrlKey) { + e.stopPropagation(); + e.preventDefault(); + let docid = (e.target as any).DashDocId; + let tab = (e.target as any).parentElement as HTMLElement; + Server.GetField(docid, action((f: Opt<Field>) => + DragManager.StartDocumentDrag(tab, new DragManager.DocumentDragData(f as Document), + { + handlers: { + dragComplete: action(() => { }), + }, + hideSource: true + })) + ); + } if (className == "lm_drag_handle" || className == "lm_close" || className == "lm_maximise" || className == "lm_minimise" || className == "lm_close_tab") { this._flush = true; } @@ -208,6 +224,7 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp this.stateChanged(); } tabCreated = (tab: any) => { + tab.titleElement[0].DashDocId = tab.contentItem.config.props.documentId; tab.closeElement.off('click') //unbind the current click handler .click(function () { tab.contentItem.remove(); diff --git a/src/fields/Document.ts b/src/fields/Document.ts index b6439364a..2403c670c 100644 --- a/src/fields/Document.ts +++ b/src/fields/Document.ts @@ -36,7 +36,7 @@ export class Document extends Field { @computed public get Title() { - return this.GetText(KeyStore.Title, "<untitled>"); + return this.GetText(KeyStore.Title, "-untitled-"); } @computed |