值
一个 String,其中包含替换 updateRangeStart 和 updateRangeEnd 索引之间的文本的文本。
示例
使用 textupdate 显示插入的文本和位置
html
<div id="editor"></div>
js
const editorEl = document.getElementById("editor");
const editContext = new EditContext();
editorEl.editContext = editContext;
editContext.addEventListener("textupdate", (e) => {
console.log(
`The user inserted the text "${e.text}" at index ${e.updateRangeStart}.`,
);
});
规范
| 规范 |
|---|
| EditContext API # dom-textupdateevent-text |
浏览器兼容性
加载中…