aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/DropConverter.ts
diff options
context:
space:
mode:
authorusodhi <61431818+usodhi@users.noreply.github.com>2020-09-17 12:26:08 +0530
committerusodhi <61431818+usodhi@users.noreply.github.com>2020-09-17 12:26:08 +0530
commitdce79728f8c8db971e8ca6d5865bb14bf9b278ef (patch)
tree2132d62df0d7213d6a97d83f4aefe692de9a661f /src/client/util/DropConverter.ts
parent22a346805837cd7fc9afe8c9d22b40279cdf5b04 (diff)
parent2efd66bcef6329e4e816604ebd5a382e033dc2c6 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into acls_uv
Diffstat (limited to 'src/client/util/DropConverter.ts')
-rw-r--r--src/client/util/DropConverter.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/client/util/DropConverter.ts b/src/client/util/DropConverter.ts
index 1bbd46938..32817eefd 100644
--- a/src/client/util/DropConverter.ts
+++ b/src/client/util/DropConverter.ts
@@ -2,12 +2,13 @@ import { DragManager } from "./DragManager";
import { Doc, DocListCast, Opt } from "../../fields/Doc";
import { DocumentType } from "../documents/DocumentTypes";
import { ObjectField } from "../../fields/ObjectField";
-import { StrCast } from "../../fields/Types";
+import { StrCast, Cast } from "../../fields/Types";
import { Docs } from "../documents/Documents";
import { ScriptField, ComputedField } from "../../fields/ScriptField";
import { RichTextField } from "../../fields/RichTextField";
import { ImageField } from "../../fields/URLField";
import { Scripting } from "./Scripting";
+import { listSpec } from "../../fields/Schema";
//
// converts 'doc' into a template that can be used to render other documents.
@@ -54,7 +55,13 @@ export function convertDropDataToButtons(data: DragManager.DocumentDragData) {
let dbox = doc;
// bcz: isButtonBar is intended to allow a collection of linear buttons to be dropped and nested into another collection of buttons... it's not being used yet, and isn't very elegant
if (doc.type === DocumentType.FONTICON || StrCast(Doc.Layout(doc).layout).includes("FontIconBox")) {
- //dbox = Doc.MakeAlias(doc); // don't need to do anything if dropping an icon doc onto an icon bar since there should be no layout data for an icon
+ if (data.removeDropProperties || dbox.removeDropProperties) {
+ //dbox = Doc.MakeAlias(doc); // don't need to do anything if dropping an icon doc onto an icon bar since there should be no layout data for an icon
+ dbox = Doc.MakeAlias(dbox);
+ const dragProps = Cast(dbox.removeDropProperties, listSpec("string"), []);
+ const remProps = (data.removeDropProperties || []).concat(Array.from(dragProps));
+ remProps.map(prop => dbox[prop] = undefined);
+ }
} else if (!doc.onDragStart && !doc.isButtonBar) {
const layoutDoc = doc;// doc.layout instanceof Doc && doc.layout.isTemplateForField ? doc.layout : doc;
if (layoutDoc.type !== DocumentType.FONTICON) {