Advertisement:

View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003936SMF 2.1[SMF 2.0] Javascriptpublic2009-10-30 18:172013-12-02 14:06
ReporterShadow82x 
PrioritynormalSeveritytweakReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSOS Version
Summary0003936: [WYSIWYG] Status of BBC buttons does not update until you begin typing
Descriptionhttp://www.simplemachines.org/community/index.php?topic=345188.0 [^]

"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."

TagsBBC, WYSIWYG
Attached Files

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

-  Notes
(0012002)
Nao/Gilles (Viewer)
2010-05-28 18:07

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.
(0012264)
Nao/Gilles (Viewer)
2010-06-15 08:07

(Unassigning from Compuart.)
(0012487)
TE (SMF Friend)
2010-07-09 11:21

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.
(0012494)
Nao/Gilles (Viewer)
2010-07-09 12:51

Hmmm........
Can't this strange behavior be fixed?
(0012495)
TE (SMF Friend)
2010-07-09 16:08

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.
(0012498)
Nao/Gilles (Viewer)
2010-07-09 17:03

Hmm... Might do the trick. Is it worth it, though?
I guess we'll need to hear from the rest of the team.
(0012933)
Shadow82x (SMF Friend)
2010-09-12 01:09

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
(0012940)
Nao/Gilles (Viewer)
2010-09-12 17:03

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.
(0013112)
Shadow82x (SMF Friend)
2010-10-04 15:14

I agree Nao. Would be great to have something like ckeditor.
(0013114)
Antechinus (SMF Friend)
2010-10-05 19:36

Unfortunately I think it's a bit late for that for 2.0. Worth thinking about for 2.1 though.
(0014767)
Shadow82x (SMF Friend)
2013-02-05 02:22

Any word on this for 2.1?
(0014768)
Suki (Developer)
2013-02-06 11:33

2.1 is going to have a new editor: http://www.simplemachines.org/community/index.php?topic=486526.0 [^]

This isn't an issue with that editor.
(0014769)
Shadow82x (SMF Friend)
2013-02-16 13:49

On my latest dev alpha (which includes the new editor) it still appears to be an issue
(0014770)
emanuele (Developer)
2013-02-16 14:37

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. ;)
(0014882)
Oldiesmann (Developer)
2013-12-02 14:06

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