Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/388.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript CKEditor如何获取对话框输入_Javascript_Ckeditor - Fatal编程技术网

Javascript CKEditor如何获取对话框输入

Javascript CKEditor如何获取对话框输入,javascript,ckeditor,Javascript,Ckeditor,我有一个CKEditor,在我自己的plugin.js文件夹中添加了一个包含两个文本区域的对话框,但当按下对话框上的ok按钮时,我无法接受文本输入 CKEDITOR.dialog.add('ticketDialog', function (editor) { return { title: 'Ticket Properties', minWidth: 100, minHeight: 100, maxWidth: 100,

我有一个CKEditor,在我自己的plugin.js文件夹中添加了一个包含两个文本区域的对话框,但当按下对话框上的ok按钮时,我无法接受文本输入

CKEDITOR.dialog.add('ticketDialog', function (editor) {
    return {
        title: 'Ticket Properties',
        minWidth: 100,
        minHeight: 100,
        maxWidth: 100,
        maxHeight: 100,
        contents:
        [
            {
                id: 'general',
                label: 'Ticket from',
                elements:
                [
                    {
                        type: 'text',
                        id: 'Ticket',
                        label: "Write the company's name that you bought from",
                        'default': "Thy,Pegasus etc."
                    },
                {
                    type: 'text',
                    id: 'Price',
                    label: "Price for single ticket",
                    'default': "0.00TL"
                }
                ]
            }
        ]

    };
});
我有一个mvc视图页面,我使用javascript将我的文本区域替换为CKeditor,我需要在这里处理对话框的ok事件

<script type="text/javascript">
                                var editor = CKEDITOR.instances['editor1'];
                                if (editor) { editor.destroy(true); }
                                CKEDITOR.replace('editor1', {
                                    enterMode: CKEDITOR.ENTER_BR,
                                    extraPlugins: 'ticket',
                                    toolbar: 'Full',
                                    language:'English'
                                });


                                CKEDITOR.on('dialogDefinition', function (e) {
                                    var dialogName = e.data.name;
                                    var dialog = e.data.definition.dialog;
                                    dialog.on('ok', function () {
                                        var elementPrice = e.data.definition.dialog.getElement('Price');
                                        var rawValue = elementPrice.getInputElement().$.value;  // here I am trying to take the value of Price area input.
                                        alert(rawValue);
                                        //CKEDITOR.instances['editor1'].insertHtml(rawValue);

                                    });
                                });
                            </script>

var editor=CKEDITOR.instances['editor1'];
if(editor){editor.destroy(true);}
CKEDITOR.replace('editor1'{
输入模式:CKEDITOR.ENTER\u BR,
extraPlugins:'票证',
工具栏:“已满”,
语言:“英语”
});
CKEDITOR.on('dialogDefinition',函数(e){
var dialogName=e.data.name;
var dialog=e.data.definition.dialog;
dialog.on('ok',函数(){
var elementPrice=e.data.definition.dialog.getElement('Price');
var rawValue=elementPrice.getInputElement().$.value;//这里我尝试获取价格区域输入的值。
警报(原始值);
//CKEDITOR.instances['editor1'].insertHtml(rawValue);
});
});

谢谢。

这是答案,让其他人看清楚

CKEDITOR.on('dialogDefinition', function (e) {
                            var dialogName = e.data.name;
                            var dialog = e.data.definition.dialog;
                            dialog.on('ok', function () {
                            var elementPrice = dialog.getContentElement('general','Price');
                            });
                        });