textarea:触发本机撤消/重做的按钮 [英] textarea: button to trigger native undo/redo

查看:75
本文介绍了textarea:触发本机撤消/重做的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个textarea。它具有默认的撤消/重做功能,可以使用ctrl-z / y,也可以右键单击并选择复制/粘贴。

I have a textarea. It has default undo/redo functionality, either with ctrl-z/y or by right-clicking and choosing copy/paste.

我想创建一个撤消/重做按钮并触发本机撤消/重做。我不知道如何触发这个。 (我的用户不知道ctrl-z感到惊讶)

I want to create an undo/redo button and trigger the native undo/redo. I'm not sure how to trigger this. (Was surprised that my users don't know ctrl-z)

推荐答案

您可以使用文档。 execCommand 来实现这个功能。一些HTML编辑使用它。

You can use document.execCommand to achieve this functionallity. It is used by some HTML-editors.

execCommand兼容性

这篇关于textarea:触发本机撤消/重做的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆