Add an input element of type=file in tinymce container

前端 未结 2 1680
夕颜
夕颜 2020-12-18 03:07

I am trying to extend a tinymce pluggin and need to add an input element of type=file.

(I am new to such an exercise so please pardon my ignorance.. Also could not f

2条回答
  •  借酒劲吻你
    2020-12-18 03:57

    In TinyMCE 3.x all dialogs where HTML pages that got loaded into a iframe or window. This was changed in TinyMCE 4 to make it easier to make plugins and fully support CDN:s. But you can still load HTML based pages into TinyMCE dialogs by using the WindowManager.

    // Opens a HTML page inside a TinyMCE dialog
    editor.windowManager.open({
        title: 'Insert/edit image',
        url: 'dialogTemplate.html',
        width: 700,
        height: 600
    });
    

    Also you can inline HTML:

    // Opens a HTML page inside a TinyMCE dialog
    editor.windowManager.open({
        title: 'Upload a file to attach',
        html: '',
        width: 450,
        height: 80,
        buttons: [{
                text: 'Attach',
                subtype: 'primary',
                onclick: function() {
                    // TODO: handle primary btn click
                    (this).parent().parent().close();
                }
            },
                {
                    text: 'Close',
                    onclick: function() {
                        (this).parent().parent().close();
                    }
                }]
    });
    

提交回复
热议问题