CKEditor。使用默认值打开图像属性窗口 [英] CKEditor. Open image properties window with a default value

查看:153
本文介绍了CKEditor。使用默认值打开图像属性窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在查看API,我无法弄清楚如何使用默认网址打开图片对话框。我使用 execCommand 函数,如下所示:

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:

var editor = CKEDITOR.instances.editor1;
editor.execCommand ('image');

这很好,但我想给一些价值。我测试:

This works fine, but I want to give some value. I tested with:

editor.execCommand ('image', {
   url: myrURL,
});

它不工作。

推荐答案

要设置默认值,您必须使用 dialogDefinition 事件来修改对话框字段(请参阅此答案:如何以编程方式设置CKEditor的默认表格属性?)。

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?).

动态更改值:

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' );
        }
    }
});

这篇关于CKEditor。使用默认值打开图像属性窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆