ckeditor / ckeditor4-angular

Official CKEditor 4 Angular component.
Other
51 stars 32 forks source link

[CKEDITOR.resourceManager.load] Resource name "default" was not found #258

Open aroshanzamir opened 2 months ago

aroshanzamir commented 2 months ago

sometimes I get the following error: Uncaught Error: [CKEDITOR.resourceManager.load] Resource name "default" was not found at "https://cdn.ckeditor.com/4.12.1/full-all/styles.js?t=J5S7".

editor-error

and sometimes I get the following: editor-error-4

My problem is that sometimes it gives this error.

This is my editor config:

public getCKEditorConfig(direction: "rtl" | "ltr" = "rtl", plugins: string[] = [], type: CKEditorFormatType = "Advanced"): any {

        let removedItems: string = "Source,Templates,Save,NewPage,Print,Replace,Scayt,SelectAll,Form,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Blockquote,CreateDiv,Language,Image,Flash,Table,HorizontalRule,Smiley,SpecialChar,PageBreak,Iframe,ShowBlocks,About,Checkbox,Find,Preview,Styles,Format,Anchor,Maximize,CopyFormating"
        switch (type) {
            case "Advanced":
                break;

            case "Basic":
                removedItems += `,FontFormat,Font,Styles,Format,FontSize,Link,Unlink,TextColor,BGColor,Copy,Cut,Paste,Undo,Redo,Print,Form,TextField,Textarea,Button,SelectAll,CreateDiv,Table,PasteText,PasteFromWord,Select,HiddenField,Maximize,ShowBlocks,Image,Flash,Table,HorizontalRule,Smiley,SpecialChar,PageBreak,Iframe,-,Blockquote,CreateDiv,-,BidiLtr,BidiRtl,Subscript,Superscript,-,RemoveFormat,Form,Checkbox, Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Unlink,CopyFormatting`
                break;

            case "Empty":
                removedItems += `,Copy,Cut,Paste,Undo,Redo,Print,Form,TextField,Textarea,Button,SelectAll,NumberedList,BulletedList,CreateDiv,Table,PasteText,PasteFromWord,Select,HiddenField,Styles,Format,FontSize,TextColor,BGColor,Maximize,ShowBlocks,Image,Flash,Table,HorizontalRule,Smiley,SpecialChar,PageBreak,Iframe,NumberedList,BulletedList,-,Outdent,Indent,-,Blockquote,CreateDiv,-,JustifyLeft,JustifyCenter,JustifyRight,JustifyBlock,-,BidiLtr,BidiRtl,Bold,Italic,Underline,Strike,Subscript,Superscript,-,RemoveFormat,Form,Checkbox, Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Link,Unlink,Anchor,FontFormat,Font,CopyFormatting`
                break;
        }

        const config = {
            allowedContent: false,
            forcePasteAsPlainText: false,
            language: 'en',
            contentsLangDirection: direction,
            font_style: {
                overrides: [{ element: 'font', attributes: { 'face': null } }]
            },
            extraPlugins: `${plugins ? [...plugins, 'divarea'].toString() : 'divarea'}`, //strinsert
            removeButtons: removedItems,
            baseFloatZIndex: 9999999999
        }

        if (direction == "rtl") config.language = "fa"
        return config
 }

and I added the following scripts in the index.html:

<script src="https://cdn.ckeditor.com/4.12.1/full-all/ckeditor.js"></script>
  <script src="https://cdn.ckeditor.com/4.12.1/full-all/lang/fa.js"></script>
  <script src="https://cdn.ckeditor.com/4.12.1/full-all/lang/en.js"></script>

  <script>
    CKEDITOR.config.forcePasteAsPlainText = true;
    CKEDITOR.config.language = 'en'
  </script>