There are 4 feature requests (listed below) for the same feature:
Font-Family, Font-Size and Font-Color should be handled with STYLE-definitions instead of deprecated FONT-Tags!
My Company is actually working on a (still) provisorily solution to this problem
and we got so far, that we now have 3 working StyleCombo-DropDowns that evolved from the original FCK-StyleCombo loading style-definitions from fckstyles.xml.
Each DropDown loads its definitions from a seperate xml-file and by we created a Font-Family-DropDown, a Font-Size-DropDown and a Font-Color-DropDown that work properly together.
And her comes the problem:
In every DropDown more than one option can be selected. But it makes no sense to define more than one font-size for letter.
So we tried to modificate the code copied from _source/commandclasses/fckstylecommand.js in order to make sure
that every time a style is selected, all other styles are removed.
But we dont get access to FCKToolbarStyleCombo._Combo (inherited fromy FCKSpecialCombo).
Is there anyone who knows how to modificate the code listed below ?
(We did not (yet) succeed in sourcing out the code to a plugin.js)
// ---------------------------- BEGIN MODIFICATED CODE ----------------------
FCKStyleCommand.prototype.Execute = function( styleName, styleComboItem )
{
FCKUndo.SaveUndoStep() ;
// BEGIN MODIFICATION
// Get all Styles and remove them
for ( var s in this.Styles )
{
var oStyle = this.Styles[s] ;
// HERE COMES THE PROBLEM:
var oItem = FCKToolbarStyleCombo._Combo.SelectItem( s ) ;
oItem.Style.RemoveFromSelection();
}
// Add Selected Style
if ( !styleComboItem.Selected )
styleComboItem.Style.ApplyToSelection() ;
// END MODIFICATION
FCKUndo.SaveUndoStep() ;
FCK.Focus() ;
FCK.Events.FireEvent( "OnSelectionChange" ) ;
}
// ---------------------------- END MODIFICATED CODE ----------------------
/* ----------------------------- BEGIN ORIGINAL CODE ----------------------
FCKStyleCommand.prototype.Execute = function( styleName, styleComboItem )
{
FCKUndo.SaveUndoStep() ;
if ( styleComboItem.Selected )
styleComboItem.Style.RemoveFromSelection() ;
else
styleComboItem.Style.ApplyToSelection() ;
FCKUndo.SaveUndoStep() ;
FCK.Focus() ;
FCK.Events.FireEvent( "OnSelectionChange" ) ;
}
*/ ------------------------------ END ORIGINAL CODE ----------------------
Feature-Requests:
http://sourceforge.net/tracker/?group_i ... id=1183550
http://sourceforge.net/tracker/?group_i ... id=1308192
http://sourceforge.net/tracker/?group_i ... id=1051561
http://sourceforge.net/tracker/?group_i ... aid=942238
Fri, 03/24/2006 - 02:30
#1
RE: font-attributes with STYLE instead of <FO
If you don't make some intersting changes I think that you can change the style only through the style.cssText property, but setting it agains should remove previous values.
Maybe I'm missing something but I don't think that it's possible to set a style property (like
<Style name="blue table" element="table">
<Attribute name="style.color" value="blue;" />
</Style>
instead of
<Style name="blue table" element="table">
<Attribute name="style" value="color:blue;" />
</Style>
I know that the latter works, but as I understand it I think that the real solution would be to be able to use the name="style.color" syntax
Is it possible?
Or how are you setting the styles so that one combo doesn't change the attributes set in another one?
RE: font-attributes with STYLE instead of <FO
But i can tell you that we avoided interference between the DropDowns by copying the code of fckstylecommand.js and fcktoolbarstylecombo.js and reinserting it 3 times and changing every "FCKStyleCommand" to "FCKStyle2Command", "FCKStyle3Command" and so on. (And of course we registered the new buttons and commands.)
But thats not the point: The DropDowns work. But they work just exactly like the original one:
It is possible to select more than one Style in each DropDown, so you can select "14pt" and "12pt" for the same string.
RE: font-attributes with STYLE instead of <FO
in your .xml you have something like this
<Style name="font 10pt" element="span">
<Attribute name="style" value="font-size:10pt;" />
</Style>
<Style name="font 16pt" element="span">
<Attribute name="style" value="font-size:16pt;" />
</Style>
right?
and then other .xml for font families and another one for colors
But if I'm not mistaken your problem isn't that the same kind of style it's applied twice, but that you have nested tags and so it becomes messy and it doesn't work.
that's it:
instead of generating:
<span style="font-size:10pt; color:#FF00FF;">text</span>
you get
<span style="font-size:10pt;"><span style="color:#FF00FF;">text</span></span>
and it doesn't matter if you work only with the differente elements, but as soon as you try to change the text size you get this and you can make it work right:
<span style="font-size:10pt;"><span style="font-size:14pt;">text</span></span>
Is that the problem?
RE: font-attributes with STYLE instead of <FO
my approach to solve the problem is to change the behaviour of the DropDown so that each time a font-size is selected all other font-sizes get removed.
the code-result would still be messy but it would work rightly.
a red 12pt text would look like:
<span style="font-size:12pt;"><span style="color:red;">SAMPLETEXT</span><span>
but I think we could live with that for now and solve this cosmetical problem after the functional one we now have
RE: font-attributes with STYLE instead of <FO
Anyway I don't think that just using <span style> because <font> are "deprecated" it's the right thing to do, it still does leave all the mess, you are mixing content and style, it won't work fine if you try to allow the user to switch style sheets.
But that's another point not related with the fact that we must find a better way to apply styles to the content.
RE: font-attributes with STYLE instead of <FO
If you find a solution, will you please post it here? I'm very interested.
RE: font-attributes with STYLE instead of <FO
I'm also trying to figure out how to dynamically load a different 'styles.xml' file to populate the Styles dropdown. My usage of the editor is more dynamic and I would like to offer my users the ability to customize their own stylesheet sets and be able to apply them via the editor.
RE: font-attributes with STYLE instead of <FO
There are several other posts about how to dinamically generate a different styles.xml file for each user, it's basically just a header to make sure that the content/type is xml and then your code to generate the styles.
Yeah, but ideally (at least for me)...
Or at least, have the option to - not specifying a path/file would just load the default path/file as specified in the fckconfig.js file setting FCKConfig.StylesXmlPath.
RE: Yeah, but ideally (at least for me)...
Xd