Adamhumbug Posted April 12 Share Posted April 12 Hi All, I hope this is in the right place. I am using tinymce on a textarea. When populating this text area, tiny mce seems to be minifying the code. If i put this in and save <div class="row"> <div class="col">This is some info</div> <div class="col">This is some more info</div> </div> This is what i get back when it is returned <div class="row"> <div class="col">This is some info</div> <div class="col">This is some more info</div> </div> This makes editing really challenging. Here is my init function initializeTinyMCE() { tinymce.remove(".tmce"); setTimeout(function() { if ($("textarea.tmce").length > 0) { tinymce.init({ selector: "textarea.tmce", apply_source_formatting: true, highlight_on_focus: true, skin: "bootstrap", plugins: "lists, link, image, media, code", toolbar: "h1 h2 bold italic strikethrough blockquote bullist numlist backcolor | link image media | removeformat code", menubar: false, forced_root_block: 'false' }); } else { } }, 100); } This is how it is being saved into json in maria DB "Content": "<div class=\"row\">\n<div class=\"col\">This is some info<\/div>\n<div class=\"col\">This is some more info<\/div>\n<\/div>" I guess my question is - can i make tinymce pretty the code when it is displayed, indenting tags and putting blocks on new lines? Quote Link to comment Share on other sites More sharing options...
Adamhumbug Posted April 12 Author Share Posted April 12 1 hour ago, Adamhumbug said: Hi All, I hope this is in the right place. I am using tinymce on a textarea. When populating this text area, tiny mce seems to be minifying the code. If i put this in and save <div class="row"> <div class="col">This is some info</div> <div class="col">This is some more info</div> </div> This is what i get back when it is returned <div class="row"> <div class="col">This is some info</div> <div class="col">This is some more info</div> </div> This makes editing really challenging. Here is my init function initializeTinyMCE() { tinymce.remove(".tmce"); setTimeout(function() { if ($("textarea.tmce").length > 0) { tinymce.init({ selector: "textarea.tmce", apply_source_formatting: true, highlight_on_focus: true, skin: "bootstrap", plugins: "lists, link, image, media, code", toolbar: "h1 h2 bold italic strikethrough blockquote bullist numlist backcolor | link image media | removeformat code", menubar: false, forced_root_block: 'false' }); } else { } }, 100); } This is how it is being saved into json in maria DB "Content": "<div class=\"row\">\n<div class=\"col\">This is some info<\/div>\n<div class=\"col\">This is some more info<\/div>\n<\/div>" I guess my question is - can i make tinymce pretty the code when it is displayed, indenting tags and putting blocks on new lines? This is happening when pasting code into the rich text view, not the code view. Quote Link to comment Share on other sites More sharing options...
kicken Posted April 12 Share Posted April 12 Try adding the indent option. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.