如何在 TinyMCE 中更改 activeEditor?

How to change activeEditor in TinyMCE?

如何在 tinyMCE 中以编程方式更改 activeEditor。 前任: 就像我在同一个页面中有两个编辑器一样,我如何以编程方式在它们之间切换?

当你聚焦不同的编辑器时,activeEditor会切换,所以方法是调用你想要激活的编辑器的焦点。您可以通过传递 false.
选择不实际聚焦编辑器 https://www.tiny.cloud/docs/api/tinymce/tinymce.editor/#focus

从该页面摘录:

focus

focus(skipFocus:Boolean)

Focuses/activates the editor. This will set this editor as the activeEditor in the tinymce collection it will also place DOM focus inside the editor.

Parameters

  • skipFocus (Boolean) - Skip DOM focus. Just set is as the active editor.

我们可以通过 tinyMCE.get('field-name')tinyMCE['field-name'] 获取 TinyMCE 的任何实例,此处字段名称将是与 TinyMCE 关联的字段。