15
Views
3
Comments
Solved
[CKEditor] How to call an button/action after leaving the focus from CKEditor
Forge component by Matthias Preuter
29
Published on 25 Aug 2020
Application Type
Traditional Web

I want to save the information entered as soon as the user leaves the CKEditor, so I want to call the save button automatically rather than wait for the user to do so. However I tried that on the input, but that does not work and cannot see an obvious placeholder for this inside the CKEditor widget. 

Onblur event

"$('#" + btnSave.Id + "').click();"

Any ideas?

Rank: #70
Solution

Hi André,


As it was it would fail with multiple CKEditors, but with some tweaks you can have the same for all of them.

Please refer to the OML in attachment with an example with the behavior you are aiming for. 

I created a webblock WB_OnBlurCKEditor where you can pass the list of buttons you want to click, the first button will be triggered on blur of the first CK editor, the second button will be triggered on blur of the second CK editor and so on, so forth:


Hope it helps.


Regards,
João

CKEditorBlurv2.oml

Rank: #70

Hi André,


The input you see on the Service Studio canvas is not actually the one you write on the browser, an iframe instead is loaded with CKEditor content.

But still they have classes and you can put the listener on the right place, using escaped Javascript content.


Please refer to the OML in attachment with an example with the behavior you are aiming for.


Hope it helps.


Regards,
João

CKEditorBlur.oml

Rank: #587

João, thank you, will this work with many CKEditors in the same screen?