TinyMCE formatted text in MySQL database

拜拜、爱过 提交于 2019-12-13 04:07:13

问题


I have been searching for an answer for this for quite some time now, and I haven't been able to find a logical one yet.

I want to use TinyMCE to allow users to post formatted blogs. I don't want to force the user to use HTML tags in the textarea to put a new paragraph, they should just be able to hit the return key to get a new line, push a button to get bolded text, etc... My question is, if I am storing these blog posts in a mysql database, how can I preserve the formatting in the database securely and then show the blog post from the database with the formatting intact?


回答1:


Use getContent:

tinyMCE.activeEditor.getContent();

it will return you the HTML of current tinymce editor, and you can send it to your server.



来源:https://stackoverflow.com/questions/14961732/tinymce-formatted-text-in-mysql-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!