-
Notifications
You must be signed in to change notification settings - Fork 53
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
On dialog definition event is not working #67
Comments
I think your problem is related to this.
ckeditor4-react/src/ckeditor.jsx Line 98 in 9e5955f
|
Actually I need to add some html to image plugin and change some names, I done it in onDialogDefinition Event. Is there any other way to do it |
Sorry for the late response! You can use <CKEditor
onBeforeLoad = { ( CKEDITOR ) => CKEDITOR.on( 'dialogDefinition', someFn ) }
/> |
I was using the same but, I am adding a custom button in image plugin some times the button is showing more than one time . I can't reproduce why this is happening since it is occuring randomly |
@codeforsure that shouldn't happen TBH. Make sure that your |
Actually, I am using custom check and it is working. But, I am not sure why the dialogDefinition is attaching 'n' times( I am loading the editor component not the whole page on event) for 'n' loads of editor component |
It's caused by the fact that for now let attached = false;
<CKEditor
onBeforeLoad = { ( CKEDITOR ) => { !attached && CKEDITOR.on( 'dialogDefinition', someFn ); attached = true; } }
/> |
I assume that |
To sum up, the Dialog definition is fired on global This means that when having more than one editor instance, attaching any callback to The first solution is to provide check if the callback was already attached as proposed in #67 (comment). Another solution could be attaching the callback to only one editor instance. Both are fine as long as you want to apply the same dialog modifications to each editor instance. If one tries to customize differently each editor instance it will fail. So the most generic solution I'm able to think of should check if it's operating on editor instance it was attached to: <CKEditor
onBeforeLoad = { ( CKEDITOR, getEditorInstance ) => {
CKEDITOR.on( 'dialogDefinition', evt => {
if ( evt.editor === getEditorInstance() ) {
someFn();
}
} );
} }
/> However, at the moment there is no possibility to check editor instance like the above. Extracted to #77. |
Closing as we will proceed further in #77. |
Another solution is to use |
Are you reporting a feature request or a bug?
calling on DialogDefinition event in the ckeditor4-react npm package doesn't work
Provide detailed reproduction steps (if any)
<CKEditor
data={'random'}
config={{
filebrowserUploadUrl: 'random/',
uploadUrl: '',
}}
onChange={e => {e.editor.getData (); }}
onDialogDefinition={ev => console.log (ev) }
onFileUploadRequest={e => console.log (e)}
/>
Expected result
on dialogDefinition event should be logged
Actual result
no event is seen
Other details
The text was updated successfully, but these errors were encountered: