tinyMCE的撤销是如何工作的?

发布于 2024-10-21 04:57:14 字数 283 浏览 2 评论 0原文

我的一位用户对tinyMCE 中的撤消功能感到非常沮丧。它不是撤消最后一个微小的更改,而是撤消许多更改。这是每隔几秒拍摄一次快照的计时问题吗?这是可配置的吗?

其他信息:用户正在将信息从 Word 复制并粘贴到编辑器。然后清理Word留下的残渣。这包括删除项目符号之间多余的空行、删除“从 Word 粘贴”功能留下的多余垃圾等。发生的情况是她哎呀删除了太多内容。所以她点击撤消,它会撤消比上一次更多的内容。让她把一切都重新做一遍。撤消操作甚至完全删除了她最初粘贴的所有文本(即使这不是最后一次编辑)。

One of my users has a major frustration with the undo feature in tinyMCE. Instead of undoing the last minor change, it undoes many changes. Is this a timing thing were a snapshot is taken every few seconds? Is this configurable?

Additional Information: The user is copying and pasting information from Word to the editor. Then cleaning up the crud that Word leaves behind. This includes deleting the extra blank lines between bullets, deleting extra garbage that the Paste from Word function leaves behind, etc. What happens is she does an oops and deletes too much. So she hits undo and it'll undo a lot more than the last oops. Making her do everything again. The undo has even completely removed all of the text she has pasted in initially (even though that wasn't the last edit).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

逆光下的微笑 2024-10-28 04:57:14

撤消以一种特殊的方式进行。当发生特殊事件(返回、删除、粘贴...)时,tinymce 会生成撤消步骤(编辑器内容的快照)。拍摄快照没有时间间隔。

您甚至可以捕获事件并添加自己的撤消步骤。这是一个示例(我在我自己的插件之一中使用):

// save undo step when space is pressed
ed.onKeyUp.add(function(ed, evt)
  if (evt.keyCode == 32) {
    ed.undoManager.add();
  }
});

有关更多信息,请查看 位于tinymce api 的 undomanager 部分。

Undo works in a special way. There are undo steps (snapshots of the editors content) produced by tinymce when special events occur (return, delete, paste, ... ). There is no interval in what snapshots are taken.

You even may catch events and add your own undo steps. Here is an example (i use in one of my own plugins):

// save undo step when space is pressed
ed.onKeyUp.add(function(ed, evt)
  if (evt.keyCode == 32) {
    ed.undoManager.add();
  }
});

For more information have a look at the undomanager section of the tinymce api.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文