jQuery 如何制作像 StackOverflow 这样的富文本输入框字段?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7870543/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I make a rich text input box field like StackOverflow has?
提问by GeekedOut
I am working on a site that depends on user generated content, and it would be very nice to also have a way to let the users enter rich text.
我正在开发一个依赖于用户生成内容的网站,如果还有一种方法可以让用户输入富文本,那就太好了。
How do they accomplish the rich text like they do on this site to post questions?
他们如何像在本网站上那样完成富文本发布问题?
I understand that I can make arbitrary signs above the text area and when something is highlighted and one of the control buttons is pressed, make some jQuery call to see what is highlighted, and wrap that in some html tags like for bold text for example...and then just add the text into my database with the HTML. Is that how these kinds of rich-text things are done?
我知道我可以在文本区域上方制作任意符号,当突出显示某些内容并按下其中一个控制按钮时,进行一些 jQuery 调用以查看突出显示的内容,并将其包装在一些 html 标签中,例如粗体文本。 ..然后用 HTML 将文本添加到我的数据库中。这些富文本的东西就是这样完成的吗?
Thanks!!
谢谢!!
采纳答案by Phil
回答by Brent
Check out TinyMCE. It's a great rich text input library.
查看 TinyMCE。这是一个很棒的富文本输入库。