christiaan / tinymce-codemirror

Development moved to gitlab.com/tinymce-plugins/tinymce-codemirror
https://gitlab.com/tinymce-plugins/tinymce-codemirror
Apache License 2.0
71 stars 29 forks source link

Codemirror addons not executed. #35

Closed BondaCB closed 7 years ago

BondaCB commented 7 years ago

Hello,

I have been implementing your plugin in tinymce without major issues, but when I want to include some codemirror JS addons, i find them not executing properly..

Adding paths to jsFiles indeed load the files:

jsFiles: [
    'addon/edit/closetag.js',
    'addon/fold/xml-fold.js',
    'addon/edit/closebrackets.js',
    'addon/edit/matchtags.js',
],
autoCloseTags: true,

But despite being loaded (the server returns 200 code, and can be read in the console network tab), the addon is not initialized.

I have tried multiple codemirror installations (4.8 and the actual 5.29), as well as loading the file manually, but without success.

Thanks

BondaCB commented 7 years ago

My bad, i had a misunderstanding about tinymce config, your plugin config, and codemirror config. In case anyone has the same issue, this is how I solved it (for autloclose tags for example):

tinymce.init({
    selector: '#mytextarea',

    plugins: [
        ' codemirror',
    ],

    // codemirror options
    codemirror: {
        jsFiles: [
            'addon/edit/closetag.js',
            'addon/fold/xml-fold.js',
            'addon/edit/closebrackets.js',
            'addon/edit/matchtags.js',
        ],

        config: {
           mode: 'htmlmixed',
           autoCloseTags: true,
        }
    },

    menubar: false,

});