c# - אנגולר Typescript CKEDITOR


אני מנסה להשתמש במצב inline הזה אבל אני נתקל בהרבה בעיות איתו. איכשהו הסגנון מוסר ואני מקבל את השגיאה הזו לגבי reading 'config'. רציתי לוודא שאני מגדיר את הקונפיגורציה עבור בקרת זו על ידי שימוש באובייקט editor. כל עזרה תהיה נהדרת.

לא ניתן לקרוא מאפיינים של ערך שאינו מוגדר (קריאה ל-'config')

תצוגה

<div class="col-sm-10">
    <div class="controls">
        <textarea id="indicationElementId" 
            formControlName="indicationContent" 
            class="form-control" 
            [(ngModel)]="item.ValueName"
            placeholder="Indication text"
            [class.has-error]="indicationContentNeedsErrorClass">
        </textarea>
    </div>
</div>

צ'ס

CKEDITORInitializer() {
    if ((<any>window).CKEDITOR.instances.indicationElementId)
        (<any>window).CKEDITOR.instances.indicationElementId.destroy(); 
        (<any>window).CKEDITOR.instances["indicationElementId"];
        let editor = (<any>window).CKEDITOR.inline("indicationElementId", {
                keystrokes: [
                    [13 /*Enter*/, 'doNothing'],
                    [(<any>window).CKEDITOR.SHIFT + 13, 'doNothing']
                ],
                enterMode: 2,
                toolbar: [
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Subscript', 'Superscript'] },
                    { name: 'insert', items: ['SpecialChar'] },
                    { name: 'source', items: ['Sourcedialog'] }
                ],
                specialChars: ['&copy;', '&reg;', '&ndash;', '&frac34;', '&ge;', '&le;'],
                removeButtons: '',
                extraPlugins: 'sourcedialog'
        });

        editor.CKEDITOR.config.allowedContent = true;
        editor.CKEDITOR.config.autoParagraph = false;
        editor.CKEDITOR.disableAutoInline = true;

        editor.on("change", () => {
            this.ngZone.run(() => {
                this.item.ValueName = this.getContent();
                this.indicationContentChanged.next(null);
            });

        });

פלט

תשובה #1

הבעיה היא בניסיון להגדיר את הקונפיגורציה. אפשר לנסות:

editor.config.set('allowedContent', true);
editor.config.set('autoParagraph', false);
editor.config.set('disableAutoInline', true);