<commit_before>CKEDITOR.plugins.add('files',
    {
        requires: [ 'iframedialog' ],
        icons: 'files',
        init: function( editor )
        {
            var height = 480, width = 750;
            CKEDITOR.dialog.addIframe(
                'filesDialog',
                'Files',
                '?option=com_files&container=files-files&view=images&tmpl=dialog', width, height,
                function()
                { // onContentLoad
                    // Iframe loaded callback.
                },

                { // userDefinition
                    onOk : function()
                    {
                        // Dialog onOk callback.
                    },
                    onShow : function()
                    {
                        this.parts.dialog.addClass('files_dialog');
                    }
                }
            );

            editor.addCommand( 'filesDialog', new CKEDITOR.dialogCommand( 'filesDialog' ) );

            editor.ui.addButton( 'files',
                {
                    label: 'Files Dialog',
                    command: 'filesDialog',
                    icon: this.path + 'images/icon.gif'
                } );

        }
    }
);

function showDialogPlugin(e){
    e.openDialog('files.dlg');
}<commit_msg>Image selecting with com_files re #386<commit_after>var iframeWindow = null;
CKEDITOR.plugins.add('files',
    {
        requires: [ 'iframedialog' ],
        icons: 'files',
        init: function( editor )
        {
            var height = 480, width = 750;
            CKEDITOR.dialog.addIframe(
                'filesDialog',
                'Files',
                '?option=com_files&container=files-files&view=images&tmpl=dialog', width, height,
                function() {
                    var iframe = document.getElementById( this._.frameId );
                    iframeWindow = iframe.contentWindow;
                },

                { // userDefinition
                    onOk : function()
                    {

                        var iframedocument = iframeWindow.document;
                        var src = iframedocument.id('image-url').get('value');
                        var attrs = {};
                        ['align', 'alt', 'title'].each(function(id) {
                            var value = iframedocument.id('image-'+id).get('value');
                            if (value) {
                                attrs[id] = value;
                            }
                        });
                        if (iframedocument.id('image-caption').get('value')) {
                            attrs['class'] = 'caption';
                        }

                        var str = '<img src="'+src+'" ';
                        var parts = [];
                        $each(attrs, function(value, key) {
                            parts.push(key+'="'+value+'"');
                        });
                        str += parts.join(' ')+' />';

                        // puts the image in the editor
                        this._.editor.insertHtml(str);
                    },
                    onShow : function()
                    {
                        this.parts.dialog.addClass('files_dialog');
                    }
                }
            );

            editor.addCommand( 'filesDialog', new CKEDITOR.dialogCommand( 'filesDialog' ) );

            editor.ui.addButton( 'files',
                {
                    label: 'Files Dialog',
                    command: 'filesDialog',
                    icon: this.path + 'images/icon.gif'
                } );

        }
    }
);

function showDialogPlugin(e){
    e.openDialog('files.dlg');
}
{'fraction_non_alphanumeric': 0.11661255411255411, 'fraction_numerical': 0.004058441558441558, 'mean_word_length': 1.0016242555495398, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6273636', 'n_tokens_mistral': 942, 'n_tokens_neox': 850, 'n_words': 150}