aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/util/RichTextSchema.tsx2
-rw-r--r--src/new_fields/Doc.ts13
-rw-r--r--src/server/authentication/models/current_user_utils.ts6
3 files changed, 11 insertions, 10 deletions
diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx
index 31935df3e..659d317f6 100644
--- a/src/client/util/RichTextSchema.tsx
+++ b/src/client/util/RichTextSchema.tsx
@@ -875,7 +875,7 @@ export class DashFieldView {
this._fieldWrapper.style.width = node.attrs.width;
this._fieldWrapper.style.height = node.attrs.height;
this._fieldWrapper.style.position = "relative";
- this._fieldWrapper.style.display = "inline-block";
+ this._fieldWrapper.style.display = "inline-flex";
const self = this;
this._enumerables = document.createElement("div");
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts
index 322b57272..8447a4e93 100644
--- a/src/new_fields/Doc.ts
+++ b/src/new_fields/Doc.ts
@@ -587,7 +587,6 @@ export namespace Doc {
target._nativeWidth = undefined;
target._nativeHeight = undefined;
target.type = undefined;
- target.onClick = undefined;
return;
}
@@ -598,8 +597,6 @@ export namespace Doc {
titleTarget && (Doc.GetProto(target).title = titleTarget);
Doc.GetProto(target)[targetKey] = new PrefetchProxy(templateDoc);
}
- const scriptField = ScriptCast(templateDoc.onClick);
- scriptField && (target.onClick = scriptField[Copy]());
}
target.layoutKey = targetKey;
return target;
@@ -791,6 +788,10 @@ export namespace Doc {
return fieldStr === value;
}
+ export function deiconifyView(doc: any) {
+ StrCast(doc.layoutKey).split("_")[1] === "icon" && setNativeView(doc);
+ }
+
export function setNativeView(doc: any) {
const prevLayout = StrCast(doc.layoutKey).split("_")[1];
const deiconify = prevLayout === "icon" && StrCast(doc.deiconifyLayout) ? "layout_" + StrCast(doc.deiconifyLayout) : "";
@@ -813,8 +814,8 @@ export namespace Doc {
}
}
- export function aliasDocs(field:any) {
- return new List<Doc>(field.map((d: any) => Doc.MakeAlias(d)));
+ export function aliasDocs(field: any) {
+ return new List<Doc>(field.map((d: any) => Doc.MakeAlias(d)));
}
// filters document in a container collection:
@@ -890,7 +891,7 @@ Scripting.addGlobal(function copyField(field: any) { return ObjectField.MakeCopy
Scripting.addGlobal(function aliasDocs(field: any) { return Doc.aliasDocs(field); });
Scripting.addGlobal(function docList(field: any) { return DocListCast(field); });
Scripting.addGlobal(function sameDocs(doc1: any, doc2: any) { return Doc.AreProtosEqual(doc1, doc2); });
-Scripting.addGlobal(function setNativeView(doc: any) { Doc.setNativeView(doc); });
+Scripting.addGlobal(function deiconifyView(doc: any) { Doc.deiconifyView(doc); });
Scripting.addGlobal(function undo() { return UndoManager.Undo(); });
Scripting.addGlobal(function redo() { return UndoManager.Redo(); });
Scripting.addGlobal(function DOC(id: string) { console.log("Can't parse a document id in a script"); return "invalid"; });
diff --git a/src/server/authentication/models/current_user_utils.ts b/src/server/authentication/models/current_user_utils.ts
index 9c39ce7de..cfa13cb44 100644
--- a/src/server/authentication/models/current_user_utils.ts
+++ b/src/server/authentication/models/current_user_utils.ts
@@ -273,14 +273,14 @@ export class CurrentUserUtils {
Doc.GetProto(descriptionTemplate).layout = FormattedTextBox.LayoutString("description");
descriptionTemplate.isTemplateDoc = makeTemplate(descriptionTemplate, true, "descriptionView");
- const iconDoc = Docs.Create.TextDocument("", { title: "icon", _width: 150, _height: 30, isTemplateDoc: true, onClick: ScriptField.MakeScript("setNativeView(this)") });
+ const iconDoc = Docs.Create.TextDocument("", { title: "icon", _width: 150, _height: 30, isTemplateDoc: true, onClick: ScriptField.MakeScript("deiconifyView(this)") });
Doc.GetProto(iconDoc).icon = new RichTextField('{"doc":{"type":"doc","content":[{"type":"paragraph","attrs":{"align":null,"color":null,"id":null,"indent":null,"inset":null,"lineSpacing":null,"paddingBottom":null,"paddingTop":null},"content":[{"type":"dashField","attrs":{"fieldKey":"title","docid":""}}]}]},"selection":{"type":"text","anchor":2,"head":2},"storedMarks":[]}', "");
doc.isTemplateDoc = makeTemplate(iconDoc);
doc.iconView = new PrefetchProxy(iconDoc);
- const imgIconDoc = Docs.Create.ImageDocument("http://www.cs.brown.edu/~bcz/face.gif", { title: "data", _width: 50, isTemplateDoc: true, onClick: ScriptField.MakeScript("setNativeView(this)") });
+ const imgIconDoc = Docs.Create.ImageDocument("http://www.cs.brown.edu/~bcz/face.gif", { title: "data", _width: 50, isTemplateDoc: true, onClick: ScriptField.MakeScript("deiconifyView(this)") });
doc.isTemplateDoc = makeTemplate(imgIconDoc, true, "image_icon");
doc.iconImageView = new PrefetchProxy(imgIconDoc);
- const colIconDoc = Docs.Create.TreeDocument([], { title: "data", _width: 180, _height: 80, isTemplateDoc: true, onClick: ScriptField.MakeScript("setNativeView(this)") });
+ const colIconDoc = Docs.Create.TreeDocument([], { title: "data", _width: 180, _height: 80, isTemplateDoc: true, onClick: ScriptField.MakeScript("deiconifyView(this)") });
doc.isTemplateDoc = makeTemplate(colIconDoc, true, "collection_icon");
doc.iconColView = new PrefetchProxy(colIconDoc);