Hi all,
I need for my page a configuration, that allows handling each html tag seperatly, if it can be pasted and displayed or not. Allowed tags should be <ul>,<ol>,<li>, <br /> for example, not allowed ones would be <h1>-<h6>, <p>, <img>... (though it should be allowed to enter an image using the editor's add-image button)
I already looked a lot through the FAQ and found some options to config pasting over word:
config.enterMode = 2;
config.CleanWordKeepsStructure = true;
config.pasteFromWordRemoveFontStyles = true;
but copying content to word and then again to the ckeditor is not a good alternative. As there can still be headings or similar content included.
I was going to write a custom/overwrite a paste method, that analyzes the pasted text and fires an alert if unallowed tags with attributes are found and gives the opportunity "to clean up", but I thought it might be clever to ask here, if there is maybe a simpler or already existing solution for that :) Or if anyone could give some advices about what is the best practice to add a custom paste method, I would appreciate it very much.
Thanks,
Conrad
I need for my page a configuration, that allows handling each html tag seperatly, if it can be pasted and displayed or not. Allowed tags should be <ul>,<ol>,<li>, <br /> for example, not allowed ones would be <h1>-<h6>, <p>, <img>... (though it should be allowed to enter an image using the editor's add-image button)
I already looked a lot through the FAQ and found some options to config pasting over word:
config.enterMode = 2;
config.CleanWordKeepsStructure = true;
config.pasteFromWordRemoveFontStyles = true;
but copying content to word and then again to the ckeditor is not a good alternative. As there can still be headings or similar content included.
I was going to write a custom/overwrite a paste method, that analyzes the pasted text and fires an alert if unallowed tags with attributes are found and gives the opportunity "to clean up", but I thought it might be clever to ask here, if there is maybe a simpler or already existing solution for that :) Or if anyone could give some advices about what is the best practice to add a custom paste method, I would appreciate it very much.
Thanks,
Conrad
Re: Allow / disallow *some* html tags
plugins/autoclean/plugin.js
config.js
Re: Allow / disallow *some* html tags
Re: Allow / disallow *some* html tags
Requesting for help at the earliest.
CKEDITOR.plugins.add('autoclean', {
init: function(editor) {
editor.on('paste', function(evt) {
//////////////////IT NEVER REACHES HERE WHEN I DO A PASTE IN THE TEXT AREA>[/color]
alert("In the function"); });
}
})
It will be of great help if some one can find a solution for my problem.
var editorinstance = CKEDITOR.replace('editDisclosures', {
resize_enabled: true,
contentsCss: baseUrl + "Content/contents.css",
resize_enabled: true,
toolbarStartupExpanded: true,
fontSize_sizes: '16/16px;24/24px;48/48px;',
fontSize_defaultLabel: '12px',
font_names: 'Arial;Times New Roman;Verdana',
font_defaultLabel: 'Arial',
extraPlugins: 'autoclean',
height: 230,
toolbar: [
['Bold', 'Italic', 'Underline', '-'],
['Link', 'Unlink', 'TextColor', 'BGColor', 'NumberedList', 'BulletedList']
]
});
thanks
Madhuri
something in the config?
Isn't there something in the config which will allow CKedit to just allow all HTML tags?