From f38d2de249ddf2cad533e2f92197738835688a73 Mon Sep 17 00:00:00 2001 From: bob Date: Fri, 10 May 2019 11:54:33 -0400 Subject: fixed dragging search results. --- src/client/views/SearchItem.tsx | 13 ++++++++++++- src/new_fields/Doc.ts | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/client/views/SearchItem.tsx b/src/client/views/SearchItem.tsx index d30579907..0da0bdae8 100644 --- a/src/client/views/SearchItem.tsx +++ b/src/client/views/SearchItem.tsx @@ -8,6 +8,7 @@ import { Cast } from "../../new_fields/Types"; import { FieldView, FieldViewProps } from './nodes/FieldView'; import { computed } from "mobx"; import { IconField } from "../../new_fields/IconField"; +import { SetupDrag } from "../util/DragManager"; export interface SearchProps { @@ -40,9 +41,19 @@ export class SearchItem extends React.Component { return ; } + collectionRef = React.createRef(); + startDocDrag = () => { + let doc = this.props.doc; + const isProto = Doc.GetT(doc, "isPrototype", "boolean", true); + if (isProto) { + return Doc.MakeDelegate(doc); + } else { + return Doc.MakeAlias(doc); + } + } render() { return ( -
+
title: {this.props.doc.title}
{/*
Type: {this.props.doc.layout}
*/} {/*
{SearchItem.DocumentIcon(this.layout)}
*/} diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts index f844dad6e..2ab145fa3 100644 --- a/src/new_fields/Doc.ts +++ b/src/new_fields/Doc.ts @@ -92,8 +92,8 @@ export class Doc extends RefField { private [Self] = this; private [SelfProxy]: any; - public [WidthSym] = () => NumCast(this.__fields.width); // bcz: is this the right way to access width/height? it didn't work with : this.width - public [HeightSym] = () => NumCast(this.__fields.height); + public [WidthSym] = () => NumCast(this[SelfProxy].width); // bcz: is this the right way to access width/height? it didn't work with : this.width + public [HeightSym] = () => NumCast(this[SelfProxy].height); public [HandleUpdate](diff: any) { console.log(diff); -- cgit v1.2.3-70-g09d2