aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-12-10 18:47:27 -0500
committerBob Zeleznik <zzzman@gmail.com>2019-12-10 18:47:27 -0500
commit4ab742c54d600fb62b02268f48e711258558924b (patch)
treefbda9419f1941097d935c035f67a19470f807587
parent65c7ce1c6be70f28e1be57e369cf15bc2df7d729 (diff)
fixes to color marks
-rw-r--r--src/client/util/RichTextSchema.tsx2
-rw-r--r--src/client/util/TooltipTextMenu.tsx6
2 files changed, 5 insertions, 3 deletions
diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx
index 7cb8448ca..4369be1ee 100644
--- a/src/client/util/RichTextSchema.tsx
+++ b/src/client/util/RichTextSchema.tsx
@@ -313,7 +313,7 @@ export const marks: { [index: string]: MarkSpec } = {
attrs: {
color: { default: "#000" }
},
- inclusive: false,
+ inclusive: true,
parseDOM: [{
tag: "span", getAttrs(dom: any) {
return { color: dom.getAttribute("color") };
diff --git a/src/client/util/TooltipTextMenu.tsx b/src/client/util/TooltipTextMenu.tsx
index 01d566831..f29dbf2e4 100644
--- a/src/client/util/TooltipTextMenu.tsx
+++ b/src/client/util/TooltipTextMenu.tsx
@@ -839,9 +839,11 @@ export class TooltipTextMenu {
}
public static insertColor(color: String, state: EditorState<any>, dispatch: any) {
- if (state.selection.empty) return false;
-
const colorMark = state.schema.mark(state.schema.marks.pFontColor, { color: color });
+ if (state.selection.empty) {
+ dispatch(state.tr.addStoredMark(colorMark));
+ return false;
+ }
dispatch(state.tr.addMark(state.selection.from, state.selection.to, colorMark));
}