aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/RichTextSchema.tsx
diff options
context:
space:
mode:
authorFawn <fangrui_tong@brown.edu>2019-10-12 17:18:58 -0400
committerFawn <fangrui_tong@brown.edu>2019-10-12 17:18:58 -0400
commite8095539c208169b1883e8e73686382d8d8c6336 (patch)
tree1ba21677f34b92b7232f59becdc35a8e41a59d83 /src/client/util/RichTextSchema.tsx
parent1b0f0e5e434bc23128b50303ffc2b13244ba6325 (diff)
created color picker for text on rich text menu
Diffstat (limited to 'src/client/util/RichTextSchema.tsx')
-rw-r--r--src/client/util/RichTextSchema.tsx18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx
index a5502577b..e943b71e8 100644
--- a/src/client/util/RichTextSchema.tsx
+++ b/src/client/util/RichTextSchema.tsx
@@ -308,6 +308,24 @@ export const marks: { [index: string]: MarkSpec } = {
}
},
+ // :: MarkSpec Coloring on text. Has `color` attribute that defined the color of the marked text.
+ color: {
+ attrs: {
+ color: { default: "#000" }
+ },
+ inclusive: false,
+ parseDOM: [{
+ tag: "span", getAttrs(dom: any) {
+ return { color: dom.getAttribute("color") };
+ }
+ }],
+ toDOM(node: any) {
+ return node.attrs.color ? ['span', { style: 'color:' + node.attrs.color }] : ['span', { style: 'color: black' }];
+ // ["div", ["span", `"`], ["span", 0], ["span", `"`], ["br"], ["a", { ...node.attrs, class: "prosemirror-attribution" }, node.attrs.title], ["br"]] :
+ // ["a", { ...node.attrs }, 0];
+ }
+ },
+
// :: MarkSpec An emphasis mark. Rendered as an `<em>` element.
// Has parse rules that also match `<i>` and `font-style: italic`.
em: {