I am working in TINYMce. I begin with TinyMCE having a template of three bullet points. I want to highlight some text from the web and paste it into the existing bullet points in tinymce.
When I copy content from the web, then highlight the three bullets in Tinymce, and paste,I get this:
Does anyone have a solution for this using any of the init configurations? This is making me want to use a different tool than TinyMce just because of this issue.
EDIT: After some digging, I came up with a solution. What was happening was on paste there were added
tags, which created the spaces between bullets 2-3 and 3-4. Here is what worked for me:tinymce.init({
paste_preprocess: function(plugin, args) {
var regex = /<\/?p[^>]*>/g;
var rawcontent = args.content
var replacedcontent = rawcontent.replace(regex, "");
args.content = replacedcontent;
console.log(replacedcontent);
},
This is still not perfect because on paste, Tinymce adds a 4th bullet point. I'm not sure how to sovle this, but marking this complete for now.
- specifically if you have multiple spaces in a row it uses hard spaces to keep that spacing in tact as multiple regular spaces are not maintained in HTML. There is no setting to stop using
when multiple spaces are in content. If you are seeing hard spaces used when they are not needed that would be a different issue. – Michael Fromin