aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/TooltipTextMenu.tsx
diff options
context:
space:
mode:
authorTyler Schicke <tschicke@gmail.com>2020-01-09 21:33:18 -0800
committerTyler Schicke <tschicke@gmail.com>2020-01-09 21:33:18 -0800
commit2295ab2500487da6b030d871b8d81724a4ddada3 (patch)
treecc4bff122cd18066521affb382c0e93cde9b33ce /src/client/util/TooltipTextMenu.tsx
parent786d25a4f8db1db8795f04a17fba392636e5f891 (diff)
parenta8aa0facfaa23298398c15aa906bc6d69c538564 (diff)
Merge branch 'master' of github.com:browngraphicslab/Dash-Web into no_db
Diffstat (limited to 'src/client/util/TooltipTextMenu.tsx')
-rw-r--r--src/client/util/TooltipTextMenu.tsx16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/client/util/TooltipTextMenu.tsx b/src/client/util/TooltipTextMenu.tsx
index 8aa304fad..1c15dca7f 100644
--- a/src/client/util/TooltipTextMenu.tsx
+++ b/src/client/util/TooltipTextMenu.tsx
@@ -80,7 +80,7 @@ export class TooltipTextMenu {
span.appendChild(svg);
return span;
- }
+ };
const basicItems = [ // init basicItems in minimized toolbar -- paths to svgs are obtained from fontawesome
{ mark: schema.marks.strong, dom: svgIcon("strong", "Bold", "M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z") },
@@ -93,7 +93,7 @@ export class TooltipTextMenu {
{ mark: schema.marks.subscript, dom: svgIcon("subscript", "Subscript", "M496 448h-16V304a16 16 0 0 0-16-16h-48a16 16 0 0 0-14.29 8.83l-16 32A16 16 0 0 0 400 352h16v96h-16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h96a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM336 64h-67a16 16 0 0 0-13.14 6.87l-79.9 115-79.9-115A16 16 0 0 0 83 64H16A16 16 0 0 0 0 80v48a16 16 0 0 0 16 16h33.48l77.81 112-77.81 112H16a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h67a16 16 0 0 0 13.14-6.87l79.9-115 79.9 115A16 16 0 0 0 269 448h67a16 16 0 0 0 16-16v-48a16 16 0 0 0-16-16h-33.48l-77.81-112 77.81-112H336a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16z") },
];
- basicItems.map(({ dom, mark }) => this.basicTools?.appendChild(dom.cloneNode(true)));
+ basicItems.map(({ dom, mark }) => this.basicTools ?.appendChild(dom.cloneNode(true)));
basicItems.concat(items).forEach(({ dom, mark }) => {
this.tooltip.appendChild(dom);
this._marksToDoms.set(mark, dom);
@@ -474,7 +474,7 @@ export class TooltipTextMenu {
const node = self.view.state.selection.$from.nodeAfter;
const link = node && node.marks.find(m => m.type === self.view.state.schema.marks.link);
const href = link!.attrs.href;
- if (href?.indexOf(Utils.prepend("/doc/")) === 0) {
+ if (href ?.indexOf(Utils.prepend("/doc/")) === 0) {
const linkclicked = href.replace(Utils.prepend("/doc/"), "").split("?")[0];
linkclicked && DocServer.GetRefField(linkclicked).then(async linkDoc => {
if (linkDoc instanceof Doc) {
@@ -500,7 +500,7 @@ export class TooltipTextMenu {
const link = this.view.state.schema.marks.link.create({ href: Utils.prepend("/doc/" + linkDocId), title: title, location: location, targetId: targetDocId });
this.view.dispatch(this.view.state.tr.removeMark(this.view.state.selection.from, this.view.state.selection.to, this.view.state.schema.marks.link).
addMark(this.view.state.selection.from, this.view.state.selection.to, link));
- return this.view.state.selection.$from.nodeAfter?.text || "";
+ return this.view.state.selection.$from.nodeAfter ?.text || "";
}
// SUMMARIZER TOOL
@@ -510,7 +510,7 @@ export class TooltipTextMenu {
const tr = state.tr.addMark(state.selection.from, state.selection.to, mark);
const content = tr.selection.content();
const newNode = state.schema.nodes.summary.create({ visibility: false, text: content, textslice: content.toJSON() });
- dispatch?.(tr.replaceSelectionWith(newNode).removeMark(tr.selection.from - 1, tr.selection.from, mark));
+ dispatch ?.(tr.replaceSelectionWith(newNode).removeMark(tr.selection.from - 1, tr.selection.from, mark));
}
}
@@ -737,7 +737,7 @@ export class TooltipTextMenu {
// get marks in the selection
const selected_marks = new Set<Mark>();
const { from, to } = state.selection as TextSelection;
- state.doc.nodesBetween(from, to, (node) => node.marks?.forEach(m => selected_marks.add(m)));
+ state.doc.nodesBetween(from, to, (node) => node.marks ?.forEach(m => selected_marks.add(m)));
if (this._brushdom && selected_marks.size >= 0) {
TooltipTextMenuManager.Instance._brushMarks = selected_marks;
@@ -849,7 +849,7 @@ export class TooltipTextMenu {
static setMark = (mark: Mark, state: EditorState<any>, dispatch: any) => {
if (mark) {
const node = (state.selection as NodeSelection).node;
- if (node?.type === schema.nodes.ordered_list) {
+ if (node ?.type === schema.nodes.ordered_list) {
let attrs = node.attrs;
if (mark.type === schema.marks.pFontFamily) attrs = { ...attrs, setFontFamily: mark.attrs.family };
if (mark.type === schema.marks.pFontSize) attrs = { ...attrs, setFontSize: mark.attrs.fontSize };
@@ -883,7 +883,7 @@ export class TooltipTextMenu {
if (!lastState || !lastState.doc.eq(view.state.doc) || !lastState.selection.eq(view.state.selection)) {
// UPDATE LINK DROPDOWN
- const linkTarget = await this.getTextLinkTargetTitle()
+ const linkTarget = await this.getTextLinkTargetTitle();
const linkDom = this.createLinkTool(linkTarget ? true : false).render(this.view).dom;
const linkDropdownDom = this.createLinkDropdown(linkTarget).render(this.view).dom;
this.linkDom && this.tooltip.replaceChild(linkDom, this.linkDom);