Angular 中的 Tinymce 编辑器选择问题

Tiny MCE Editor Selection Issue in Angular

我正在使用 TinyMCE 编辑器,同时选择单个标签 returns 使用此函数 editor.selection.getNode() 正确的值。但是当我选择两个标签数据时,它 returns 来自编辑器的所有 HTML 内容。

示例如下截图

enter image description here

TinyMCE 编辑器的内容区域结构是一个完整的 DOM 树,包含 <head><body> 元素。 (除非使用 Full Page 插件,否则这些通常对最终用户是模糊的。)

documentation.getNode() returns 中所述:

...the currently selected element or the common ancestor element for both start and end of the selection.

和HTML 喜欢:

<h1>Heading</h1>
<p>Paragraph text.</p>

选择的“共同祖先元素”将是 <body> 包装编辑器中所有内容的元素。