当前位置:网站首页>Opening chapter of online document technology - rich text editor
Opening chapter of online document technology - rich text editor
2022-06-24 08:09:00 【Zhang Chi Terry】
Opening chapter of online document technology disclosure - Rich text editor
Preface
This article aims to introduce the core module of online document rich text editor technology , It also introduces how to select rich text editor technology for mainstream business document products in the industry .
Rich text editor
Rich text editor ,Rich Text Editor, abbreviation RTE, It can be embedded in the browser , WYSIWYG text editor .
Rich text editor - Common interactions
- Content input area
- Input content
- district & operation
- The action bar
- Top Toolbar
- Sidebar
- Embedded toolbar
- Right click menu
Rich text editor - classification
Rich text editors usually do 3 Grading :L0、L1 and L2
L0
Rely on browser features , Mainly used designMode、ContentEditable、webkit-user-modify、execCommand Other characteristics . Early editors used this approach , But the customizable space is limited . For example, early technology products WYSIWYG Editor.
<div class="kuaishou" contentediable="true"> Please enter the text </div> <!-- Rich text input box -->
documennt.execCommand('bold'); // operation
Copy code L1
L1 stay L0 Continue to use browser features based on 、DOM Of API From the main implementation Selection、Range、Element、TextNode etc. , It has certain scalability , But there will be many difficult problems . Major commercial products include graphite documents (Quill), Tencent documents (Etherpad ACE), Flying book document (Etherpad ACE), Language bird document (slate, lake), Impression notes (PromiseMirror),Confluence WIKI as well as SAAS Knowledge base integrated within the product (Teambition Thoughts、Pingcode wait ); Technical products include CKEditor、TinyMCE、Draft.js、 Slate、Quil.js 、ACE wait , Usually we're right about L1 From the layout implementation, the editor is also divided into 【 The traditional model 】 and 【MVC Pattern 】
- The traditional model
DOM Tree equals data , Use DOM API Direct manipulation (CKEditor 4、TineMCE、UEditor)
- MVC Pattern
Data and rendering are separated , After data model changes , The data changes (Slate、CKEditor 5、Quil.js)
L2
Custom input and actions , Include cursor 、 typewriting 、 Delete and other basic actions , Have the ability of drawing and layout . Major commercial products include Google Docs、 Office Word Online、WPS And light bird documentation .
Rich text editor - contrast
Add :Google Docs、WPS as well as Office Online The reason why you experience extreme performance , Rich product experience , It also comes from the huge R & D costs .
Rich text editor - Technology selection
From the perspective of team size
- The product content experience is simple , And the lack of editor developers , Direct use is recommended Quill、 Slate.js、CKEditor、TIngMCE Secondary development .
- Integrated lightweight knowledge base within the product , Yes 5 Editor development team within people : Self research is recommended L1 Level editor 、
- Take collaborative editing as the core of the product , Layout benchmarking Office, The number of editor developers exceeds 20+ Editor development team : Self research is recommended L2 Editor .
From the perspective of the essential features of the editor
- Robustness, - The stability of the editor is the lifeline of the editor .
- Excellent architecture
- Be able to define a document model , And it can distinguish whether two document models are visually equal in a simple way .
- good MVC framework , Create one in DOM Mapping to the model , And have a complete hierarchy
- The ability to define well behaved editing operations on the document model (operation).
- Maintainability - The amount of rich text editor code increases with iterations , So it is very important to maintain it in a simple and reliable way
- Extensibility - Excellent plug-in mechanism , Excellent extended iteration capability .
userInput→ Action → Edit → Operation → Command → Mutation → Model → View(Layout,Redraw)→ DOM
block-style editor
similar Notion perhaps Notion LIke The product belongs to the new block level editing experience notes , Have unlimited levels of pages and blocks ,Back Link as well as Database Experience , It is obviously different from the traditional rich text editor in product experience , This article does not focus on , If you are interested, you can read editorjs.io/
L2 Rich text editor Overview
classification
Belong to L2 level
Development mode
- The core input area of the editor is native JavaScript Realization
- Top action bar , Sidebar , Inline bar , Various plug-ins are based on React/Vue/ Native JavaScript Can be realized
Core module
1. Edit engine & Calculation engine
Independent document model , Manage documents Model And View Mapping between
2. Layout engine
Re implement the rendering layout engine , Replace the browser default layout implementation
3. Collaborative engine
Multi person cooperative operation OT, Support multi person online collaborative editing at the same time
4. Plug in engine
Support editor block The key capability of urbanization
Key design
- command Atomic operation abstraction and design
- Architecture layering of large front-end software , Open to expansion , Closed for modification
边栏推荐
- Open cooperation and win-win future | Fuxin Kunpeng joins Jinlan organization
- Interview tutorial - multi thread knowledge sorting
- Tuple remarks
- How does dating software cut your leeks
- Leetcode 174 Dungeon games (June 23, 2022)
- Introduction of model compression tool based on distiller
- Vulnhub target: boredhackerblog: social network
- Model effect optimization, try a variety of cross validation methods (system operation)
- Vulnhub靶机:BOREDHACKERBLOG_ CLOUD AV
- Leetcode 207: course schedule (topological sorting determines whether the loop is formed)
猜你喜欢
随机推荐
Vulnhub target: boredhackerblog: social network
Swift 基础 闭包/Block的使用(源码)
C# Lambda
Smart pointer remarks
Shader common functions
Keep one decimal place and two decimal places
Sql语句内运算问题
Review of postgraduate English final exam
Chapitre 2: dessiner une fenêtre
1279_VMWare Player安装VMWare Tools时VSock安装失败解决
Los Angeles p1051 who won the most Scholarships
GraphMAE----论文快速阅读
Atguigu---15- built in instruction
The monthly salary of two years after graduation is 36K. It's not difficult to say
[nilm] non intrusive load decomposition module nilmtk installation tutorial
Swift extension networkutil (network monitoring) (source code)
AWTK 最新动态:Grid 控件新用法
Pair class notes
Online education fades
第 3 篇:绘制三角形








