diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/util/RichTextRules.ts | 4 | ||||
-rw-r--r-- | src/client/util/RichTextSchema.tsx | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/client/util/RichTextRules.ts b/src/client/util/RichTextRules.ts index c69112b3b..ba2bc785d 100644 --- a/src/client/util/RichTextRules.ts +++ b/src/client/util/RichTextRules.ts @@ -149,6 +149,10 @@ export const inpRules = { (state, match, start, end) => { if (state.selection.to === state.selection.from) return null; const pos = (state.doc.resolve(start) as any); + if (state.selection instanceof NodeSelection && (state.selection as NodeSelection).node.type === schema.nodes.ordered_list) { + let node = (state.selection as NodeSelection).node; + return state.tr.setNodeMarkup(pos.pos, node.type, { ...node.attrs, indent: 30 }); + } let depth = pos.path.length / 3 - 1; for (; depth >= 0; depth--) { if (pos.node(depth).type === schema.nodes.paragraph) { diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx index c6314bc30..f9251fb7e 100644 --- a/src/client/util/RichTextSchema.tsx +++ b/src/client/util/RichTextSchema.tsx @@ -229,14 +229,15 @@ export const nodes: { [index: string]: NodeSpec } = { setFontSize: { default: undefined }, setFontFamily: { default: "inherit" }, inheritedFontSize: { default: undefined }, - visibility: { default: true } + visibility: { default: true }, + indent: { default: undefined } }, toDOM(node: Node<any>) { if (node.attrs.mapStyle === "bullet") return ['ul', 0]; const map = node.attrs.bulletStyle ? node.attrs.mapStyle + node.attrs.bulletStyle : ""; const fsize = node.attrs.setFontSize ? node.attrs.setFontSize : node.attrs.inheritedFontSize; const ffam = node.attrs.setFontFamily; - return node.attrs.visibility ? ['ol', { class: `${map}-ol`, style: `list-style: none; font-size: ${fsize}; font-family: ${ffam}` }, 0] : + return node.attrs.visibility ? ['ol', { class: `${map}-ol`, style: `list-style: none; font-size: ${fsize}; font-family: ${ffam}; margin-left: ${node.attrs.indent}` }, 0] : ['ol', { class: `${map}-ol`, style: `list-style: none; font-size: ${fsize}; font-family: ${ffam}` }]; } }, |