When I paste a text with a table in ckeditor 4, I want to wrap that table in a div. I have the below code that wrap a table in a Div when I insert from button in ckeditor, How do I make same thing when paste?
This is the code from the basic plugin: first load plugin in config.js
config.extraPlugins = 'table_wrapper';
here the content of the plugin:
CKEDITOR.plugins.add('table_wrapper', {
init: function (editor) {
editor.on('insertElement', function (event) {
if (event.data.getName() === 'table') {
var div = new CKEDITOR.dom.element('div').addClass('w3-responsive'); // Create a new div element to use as a wrapper.
event.data.appendTo(div); // Append the original element to the new wrapper.
event.data = div; // Replace the original element with the wrapper.
}
}, null, null, 1);
}
});