aboutsummaryrefslogtreecommitdiff
path: root/src/client/views
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-08-24 18:37:46 -0400
committerbobzel <zzzman@gmail.com>2020-08-24 18:37:46 -0400
commit69f94b19baa37a0a9114bc21710d2e09b49b638d (patch)
treef19e30107f0c2242de167b1179994cdfb45b6766 /src/client/views
parent2e4ab06f38323bba06a4d77c04da1507bac5657f (diff)
removed treeViewOpen from sidebar panels since they don't need them now that the top level is hidden.
Diffstat (limited to 'src/client/views')
-rw-r--r--src/client/views/MainView.tsx6
-rw-r--r--src/client/views/collections/CollectionTreeView.tsx10
-rw-r--r--src/client/views/collections/CollectionView.tsx2
-rw-r--r--src/client/views/nodes/DocumentView.tsx3
4 files changed, 12 insertions, 9 deletions
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index 9189c1951..67d1de2ec 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -293,8 +293,9 @@ export class MainView extends React.Component {
const toggleTheme = ScriptField.MakeScript(`self.darkScheme = !self.darkScheme`);
const toggleComic = ScriptField.MakeScript(`toggleComicMode()`);
const copyDashboard = ScriptField.MakeScript(`copyDashboard()`);
- dashboardDoc.contextMenuScripts = new List<ScriptField>([toggleTheme!, toggleComic!, copyDashboard!]);
- dashboardDoc.contextMenuLabels = new List<string>(["Toggle Theme Colors", "Toggle Comic Mode", "Snapshot Dashboard"]);
+ const createDashboard = ScriptField.MakeScript(`createDashb oard()`);
+ dashboardDoc.contextMenuScripts = new List<ScriptField>([toggleTheme!, toggleComic!, copyDashboard!, createDashboard!]);
+ dashboardDoc.contextMenuLabels = new List<string>(["Toggle Theme Colors", "Toggle Comic Mode", "Snapshot Dashboard", "Create Dashboard"]);
Doc.AddDocToList(dashboards, "data", dashboardDoc);
// bcz: strangely, we need a timeout to prevent exceptions/issues initializing GoldenLayout (the rendering engine for Main Container)
@@ -1005,5 +1006,6 @@ Scripting.addGlobal(function copyDashboard() {
setTimeout(() => MainView.Instance.openDashboard(copy), 0);
});
});
+Scripting.addGlobal(function createDashboard() { MainView.Instance.createNewDashboard(); });
Scripting.addGlobal(function importDocument() { return MainView.Instance.importDocument(); },
"imports files from device directly into the import sidebar");
diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx
index c5ea02a2f..585d1f775 100644
--- a/src/client/views/collections/CollectionTreeView.tsx
+++ b/src/client/views/collections/CollectionTreeView.tsx
@@ -327,7 +327,7 @@ class TreeView extends React.Component<TreeViewProps> {
(doc instanceof Doc ? [doc] : doc).reduce((flg, doc) => flg && Doc.AddDocToList(this.dataDoc, expandKey, doc, addBefore, before, false, true), true);
const docs = expandKey === "links" ? this.childLinks : expandKey === "annotations" ? this.childAnnos : this.childDocs;
const sortKey = `${this.fieldKey}-sortAscending`;
- return <ul key={expandKey + "more"} className={this.doc.treeViewHideTopDoc ? "no-indent" : ""} onClick={(e) => {
+ return <ul key={expandKey + "more"} className={this.doc.treeViewHideTopLevel ? "no-indent" : ""} onClick={(e) => {
this.doc[sortKey] = (this.doc[sortKey] ? false : (this.doc[sortKey] === false ? undefined : true));
e.stopPropagation();
}}>
@@ -506,7 +506,7 @@ class TreeView extends React.Component<TreeViewProps> {
}
}
} else this._editMaxWidth = "";
- return this.doc.treeViewHideTopDoc && this.props.firstLevel ? !this.treeViewOpen || this.props.renderedIds.indexOf(this.doc[Id]) !== -1 ? (null) : this.renderContent :
+ return this.doc.treeViewHideTopLevel && this.props.firstLevel ? !this.treeViewOpen || this.props.renderedIds.indexOf(this.doc[Id]) !== -1 ? (null) : this.renderContent :
<div className="treeViewItem-container" ref={this.createTreeDropTarget} onPointerDown={e => this.props.active(true) && SelectionManager.DeselectAll()}>
<li className="collection-child">
<div className={`treeViewItem-header` + (this._editMaxWidth ? "-editing" : "")} ref={this._header} style={{ maxWidth: this._editMaxWidth }} onClick={e => {
@@ -678,7 +678,7 @@ class TreeView extends React.Component<TreeViewProps> {
}
export type collectionTreeViewProps = {
- treeViewHideTopDoc?: boolean;
+ treeViewHideTopLevel?: boolean;
treeViewHideHeaderFields?: boolean;
onCheckedClick?: () => ScriptField;
onChildClick?: () => ScriptField;
@@ -754,7 +754,7 @@ export class CollectionTreeView extends CollectionSubView<Document, Partial<coll
const layoutItems: ContextMenuProps[] = [];
layoutItems.push({ description: (this.doc.treeViewPreventOpen ? "Persist" : "Abandon") + "Treeview State", event: () => this.doc.treeViewPreventOpen = !this.doc.treeViewPreventOpen, icon: "paint-brush" });
layoutItems.push({ description: (this.doc.treeViewHideHeaderFields ? "Show" : "Hide") + " Header Fields", event: () => this.doc.treeViewHideHeaderFields = !this.doc.treeViewHideHeaderFields, icon: "paint-brush" });
- layoutItems.push({ description: (this.doc.treeViewHideTopDoc ? "Show" : "Hide") + " Title", event: () => this.doc.treeViewHideTopDoc = !this.doc.treeViewHideTopDoc, icon: "paint-brush" });
+ layoutItems.push({ description: (this.doc.treeViewHideTopLevel ? "Show" : "Hide") + " Title", event: () => this.doc.treeViewHideTopLevel = !this.doc.treeViewHideTopLevel, icon: "paint-brush" });
layoutItems.push({ description: (this.doc.treeViewHideLinkLines ? "Show" : "Hide") + " Link Lines", event: () => this.doc.treeViewHideLinkLines = !this.doc.treeViewHideLinkLines, icon: "paint-brush" });
ContextMenu.Instance.addItem({ description: "Options...", subitems: layoutItems, icon: "eye" });
}
@@ -831,7 +831,7 @@ export class CollectionTreeView extends CollectionSubView<Document, Partial<coll
this.outerXf, this.props.active, this.props.PanelWidth, this.props.ChromeHeight, this.props.renderDepth, () => this.props.treeViewHideHeaderFields || BoolCast(this.doc.treeViewHideHeaderFields),
BoolCast(this.doc.treeViewPreventOpen), [], this.props.LibraryPath, this.props.onCheckedClick,
this.onChildClick, this.props.ignoreFields, true, BoolCast(this.props.Document.treeViewOpen));
- const hideTitle = this.props.treeViewHideTopDoc || this.doc.treeViewHideTopDoc;
+ const hideTitle = this.props.treeViewHideTopLevel || this.doc.treeViewHideTopLevel;
return !childDocs ? (null) : (
<div className="collectionTreeView-container" onContextMenu={this.onContextMenu}>
<div className="collectionTreeView-dropTarget" id="body"
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 38809e1e8..828cdd282 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -549,7 +549,7 @@ export class CollectionView extends Touchable<FieldViewProps & CollectionViewCus
bringToFront={emptyFunction}
active={this.props.active}
whenActiveChanged={returnFalse}
- treeViewHideTopDoc={true}
+ treeViewHideTopLevel={true}
ContentScaling={returnOne}
focus={returnFalse}
treeViewHideHeaderFields={true}
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 9ab2889e1..c8ac59bcd 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -322,13 +322,14 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
}
}
} else if (this.onClickHandler?.script && !StrCast(Doc.LayoutField(this.layoutDoc))?.includes("ScriptingBox")) { // bcz: hack? don't execute script if you're clicking on a scripting box itself
+ const shiftKey = e.shiftKey;
const func = () => this.onClickHandler.script.run({
this: this.layoutDoc,
self: this.rootDoc,
scriptContext: this.props.scriptContext,
thisContainer: this.props.ContainingCollectionDoc,
documentView: this,
- shiftKey: e.shiftKey
+ shiftKey
}, console.log);
const clickFunc = () => {
if (!Doc.AreProtosEqual(this.props.Document, Doc.UserDoc()["dockedBtn-undo"] as Doc) && !Doc.AreProtosEqual(this.props.Document, Doc.UserDoc()["dockedBtn-redo"] as Doc)) {