CKEditor调用openDialog我得到淡出但没有对话框

CKEditor calling openDialog I get fade but no dialog

本文关键字:对话框 淡出 调用 openDialog CKEditor      更新时间:2023-09-26

使用 CKEditor,我想创建一个对话框,而不是作为插件的一部分。但是,当我调用 openDialog 进行对话框时,我添加了...它使屏幕变淡,但我从未看到对话框。谁能帮我?

<table cellpadding="0" cellspacing="0">
<tr>
    <td style="padding:0" valign="top">
        <div class="leftsidemenu sidemenu">
            <div class="menusection">
                <div class="menuheader">Test Menu</div>
                <div class="menuitem"><a id="testClick" href="#">Test Click</a></div>
            </div>
        </div>
    </td>
    <td style="padding:0" valign="top"><div class="editor1"><textarea id='editor1'>Testing it out</textarea></div>
    </td>
</tr>
</table>

下面是添加对话框然后打开对话框的 javascript。

<script>
    $(document).ready(function () {
        CKEDITOR.replace('editor1', {
            height: 1000
        });
        CKEDITOR.on('instanceCreated', function (ev) {
            var editor = ev.editor;
            CKEDITOR.dialog.add('placeholderDialog', function (editor) {
                return {
                    title: 'Link Properties',
                    minWidth: 400, minHeight: 200,
                    contents:
                    [
                        {
                            id: 'general', label: 'Settings',
                            elements:
                            [
                                {
                                    type: 'html', html: 'This dialog window lets you create simple links for your website.'
                                }
                            ]
                        }
                    ]
                };
            });
        });
        $("#testClick").click(function () {
            CKEDITOR.instances.editor1.openDialog('placeholderDialog');
        });
    });
</script>
CKEDITOR.replace('editor1', {
    height: 1000
});

需要之后

CKEDITOR.on('instanceCreated', fun...
因为否则,实例已经创建

,并且实例创建事件已经发生。