【发布时间】:2019-09-25 18:33:38
【问题描述】:
在 Ckeditor 5 中,我无法找到从元素中提取字符串的方法。当用户在段落中间点击回车时,我想添加一个功能:
- 分割段落
- 获取最后一段的内容
- 从编辑器中删除最后一段
editor.model.change( writer => {
const paragraph = editor.model.document.selection.getFirstPosition();
writer.split(paragraph);
const model = editor.model;
const doc = model.document;
const root = doc.getRoot();
// HTML-like string representation of lastParagraph below?
const lastParagraph = root.getChild(root.childCount - 1);
})
我的编辑器只允许一个段落。
【问题讨论】:
标签: javascript ckeditor ckeditor5 ckeditor5-react