-
Notifications
You must be signed in to change notification settings - Fork 34
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
Retrieve character count for toggling message 'on-charCounter-exceeded' #60
Comments
I think you'll want to use the editor method for that: https://www.froala.com/wysiwyg-editor/docs/methods#charCounter.count and using the charCountExceeded(component) {
let count = await component.method('charCounter.count');
} Note, |
Thanks @Panman8201 I was confused on how to use that method within Ember... Thanks for the clarification. It worked great! If there's a better way to achieve the same result without having to call 'on-charCounter-update' every keypress, please share.
|
Humm... is there a reason the {{froala-editor on-charCounter-exceeded=(action "openExceededWarning")}} actions: {
openExceededWarning(component) {
// Do something here.?.
}
} Or, using that same event, change the {{froala-editor on-charCounter-exceeded=(action (mut maxCharactersReached true))}} The trick with that approach would be getting it back to |
I'm using the first approach, but when the user removes characters, 'on-charCounter-exceeded' is no longer called (unaware of count) so I was watching the char count with on-charCounter-update=(action 'charCountExceeded'). Tried using the second approach |
Yeah, there isn't really an event for the other way. I'd suggest starting a feature request over on the "core" froala-editor repo: https://github.com/froala/wysiwyg-editor/issues As for a better way with the ember integration, I don't think there really is. Any way you go about it, calling a function to grab the count and put it in an "ember land" property is required. I can think of a couple other ways of achieving it, but it would basically do the same thing. |
Closing this for now, can re-open for further discussion if needed, but I think a new event from the actual editor would be best here (something opposite to |
I'm currently able to show a message below the editor 'on-charCounter-exceeded', however, I would like to remove the message when the character count is less than the charCounterMax.
I tried retrieving the character count on the action so I could add some logic to the controller action:
Controller
I'm getting 0 as a result for 'editor.charCounter.count.length' no matter how many characters are typed in. Would like to achieve without using jquery if possible. Any guidance on this is much appreciated.
The text was updated successfully, but these errors were encountered: