-
Notifications
You must be signed in to change notification settings - Fork 42
Inline styles applied with something other than markdown shortcut are lost after a single letter #122
Comments
I think 935fe75 is the culprit, which I'm sure you have already figured out as the author, haha. Probably takes longer for me to sort through everything. I wonder if there's some way to get the best of both worlds here... |
Here's a possible solution that might be a terrible idea but I'll just write it down in case it's not terrible. Markdown shortcut applied styles are updated to be complex inline styles keyed with 🙊 oh gosh that's probably too complicated of a solution, hopefully someone else has a smart idea 🤓 |
Huh, I didn't even know you could press CMD+B to make things bold. How do you stop making things bold and where is that shortcut coming from? |
Yeah that could work, would just require a lot of internal hacking around and would probably break integration with some other plugins. 🤔 Maybe we can override CMD+B to not only make things bold but also disable |
There's a bunch of shortcuts and then we'll encounter the same issue when pressing toolbar buttons if a user has any kind of tool bar in place :( but I agree my suggestion is too complicated too. |
Re: your question, the cmd b etc is something you have to implement, but draft does make it easy to add https://draftjs.org/docs/api-reference-rich-utils.html |
If an elegant solution is tricky to find, in the interim is there any possibility we could add an option to disable the One other possible solution I thought of is always adding an additional |
@Rosey @mxstbr I think the best solution will be to use custom change type here https://github.com/withspectrum/draft-js-markdown-plugin/blob/master/src/modifiers/handleInlineStyle.js#L64 (the place where we convert chars sequence to text with inline style) and unstick styles only if current state was modified with that custom type change. Will make a PR for it |
Just run into this problem when using this plugin. Are there any known workarounds or plans to resolve this issue? |
Just testing this on the spectrum.chat site:
Expected result: Text is bold from the time you cmd-b until ... forever, unless you press cmd-b again.
Actual result: The first letter you type after cmd-b will be bold but all subsequent letters will revert to unstyled.
The text was updated successfully, but these errors were encountered: