angular-ui / ui-ace

This directive allows you to add ACE editor elements.
http://angular-ui.github.io/ui-ace
MIT License
578 stars 172 forks source link

add readOnly option. #3

Closed rotoshine closed 11 years ago

rotoshine commented 11 years ago

add readOnly option.

douglasduteil commented 11 years ago

Can you add a unit test ? (with Editor.getReadOnly )

ProLoser commented 11 years ago

Shouldn't this be a readonly attribute?

douglasduteil commented 11 years ago

Why not. You want to standardize it as well ?

ProLoser commented 11 years ago

I mean instead of doing <textarea ui-ace="{readOnly: true}"> shouldn't it be <textarea ui-ace readonly> or in other words if (angular.isDefined(attrs.readonly)) { ...

ProLoser commented 11 years ago

Although It should probably be attrs.$observe('readonly') or something similar.

douglasduteil commented 11 years ago

Alright.

The same thing will work on Codemirror. And in ui-map readonly could directly disable all events and controls. Something like that :

{
// Event
draggable: false, zoomControl: false, scrollwheel: false, disableDoubleClickZoom: true,
// UI
disableDefaultUI: true
}

What you think ?

ProLoser commented 11 years ago

Sounds good to me, but I was at the very least primarily focused on form inputs since <textarea readonly> is a valid HTML attribute, where as it's more ambiguous (but not necessarily a bad idea) on non-form elements.