From 88b175395307e31ce713ff66c3e2ae9c62e1a369 Mon Sep 17 00:00:00 2001 From: Tyler Schicke Date: Sat, 16 Mar 2019 21:48:13 -0400 Subject: Everything but the actual template works --- src/client/documents/Documents.ts | 15 ++++++++++++++- .../views/collections/CollectionFreeFormView.tsx | 22 +--------------------- .../views/collections/CollectionViewBase.tsx | 8 ++++++-- src/client/views/nodes/DocumentView.tsx | 15 +++++++++++++++ 4 files changed, 36 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 983253347..7b6409a62 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -209,10 +209,23 @@ export namespace Documents { + FormattedTextBox.LayoutString("CaptionKey") + ` ` }; - export function FixedCaption(fieldName: string = "Caption") { + function FixedCaption(fieldName: string = "Caption") { return `
` + FormattedTextBox.LayoutString(fieldName + "Key") + `
` }; + + function Caption() { + return (` +
+
+ {layout} +
+
+ +
+
+ `) + } } \ No newline at end of file diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx index 79ea77c77..0a4b57ffb 100644 --- a/src/client/views/collections/CollectionFreeFormView.tsx +++ b/src/client/views/collections/CollectionFreeFormView.tsx @@ -209,27 +209,7 @@ export class CollectionFreeFormView extends CollectionViewBase { @action onDrop = (e: React.DragEvent): void => { var pt = this.getTransform().transformPoint(e.pageX, e.pageY); - - let text = e.dataTransfer.getData("text/plain"); - let start = text.startsWith("(KeyStore.Data, []); - console.log(children); - if (children) { - children.forEach(f => { - console.log(f.GetData(KeyStore.Layout, TextField, new String)); - }); - } - // let xx = this.props.Document.GetT(KeyStore.Thumbnail, ImageField) - // if (xx) { - // console.log(xx.toString()) - // } - this.props.Document.SetData(KeyStore.Layout, text, TextField); - e.stopPropagation(); - } - else { super.onDrop(e, { x: pt[0], y: pt[1] }); } + super.onDrop(e, { x: pt[0], y: pt[1] }); } onDragOver = (): void => { diff --git a/src/client/views/collections/CollectionViewBase.tsx b/src/client/views/collections/CollectionViewBase.tsx index dd05837d8..b0f42125a 100644 --- a/src/client/views/collections/CollectionViewBase.tsx +++ b/src/client/views/collections/CollectionViewBase.tsx @@ -68,13 +68,17 @@ export class CollectionViewBase extends React.Component @action protected onDrop(e: React.DragEvent, options: DocumentOptions): void { - e.stopPropagation() - e.preventDefault() let that = this; let html = e.dataTransfer.getData("text/html"); let text = e.dataTransfer.getData("text/plain"); + if (text && text.startsWith(" { e.stopPropagation(); } + onDrop = (e: React.DragEvent) => { + if (e.isDefaultPrevented()) { + return; + } + let text = e.dataTransfer.getData("text/plain"); + if (text && text.startsWith(" { e.stopPropagation(); @@ -315,6 +329,7 @@ export class DocumentView extends React.Component { transformOrigin: "left top", transform: `scale(${scaling} , ${scaling})` }} + onDrop={this.onDrop} onContextMenu={this.onContextMenu} onPointerDown={this.onPointerDown} > -- cgit v1.2.3-70-g09d2