HTML Javascript 富文本框 (IDE)
我希望用 javascript 构建一个 IDE,其行为与 gmail 非常相似,只是样式会根据他们键入的内容自动更改。这的逻辑不是我挣扎的地方。这就是gmail如何实现以html的丰富编辑格式进行编辑的能力。据我所知,textarea 控件不能以这种方式工作,那么他们如何伪造此功能呢?
I am hoping to build an IDE in javascript that behaves much like gmail except the style will change automatically based on what they type as they type. The logic for this isnt where im struggling. Its how gmail achieves the ability to edit in a rich edit format in html. As far as I know the textarea control does not work this way, so how do they fake this functionality?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
谷歌搜索“内容可编辑”
尝试在 Firefox 中按 F7 直接编辑 HTML 页面:)
Gmail 在 contenteditable="true" 的页面内使用 Frame。
另请参阅 Google Web 工具包:
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t= DevGuideWidgetGallery
有 RichTextArea 小部件。
Google for "content editable"
Try to press F7 in Firefox end edit HTML page directly :)
Gmail uses Frame inside a page with contenteditable="true".
See also Google Web Toolkit:
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=DevGuideWidgetGallery
There is RichTextArea widget.
我不太确定这是否是您的意思,但您是否正在寻找在线所见即所得编辑器?
在这种情况下,请允许我推荐 CKEDitor,它非常快速、现代且强大。
您可以在相应的维基百科条目中找到更广泛的列表。
您可能必须自定义任何编辑器才能编辑电子邮件(例如,您将无法使用任何预定义的 CSS 类,因此编辑器必须直接在标签)但这应该不是问题。
I'm not quite sure whether this is what you mean, but are you looking for a online WYSIWYG editor?
In that case allow me to recommend CKEDitor, it is quite fast, modern and robust.
You can find a broader list in the corresponding Wikipedia entry.
You would probably have to customize any of the editors to be able to edit E-Mails (You wouldn't be able to work with any pre-defined CSS classes for example, so the editor would have to do all the style definitions directly in the tag) but it shouldn't be a problem.
下载允许这样做的众多开源系统之一,看看他们是如何做到的。
基本上,它们将事件处理程序附加到按钮,而按钮又知道如何在光标当前位于文本区域的位置或文本区域中选定区域的周围插入“内容”。
Download one of the many open source system that allow that, and see how they did it.
Basically, they are attaching event handlers to button which in turn know how to insert "stuff" in the place the cursor is currently located in the text area, OR around the selected area in the textarea.
我投票给“editarea”,它位于基于网络的编辑器列表中:另一个维基百科条目。
我能够使用最简单的代码将其添加到现有页面中:
My vote is for 'editarea' which is in the list of web based editors: Another Wikipedia entry.
I was able to add it into an existing page with the most simplistic of code: