aboutsummaryrefslogtreecommitdiff
path: root/src/client/documents/Documents.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-03-01 17:05:45 -0500
committerbobzel <zzzman@gmail.com>2021-03-01 17:05:45 -0500
commitc41696a3169dc765512d64972ba4503cea8393e0 (patch)
tree644cb81de4a23d4b38335bb4731fccc7d1a34504 /src/client/documents/Documents.ts
parentbed03be10f9289e36f7e1621bbcf2579b0ca3f2d (diff)
added basic math typeset equation input
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r--src/client/documents/Documents.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 3f03d39da..e270d2ac8 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -57,6 +57,7 @@ import { PresElementBox } from "../views/presentationview/PresElementBox";
import { SearchBox } from "../views/search/SearchBox";
import { DashWebRTCVideo } from "../views/webcam/DashWebRTCVideo";
import { DocumentType } from "./DocumentTypes";
+import { EquationBox } from "../views/nodes/EquationBox";
const path = require('path');
const defaultNativeImageDim = Number(DFLT_IMAGE_NATIVE_DIM.replace("px", ""));
@@ -241,6 +242,7 @@ export class DocumentOptions {
sidebarColor?: string; // background color of text sidebar
sidebarViewType?: string; // collection type of text sidebar
docMaxAutoHeight?: number; // maximum height for newly created (eg, from pasting) text documents
+ text?: string;
textTransform?: string; // is linear view expanded
letterSpacing?: string; // is linear view expanded
flexDirection?: "unset" | "row" | "column" | "row-reverse" | "column-reverse";
@@ -374,6 +376,9 @@ export namespace Docs {
[DocumentType.LABEL, {
layout: { view: LabelBox, dataField: defaultDataKey },
}],
+ [DocumentType.EQUATION, {
+ layout: { view: EquationBox, dataField: defaultDataKey },
+ }],
[DocumentType.BUTTON, {
layout: { view: LabelBox, dataField: "onClick" },
}],
@@ -890,6 +895,10 @@ export namespace Docs {
return InstanceFromProto(Prototypes.get(DocumentType.LABEL), undefined, { ...(options || {}) });
}
+ export function EquationDocument(options?: DocumentOptions) {
+ return InstanceFromProto(Prototypes.get(DocumentType.EQUATION), undefined, { ...(options || {}) });
+ }
+
export function ButtonDocument(options?: DocumentOptions) {
// const btn = InstanceFromProto(Prototypes.get(DocumentType.BUTTON), undefined, { ...(options || {}), "onClick-rawScript": "-script-" });
// btn.layoutKey = "layout_onClick";
@@ -1220,6 +1229,20 @@ export namespace DocUtils {
icon: "eye"
});
ContextMenu.Instance.addItem({
+ description: ":math", event: () => {
+ const created = Docs.Create.EquationDocument();
+ if (created) {
+ created.author = Doc.CurrentUserEmail;
+ created.x = x;
+ created.y = y;
+ created.width = 300;
+ created.height = 35;
+ EquationBox.SelectOnLoad = created[Id];
+ docAdder?.(created);
+ }
+ }, icon: "compress-arrows-alt"
+ });
+ ContextMenu.Instance.addItem({
description: "Add Template Doc ...",
subitems: DocListCast(Cast(Doc.UserDoc().myItemCreators, Doc, null)?.data).filter(btnDoc => !btnDoc.hidden).map(btnDoc => Cast(btnDoc?.dragFactory, Doc, null)).filter(doc => doc && doc !== Doc.UserDoc().emptyPresentation).map((dragDoc, i) => ({
description: ":" + StrCast(dragDoc.title),