CKEditor : How to change Https to default option of Link plugin

Dung Do Tien Apr 05 2021 243

Hello,

I have a project with Angular 7 and I install CKEditor 4 to support edit the content of a post. Now in the 'Link' plugin I want to change the default Protocol option from 'Http' to 'Https'. 

CKEditor How to change Https to default option of Link plugin

I use the code below but it did not work for me.

CKEDITOR.config.linkDefaultProtocol = 'https://';

Or

CKEDITOR.tools.extend(CKEDITOR.config, {
  linkDefaultProtocol: 'https://'
});

I did really research many cases but I can't resolve this issue.

Thanks for any suggestions about it.

Have 1 answer(s) found.
  • N

    Nguyen Truong Giang Apr 05 2021

    Oh, I have the same request change for Ckeditor like you. I change this option by code below:

    CKEDITOR.on('dialogDefinition', (ev) => {
        if (ev.data.name == 'link') {
          ev.data.definition.getContents('target').get('linkTargetType')['default']='_blank';
          ev.data.definition.getContents('info').get('protocol')['default']='https://';
        }
    });

    And it worked for me!!

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close