HTML:如何在 textarea 中保留格式? [英] HTML : How to retain formatting in textarea?
问题描述
- 我正在使用 HTML textarea 让用户输入一些数据并将其保存到 App Engine 的模型中
- 问题是,当我检索内容时,它只是文本,所有格式都消失了
- 原因是因为在textarea中没有我们可以制作的格式
问题:
- 有没有办法保留用户提供的格式?
- 是否还有其他元素(除了 textarea),我必须使用?(哪个?)
P.S 我对 Web 开发领域很陌生,正在从事我的第一个项目
P.S I am very new to area of web development and working on my first project
谢谢
推荐答案
你想要的是一个 Rich文本编辑器.标准 HTML 标签只接受纯文本(即使文本是或包含 HTML 标记).那里有很多示例(包括链接页面上列出的一些示例),但我强烈建议为此使用预先打包的示例.对于新手来说,编写自己的代码相当复杂,甚至对于很多有经验的人来说也是如此.TinyMCE 和 CKEditor 是非常常见的,但还有很多其他的.
What you want is a Rich Text Editor. The standard HTML <textarea>
tag only accepts plain text (even if the text is or includes HTML markup). There are a lot of example out there (including some listed on the page linked) but I would highly recommend using a prepackaged one for this. Coding your own is fairly complicated for people who are new, and even for a lot who have some experience. Both TinyMCE and CKEditor are very common ones, but there are many others as well.
这篇关于HTML:如何在 textarea 中保留格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!