Posts: 188
Threads: 19
Joined: Dec 2013
Reputation:
11
2015-10-11, 04:49 PM
(This post was last modified: 2015-10-11, 04:52 PM by Snake_.)
Hi,
For some time now users reporting to me bug in editor. For example: if first select (ex. font-size), then again change this font - it not change BBCode, but adding next.
GIF presents:
It's hard to do with so many modify tags on tapatalk for example...
Posts: 5,525
Threads: 73
Joined: Feb 2012
Reputation:
582
This specific case looks like a bug on our end indeed, since it seems to works fine on http://www.sceditor.com/
It applies only to the [/size] tag, so I guess it's connected with our custom BBCode: https://github.com/mybb/mybb/blob/featur...s#L77-L165
Posts: 494
Threads: 82
Joined: Dec 2012
Reputation:
50
Hi,
Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.
Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/2228
Thanks for contributing to MyBB!
Regards,
The MyBB Group
Posts: 3
Threads: 1
Joined: Mar 2016
Reputation:
2
Hi,
This happens because at https://github.com/mybb/mybb/blob/featur...ceditor.js, line 146, you have:
editor.wysiwygEditorInsertHtml('<span data-scefontsize=' + sizes[fontSize-1] + ' style="font-size:' + sizes[fontSize-1] + '">', '</span>');
Instead of the above, you should use :
editor.execCommand('fontsize', desired-value-here);
Using this way, it would not add extra unnecessary spans.
Of course it would create <font .. instead, but using jquery you can change it to span.
Posts: 2,512
Threads: 122
Joined: Jul 2011
Reputation:
289
(2016-03-06, 10:47 AM)mkm87 Wrote: Hi,
This happens because at https://github.com/mybb/mybb/blob/featur...ceditor.js, line 146, you have:
editor.wysiwygEditorInsertHtml('<span data-scefontsize=' + sizes[fontSize-1] + ' style="font-size:' + sizes[fontSize-1] + '">', '</span>');
Instead of the above, you should use :
editor.execCommand('fontsize', desired-value-here); Using this way, it would not add extra unnecessary spans.
Of course it would create <font .. instead, but using jquery you can change it to span.
i tried made something like in 13/10/2015 https://github.com/mybb/mybb/pull/2229/files
but cause others bugs. And i tried understand core file of sceditor, but i not find anything. I not know what code in core that result in font tag.
Posts: 3
Threads: 1
Joined: Mar 2016
Reputation:
2
(2016-03-06, 03:27 PM)martec Wrote: i tried made something like in 13/10/2015 https://github.com/mybb/mybb/pull/2229/files
but cause others bugs. And i tried understand core file of sceditor, but i not find anything. I not know what code in core that result in font tag.
The code that result in font tag is:
editor.execCommand('fontsize' ...
https://developer.mozilla.org/en-US/docs...xecCommand -> fontSize
I've spent/wasted a whole afternoon to try to understand how it works too, and it was this method.
If you don't use execCommand, but <span.. instead, it will add additional <span.. tags if you re-apply, which is something unwanted.
I do not use neither Mybb nor the sceditor's font-size default command so i can't help you right now with the bugs. Instead i use pixels as font-size, which i've posted here:
http://community.mybb.com/thread-189611.html
Maybe that code can help you fix it.
Posts: 2,512
Threads: 122
Joined: Jul 2011
Reputation:
289
2016-03-06, 09:23 PM
(This post was last modified: 2016-03-07, 03:28 AM by martec.)
(2016-03-06, 04:42 PM)mkm87 Wrote: The code that result in font tag is:
editor.execCommand('fontsize' ...
https://developer.mozilla.org/en-US/docs...xecCommand -> fontSize
I've spent/wasted a whole afternoon to try to understand how it works too, and it was this method.
If you don't use execCommand, but <span.. instead, it will add additional <span.. tags if you re-apply, which is something unwanted.
I do not use neither Mybb nor the sceditor's font-size default command so i can't help you right now with the bugs. Instead i use pixels as font-size, which i've posted here:
http://community.mybb.com/thread-189611.html
Maybe that code can help you fix it.
i thought that execCommand it was internal command, but appear that not. thanks for unravel the mystery.
and i not know if this bug persist https://bugzilla.mozilla.org/show_bug.cgi?id=763859 , if not document.execCommand('styleWithCSS',false,true); is fix for this.
EDIT: i tested here. Yes editor.execCommand('styleWithCSS', true); is solution for this. But only work in webkit/Blink. Not work in Gecko (FF).
EDIT2: This really not fault or bug of SCEditor. I check here Redactor, and Redactor too add font tag, this happen why browser (FF, Edge etc...) not respect styleWithCSS. So what solution that xenforo used for this?
Xenforo use css to "fix" this.
Some like this:
font[size="6"] {
font-size: 22px;
}
So solution is use font tag in SCEditor and make correction using css like xenforo.
Posts: 5,525
Threads: 73
Joined: Feb 2012
Reputation:
582
Feel free to edit your PR with that solution
Posts: 2,512
Threads: 122
Joined: Jul 2011
Reputation:
289
(2016-03-07, 05:22 PM)Destroy666 Wrote: Feel free to edit your PR with that solution
yes... i willl.
now only in 1.8.8 correct?
so not need rush.
Posts: 5,525
Threads: 73
Joined: Feb 2012
Reputation:
582
|