aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields
diff options
context:
space:
mode:
authoranika-ahluwalia <anika.ahluwalia@gmail.com>2020-04-29 17:21:06 -0500
committeranika-ahluwalia <anika.ahluwalia@gmail.com>2020-04-29 17:21:06 -0500
commita3d0d5cb8d00eb6c360c95e0c5c03e37b218e49a (patch)
tree734f941feef0c87e2c15cb0c323334de29cafcaf /src/new_fields
parent7b8651a1a1f824e6c6a5135a4420766686f35175 (diff)
parentd66aaffc27405f4231a29cd6edda3477077ae946 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into script_documents
Diffstat (limited to 'src/new_fields')
-rw-r--r--src/new_fields/Doc.ts36
-rw-r--r--src/new_fields/RichTextUtils.ts12
-rw-r--r--src/new_fields/documentSchemas.ts5
3 files changed, 16 insertions, 37 deletions
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts
index 18ffc38f5..153af933a 100644
--- a/src/new_fields/Doc.ts
+++ b/src/new_fields/Doc.ts
@@ -254,6 +254,7 @@ export namespace Doc {
// return Cast(field, ctor);
// });
// }
+
export function RunCachedUpdate(doc: Doc, field: string) {
const update = doc[CachedUpdates][field];
if (update) {
@@ -976,7 +977,8 @@ export namespace Doc {
if (layoutKey && layoutKey !== "layout" && layoutKey !== "layout_icon") doc.deiconifyLayout = layoutKey.replace("layout_", "");
}
- export function pileup(newCollection: Doc, selected: Doc[]) {
+ export function pileup(selected: Doc[], x: number, y: number) {
+ const newCollection = Docs.Create.PileDocument(selected, { title: "pileup", x: x - 55, y: y - 55, _width: 110, _height: 100, _LODdisable: true });
let w = 0, h = 0;
selected.forEach((d, i) => {
Doc.iconify(d);
@@ -993,12 +995,10 @@ export namespace Doc {
newCollection.y = NumCast(newCollection.y) + NumCast(newCollection._height) / 2 - 55;
newCollection._width = newCollection._height = 110;
//newCollection.borderRounding = "40px";
- newCollection.jitterRotation = 10;
+ newCollection._jitterRotation = 10;
newCollection._backgroundColor = "gray";
-
- newCollection._layoutEngine = "pass";
newCollection.overflow = "visible";
- newCollection.onClick = ScriptField.MakeScript("toggleStarburst(self, this)", { self: Doc.name, this: Doc.name });
+ return newCollection;
}
@@ -1055,28 +1055,4 @@ Scripting.addGlobal(function selectedDocs(container: Doc, excludeCollections: bo
return docs.length ? new List(docs) : prevValue;
});
Scripting.addGlobal(function setDocFilter(container: Doc, key: string, value: any, modifiers?: "check" | "x" | undefined) { Doc.setDocFilter(container, key, value, modifiers); });
-Scripting.addGlobal(function setDocFilterRange(container: Doc, key: string, range: number[]) { Doc.setDocFilterRange(container, key, range); });
-Scripting.addGlobal(function toggleStarburst(self: Doc, tLayout: Doc) {
- if (self._layoutEngine === 'starburst') {
- const defaultSize = 110;
- tLayout.overflow = undefined;
- self.x = NumCast(self.x) + tLayout[WidthSym]() / 2 - NumCast(tLayout._starburstPileWidth, defaultSize) / 2;
- self.y = NumCast(self.y) + tLayout[HeightSym]() / 2 - NumCast(tLayout._starburstPileHeight, defaultSize) / 2;
- tLayout._width = NumCast(tLayout._starburstPileWidth, defaultSize);
- tLayout._height = NumCast(tLayout._starburstPileHeight, defaultSize);
- self._layoutEngine = 'pass';
- } else {
- const defaultSize = 25;
- tLayout.overflow = 'visible';
- !tLayout._starburstRadius && (tLayout._starburstRadius = 500);
- !tLayout._starburstDocScale && (tLayout._starburstDocScale = 2.5);
- if (self._layoutEngine === 'pass') {
- self.x = NumCast(self.x) + tLayout[WidthSym]() / 2 - defaultSize / 2;
- self.y = NumCast(self.y) + tLayout[HeightSym]() / 2 - defaultSize / 2;
- tLayout._starburstPileWidth = tLayout[WidthSym]();
- tLayout._starburstPileHeight = tLayout[HeightSym]();
- }
- tLayout._width = tLayout._height = defaultSize;
- self._layoutEngine = 'starburst';
- }
-}); \ No newline at end of file
+Scripting.addGlobal(function setDocFilterRange(container: Doc, key: string, range: number[]) { Doc.setDocFilterRange(container, key, range); }); \ No newline at end of file
diff --git a/src/new_fields/RichTextUtils.ts b/src/new_fields/RichTextUtils.ts
index 635fd053d..c475d0d73 100644
--- a/src/new_fields/RichTextUtils.ts
+++ b/src/new_fields/RichTextUtils.ts
@@ -2,20 +2,20 @@ import { AssertionError } from "assert";
import { docs_v1 } from "googleapis";
import { Fragment, Mark, Node } from "prosemirror-model";
import { sinkListItem } from "prosemirror-schema-list";
-import { EditorState, TextSelection, Transaction } from "prosemirror-state";
-import { GoogleApiClientUtils } from "../client/apis/google_docs/GoogleApiClientUtils";
+import { Utils } from "../Utils";
+import { Docs } from "../client/documents/Documents";
+import { schema } from "../client/views/nodes/formattedText/schema_rts";
import { GooglePhotos } from "../client/apis/google_docs/GooglePhotosClientUtils";
import { DocServer } from "../client/DocServer";
-import { Docs } from "../client/documents/Documents";
import { Networking } from "../client/Network";
-import { schema } from "../client/util/RichTextSchema";
-import { FormattedTextBox } from "../client/views/nodes/FormattedTextBox";
-import { Utils } from "../Utils";
+import { FormattedTextBox } from "../client/views/nodes/formattedText/FormattedTextBox";
import { Doc, Opt } from "./Doc";
import { Id } from "./FieldSymbols";
import { RichTextField } from "./RichTextField";
import { Cast, StrCast } from "./Types";
import Color = require('color');
+import { EditorState, TextSelection, Transaction } from "prosemirror-state";
+import { GoogleApiClientUtils } from "../client/apis/google_docs/GoogleApiClientUtils";
export namespace RichTextUtils {
diff --git a/src/new_fields/documentSchemas.ts b/src/new_fields/documentSchemas.ts
index 61b185e5c..7a0be8863 100644
--- a/src/new_fields/documentSchemas.ts
+++ b/src/new_fields/documentSchemas.ts
@@ -8,7 +8,8 @@ export const documentSchema = createSchema({
layout: "string", // this is the native layout string for the document. templates can be added using other fields and setting layoutKey below
layoutKey: "string", // holds the field key for the field that actually holds the current lyoat
title: "string", // document title (can be on either data document or layout)
- dropAction: "string", // override specifying what should happen when this document is dropped (can be "alias" or "copy")
+ dropAction: "string", // override specifying what should happen when this document is dropped (can be "alias", "copy", "move")
+ targetDropAction: "string", // allows the target of a drop event to specify the dropAction ("alias", "copy", "move")
childDropAction: "string", // specify the override for what should happen when the child of a collection is dragged from it and dropped (can be "alias" or "copy")
_autoHeight: "boolean", // whether the height of the document should be computed automatically based on its contents
_nativeWidth: "number", // native width of document which determines how much document contents are scaled when the document's width is set
@@ -29,6 +30,8 @@ export const documentSchema = createSchema({
_replacedChrome: "string", // what the default chrome is replaced with. Currently only supports the value of 'replaced' for PresBox's.
_chromeStatus: "string", // determines the state of the collection chrome. values allowed are 'replaced', 'enabled', 'disabled', 'collapsed'
_freezeChildDimensions: "boolean", // freezes child document dimensions (e.g., used by time/pivot view to make sure all children will be scaled to fit their display rectangle)
+ _fontSize: "number",
+ _fontFamily: "string",
isInPlaceContainer: "boolean",// whether the marked object will display addDocTab() calls that target "inPlace" destinations
color: "string", // foreground color of document
backgroundColor: "string", // background color of document