how to got multi-line ordered-list or bullet-list #1132
Replies: 2 comments 1 reply
-
I'm trying to use export const customWrapBulletCommand = $command('CustomWrapBullet', ctx => () => {
return wrapIn(listItemSchema.type(ctx), { listType: 'bullet' })
}) |
Beta Was this translation helpful? Give feedback.
-
The prosemirror basic example (https://prosemirror.net/examples/basic/) has this functionality. I tried to discover the difference between the implementations. It turns out that the milkdown commands If you create your own alternative commands from the correct prosemirror one, the new commands work perfectly to set 1 list item per selected p! import {Editor} from '@milkdown/core';
import {commonmark, bulletListSchema, orderedListSchema} from '@milkdown/preset-commonmark';
import {gfm} from '@milkdown/preset-gfm';
import {wrapInList} from "@milkdown/prose/schema-list";
import {$command} from '@milkdown/utils';
export const bulletWrapCommand = $command('BulletListWrap', (ctx) => () => wrapInList(bulletListSchema.type(ctx)));
export const orderWrapCommand = $command('OrderedListWrap', (ctx) => () => wrapInList(orderedListSchema.type(ctx)));
const editor = Editor
.make()
.config((ctx) => {
[...]
})
.use([commonmark, gfm])
.use([bulletWrapCommand, orderWrapCommand])
.create() |
Beta Was this translation helpful? Give feedback.
-
When we type three lines of text and select ordered-list or bullet-list, we only got one list, and we can't remove the list
Can we do it like github?
iShot_2023-09-28_16.38.42.mp4
iShot_2023-09-28_16.36.50.mp4
Beta Was this translation helpful? Give feedback.
All reactions