aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText/RichTextMenu.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-09-09 22:49:13 -0400
committerbobzel <zzzman@gmail.com>2021-09-09 22:49:13 -0400
commit9d177851ecaaea1a89ac9b7de1cec16368603eaa (patch)
tree4000ee3540ebb84db85ffcfb8e09e43ec0fe92fc /src/client/views/nodes/formattedText/RichTextMenu.tsx
parent3ae79d3742030a255855d0c9c4ba8345f1cc73dd (diff)
added SelectionManager.Docs() to avoid having to dereference props to get at the seelcted Doc. this was causing a cycle in menu items when selected. fixed sizing of filterBox. enabled showing titles for VID,COL,and IMG in addition to RTF.
Diffstat (limited to 'src/client/views/nodes/formattedText/RichTextMenu.tsx')
-rw-r--r--src/client/views/nodes/formattedText/RichTextMenu.tsx20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/client/views/nodes/formattedText/RichTextMenu.tsx b/src/client/views/nodes/formattedText/RichTextMenu.tsx
index 3d9d9543d..3919fbf94 100644
--- a/src/client/views/nodes/formattedText/RichTextMenu.tsx
+++ b/src/client/views/nodes/formattedText/RichTextMenu.tsx
@@ -279,33 +279,33 @@ export class RichTextMenu extends AntimodeMenu<AntimodeMenuProps> {
});
}
- toggleBold = (view: EditorView, forceBool?:boolean) => {
- const mark = view.state.schema.mark(view.state.schema.marks.strong, {strong: forceBool});
+ toggleBold = (view: EditorView, forceBool?: boolean) => {
+ const mark = view.state.schema.mark(view.state.schema.marks.strong, { strong: forceBool });
this.setMark(mark, view.state, view.dispatch, false);
view.focus();
}
- toggleUnderline = (view: EditorView, forceBool?:boolean) => {
- const mark = view.state.schema.mark(view.state.schema.marks.underline, {underline: forceBool});
+ toggleUnderline = (view: EditorView, forceBool?: boolean) => {
+ const mark = view.state.schema.mark(view.state.schema.marks.underline, { underline: forceBool });
this.setMark(mark, view.state, view.dispatch, false);
view.focus();
}
- toggleItalic = (view: EditorView, forceBool?:boolean) => {
- const mark = view.state.schema.mark(view.state.schema.marks.em, {em: forceBool});
+ toggleItalic = (view: EditorView, forceBool?: boolean) => {
+ const mark = view.state.schema.mark(view.state.schema.marks.em, { em: forceBool });
this.setMark(mark, view.state, view.dispatch, false);
view.focus();
}
- setFontSize = (size:number, view: EditorView) => {
+ setFontSize = (size: number, view: EditorView) => {
const fmark = view.state.schema.marks.pFontSize.create({ fontSize: size });
this.setMark(fmark, view.state, (tx: any) => view.dispatch(tx.addStoredMark(fmark)), true);
view.focus();
this.updateMenu(view, undefined, this.props);
}
- setFontFamily = (family:string, view: EditorView) => {
+ setFontFamily = (family: string, view: EditorView) => {
const fmark = view.state.schema.marks.pFontFamily.create({ family: family });
this.setMark(fmark, view.state, (tx: any) => view.dispatch(tx.addStoredMark(fmark)), true);
view.focus();
@@ -516,7 +516,7 @@ export class RichTextMenu extends AntimodeMenu<AntimodeMenuProps> {
get TextView() { return (this.view as any)?.TextView as FormattedTextBox; }
get TextViewFieldKey() { return this.TextView?.props.fieldKey; }
-
+
@action setActiveHighlight(color: string) { this.activeHighlightColor = color; }
@@ -566,7 +566,7 @@ export class RichTextMenu extends AntimodeMenu<AntimodeMenuProps> {
if (linkDoc instanceof Doc) {
const anchor1 = await Cast(linkDoc.anchor1, Doc);
const anchor2 = await Cast(linkDoc.anchor2, Doc);
- const currentDoc = SelectionManager.Views().length && SelectionManager.Views()[0].props.Document;
+ const currentDoc = SelectionManager.Docs().lastElement();
if (currentDoc && anchor1 && anchor2) {
if (Doc.AreProtosEqual(currentDoc, anchor1)) {
return StrCast(anchor2.title);