-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buttons state not preserved #533
Comments
Hey @qasid, I'm not sure what you mean with "state is not preserved". AlloyEditor does not preserve the state of buttons and it shouldn't do it. When the button is (re)rendered, its current state - pressed or not, is being determined depending on the selection. Thanks, |
Hello @ipeychev , You can reproduce this scenario by adding the above config.coreStyles settings in config.js (lib/ck-editor). As you can see below bold button is not shown pressed (using config.js) even though the text selected is bold. i hope this image clarifies. |
Hey @qasid, as @ipeychev hinted, this is a cas of misconfiguration. We use the button I've tried your sample an I got it working like this: var customBoldStyle = {
element: 'span',
attributes: {'style': 'font-weight: bold;'},
overrides: 'b'
};
AlloyEditor.editable('editable', {
buttonCfg: {
bold: {
style: customBoldStyle
}
},
coreStyles_bold: customBoldStyle
}); Hope it helps |
On a related note, I think we can change var style = AlloyEditor.Lang.isObject(this.props.style) ? this.props.style : this.props.editor.get('nativeEditor').config[this.props.style];
this._style = new CKEDITOR.style(style); This way we can have our buttons default to the What do you think about this, @ipeychev? |
Hey Chema, Yeah, I think it would be a good improvement. Also, for the record, it would be better to overwrite button bold style property following this approach. Thanks, |
Oh, I forgot we added that.. just updated my previous comment to reflect it 😉 |
Great, Chema, thanks! |
I'm using following configurations of basic styles in config.js. Problem i'm having is when a style (e.g "bold") is applied, button's pressed state is not preserved. I've gone through your code and observed isactive() in buttonStateClasses returns false therefore fails to add state class "ae-button-pressed". This problem also arises when using "ae_buttonbridge" and use basic styles external plugin.
The text was updated successfully, but these errors were encountered: