From d075dbb4b1d2289a47e929c1e7378f341c2a9c35 Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Thu, 11 Jun 2020 15:12:24 -0500 Subject: initial commit --- src/client/documents/Documents.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/client/documents') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 8d867348f..37858bbd9 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -21,7 +21,7 @@ import { YoutubeBox } from "../apis/youtube/YoutubeBox"; import { CollectionDockingView } from "../views/collections/CollectionDockingView"; import { LinkManager } from "../util/LinkManager"; import { DocumentManager } from "../util/DocumentManager"; -import DirectoryImportBox from "../util/Import & Export/DirectoryImportBox"; +import { DirectoryImportBox } from "../util/Import & Export/DirectoryImportBox"; import { Scripting } from "../util/Scripting"; import { LabelBox } from "../views/nodes/LabelBox"; import { SliderBox } from "../views/nodes/SliderBox"; -- cgit v1.2.3-70-g09d2 From 51a09fd7abdc44902587b2b610bf728908e288e7 Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Sun, 14 Jun 2020 16:41:31 -0500 Subject: inline images (need resizing) --- src/client/documents/Documents.ts | 2 +- .../views/collections/CollectionSchemaCells.tsx | 91 ++++++++++++---------- 2 files changed, 51 insertions(+), 42 deletions(-) (limited to 'src/client/documents') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 37858bbd9..865fc296b 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -385,7 +385,7 @@ export namespace Docs { // synthesize the default options, the type and title from computed values and // whatever options pertain to this specific prototype const options = { title, type, baseProto: true, ...defaultOptions, ...(template.options || {}) }; - options.layout = layout.view.LayoutString(layout.dataField); + options.layout = layout.view?.LayoutString(layout.dataField); const doc = Doc.assign(new Doc(prototypeId, true), { layoutKey: "layout", ...options }); doc.layout_keyValue = KeyValueBox.LayoutString(""); return doc; diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx index 4f2bfac08..8164e37e3 100644 --- a/src/client/views/collections/CollectionSchemaCells.tsx +++ b/src/client/views/collections/CollectionSchemaCells.tsx @@ -319,49 +319,58 @@ export class CollectionSchemaDocCell extends CollectionSchemaCell { @observer export class CollectionSchemaImageCell extends CollectionSchemaCell { - render() { - return this.renderCellWithType("image"); - } // render() { - // const props: FieldViewProps = { - // Document: this.props.rowProps.original, - // DataDoc: this.props.rowProps.original, - // LibraryPath: [], - // dropAction: "alias", - // bringToFront: emptyFunction, - // rootSelected: returnFalse, - // fieldKey: this.props.rowProps.column.id as string, - // ContainingCollectionView: this.props.CollectionView, - // ContainingCollectionDoc: this.props.CollectionView && this.props.CollectionView.props.Document, - // isSelected: returnFalse, - // select: emptyFunction, - // renderDepth: this.props.renderDepth + 1, - // ScreenToLocalTransform: Transform.Identity, - // focus: emptyFunction, - // active: returnFalse, - // whenActiveChanged: emptyFunction, - // PanelHeight: returnZero, - // PanelWidth: returnZero, - // NativeHeight: returnZero, - // NativeWidth: returnZero, - // addDocTab: this.props.addDocTab, - // pinToPres: this.props.pinToPres, - // ContentScaling: returnOne - // }; - - // if (props.fieldKey === "data") { - // const reference = React.createRef(); - // return ( - //
- //
- // {props.DataDoc?.data} - //
- //
- // ); - // } else { - // return this.renderCellWithType("image"); - // } + // return this.renderCellWithType("image"); // } + render() { + const props: FieldViewProps = { + Document: this.props.rowProps.original, + DataDoc: this.props.rowProps.original, + LibraryPath: [], + dropAction: "alias", + bringToFront: emptyFunction, + rootSelected: returnFalse, + fieldKey: this.props.rowProps.column.id as string, + ContainingCollectionView: this.props.CollectionView, + ContainingCollectionDoc: this.props.CollectionView && this.props.CollectionView.props.Document, + isSelected: returnFalse, + select: emptyFunction, + renderDepth: this.props.renderDepth + 1, + ScreenToLocalTransform: Transform.Identity, + focus: emptyFunction, + active: returnFalse, + whenActiveChanged: emptyFunction, + PanelHeight: returnZero, + PanelWidth: returnZero, + NativeHeight: returnZero, + NativeWidth: returnZero, + addDocTab: this.props.addDocTab, + pinToPres: this.props.pinToPres, + ContentScaling: returnOne + }; + + const data = Cast(props.DataDoc?.data, ImageField); + const url = data ? data.url.href : undefined; + console.log(url); + + + if (props.fieldKey === "data") { + if (url) { + const reference = React.createRef(); + return ( +
+
+ +
+
+ ); + } else { + return this.renderCellWithType("image"); + } + } else { + return this.renderCellWithType("image"); + } + } } @observer -- cgit v1.2.3-70-g09d2 From 3edb09b219ac4af949c31dace64c4dfa9dc15858 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Tue, 30 Jun 2020 19:23:23 -0400 Subject: fixed ':' freeform menu to restore non text entries. aded onClick and dragFactories for more btns. --- src/client/documents/Documents.ts | 2 +- src/client/util/CurrentUserUtils.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src/client/documents') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 3d4694bc5..4c27cf47d 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -977,7 +977,7 @@ export namespace DocUtils { }); ContextMenu.Instance.addItem({ description: "Add Template Doc ...", - subitems: DocListCast(Cast(Doc.UserDoc().dockedBtns, Doc, null)?.data).map(btnDoc => Cast(btnDoc?.dragFactory, Doc, null)).filter(doc => doc).map((dragDoc, i) => ({ + subitems: DocListCast(Cast(Doc.UserDoc().myItemCreators, Doc, null)?.data).map(btnDoc => Cast(btnDoc?.dragFactory, Doc, null)).filter(doc => doc).map((dragDoc, i) => ({ description: ":" + StrCast(dragDoc.title), event: (args: { x: number, y: number }) => { const newDoc = Doc.ApplyTemplate(dragDoc); diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts index 09e4d2bb1..ef216001c 100644 --- a/src/client/util/CurrentUserUtils.ts +++ b/src/client/util/CurrentUserUtils.ts @@ -364,16 +364,22 @@ export class CurrentUserUtils { doc.emptyCollection = Docs.Create.FreeformDocument([], { _nativeWidth: undefined, _nativeHeight: undefined, _width: 150, _height: 100, title: "freeform" }); } + if (doc.emptyComparison === undefined) { + doc.emptyComparison = Docs.Create.ComparisonDocument({ title: "compare", _width: 300, _height: 300 }); + } + if (doc.emptyScript === undefined) { + doc.emptyScript = Docs.Create.ScriptingDocument(undefined, { _width: 200, _height: 250, title: "script" }) + } if (doc.emptyDocHolder === undefined) { doc.emptyDocHolder = Docs.Create.DocumentDocument( ComputedField.MakeFunction("selectedDocs(this,this.excludeCollections,[_last_])?.[0]") as any, { _width: 250, _height: 250, title: "container" }); } if (doc.emptyWebpage === undefined) { - doc.emptyWebpage = Docs.Create.WebDocument("", { title: "New Webpage", _nativeWidth: 850, _nativeHeight: 962, _width: 600, UseCors: true }); + doc.emptyWebpage = Docs.Create.WebDocument("", { title: "webpage", _nativeWidth: 850, _nativeHeight: 962, _width: 600, UseCors: true }); } return [ - { title: "Drag a comparison box", label: "Comp", icon: "columns", ignoreClick: true, drag: 'Docs.Create.ComparisonDocument()' }, + { title: "Drag a comparison box", label: "Comp", icon: "columns", click: 'openOnRight(getCopy(this.dragFactory, true))', drag: 'getCopy(this.dragFactory, true)', dragFactory: doc.emptyComparison as Doc }, { title: "Drag a collection", label: "Col", icon: "folder", click: 'openOnRight(getCopy(this.dragFactory, true))', drag: 'getCopy(this.dragFactory, true)', dragFactory: doc.emptyCollection as Doc }, { title: "Drag a web page", label: "Web", icon: "globe-asia", click: 'openOnRight(getCopy(this.dragFactory, true))', drag: 'getCopy(this.dragFactory, true)', dragFactory: doc.emptyWebpage as Doc }, { title: "Drag a cat image", label: "Img", icon: "cat", ignoreClick: true, drag: 'Docs.Create.ImageDocument("https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg", { _width: 250, _nativeWidth:250, title: "an image of a cat" })' }, @@ -383,7 +389,7 @@ export class CurrentUserUtils { { title: "Drag a clickable button", label: "Btn", icon: "bolt", ignoreClick: true, drag: 'Docs.Create.ButtonDocument({ _width: 150, _height: 50, _xPadding:10, _yPadding: 10, title: "Button" })' }, { title: "Drag a presentation view", label: "Prezi", icon: "tv", click: 'openOnRight(Doc.UserDoc().activePresentation = getCopy(this.dragFactory, true))', drag: `Doc.UserDoc().activePresentation = getCopy(this.dragFactory,true)`, dragFactory: doc.emptyPresentation as Doc }, { title: "Drag a search box", label: "Query", icon: "search", ignoreClick: true, drag: 'Docs.Create.QueryDocument({ _width: 200, title: "an image of a cat" })' }, - { title: "Drag a scripting box", label: "Script", icon: "terminal", ignoreClick: true, drag: 'Docs.Create.ScriptingDocument(undefined, { _width: 200, _height: 250 title: "untitled script" })' }, + { title: "Drag a scripting box", label: "Script", icon: "terminal", click: 'openOnRight(getCopy(this.dragFactory, true))', drag: 'getCopy(this.dragFactory, true)', dragFactory: doc.emptyScript as Doc }, { title: "Drag an import folder", label: "Load", icon: "cloud-upload-alt", ignoreClick: true, drag: 'Docs.Create.DirectoryImportDocument({ title: "Directory Import", _width: 400, _height: 400 })' }, { title: "Drag a mobile view", label: "Phone", icon: "phone", ignoreClick: true, drag: 'Doc.UserDoc().activeMobile' }, { title: "Drag an instance of the device collection", label: "Buxton", icon: "globe-asia", ignoreClick: true, drag: 'Docs.Create.Buxton()' }, -- cgit v1.2.3-70-g09d2