Open thibaudcolas opened 6 years ago
I think this needs to be done with the controls
API / prop (https://www.draftail.org/docs/arbitrary-controls), using ToolbarButton
to add a button to the toolbar.
Then, the fun bit of the task is to figure out how to dedent/indent content when the user clicks the button.
Draftail's docs mentions using the tab key to indent a paragraph "if enabled". This does not seem to work for me on my mac. I tried in the examples on Draftail's site, my wagtail site, on 2 different macs and on Safari and Chrome.
Are you referring to indenting a paragraph? e.g. what happens when you press "tab" in front of text in a word document, right?
If you’re referring to https://www.draftail.org/docs/keyboard-shortcuts, it says "Increase list indentation". This is only for list items, where the indentation in the editor denotes the list nesting in HTML.
Only available as a keyboard shortcut at the moment. Applies to blocks that have a notion of depth – list items only at the moment.
This could be built as an example / extension, using the controls API, instead of something that’s built-in. It would be nice to have this as a demo directly in the repo though.
Here is how it would work roughly:
controls
API.getEditorState
prop of the controleditorState.getSelection()
)depth
.Initially reported at https://github.com/springload/wagtaildraftail/issues/49 by @tomdyson.