Skip to content
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

Wordcount plugin does not update the char counter on afterPage event #211

Closed
iliasmertzanos opened this issue Mar 23, 2021 · 7 comments
Closed
Labels

Comments

@iliasmertzanos
Copy link

iliasmertzanos commented Mar 23, 2021

Hi guys,

great job you have done!

I am having an issue with events in regard to wordcount plugin.

I am trying to catch the afterPaste event (ctrl+V) but at that moment the counter evt.editor.wordcount.charCount is empty.

I tried to set a timeout, so that the read of the worcount value waits a bit and it works.
That means somehow wordcount is updating his content at some point later.

Is there any specific Event from the wordcount plugin ?

@w8tcha
Copy link
Owner

w8tcha commented Mar 24, 2021

Yes you need to set the the same timeout 100 as the plugin does.

CKEDITOR.instances.editor1.on('afterPaste', function (event) { console.log(event.editor.wordCount.charCount) }, null,null,100);

this should work

@iliasmertzanos
Copy link
Author

If I am getting this right there should be en event that we can bind without using timeouts. Timeouts can bring all lot of problems.
So the question is whats the problem ? Is this a bug in CKEditor or in Wordcount?

@w8tcha
Copy link
Owner

w8tcha commented Mar 24, 2021

I thinks this is a misunderstand. The Value 100 is not a timeout event. its the execution priority...

The listener priority. Lower priority listeners are called first. Listeners with the same priority value are called in registration order.

@w8tcha
Copy link
Owner

w8tcha commented Mar 24, 2021

If the value 100 is a problem for you i could remove it.

@iliasmertzanos
Copy link
Author

Oh ok now I get it. But still I would expect that afterPaste should catch the right result from wordcount.
So I would say somehow there is a bug in CKEditor. Why would you need the priority if it would function correctly?

@w8tcha
Copy link
Owner

w8tcha commented Mar 24, 2021

Why is this a bug i dont unterstand. The default value is 10. i set it to 100 to make sure that the events of the editor are executed before the content is filtered. Otherwise its possible that the counting is wrong

@stale
Copy link

stale bot commented Apr 23, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 23, 2021
@stale stale bot closed this as completed Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants