我正在使用Tiptap构建RichText编辑器,其中一个菜单按钮在单击时有以下操作:
async function handleHtmlPaste() {
// editor?.chain().focus().run();
const text = await navigator.clipboard.readText();
// let text = `<h1 style="margin-left: 0px!important;">Test</h1><h2 style="margin-left: 0px!important;">Basic text formatting</h2>`;
editor
?.chain()
.focus()
.command((props) => {
props.view.pasteHTML(text);
return true;
});
return true;
}
不幸的是,我收到了以下错误:unauect(In Promise)DOMException:Read权限被拒绝.原因是什么?