无法在Angular2中设置未定义的ckeditor的属性'dir'

时间:2017-04-11 09:53:19

标签: javascript angular ckeditor ckeditor4.x

每当我尝试加载Ckeditor时,我都会收到“无法设置未定义的属性'dir'”。我正在使用angular-cli来开发我的Angular2应用程序。

CKEditor版本:4.4.7

当我使用ng服务运行应用程序时。此问题不会重现,但是当我使用ssl运行此应用程序时,我得到了CKEditor的这个问题。

我在index.html中添加了basepath,但仍面临问题。

我试过这个: 1)

<script type="text/javascript">
 window.CKEDITOR_BASEPATH = '//localhost/assets/axp-dev-portal/ckeditor/';
</script>
<script src="//localhost/assets/axp-dev-portal/ckeditor/ckeditor.js"></script>

2)

<script type="text/javascript">
 window.CKEDITOR_BASEPATH = '/assets/ckeditor/';
</script>
<script src="/assets/ckeditor/ckeditor.js"></script>

3)

<script type="text/javascript">
 var CKEDITOR_BASEPATH = '/assets/ckeditor/';
</script>
<script src="/assets/ckeditor/ckeditor.js"></script>

在document.ts文件中:

focusFunction() {

            if (window['CKEDITOR'].instances['prodAPIDoc'] == undefined) {
                window['CKEDITOR']['inline']('prodAPIDoc', { customConfig: '../../../assets/ckeditor/config.js' });
        }
    }

document.html

<div  id="prodAPIDoc" [attr.contenteditable]="isEditable" 
      style="text-align: left; position: relative;margin-left:5px;" [innerHTML]="documentation | sanitizeHtml"
      (focus)="focusFunction()">

我想使用ckeditor.js而不是ng2-ckeditor。

如何将ng2-editor实现为angular2中的内联? 我将ng2-ckeditor实现为内联,但我收到以下错误。

错误:

vendor.abcb022….bundle.js:1262 EXCEPTION: Cannot set property 'dir' of undefinedt.handleError @ vendor.abcb022….bundle.js:1262next @ vendor.abcb022….bundle.js:736e.object.i @ vendor.abcb022….bundle.js:785e.__tryOrUnsub @ vendor.abcb022….bundle.js:1e.next @ vendor.abcb022….bundle.js:1e._next @ vendor.abcb022….bundle.js:1e.next @ vendor.abcb022….bundle.js:1e.next @ vendor.abcb022….bundle.js:22e.emit @ vendor.abcb022….bundle.js:785t.triggerError @ vendor.abcb022….bundle.js:841onHandleError @ vendor.abcb022….bundle.js:841t.handleError @ vendor.abcb022….bundle.js:2158n.runTask @ vendor.abcb022….bundle.js:2158invoke @ vendor.abcb022….bundle.js:2158
vendor.abcb022….bundle.js:1262 ORIGINAL STACKTRACE:t.handleError @ vendor.abcb022….bundle.js:1262next @ vendor.abcb022….bundle.js:736e.object.i @ vendor.abcb022….bundle.js:785e.__tryOrUnsub @ vendor.abcb022….bundle.js:1e.next @ vendor.abcb022….bundle.js:1e._next @ vendor.abcb022….bundle.js:1e.next @ vendor.abcb022….bundle.js:1e.next @ vendor.abcb022….bundle.js:22e.emit @ vendor.abcb022….bundle.js:785t.triggerError @ vendor.abcb022….bundle.js:841onHandleError @ vendor.abcb022….bundle.js:841t.handleError @ vendor.abcb022….bundle.js:2158n.runTask @ vendor.abcb022….bundle.js:2158invoke @ vendor.abcb022….bundle.js:2158
vendor.abcb022….bundle.js:1262 TypeError: Cannot set property 'dir' of undefined
    at Object.t (main.d2b46cd….bundle.js:4)
    at c (main.d2b46cd….bundle.js:4)
    at Array.p (main.d2b46cd….bundle.js:4)
    at u (main.d2b46cd….bundle.js:4)
    at HTMLScriptElement.CKEDITOR.env.ie.CKEDITOR.env.version.i.$.onerror (main.d2b46cd….bundle.js:4)
    at HTMLScriptElement.e [as __zone_symbol___onerror] (vendor.abcb022….bundle.js:2130)
    at t.invokeTask (vendor.abcb022….bundle.js:2158)
    at Object.onInvokeTask (vendor.abcb022….bundle.js:841)
    at t.invokeTask (vendor.abcb022….bundle.js:2158)
    at n.runTask (vendor.abcb022….bundle.js:2158)
    at HTMLScriptElement.invoke (vendor.abcb022….bundle.js:2158)

0 个答案:

没有答案