aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-08-27 10:27:50 -0400
committerbob <bcz@cs.brown.edu>2019-08-27 10:27:50 -0400
commit2b1035aa307a0cea6076030822cd5bb3c9793fb4 (patch)
treedb41afd8c5e17d58b89f69fb5a8b35c2d3e66b98
parentd31999dd3fce11a886bd402c27f34c35c7c85935 (diff)
last refinements for now.
-rw-r--r--src/client/util/ProsemirrorExampleTransfer.ts8
-rw-r--r--src/client/util/RichTextSchema.tsx9
2 files changed, 13 insertions, 4 deletions
diff --git a/src/client/util/ProsemirrorExampleTransfer.ts b/src/client/util/ProsemirrorExampleTransfer.ts
index 4ca19eff1..8b6936748 100644
--- a/src/client/util/ProsemirrorExampleTransfer.ts
+++ b/src/client/util/ProsemirrorExampleTransfer.ts
@@ -104,6 +104,14 @@ export default function buildKeymap<S extends Schema<any>>(schema: S, mapKeys?:
let sxf = state.tr.setSelection(TextSelection.create(state.doc, range!.start, range!.end));
let newstate = state.applyTransaction(sxf);
if (!wrapInList(schema.nodes.ordered_list)(newstate.state, (tx2: Transaction) => {
+ const resolvedPos = tx2.doc.resolve(Math.round((range!.start + range!.end) / 2));
+ let path = (resolvedPos as any).path as any;
+ for (let i = path.length - 1; i > 0; i--) {
+ if (path[i].type === schema.nodes.ordered_list) {
+ path[i].attrs.bulletStyle = nodeTypeMark(depth);
+ break;
+ }
+ }
marks && tx2.ensureMarks([...marks]);
marks && tx2.setStoredMarks([...marks]);
diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx
index 2df49d8a4..bbced3b77 100644
--- a/src/client/util/RichTextSchema.tsx
+++ b/src/client/util/RichTextSchema.tsx
@@ -175,7 +175,7 @@ export const nodes: { [index: string]: NodeSpec } = {
content: 'list_item+',
group: 'block',
attrs: {
- bulletStyle: { default: "decimal" },
+ bulletStyle: { default: "" },
},
toDOM(node: Node<any>) {
for (let i = 0; i < node.childCount; i++) node.child(i).attrs.className = node.attrs.bulletStyle;
@@ -189,9 +189,10 @@ export const nodes: { [index: string]: NodeSpec } = {
content: 'list_item+',
group: 'block',
// parseDOM: [{ tag: "ul" }, { style: 'list-style-type=disc' }],
- // toDOM() { return ['ol', {
- // style: 'list-type: hebrew'
- // }] }
+ toDOM(node: Node<any>) {
+ for (let i = 0; i < node.childCount; i++) node.child(i).attrs.className = "";
+ return ['ul', 0]
+ }
},
//bullet_list: {