aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/RichTextMenu.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-01-16 07:59:03 -0500
committerBob Zeleznik <zzzman@gmail.com>2020-01-16 07:59:03 -0500
commitc919514f854db67be96ec0f0283bdce635d53571 (patch)
tree4f10ee00dc2fa66fe5ec9ff84e8750d2cf815fd7 /src/client/util/RichTextMenu.tsx
parent2bc808135edfc0df1f80c8c52b1015daddf0aecc (diff)
parent380215f0b934eba265a6b97ab2edc502fd71818a (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/util/RichTextMenu.tsx')
-rw-r--r--src/client/util/RichTextMenu.tsx13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/client/util/RichTextMenu.tsx b/src/client/util/RichTextMenu.tsx
index 639772faa..419d7caf9 100644
--- a/src/client/util/RichTextMenu.tsx
+++ b/src/client/util/RichTextMenu.tsx
@@ -175,7 +175,7 @@ export default class RichTextMenu extends AntimodeMenu {
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 };
@@ -294,8 +294,8 @@ export default class RichTextMenu extends AntimodeMenu {
e.preventDefault();
e.stopPropagation();
self.view && self.view.focus();
- self.view && command && command(self.view!.state, self.view!.dispatch, self.view);
- self.view && onclick && onclick(self.view!.state, self.view!.dispatch, self.view);
+ self.view && command && command(self.view.state, self.view.dispatch, self.view);
+ self.view && onclick && onclick(self.view.state, self.view.dispatch, self.view);
self.setActiveMarkButtons(self.getActiveMarksOnSelection());
}
@@ -602,7 +602,7 @@ export default class RichTextMenu extends AntimodeMenu {
const link = this.currentLink ? this.currentLink : "";
- const button = <FontAwesomeIcon icon="link" size="lg" />
+ const button = <FontAwesomeIcon icon="link" size="lg" />;
const dropdownContent =
<div className="dropdown link-menu">
@@ -684,8 +684,9 @@ export default class RichTextMenu extends AntimodeMenu {
}
} else {
if (node) {
- const extension = this.linkExtend(this.view!.state.selection.$anchor, href);
- this.view!.dispatch(this.view!.state.tr.removeMark(extension.from, extension.to, this.view!.state.schema.marks.link));
+ const { tr, schema, selection } = this.view.state;
+ const extension = this.linkExtend(selection.$anchor, href);
+ this.view.dispatch(tr.removeMark(extension.from, extension.to, schema.marks.link));
}
}
}