Opened 18 years ago
Last modified 9 years ago
#864 assigned New Feature
Make subscript/superscript switchable
Reported by: | Owned by: | Szymon Cofalik | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | |
Keywords: | IBM SF | Cc: | Frederico Caldeira Knabben, Joe Kavanagh, dchojna@…, lynne_kues@…, camden.michael@… |
Description (last modified by )
I've observed strange behaviour when switching between subscript/superscript (concerns situations when both are switched on). Added this to fcknamedcommand (start of execute function):
if (((this.Name=='Subscript') && (!FCK.EditorDocument.queryCommandState('Subscript'))) || ((this.Name=='Superscript') && (!FCK.EditorDocument.queryCommandState('Superscript')))) { FCK.ExecuteNamedCommand('RemoveFormat'); }
and voila - subscript/superscript works fine ...
Moved from SF:
http://sourceforge.net/tracker/index.php?func=detail&aid=1428321&group_id=75348&atid=543656
Attachments (1)
Change History (17)
comment:1 follow-up: 4 Changed 18 years ago by
Cc: | Frederico Caldeira Knabben added |
---|---|
Description: | modified (diff) |
Reporter: | changed from Martin Kou to virtimus@… |
comment:2 Changed 17 years ago by
Keywords: | Discussion added |
---|
comment:3 Changed 15 years ago by
Cc: | Joe Kavanagh dchojna@… added |
---|---|
Keywords: | IBM added |
#5083 has been marked as dup
comment:4 Changed 15 years ago by
If the user clicks the subscript button, then the superscript button, while the same text is selected the result is: <sup><sub>text</sub></sup>. In this scenario can the sub element be removed, and the subscript button deselected.
comment:5 Changed 14 years ago by
Cc: | lynne_kues@… added |
---|
comment:6 Changed 14 years ago by
This issue has been raised against the editor in our product. The expected user behavior is that subscript/superscript should be mutually exclusive. That is, if I format the text as subscript, then change to superscript, <sub> should be replaced with <sup>, as indicated in the above comment by JoeK.
comment:7 Changed 14 years ago by
Cc: | camden.michael@… added |
---|
comment:8 Changed 14 years ago by
Status: | new → pending |
---|
Can you cite any editor that have sub/sup exclusive?
comment:9 follow-up: 10 Changed 14 years ago by
Keywords: | Discussion removed |
---|---|
Status: | pending → confirmed |
I think MS Word is a good example for it.
Considering the limitation precisely described at martinkou's comments, this request is definitely valid.
comment:10 follow-up: 11 Changed 14 years ago by
Replying to fredck:
I think MS Word is a good example for it.
I don't understand, MS Word has exactly inclusive sub/sup.
comment:11 Changed 14 years ago by
Replying to garry.yao:
Replying to fredck:
I think MS Word is a good example for it.
I don't understand, MS Word has exactly inclusive sub/sup.
In my installation (Word 2007), sub and sub are mutually exclusive. In any case, that's just an example, not a rule to be followed.
There are some facts that justify making it mutually exclusive, other than MS Word:
- This is not a formula editor. There are other tools and plugins that provide this feature in the right way.
- The current "feature" is incomplete. If it's possible to have a sub inside a sup, it should be possible to have sub inside another sub, but it's not possible.
- Another issue with the current "feature" is that is should make validations to make it possible to have sub inside sup. Currently, it's possible to have things like the following, which gives a pretty bad output:
x<sup><sub>2</sub></sup>
comment:12 Changed 14 years ago by
Well the problem is that current (inclusive) feature is a super set of the proposed feature, as you can always achieve the exclusion via toggle previous one + apply new one.
As you pointed out we're not going to into the formula world it should be a worry of having an incomplete feature.
Changed 14 years ago by
comment:13 Changed 14 years ago by
Owner: | set to Sa'ar Zac Elias |
---|---|
Status: | confirmed → review |
Proposing a new "toggles" field, that removes the conflicting style if applied on the current selection.
comment:14 Changed 14 years ago by
Status: | review → review_failed |
---|
We don't need a change in the API adding new parameters to pass the toggles thing. We can simply have this in the style definition, much like the overrides entry. In this way we can define styles that get removed by the style application.
Additionally, the "toggles" name is not appropriate, as it refers to a visual action. Better to simply call it "removes", having the same implementation as "overrides".
---
Finally, just to make it reported, after patch, with the following HTML:
<p>x<sup>1234</sup></p>
- Select "234".
- Click the "Subscript" button.
- Without changing the selection, click "Superscript".
Nothing happens... as js error is thrown.
comment:15 Changed 10 years ago by
I ran into the same situation and found the below workaround for switching the buttons:
$(".cke").find(".cke_buttonsubscript").unbind("click").bind("click", function(e){
if($(this).parents(".cke").find(".cke_buttonsuperscript").hasClass("cke_button_on")) {
$(this).parents(".cke").find(".cke_buttonsuperscript").click();
}
});
$(".cke").find(".cke_buttonsuperscript").unbind("click").bind("click", function(e){
if($(this).parents(".cke").find(".cke_buttonsubscript").hasClass("cke_button_on")) {
$(this).parents(".cke").find(".cke_buttonsubscript").click();
}
});
comment:16 Changed 9 years ago by
Owner: | changed from Sa'ar Zac Elias to Szymon Cofalik |
---|---|
Status: | review_failed → assigned |
Well... actually it is not an error to have such situation. Many will tell you that this is necessary. For example:
x<sup>B<sub>1</sub></sup>
The above is ok. Actually there is a limitation in the editor as it is not able to include a subscript inside another subscript!
But ok, we are not proposing a formula editor here... maybe the "switchable" approach is better?! Any thoughts?
I'm moving it to the Features Requests therefore.
Moved from SF. Original poster: fredck