diff options
| author | andrewdkim <adkim414@gmail.com> | 2019-09-15 17:00:46 -0400 | 
|---|---|---|
| committer | andrewdkim <adkim414@gmail.com> | 2019-09-15 17:00:46 -0400 | 
| commit | 7dba132c37b0f4402e375d95c068a5fe31904a1f (patch) | |
| tree | cd4ab0558f6b599cf685f99e542f24d86328e0cc /src/client/views/collections/CollectionSubView.tsx | |
| parent | c7678db105f952e7562f1b573266fb295e13cf7b (diff) | |
| parent | 143d4669e764f6967d4d826b00b29912892ca637 (diff) | |
new changes + pull from master
Diffstat (limited to 'src/client/views/collections/CollectionSubView.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionSubView.tsx | 22 | 
1 files changed, 17 insertions, 5 deletions
| diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx index 7482f5665..e6fadd71e 100644 --- a/src/client/views/collections/CollectionSubView.tsx +++ b/src/client/views/collections/CollectionSubView.tsx @@ -11,11 +11,12 @@ import { CurrentUserUtils } from "../../../server/authentication/models/current_  import { RouteStore } from "../../../server/RouteStore";  import { Utils } from "../../../Utils";  import { DocServer } from "../../DocServer"; -import { Docs, DocumentOptions, DocumentType } from "../../documents/Documents"; +import { DocumentType } from "../../documents/DocumentTypes"; +import { Docs, DocumentOptions } from "../../documents/Documents";  import { DragManager } from "../../util/DragManager";  import { undoBatch, UndoManager } from "../../util/UndoManager";  import { FieldViewProps } from "../nodes/FieldView"; -import { FormattedTextBox } from "../nodes/FormattedTextBox"; +import { FormattedTextBox, GoogleRef } from "../nodes/FormattedTextBox";  import { CollectionPDFView } from "./CollectionPDFView";  import { CollectionVideoView } from "./CollectionVideoView";  import { CollectionView } from "./CollectionView"; @@ -33,6 +34,7 @@ export interface CollectionViewProps extends FieldViewProps {  export interface SubCollectionViewProps extends CollectionViewProps {      CollectionView: CollectionView | CollectionPDFView | CollectionVideoView; +    ruleProvider: Doc | undefined;  }  export function CollectionSubView<T>(schemaCtor: (doc: Doc) => T) {  @@ -82,7 +84,7 @@ export function CollectionSubView<T>(schemaCtor: (doc: Doc) => T) {              let ind;              let doc = this.props.Document;              let id = CurrentUserUtils.id; -            let email = CurrentUserUtils.email; +            let email = Doc.CurrentUserEmail;              let pos = { x: position[0], y: position[1] };              if (id && email) {                  const proto = Doc.GetProto(doc); @@ -112,7 +114,7 @@ export function CollectionSubView<T>(schemaCtor: (doc: Doc) => T) {          @undoBatch          @action          protected drop(e: Event, de: DragManager.DropEvent): boolean { -            if (de.data instanceof DragManager.DocumentDragData) { +            if (de.data instanceof DragManager.DocumentDragData && !de.data.applyAsTemplate) {                  if (de.mods === "AltKey" && de.data.draggedDocuments.length) {                      this.childDocs.map(doc =>                          Doc.ApplyTemplateTo(de.data.draggedDocuments[0], doc, undefined) @@ -212,7 +214,17 @@ export function CollectionSubView<T>(schemaCtor: (doc: Doc) => T) {                  this.props.addDocument(Docs.Create.VideoDocument(url, { ...options, title: url, width: 400, height: 315, nativeWidth: 600, nativeHeight: 472.5 }));                  return;              } - +            let matches: RegExpExecArray | null; +            if ((matches = /(https:\/\/)?docs\.google\.com\/document\/d\/([^\\]+)\/edit/g.exec(text)) !== null) { +                let newBox = Docs.Create.TextDocument({ ...options, width: 400, height: 200, title: "Awaiting title from Google Docs..." }); +                let proto = newBox.proto!; +                proto.autoHeight = true; +                proto[GoogleRef] = matches[2]; +                proto.data = "Please select this document and then click on its pull button to load its contents from from Google Docs..."; +                proto.backgroundColor = "#eeeeff"; +                this.props.addDocument(newBox); +                return; +            }              let batch = UndoManager.StartBatch("collection view drop");              let promises: Promise<void>[] = [];              // tslint:disable-next-line:prefer-for-of | 
