react-draft-wysiwyg icon indicating copy to clipboard operation
react-draft-wysiwyg copied to clipboard

Allow indenting text

Open jpuri opened this issue 7 years ago • 15 comments

jpuri avatar Sep 27 '17 17:09 jpuri

Looking forward to update the function。

belief-cyf avatar Sep 29 '17 01:09 belief-cyf

I've started looking into implementing this, and DraftJS doesn't support indenting outside of lists:

Note that there is currently no support for handling depth for blocks of any type except 'ordered-list-item' and 'unordered-list-item'. https://draftjs.org/docs/advanced-topics-nested-lists.html#content

One workaround I'm considering is inserting a series of &nbsp at the beginning of the line. That feels hacky, but I don't know much about DraftJS internals so I don't know if it's not supported because it's hard or if they just haven't implemented it yet.

dpetranek avatar Oct 06 '17 14:10 dpetranek

In my opinion this can be done like I have done text alignment, by adding a block level metadata and then using it to style the block.

jpuri avatar Oct 06 '17 17:10 jpuri

The inserting spaces approach I just tried is woefully insufficient.

It looks like a proper discussion of the issue is happening here: https://github.com/facebook/draft-js/issues/887.

dpetranek avatar Oct 06 '17 18:10 dpetranek

Yep would be great to have block level inline styles.

jpuri avatar Oct 06 '17 18:10 jpuri

@jpuri In the metadata approach, how does the metadata get used to apply a style? I see where it's added but not where you use it to apply a style.

dpetranek avatar Oct 06 '17 19:10 dpetranek

has the indentation supported yet? i still cannot use it on the demo page, work only on list .

gjulivan avatar Apr 04 '18 05:04 gjulivan

Hi, I am also curious about the current state. It seems that dpetraneks changes got merged, but I couldnt find any of his commits in the current master branch? By intention or did something go wrong? Thanks

whylow avatar Apr 18 '18 08:04 whylow

Sorry guys dpetraneks's changes have been merged but the release got delayed. Some of relates libs draftjs-to-html, html-to-draftjs. Are required to be updated for that. I will try to make it sooner.

jpuri avatar Apr 19 '18 13:04 jpuri

Is it supported now?

dexterjohncaones avatar Sep 14 '18 01:09 dexterjohncaones

Is it supported now?

lhammond avatar Dec 04 '18 16:12 lhammond

Sorry guys dpetraneks's changes have been merged but the release got delayed. Some of relates libs draftjs-to-html, html-to-draftjs. Are required to be updated for that. I will try to make it sooner.

Hi, any news about dynamic inline style changes approach? Like, if I need to change font-size from 10 to 200 - I really can't make too lot of combinations of predefined customStyleMaps.

strangedk avatar Jul 04 '19 06:07 strangedk

Still no news about this? ^^

MamorukunBE avatar Apr 01 '22 19:04 MamorukunBE

@MamorukunBE do you know how to make it work on a list? It is meant to work on a list but don't see how. Thanks!

aurelieuno avatar May 04 '22 16:05 aurelieuno

At my end, rendering customs blocks permitted me to indent text in <p> but also in <li>. Without the code in front of me (just woke up), when rendering a <li> ([un]ordered-list-item), I wrap its content into a indented span, as simple as that :)

MamorukunBE avatar May 05 '22 05:05 MamorukunBE