PANmedia / raptor-editor

Raptor, an HTML5 WYSIWYG content editor!
www.raptor-editor.com
GNU General Public License v3.0
533 stars 136 forks source link

Raptor add "style" attributes to span inside <p> #122

Open HugoHeneault opened 10 years ago

HugoHeneault commented 10 years ago

I have some paragraphs edited by raptor with this css properties :

font-family: inherit;
font-weight: normal;
font-size: 1em;
line-height: 1.6;

On start, source is :

<p><strong class="cms-bold"><a href="#">Link</a></strong></p>
<p><a href="#">Second link</a></p>
<p><br></p>

When I remove the line return between the 2 paragraphs, source becomes

<p><strong class="cms-bold"><a href="#">Link</a></strong><a href="#" style="font-family: inherit; font-size: 1em; line-height: 1.6;">Second link</a></p>
<p><br></p>

But why is it some style="font-family: inherit; font-size: 1em; line-height: 1.6;" added ?

Petah commented 10 years ago

This is a browser bug, and its not easy to work around (I've tried).

https://bugs.webkit.org/show_bug.cgi?id=114791 https://code.google.com/p/chromium/issues/detail?id=226941

I will have another look if time allows.

HugoHeneault commented 10 years ago

I see. It could be interesting to look how TinyMCE handle it. They don't seem to have this bug.

It look like there's some changes on chromium's issue. On Nov 17, a chromium contributor add a label to the bug report.

Petah commented 10 years ago

I have looked at how TinyMCE have dealt with it. Almost 1000 SLOC (lines of code) totally incompatible with Raptor (reliant of TinyMCE API).

http://www.tinymce.com/develop/bugtracker_view.php?id=5641 https://github.com/tinymce/tinymce/blob/113bd1ceaef1e1de5f2fdf54633d58424817182c/jscripts/tiny_mce/classes/util/Quirks.js

CK also has reported the issue, and AFAIK still have not fixed it. http://dev.ckeditor.com/ticket/9998

So if I get time I will try to implement something similar, otherwise given that Google and Apple have confirmed the bug, I hope they will fix it on their end so I don't have to.

I know it is a pretty big issue, but I need to spend a significant amount of time to deal with it.

HugoHeneault commented 10 years ago

I will use Firefox for now. Hope a fix will come soon from Google and Apple.

HugoHeneault commented 10 years ago

There's only two functions that fix this bug in TinyMCE : keepInlineElementOnDeleteBackspace() and cleanupStylesWhenDeleting()

(in case of Google and Apple are very slow...)

HugoHeneault commented 10 years ago

Even if it's a browser-side issue, I think this must be fixed on raptor-side. Because if user has an old chrome or safari, he will definitively break its content with no possibility to fix it later with another browser (if he doesn't know any HTML things).

If I have some time I'll try to have a look in converting TinyMCE's fixes next week.

Petah commented 10 years ago

I agree.

HugoHeneault commented 10 years ago

If I want to run the tests, how can I do that ? Is it still possible to build raptor by myself ? :)

Petah commented 10 years ago

You don't need to build Raptor to run the tests. And I have changed the build process about 1-2 months ago, so I will have to push an update to do it. It requires NodeJS, NPM, and a SCSS compiler. Ill see if I can get a tutorial up tomorrow.

HugoHeneault commented 10 years ago

I already have it. I'm waiting for your tutorial. :) Thanks.

HugoHeneault commented 10 years ago

Hello,

I don't have time to work on this for now, and because of the lack of support for some critical elements for Raptor, we are moving to TinyMCE, which is, unfortunately, less sexy and doesn't have some very interesting features (docking, for example), but is really more stable for content editing (Raptor is, for me, still in beta).

I understand you don't have time for now to fix submited issue, but I need more stability right now for my CMS. So, I hope you guys will find time and money (of course) to fix things. Raptor could the best WYSIWYG editor. You've got a great idea ! But there's still some work to do. :)

Petah commented 10 years ago

Thats a shame. But understandable.

Petah commented 10 years ago

Took me long enough, but here is the new build process https://github.com/PANmedia/raptor-editor/wiki/Building-and-Running-from-Source