Releases: red-axe/am-editor
Releases · red-axe/am-editor
@aomao/[email protected]
Improvements
- Remove the bound event when the plugin destroys
- Upload files based on mimeType
@aomao/[email protected]
Fixed
- paste: In some cases when pasting, some nodes will be skipped and cannot be parsed
@aomao/[email protected]
Fixed
- codeblock parsing markdown will be one less character
- Add a blank line when clicking at the head and tail of the editor area
- Rendering the card under readonly will lose the cursor nodes on the left and right sides of the card
- Toolbar is not centered after image upload
@aomao/[email protected]
特征
解耦协作者光标,否则协作者的光标变化数据会被频繁写入数据库
- 需要在初始化时提供一个监听协作光标变化的方法,并且广播其给的协同光标数据
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,
});
}
}
}
修复
- 在当前编辑环境中如果编辑器处于失去焦点的状态,那么协作者数据变化时,会被自动设置焦点到编辑器上
- typing 在 engine.destroy 中未销毁
@aomao/[email protected]
Fixed
- ot: Multiplayer collaborative background will cause a horizontal scroll bar to appear
Improvements
- video: increase the mask, and it will play immediately if it is not selected
- image: add the maxHeight option, and images with a height greater than maxHeight will be scaled proportionally
@aomao/[email protected]
Features
- Added
getSelectionData
api to editor- Use
editor.getSelectionData()
to get the text and html selected in the current editor
- Use
- Added
paste
api to editor- Use
engine.change.paste('HTML')
to paste a piece of html in the current selection
- Use
Improvements
- table When multiple people are collaboratively editing, clicking on the table will repeat the cursor information of the collaborators
@aomao/[email protected]
Improvements
- table
- Table card toolbar blocks delete buttons for table rows and columns
- The cell is filled with block-level cards, and an empty row is added after clicking the cell
@aomao/[email protected]
@aomao/[email protected]
Fixed
- engine 空值情况下编辑可能会出现不符合预期的div节点
Improvements
- table 调整工具栏右键打开菜单栏时的位置
- paste 优化粘贴的精准性
- ot & card 协同编辑情况下,卡片节点的属性发生变化将不再触发可编辑卡片重绘
@aomao/[email protected]
Features
- card.parserHtml 增加回调函数,通过继承重写 parserHtml 方法转换卡片为html更快捷
Fixed
- plugin-math 多个请求导致只能渲染一个math卡片
- scrollbar 滚动条在比较时在1px以下的差异,导致出现不必要的滚动条
- mark mark节点类型执行wrapByNode的时会重复包裹相同的插件
- plugin-mention 鼠标在列表上移动失去了背景颜色变化