Opened 17 years ago

Closed 16 years ago

#670 closed Bug (fixed)

CommandState Incorrect when in 'View Source' Mode

Reported by: f209@… Owned by: Martin Kou
Priority: Normal Milestone: FCKeditor 2.6
Component: UI : Source View Version: SVN (FCKeditor) - Retired
Keywords: Review+ Cc:

Description (last modified by Martin Kou)

When in view source mode a majority of the buttons apear to be off from the editor. However a call to check state on the buttons:

oEditor.Commands.GetCommand( commandName ).GetState();

show the buttons below as still accessible, actually calling the execute function on these commands can sometimes cause problems. For example running find while in view source and actually searching for something that it finds in the source causes script errors.

Although this is not a major issue if one plans to use only the buttons in the editor, I'm attempting to add a menu bar above the buttons, and need to check state to see what buttons are available and not available at any given time.

Here is the list of buttons that show as still available:

Paste
PasteText
PasteWord
SelectAll
Find
Replace
InsertUnorderedList
InsertOrderedList
Anchor
Image
Flash
Table
InsertHorizontalRule
Smiley
SpecialChar
JustifyLeft
JustifyCenter
JustifyRight
JustifyFull
Bold
Italic
Underline
StrikeThrough
Subscript
Superscript
Outdent
Indent
RemoveFormat
SpellCheck
UniversalKey
Templates

Moved from SF:
http://sourceforge.net/tracker/index.php?func=detail&aid=1257865&group_id=75348&atid=543653

Attachments (2)

670.patch (7.9 KB) - added by Martin Kou 16 years ago.
Proposed patch for fixing #670.
670_2.patch (7.9 KB) - added by Martin Kou 16 years ago.
Updated patch for fixing #670, fixed the About dialog status issue.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 17 years ago by Martin Kou

Description: modified (diff)
Reporter: changed from Martin Kou to f209@…

comment:2 Changed 17 years ago by Alfonso Martínez de Lizarrondo

Component: GeneralUI : Source View

comment:3 Changed 17 years ago by Martin Kou

Keywords: Confirmed added
Milestone: FCKeditor 2.6
Version: SVN

comment:4 Changed 16 years ago by Martin Kou

Owner: set to Martin Kou
Status: newassigned

Changed 16 years ago by Martin Kou

Attachment: 670.patch added

Proposed patch for fixing #670.

comment:5 Changed 16 years ago by Martin Kou

Keywords: Review? added; SF Confirmed removed

It's ok to return 0 for the SelectAll command since it is supposed to be usable in Source mode. For the other commands, theirs states are fixed in the proposed patch.

comment:6 Changed 16 years ago by Alfonso Martínez de Lizarrondo

The patch looks fine, but I've always thought that the correct solution should be to reuse the sourceView parameter of the constructor.

var FCKToolbarButton = function( commandName, label, tooltip, style, sourceView, contextSensitive, icon )

The fact is that such parameter is just a hint for the toolbar system to know easily which buttons will be always disabled in source view, so maybe this approach should be left for FCKeditor 3, and apply the easy solution right now (and even in the future, the fact that a command is enabled or not is something that should be handled by the command itself, not by its button)

Anyway, I would rather if Fred could give the OK to the changes.

comment:7 Changed 16 years ago by Frederico Caldeira Knabben

Keywords: Review- added; Review? removed

Alfonso's comments are correct, and it should be actually addressed for V3 at this point. Actually, even this ticket has not much sense of being fixed right now as this is a pure API fix that can be easily workaround by checking the view mode outside the editor, and it is also supposed to be reworked for V3.

Anyway, Martin has already devoted time to fix it, so let's move it to the trunk.

The only thing that bugs me out here is the change in fckcommands.js. Why should the about button always return FCK_TRISTATE_DISABLED? It should always return FCK_TRISTATE_OFF, shouldn't it? Feel free to Review? again if I'm wrong with it.

comment:8 Changed 16 years ago by Martin Kou

Ah, I must had a slip of mind then. I defined a state function for the About dialog because I wanted it to always return FCK_TRISTATE_OFF instead of FCKDialogCommand's behavior (return FCK_TRISTATE_DISABLED when not in WYSIWYG mode).

Changed 16 years ago by Martin Kou

Attachment: 670_2.patch added

Updated patch for fixing #670, fixed the About dialog status issue.

comment:9 Changed 16 years ago by Martin Kou

Keywords: Review? added; Review- removed

comment:10 Changed 16 years ago by Frederico Caldeira Knabben

Keywords: Review+ added; Review? removed

comment:11 Changed 16 years ago by Martin Kou

Resolution: fixed
Status: assignedclosed

Fixed with [1343].

Click here for more info about our SVN system.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy