Anonymous Login
06-18-2018 04:42 PM

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0003936SMF 2.1[SMF 2.0] Javascriptpublic2013-12-02 14:06
StatusclosedResolutionno change required 
Summary0003936: [WYSIWYG] Status of BBC buttons does not update until you begin typing

"When using the editor, the bbc icon should stay in a state of being pressed until you press it again. For example lets say you press bold (while in the WYSWIYG editor,) the BBC hover image won't show until you start typing. This has been something that annoyed me for quite some time."

Attached Files

related to 0003975resolved Can't stop BBC when it starts the line 



Nao/Gilles (Viewer)

This one is an awful mess to debug... As long as I'm tracing through the code, the hover state remains selected. There's hardly any way to guess where it's happening with regular tools at least. Too bad Compuart never had the opportunity to look into it.


Nao/Gilles (Viewer)

(Unassigning from Compuart.)


TE (Viewer)

IMO this isn't a bug, it's by design. the button status is updated whenever you click a button or press a key. oProperties.bIsActive (which indicates the button status) is set to true whenever the cursor is INSIDE a related formatting. With the first click there is no text selected and therefore the button remains inactive.

a dirty "hack":
find (in editor.js):
if ('sButtonClickHandler' in this.opt)
        eval(this.opt.sButtonClickHandler + '(oProperties)');

add after:
oButtonImg.bIsActive = !oButtonImg.bIsActive;

this will set the button to "active" with the first click, but this only works for one button click.
Example: If you click the buttons for "bold" and then "invert" the "bold" button is set back to inactive with the click on the "invert" button because there is still no text selected.

therefore gain: this is by design.


Nao/Gilles (Viewer)

Can't this strange behavior be fixed?


TE (Viewer)

It's fixable, sure.. but you'd have to add another property to all buttons (e.g. oButtonImg.bIsClicked) and then split the mouse and key events:

// Attach functions to the key and mouse events.
        this.oFrameDocument.addEventListener('keyup', this.aEventWrappers.editorKeyUp, true);
        this.oFrameDocument.addEventListener('mouseup', this.aEventWrappers.editorKeyUp, true);

As you can see, both of them use the same EventWrapper (editorKeyUp) and therefore do exactly the same. (updateEditorControls();)

I believe the prefered behaviour is this one:
- click one or more buttons -> change the status of the clicked buttons
- move through the text with the keyboard arrows -> only those buttons are active where the text is formatted.

You'd set oButtonImg.bIsClicked (the new property) to 'true' after the button was clicked and would change it back to 'false' after the keyboard is pressed -> This implements a loop through all the buttons for the editorKeyUp Event.


Nao/Gilles (Viewer)

Hmm... Might do the trick. Is it worth it, though?
I guess we'll need to hear from the rest of the team.


Shadow82x (SMF Friend)

Is it worth it? Well all other WYSIWYG editors work by having the current state showing when you click it, unless SMF wants to stand out with this. :P


Nao/Gilles (Viewer)

Well, SMF's wysiwyg editor sucks in many ways anyway.
You might as well dump it and use some real, proper open source editor. There are plenty.


Shadow82x (SMF Friend)

I agree Nao. Would be great to have something like ckeditor.


Antechinus (SMF Friend)

Unfortunately I think it's a bit late for that for 2.0. Worth thinking about for 2.1 though.


Shadow82x (SMF Friend)

Any word on this for 2.1?


Suki (Developer)

2.1 is going to have a new editor:

This isn't an issue with that editor.


Shadow82x (SMF Friend)

On my latest dev alpha (which includes the new editor) it still appears to be an issue


emanuele (Viewer)

I doubt it is an issue with the new editor, because it doesn't have the status at all.

The status has been introduced with the SCEditor 1.4.1 that is not yet used in SMF. ;)


Oldiesmann (Developer)

This bug is no longer applicable since we switched to a new editor in 2.1
MantisBT (Modified for SMF Intergration)[^] Copyright © 2000 - 2010 Mantis Group