JSFiddle - React, Tailwind, and code Playground

by RaphaelDDL

JavaScript

// file `plugin.js` inside `plugins/templatesmodal` folder

CKEDITOR.plugins.add( 'templatesmodal', { //folder: plugins/templatesmodal
    icons:'templatesmodal',  //folder: plugins/templatesmodal/icons/templatesmodal.png
    init: function(editor){

		//create some command
		editor.addCommand( 'openTemplatesModal', {
			exec: function(editor){ //what to do when fired
				window.parent.templatesModal(); // window.parent because maybe might be called from an iframe.  templatesModal() is a function on the main .js file that actually creates the modal and stuff
			}
		});
		//add the damned button
		editor.ui.addButton( 'TemplatesModal', { //name of the button to add on the toolbar
			command: 'openTemplatesModal', //call the addCommand above
            label: 'Templates Central'
		});
	}
});

//PS.: on the ckeditor.config call, add extraPlugins: 'templatesmodal' and on the toolbar, add the 'TemplatesModal'