aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/RichTextSchema.tsx
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-08-27 10:16:21 -0400
committerbob <bcz@cs.brown.edu>2019-08-27 10:16:21 -0400
commitd31999dd3fce11a886bd402c27f34c35c7c85935 (patch)
tree24026569304f6fb4b3c05f09d5423e78b2b2f5e4 /src/client/util/RichTextSchema.tsx
parent074961d68788d2d19b6bfbcc9b95712a7b3940eb (diff)
mostly working. some glitches though.
Diffstat (limited to 'src/client/util/RichTextSchema.tsx')
-rw-r--r--src/client/util/RichTextSchema.tsx17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx
index 655edb68a..2df49d8a4 100644
--- a/src/client/util/RichTextSchema.tsx
+++ b/src/client/util/RichTextSchema.tsx
@@ -178,10 +178,9 @@ export const nodes: { [index: string]: NodeSpec } = {
bulletStyle: { default: "decimal" },
},
toDOM(node: Node<any>) {
- (node.content as any).content.map((x: any) => x.type.attrs.className = node.attrs.bulletStyle);
- let fsize = node.attrs.bulletStyle === "decimal" ? 24 : node.attrs.bulletStyle === "upper-alpha" ? 18 : node.attrs.bulletStyle === "lower-roman" ? 14 : 10;
- return ['ol', { class: `${node.attrs.bulletStyle}-ol`, style: `list-style: none; font-size: ${fsize}` }, 0]
- //return ['ol', { class: `${node.attrs.bulletStyle}`, style: `list-style: ${node.attrs.bulletStyle}; font-size: ${fsize}` }, 0]
+ for (let i = 0; i < node.childCount; i++) node.child(i).attrs.className = node.attrs.bulletStyle;
+ return ['ol', { class: `${node.attrs.bulletStyle}-ol`, style: `list-style: none;` }, 0]
+ //return ['ol', { class: `${node.attrs.bulletStyle}`, style: `list-style: ${node.attrs.bulletStyle};`, 0]
}
},
//this doesn't currently work for some reason
@@ -210,15 +209,7 @@ export const nodes: { [index: string]: NodeSpec } = {
...listItem,
content: 'paragraph block*',
toDOM(node: any) {
- let first = node.firstChild;
- while (first) {
- if (first.marks.find((m: any) => m.type === schema.marks.mbulletType)) {
- let x = first.marks.find((m: any) => m.type === schema.marks.mbulletType);
- return ["li", { class: "XXX" }, 0];
- }
- first = first.firstChild;
- }
- return ["li", { class: node.type.attrs.className }, 0];
+ return ["li", { class: node.attrs.className }, 0];
}
},
};