Cannot set 'readonly' property using angular-ckeditor

Viewed 515

I'm using this npm package - https://www.npmjs.com/package/angular-ckeditor in an AngularJs app with angular version 1.4.8.

I'm using the ckeditor directive like this:

        <div class="messaging-editor>
           <div ckeditor="ctrl.ckOptions" ng-model="ctrl.formData.email"></div>
        </div>

I need to be able to dynamically set the readOnly property for this editor based on a certain condition. I haven't been able to set the editor to readOnly by hardcoding it or by any means. Note: I tried both lowercase readonly as well as camelCase readOnly.

I've attempted to set the readOnly property in the ctrl.ckOptions object.

I've tried hardcoding it to true in the main config file.

I tried adding the readonly attribute to the <div> where the directive is being used.

I've also added a script directly to my template file to try to set the editor to readOnly on instanceReady event. I'm able to see the event fire and tried running editor.setReadOnly(true) but it remains false.

I've also tried this workaround I've found on other posts, though it wasn't for this node package specifically but ckeditor:

    editor.document.$.body.disabled = true;
    editor.document.$.body.contentEditable = false;
    editor.document.$.designMode="off";
0 Answers
Related