From 237b5f67733b25686b825573298818f3ea443876 Mon Sep 17 00:00:00 2001 From: bob Date: Mon, 26 Aug 2019 17:42:19 -0400 Subject: try another branch --- src/client/util/RichTextSchema.tsx | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/client/util/RichTextSchema.tsx') diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx index f128162c2..6e3d9ab77 100644 --- a/src/client/util/RichTextSchema.tsx +++ b/src/client/util/RichTextSchema.tsx @@ -178,6 +178,14 @@ export const nodes: { [index: string]: NodeSpec } = { bulletStyle: { default: "decimal" }, }, toDOM(node: Node) { + let first = node.firstChild; + while (first) { + if (first.marks.find((m) => m.type === schema.marks.mbulletType)) { + let x = first.marks.find((m) => m.type === schema.marks.mbulletType); + return ['ol', { style: `list-style: ${(x as any).attrs.bulletType}` }, 0] + } + first = first.firstChild; + } return ['ol', { style: `list-style: ${node.attrs.bulletStyle}` }, 0] } }, @@ -319,13 +327,15 @@ export const marks: { [index: string]: MarkSpec } = { toDOM: () => ['sup'] }, - malphabet_list: { - }, - mcap_alphabet_list: { - }, - mroman_list: { - }, - mo_list: { + mbulletType: { + attrs: { + bulletType: { default: "decimal" } + }, + toDOM(node: any) { + return ['span', { + style: `background: ${node.attrs.bulletType == "decimal" ? "yellow" : node.attrs.bulletType === "upper-alpha" ? "blue" : "green"}` + }]; + } }, highlight: { -- cgit v1.2.3-70-g09d2