Angular material 2 个带 ckeditor 的选项卡

Angular material 2 tabs with ckeditor

我在尝试将 ng2-ckeditor 放入 angular-material2 的 md-tab 中时遇到问题。

代码如下:

HTML:

<md-tab-group>
    <md-tab>
        <ckeditor [(ngModel)]="content"></ckeditor>
    </md-tab>
</md-tab-group>

问题是,每当我在 ckeditor 中单击某些内容时,我都会收到错误消息:

ckeditor.js:438 Uncaught TypeError: Cannot read property 'getSelection' of undefined at CKEDITOR.dom.selection.getNative (ckeditor.js:438) at CKEDITOR.dom.selection (ckeditor.js:436) at a.CKEDITOR.editor.getSelection (ckeditor.js:434) at $.onOpen (ckeditor.js:721) at $.d.onShow (ckeditor.js:697) at $.showBlock (ckeditor.js:716) at $.e [as click] (ckeditor.js:696) at Object.execute (ckeditor.js:690) at ckeditor.js:691 at ckeditor.js:31 at Object.callFunction (ckeditor.js:31) at HTMLAnchorElement.onclick (VM30482 -KkkPBxTMDSipcy86VCV:1)`

奇怪的是,当它加载选项卡时(大约 1 秒)显示正常。

有什么解决办法吗?谢谢!

您好,添加 divarea 插件后似乎可以正常工作: <ckeditor [(ngModel)]="content" [config]="{extraPlugins: 'divarea'}"></ckeditor>

我有类似的问题 (CkEditor and Angular Material 2 Tabs)。

Thew divarea 插件没有成功,但我发现如果我将 CkEditor 放在将立即可见的选项卡中(第一个 one/selected),那么编辑器工作正常。

也许这会对某人有所帮助。