在textarea中加粗的文字 [英] bold text in textarea

查看:122
本文介绍了在textarea中加粗的文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编写一个非常简单的wysiwyg编辑器,用户可以在选择部分文本后简单地添加粗体文本,超链接和项目符号。实际上就像CKEditor一样。



但据我所知,没有办法将格式添加到textarea。所以我想知道,CKEditor等其他编辑器如何解决这个问题。

您正在编辑的文档/文本的HTML。换句话说,你基本上是在浏览器中编辑HTML,而不是在 TEXTAREA 中的文本。您可能需要查看富文本编辑器的源代码,以及在开始编写所有的东西之前,先查阅Mozilla的 Midas规范


i'm trying to write a very simple wysiwyg editor, where users can simply add bold text, hyperlinks and bullets, after selecting part of the text.. actualy just like CKEditor.

But as far as i know there is no way to add formatting to a textarea. So I would like to know, how do other wysiwyg editors like CKEditor solve this.

解决方案

The browser based WYSIWYG editors work by building the HTML for the document/text you're editing. In other words, you're essentially editing HTML inside the browser and not the text in a TEXTAREA. You might want to have a look at the source code for Rich Text Editor and check out Mozilla's Midas Specification before you embark on writing everything from scratch.

这篇关于在textarea中加粗的文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆