Skip to content

Commit b53fd1b

Browse files
committed
Support lists*
1 parent 686ca52 commit b53fd1b

2 files changed

Lines changed: 52 additions & 1 deletion

File tree

django_prose_editor/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ def process_node_class(config, shared_config):
170170
"tableCell": ["td", "th"],
171171
"tableHeader": ["th"],
172172
"listItem": ["li"],
173+
"bulletList": ["ul"],
174+
"orderedList": ["ol"],
173175
"blockquote": ["blockquote"],
174176
"codeBlock": ["pre"],
175177
}

docs/nodeclass.rst

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@ To use the NodeClass extension, configure it with CSS classes organized by node
5555
"section-title",
5656
{"className": "accent", "title": "Accent Heading"}
5757
]
58+
},
59+
"bulletList": {
60+
"title": "List",
61+
"cssClasses": [
62+
"checklist",
63+
"no-bullets",
64+
{"className": "spaced", "title": "Spaced List"}
65+
]
66+
},
67+
"orderedList": {
68+
"title": "Numbered List",
69+
"cssClasses": [
70+
"alpha",
71+
"roman",
72+
{"className": "outline", "title": "Outline Style"}
73+
]
5874
}
5975
}
6076
}
@@ -75,7 +91,9 @@ For simpler use cases, you can still use the array format without custom titles:
7591
"cssClasses": {
7692
"paragraph": ["highlight", "callout", "centered"],
7793
"table": ["bordered", "striped", "compact"],
78-
"tableCell": ["centered", "right-aligned", "numeric"]
94+
"tableCell": ["centered", "right-aligned", "numeric"],
95+
"bulletList": ["checklist", "no-bullets", "spaced"],
96+
"orderedList": ["alpha", "roman", "outline"]
7997
}
8098
}
8199
}
@@ -125,6 +143,8 @@ The following node types are supported for CSS class application:
125143
- **tableRow**: Table rows (``<tr>``)
126144
- **heading**: Heading elements (``<h1>``-``<h6>``)
127145
- **listItem**: List items (``<li>``)
146+
- **bulletList**: Unordered lists (``<ul>``)
147+
- **orderedList**: Ordered lists (``<ol>``)
128148
- **blockquote**: Blockquote elements (``<blockquote>``)
129149
- **codeBlock**: Code block elements (``<pre>``)
130150

@@ -268,6 +288,35 @@ Define CSS rules in your stylesheet to style the configured classes:
268288
padding-left: 1rem;
269289
}
270290
291+
/* List classes */
292+
.ProseMirror ul.checklist {
293+
list-style: none;
294+
padding-left: 1.5rem;
295+
}
296+
297+
.ProseMirror ul.checklist li:before {
298+
content: "";
299+
margin-right: 0.5rem;
300+
}
301+
302+
.ProseMirror ul.no-bullets {
303+
list-style: none;
304+
padding-left: 1rem;
305+
}
306+
307+
.ProseMirror ol.alpha {
308+
list-style-type: lower-alpha;
309+
}
310+
311+
.ProseMirror ol.roman {
312+
list-style-type: lower-roman;
313+
}
314+
315+
.ProseMirror .spaced li,
316+
.ProseMirror .outline li {
317+
margin-bottom: 0.5rem;
318+
}
319+
271320
Example Use Cases
272321
-----------------
273322

0 commit comments

Comments
 (0)