diff options
author | Fawn <fangrui_tong@brown.edu> | 2019-10-23 22:22:34 -0400 |
---|---|---|
committer | Fawn <fangrui_tong@brown.edu> | 2019-10-23 22:22:34 -0400 |
commit | bd817ac118c53845c882b89c4b8a110dc8fe10c2 (patch) | |
tree | 669b3aeb4daac0e7419473f17c9e1e010ad0f934 /src/client/util/RichTextSchema.tsx | |
parent | 43b09cb2aded66e67006d99e544d90637a62c048 (diff) |
added dropdown to highlighter tool to choose colors
Diffstat (limited to 'src/client/util/RichTextSchema.tsx')
-rw-r--r-- | src/client/util/RichTextSchema.tsx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx index e943b71e8..22756be24 100644 --- a/src/client/util/RichTextSchema.tsx +++ b/src/client/util/RichTextSchema.tsx @@ -321,8 +321,21 @@ export const marks: { [index: string]: MarkSpec } = { }], 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]; + } + }, + + highlight2: { + attrs: { + highlight: { default: "transparent" } + }, + inclusive: false, + parseDOM: [{ + tag: "span", getAttrs(dom: any) { + return { highlight: dom.getAttribute("backgroundColor") }; + } + }], + toDOM(node: any) { + return node.attrs.highlight ? ['span', { style: 'background-color:' + node.attrs.highlight }] : ['span', { style: 'background-color: transparent' }]; } }, |