如何使 execCommand 以角度工作

问题描述

我尝试使用 execCommand 构建自定义的新文本编辑器。 我已经有了基于选择 AP 的文本编辑器。但是改进它和修复错误太重了。 角版本 - 5; CkEditor 和其他 - 不是一个选项:(

我遇到了一个问题 - 无法在 angular 上使用 document.execCommand('bold',false,null)(或任何其他 execCommand)。我拥有的: HTML 内部

 <div #content contentEditable="true" id"content"></div>
    <button (click)="addStyles($event)">

组件内部:

addStyles(e:MouseEvent) {
 e.preventDefault();
 document.execCommand('bold');
 console.log(document.execCommand('bold)) ->  false // but should be true
}

需要您的建议,如何在 Angular 中正确使用 document.execCommand()

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...