GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.36k stars 4.05k forks source link

[Bug] its not possible to make part of H1 non-bold #2878

Closed fedulovivan closed 4 years ago

fedulovivan commented 4 years ago

Steps:

Expected:

Actual:

Those steps above are for CKE editor, which is now enabled on newsletter demo.

For built-in editor behaviour is a bit different: Selected word is changing its style to non-bold while the editing is activated. Generated html is also contains correct styles. But canvas renders it as bold again, once editing of H1 is finished.

See demo: making-non-bold-title

robsonsobral commented 4 years ago

This looks like a flaw of logic to me. <Hn> elements aren't bold, but titles. As you mentioned, even the browser native execCommand, used on built-in editor, doesn't know what to do.

@fedulovivan, do you have a suggestion of a possible HTML markup for the situation?

fedulovivan commented 4 years ago

Hi, @robsonsobral An html, generated by built-in RTE is correct: Original: <h1>Insert title here</h1> After making word "title" non-bold: <h1>Insert <span style="font-weight: normal">title</span> here</h1>

The problem is it's not rendered properly on the canvas. The whole text remains bold.

robsonsobral commented 4 years ago

I dig a little into this. After the blur event, the markup changes from <span style="font-weight: normal">title</span> to <span data-gjs-type="default"><span data-gjs-type="text">title </span></span>. If I try again, it becomes <span data-gjs-type="default"><span data-gjs-type="default"><span data-gjs-type="text">title </span></span></span>.

It's hard to have a simple, but functional built-in editor other than markdown.

I couldn't reproduce the error on the newsletter demo. It worked fine.

fedulovivan commented 4 years ago

Provided steps are reproducible for me on newsletter demo on macos 10.14.5 on four different browsers:

For chrome html markup right from canvas:

Markup and CKE behaviour are correct. Looks like this is styling issue only.

artf commented 4 years ago

I'm not sure it's something fixable on our side. It's more like CKE behavior which doesn't see <h1> as a bold element. I'd close this for now, but I welcome to hear good workarounds/fixes