CKEditor. Open image properties window with a default value

后端 未结 1 1094
醉酒成梦
醉酒成梦 2021-01-16 15:27

I\'ve been looking at the API and I can not figure out how to open the image dialog with a default url. I use the execCommand function, as follows:



        
相关标签:
1条回答
  • 2021-01-16 16:22

    To set default value, you got to use the dialogDefinition event to modify dialog fields (see this answer: How do I programatically set default table properties for CKEditor?).

    To change the value dynamically:

    CKEDITOR.replace( 'editor1', {
        extraPlugins: 'devtools', // useful for dialog development
        on: {
            dialogShow: function ( evt ) {
                var dialog = evt.data;
    
                if ( dialog.getName() == 'image' )
                    dialog.setValueOf( 'info', 'txtUrl', 'http://foo.com' );
            }
        }
    });
    
    0 讨论(0)
提交回复
热议问题