如何在 Cypress Automation 的 CKEditor5 中设置光标位置或选择特定内容?

问题描述

我正在寻找一种在 Cypress Automation 的 ckeditor5 中设置光标位置(或设置选择)的方法。从这个位置开始输入或删除一些内容。但我找不到如何做到这一点的方法。 我尝试使用 ckeditor5 对象如下:

cy.window()
  .its('editor')
  .then(editor => {
    editor.model.change(writer => {
      const position = writer.createPositionFromPath(
        editor.model.document.getRoot(),[0,2,27]);
      const position1 = writer.createPositionFromPath(
        editor.model.document.getRoot(),27]);
      const range = writer.createrange(position1,position);
      writer.setSelection(range);
    });
});
CKEDITOR.Editor.create( document.querySelector( '#editor' ) )
  .then( editor => {
    window.editor = editor;
  })

但它不起作用。

也许有人知道如何做到这一点?使用 cypress 或 ckeditor5 对象...

解决方法

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

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

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