aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/CurrentUserUtils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/util/CurrentUserUtils.ts')
-rw-r--r--src/client/util/CurrentUserUtils.ts34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index 600c143a7..c7f293f2c 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -29,7 +29,7 @@ import { DragManager } from "./DragManager";
import { makeTemplate } from "./DropConverter";
import { HistoryUtil } from "./History";
import { LinkManager } from "./LinkManager";
-import { Scripting } from "./Scripting";
+import { ScriptingGlobals } from "./ScriptingGlobals";
import { SearchUtil } from "./SearchUtil";
import { SelectionManager } from "./SelectionManager";
import { ColorScheme } from "./SettingsManager";
@@ -1567,7 +1567,7 @@ export class CurrentUserUtils {
@computed public static get SelectedTool(): InkTool { return StrCast(Doc.UserDoc().activeInkTool, InkTool.None) as InkTool; }
}
-Scripting.addGlobal(function openDragFactory(dragFactory: Doc) {
+ScriptingGlobals.add(function openDragFactory(dragFactory: Doc) {
const copy = Doc.copyDragFactory(dragFactory);
if (copy) {
CollectionDockingView.AddSplit(copy, "right");
@@ -1575,27 +1575,27 @@ Scripting.addGlobal(function openDragFactory(dragFactory: Doc) {
view && SelectionManager.SelectView(view, false);
}
});
-Scripting.addGlobal(function MySharedDocs() { return Doc.SharingDoc(); },
+ScriptingGlobals.add(function MySharedDocs() { return Doc.SharingDoc(); },
"document containing all shared Docs");
-Scripting.addGlobal(function IsNoviceMode() { return Doc.UserDoc().noviceMode; },
+ScriptingGlobals.add(function IsNoviceMode() { return Doc.UserDoc().noviceMode; },
"is Dash in novice mode");
-Scripting.addGlobal(function snapshotDashboard() { CurrentUserUtils.snapshotDashboard(Doc.UserDoc()); },
+ScriptingGlobals.add(function snapshotDashboard() { CurrentUserUtils.snapshotDashboard(Doc.UserDoc()); },
"creates a snapshot copy of a dashboard");
-Scripting.addGlobal(function createNewDashboard() { return CurrentUserUtils.createNewDashboard(Doc.UserDoc()); },
+ScriptingGlobals.add(function createNewDashboard() { return CurrentUserUtils.createNewDashboard(Doc.UserDoc()); },
"creates a new dashboard when called");
-Scripting.addGlobal(function createNewPresentation() { return MainView.Instance.createNewPresentation(); },
+ScriptingGlobals.add(function createNewPresentation() { return MainView.Instance.createNewPresentation(); },
"creates a new presentation when called");
-Scripting.addGlobal(function createNewFolder() { return MainView.Instance.createNewFolder(); },
+ScriptingGlobals.add(function createNewFolder() { return MainView.Instance.createNewFolder(); },
"creates a new folder in myFiles when called");
-Scripting.addGlobal(function links(doc: any) { return new List(LinkManager.Instance.getAllRelatedLinks(doc)); },
+ScriptingGlobals.add(function links(doc: any) { return new List(LinkManager.Instance.getAllRelatedLinks(doc)); },
"returns all the links to the document or its annotations", "(doc: any)");
-Scripting.addGlobal(function importDocument() { return CurrentUserUtils.importDocument(); },
+ScriptingGlobals.add(function importDocument() { return CurrentUserUtils.importDocument(); },
"imports files from device directly into the import sidebar");
-Scripting.addGlobal(function shareDashboard(dashboard: Doc) {
+ScriptingGlobals.add(function shareDashboard(dashboard: Doc) {
SharingManager.Instance.open(undefined, dashboard);
},
"opens sharing dialog for Dashboard");
-Scripting.addGlobal(async function removeDashboard(dashboard: Doc) {
+ScriptingGlobals.add(async function removeDashboard(dashboard: Doc) {
const dashboards = await DocListCastAsync(CurrentUserUtils.MyDashboards.data);
if (dashboards && dashboards.length > 1) {
if (dashboard === CurrentUserUtils.ActiveDashboard) CurrentUserUtils.openDashboard(Doc.UserDoc(), dashboards.find(doc => doc !== dashboard)!);
@@ -1603,7 +1603,7 @@ Scripting.addGlobal(async function removeDashboard(dashboard: Doc) {
}
},
"Remove Dashboard from Dashboards");
-Scripting.addGlobal(async function addToDashboards(dashboard: Doc) {
+ScriptingGlobals.add(async function addToDashboards(dashboard: Doc) {
const dashboardAlias = Doc.MakeAlias(dashboard);
const allDocs = await DocListCastAsync(dashboard[DataSym]["data-all"]);
@@ -1627,7 +1627,7 @@ Scripting.addGlobal(async function addToDashboards(dashboard: Doc) {
/**
* Dynamically computes which docs should be rendered in the off-screen tabs tree of a dashboard.
*/
-Scripting.addGlobal(function dynamicOffScreenDocs(dashboard: Doc) {
+ScriptingGlobals.add(function dynamicOffScreenDocs(dashboard: Doc) {
if (dashboard[DataSym] instanceof Doc) {
const allDocs = DocListCast(dashboard["data-all"]);
const onScreenTab = DocListCast(dashboard.data)[0];
@@ -1639,7 +1639,7 @@ Scripting.addGlobal(function dynamicOffScreenDocs(dashboard: Doc) {
}
return [];
});
-Scripting.addGlobal(function selectedDocumentType(docType?: DocumentType, colType?: CollectionViewType, checkParent?: boolean) {
+ScriptingGlobals.add(function selectedDocumentType(docType?: DocumentType, colType?: CollectionViewType, checkParent?: boolean) {
let selected = SelectionManager.Docs().length ? SelectionManager.Docs()[0] : undefined;
if (selected && checkParent) {
const parentDoc: Doc = Cast(selected.context, Doc, null);
@@ -1650,11 +1650,11 @@ Scripting.addGlobal(function selectedDocumentType(docType?: DocumentType, colTyp
else if (selected && !colType && !docType) return false;
else return true;
});
-Scripting.addGlobal(function makeTopLevelFolder() {
+ScriptingGlobals.add(function makeTopLevelFolder() {
const folder = Docs.Create.TreeDocument([], { title: "Untitled folder", _stayInCollection: true, isFolder: true });
TreeView._editTitleOnLoad = { id: folder[Id], parent: undefined };
return Doc.AddDocToList(Doc.UserDoc().myFilesystem as Doc, "data", folder);
});
-Scripting.addGlobal(function toggleComicMode() {
+ScriptingGlobals.add(function toggleComicMode() {
Doc.UserDoc().renderStyle = Doc.UserDoc().renderStyle === "comic" ? undefined : "comic";
}); \ No newline at end of file