angular-ui / ui-tinymce

AngularUI wrapper for TinyMCE
MIT License
488 stars 371 forks source link

Editor does not respect ng-disabled #214

Open richcocks opened 8 years ago

richcocks commented 8 years ago

Hi,

I am having issues getting this directive to follow ng-disabled. There seems to be an issue where in the toggleDisable function, the tinyInstance variable is always null.

Plunkr: https://plnkr.co/edit/7gnFLWZQkWtKhN68LJTs?p=preview

This shows the editor is not read only, despite the expression evaluating to true.

Additionally, even with a checkbox to control the value of test2: https://plnkr.co/edit/QDuPfwAHr7mxfu3daMB7?p=preview

Here, the editor should start read only but does not, and only when un-checking and re-checking the checkbox does the editor go to read only.

Lastly, even in read only, it is possible to delete content but not add content to the editor, also the controls are not greyed out on the toolbar.

Is there something I am doing wrong that means the editor is behaving differently to than if I specify readonly through the editor setup options?

deeg commented 8 years ago

Thanks for posting this, looks to be a legitimate issue still.

Looks like this is related to #74.

Feel free to put up a PR if you already have a fix with appropriate tests, if not I will try to get to it as soon as possible.

deeg commented 8 years ago

The more I look this seems to be an issue with TinyMCE and not this library.

What we are currently doing to disable editing seems to be the suggested way of disabling the editor. This has the known side effect of not disabling the buttons on the editor, and a bug where you can still delete the content.

It doesn't seem that TinyMCE gives us a great way to disable changing the content in the editor as well as making all of the buttons looked disabled.

I'm going to spend a bit more time researching and most likely open a bug/feature request with TinyMCE.

Will leave this bug open until a decision has been made.

monkeypro commented 7 years ago

Seems to work as expected if you use tinyInstance.setMode('readonly'); instead of tinyInstance.getBody().setAttribute('contenteditable', false);

dev-thinks commented 4 years ago

tinyInstance.setMode('readonly');

This works