I want to create an editor with TinyMCE and I have an error when I want to add content from SQL. The function inside tinymce.init is: setup: function (editor) { editor.on(‘init’, function (e) { …
Tag: tinymce
How to get plain text from html in laravel model?
I’ve a database column named description in which i’ve saved input from tinymce editor. data is something like this, I can easily display the data in view with following, But, I need some processing to get 30 words from text with following code in model, and I’m currently geting empty when I call shortDescription function. Is there any way to
Remove style attribute from HTML tags
I’m not too good with regular expressions, but with PHP I’m wanting to remove the style attribute from HTML tags in a string that’s coming back from TinyMCE. So change <p style=”…”>Text</p> to just vanilla <p>Test</p>. How would I achieve this with something like the preg_replace() function? Answer The pragmatic regex (<[^>]+) style=”.*?” will solve this problem in all reasonable