HTML Javascript 富文本框 (IDE)

发布于 2024-08-17 04:20:05 字数 151 浏览 4 评论 0原文

我希望用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

月光色 2024-08-24 04:20:05

谷歌搜索“内容可编辑”
尝试在 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.

(り薆情海 2024-08-24 04:20:05

我不太确定这是否是您的意思,但您是否正在寻找在线所见即所得编辑器?

在这种情况下,请允许我推荐 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.

空宴 2024-08-24 04:20:05

下载允许这样做的众多开源系统之一,看看他们是如何做到的。
基本上,它们将事件处理程序附加到按钮,而按钮又知道如何在光标当前位于文本区域的位置或文本区域中选定区域的周围插入“内容”。

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.

撧情箌佬 2024-08-24 04:20:05

我投票给“editarea”,它位于基于网络的编辑器列表中:另一个维基百科条目

我能够使用最简单的代码将其添加到现有页面中:

<script language="javascript" type="text/javascript" src="edit_area/edit_area_full.js"></script>
<script language="javascript" type="text/javascript" >
editAreaLoader.init({
  id: "my_textarea_id"   // ID of textarea to turn into syntax editor.
  , syntax: "php"
  , start_highlight: true
  , allow_resize: "both"
  , toolbar: "search, go_to_line, |, undo, redo, |, highlight, reset_highlight, word_wrap,|,syntax_selection"
  , min_height:150
  , min_width:400
});
</script> 

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:

<script language="javascript" type="text/javascript" src="edit_area/edit_area_full.js"></script>
<script language="javascript" type="text/javascript" >
editAreaLoader.init({
  id: "my_textarea_id"   // ID of textarea to turn into syntax editor.
  , syntax: "php"
  , start_highlight: true
  , allow_resize: "both"
  , toolbar: "search, go_to_line, |, undo, redo, |, highlight, reset_highlight, word_wrap,|,syntax_selection"
  , min_height:150
  , min_width:400
});
</script> 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文