I want links to open on a new window as default. I tried:
CKEDITOR.on('dialogDefinition', function ( ev ){ if(ev.data.name == 'link'){ ev.data.definition.getContents('target').get('linkTargetType')['default']='_blank'; } });
It doesn't work. But I figured out that if I remove the following line. It works.
config.removeDialogTabs = 'image:advanced;image:Link;link:advanced;link:target';
But then the problem is now there is the target tab that allow user to change the link target.
What I want to keep the editor as simple as possible and don't want to allow users to change the link target. Yet, I want to set default target as target:_blank. Any suggestions? Thanks!
Check this article on how to
Check this article on how to customize dialog windows: http://docs.ckeditor.com/#!/guide/dev_howtos_dialog_windows
Customer and Community Manager, CKSource
Follow us on: Facebook, Twitter, LinkedIn
If you think you found a bug in CKEditor, read this!
I have read that. That's why
I have read that. That's why I can come up with the above code. It only works when the Link Tab is visible. But it does not work when I remove the tab.
I had the same question.
I had the same question.
But, as a workaround, we have another section in our implementation that does the following:
and in that method, we do the following:
The good part about this is it will apply the change to all links in your document. That's what I wanted regardless of whether or not the dialog is ever used.
The only thing we can't confirm is whether the link dialog is smart enough to see that links are _blank and show the correct value in the dropdown, but since we're also hiding the whole tab like you it doesn't matter to our implementation.
As a side note, this method is a way to avoid "contents.css". Apply all CKEditor elements styles by using JQuery. table, hr, blockquote, ol,ul, etc. That makes the output of our CKEditor far more consistent with the editing view - without loading in contents.css