A rich text editor that supports collaborative editing and allows for the free use of front-end common libraries such as React and Vue to extend and define plugins.
MIT License
Bot releases are hidden (Show)
Published by big-camel over 2 years ago
Published by big-camel over 2 years ago
Added options
A table copied from a word document will have blank lines before and after the cells
Published by big-camel over 2 years ago
Published by big-camel over 2 years ago
Published by big-camel over 2 years ago
Published by big-camel over 2 years ago
onClick
onSelect
event of toolbarPublished by big-camel over 2 years ago
https://github.com/red-axe/am-editor/blob/master/examples/react/components/editor/ot/client.ts
// 实例化编辑器内部协同服务
this.engine.ot.initRemote(doc, defaultValue, (paths) => {
this.broadcast('select', paths);
});
engine.ot.renderSelection
api 绘制协作者的光标// 广播信息,一个协作用户发送给全部协作者的广播
if ('broadcast' === action) {
const { uuid, body, type } = data;
// 如果接收者和发送者不是同一人就触发一个message事件,外部可以监听这个事件并作出响应
if (uuid !== this.current?.uuid) {
switch (type) {
case 'select':
this.engine.ot.renderSelection(body);
break;
default:
this.emit(EVENT.message, {
type,
body,
});
}
}
}
getSelectionData
api to editor
editor.getSelectionData()
to get the text and html selected in the current editorpaste
api to editor
engine.change.paste('HTML')
to paste a piece of html in the current selection