aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-12-10 23:27:55 -0500
committerBob Zeleznik <zzzman@gmail.com>2019-12-10 23:27:55 -0500
commit921554d7d585a1138c7cf8d02d1e46f47c7cafe7 (patch)
treebf462a91db4282e5c0f7d8184317f3c28f7b827c /src
parent8a5b1332ec6c01b7caf14355e76980ab7afe71ba (diff)
added indenting for ordered lists
Diffstat (limited to 'src')
-rw-r--r--src/client/util/RichTextRules.ts4
-rw-r--r--src/client/util/RichTextSchema.tsx5
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}` }];
}
},