question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onTab only works with ordered/unordered list block types

See original GitHub issue

Do you want to request a feature or report a bug?

I guess a feature request, more like a minor behaviour change.

In short: onTab is hard-coded on only work with unordered-list-item & ordered-list-item block types. I’d like to change the API to allow for that set to be customised.

What is the current behavior?

https://github.com/facebook/draft-js/blob/master/src/model/modifier/RichTextEditorUtil.js#L207

Currently RichUtils.onTab limited to only work with unordered-list-item & ordered-list-item block types.

What is the expected behavior?

I’d like to canvas opinion on adding an acceptedTypes = ['unordered-list-item', 'ordered-list-item'] argument to onTab.

Why? I’m adding support for checklists (similar to Githubs) which are implemented using a custom block renderer component. Surprisingly if you use the Github markdown syntax - [ ] it mostly works, it needs a a bit of styling tweaks.

Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js?

All as far as I can tell. No blaming the line this statement has been there since the project was open sourced.


Happy to submit a PR but wanted to gauge opinion first before committing. Will try to find another way around the problem if not.

PS. Great project we make huge use of it at Hugo!

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
niveditccommented, Sep 9, 2018

@andrewbranch - we’re switching to new maintainers internally and I’m one of them. It’s still a side project for us and we’re leaning on the safe side to make sure that any PRs pulled in don’t break the project + production Facebook (which uses it heavily).

We had a meeting on Friday, and I will be posting meeting notes on Monday that will hopefully give the community a bit more clarity. I’ll also post a link to those on the discussion in #1193.

I’m probably not going to get a chance to look into #1811 until next weekend at the earliest since I’m signing off for today & will probably need to test that PR on our stack before merging 😃

0reactions
andrewbranchcommented, Sep 8, 2018

Cool! Given the discussion in #1193 and my own experience in #1811, I didn’t think this project was really accepting any non-trivial changes at this point. Good to hear though!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lists in HTML documents
Ordered and unordered lists are rendered in an identical manner except that visual user agents number ordered list items. User agents may present...
Read more >
List Block – WordPress.org Forums
The List Block unordered list option in the Toolbar. An unordered list typically is a bulleted list of items. You can use unordered...
Read more >
<li>: The List Item element - HTML: HyperText Markup Language
The HTML element is used to represent an item in a list. It must be contained in a parent element: an ordered list...
Read more >
HTML Unordered Lists - W3Schools
An unordered list starts with the <ul> tag. Each list item starts with the <li> tag. The list items will be marked with...
Read more >
The Complete Guide to the Gutenberg List Block
The list block is a simple, text-only block for adding bulleted or numbered lists. It's sole purpose is for displaying content in a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found