Principles of Rich Text Editor

Source: Internet
Author: User
Rich Text Editor, RTE for short, is a text editor embedded in a browser that is WYSIWYG.
The Rich Text Editor is different from the text editor. The better text editor is kindeditor and FCKeditor. The open-source Rich Text Editor ueditor launched by Baidu is one of the highlights. For browsers that support rich text editing, you can set the document designMode attribute to on and then execute document.exe ccommand ('commandname' [, uiflag [, value. Commandname and value can be found on msdn and MDC. They are the commands for creating various formats. For example, we need to bold the font and execute document.exe ccommand ('bold ', false. It's easy, right? However, it is worth noting that the command is executed only after the selected text is selected, and the selected text is formatted. For unselected text, different browsers have different processing methods. For example, ie may format the label content in the cursor, but other browsers do not process it, this is beyond the content of this article. Note that setting uiflag to true indicates display any user interface triggered by the Command (if any)
Differences between browsers 1. When Mozilla and IE generate HTML, Mozilla generates a span style, While IE generates a style using HTML tags: Mozilla
<span style="font-weight: bold;">I love geckos.</span><span style="font-weight: bold; font-style: italic;     text-decoration: underline;">Dinosaurs are big.</span>
IE
<STRONG>I love geckos.</STRONG><STRONG><EM><U>Dinosaurs are big.</U></EM></STRONG>
2. Another difference is that the access to documentmozilla in IFRAME uses the W3C standard iframeelement. contententie to use iframeelement.doc ument or directly use document.getelementbyid(aid).content{doc ument to obtain the document
The simplest editor example is provided here:

Eidtor.html
<! Doctype HTML> Eidtoriframe.html

<!DOCTYPE html>




Common command reference: https://developer.mozilla.org/en-US/docs/Web/API/document.execCommand

Principles of Rich Text Editor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.