javascript - CKeditor: change default select option in dialog -


i changle "link" dialog window. need able insert anchor (remove url , emails option). use code:

ckeditor.on( 'dialogdefinition', function( ev ) {      var dialogname = ev.data.name;      var dialogdefinition = ev.data.definition;      if ( dialogname == 'link' ) {          var infotab = dialogdefinition.getcontents( 'info' );          var linktypefield = infotab.get( 'linktype' );                  linktypefield['default'] = 'anchor';          linktypefield['items'].splice(0, 1);          linktypefield['items'].splice(1, 1);              }  });

this code remove url , email options. when dialog box appears nothing selected. how select "anchor" option default?

your customisation ok, except it's missing:

linktypefield.setup = function() {     this.setvalue( 'anchor' ); }; 

because default implementation selects url link type when creating new link, unless data (link selected in editor contents) says different:

setup: function( data ) {     this.setvalue( data.type || 'url' ); }, 

see fiddle.


Popular posts from this blog