outsideris / angular-summernote

AngularJS directive to Summernote
MIT License
335 stars 128 forks source link

ng-disabled #67

Open loykianos opened 9 years ago

loykianos commented 9 years ago

Hi there, is there a way to disable the summernote? I have tried using ng-disabled but it doesn't seem to work. Good job either way.

outsideris commented 9 years ago

Now, it isn't supported. I will consider it.

bjaraujo commented 8 years ago

+1

chakrabandla commented 8 years ago

Any updates please

martijndebruijn commented 8 years ago

+1 would be great. Reduces a lot of boilerplate is my existing code.

hamxabaig commented 8 years ago

+1 please.

javieerrubio11 commented 7 years ago

+1 please

robbporto commented 7 years ago

+1

nicolaib commented 7 years ago

Any news on this? Or can anyone give me some pointers on how this could be implemented? The original version has this in built in to the Basic API using $('#summernote').summernote('disable'); and $('#summernote').summernote('enable'); Thanks

hamxabaig commented 7 years ago

@nicolaib instead, you can show an absolute div with z-index greater than parent. So that it acts as overlay and stops interaction to summernote. Some CSS can do this job easily ;)

nicolaib commented 7 years ago

I solved it this way, which removes the possibility to change the text and images. It's also kinda hacky but better than putting a div over the textarea - I think ;-) $timeout(function(){ angular.element('.note-editable').attr('contenteditable', false); angular.element('.note-control-selection').remove(); },0); This is useful if it's needed on-the-fly.

Another solution that is also useful (and maybe better if not needed on-the-fly) is to show the editor content as trusted HTML like this: Controller: function trustedHTML(inputHTML){ return $sce.trustAsHtml(inputHTML); } View: <div ng-bind-html="$ctrl.trustedHTML($ctrl.text)"></div>

hamxabaig commented 7 years ago

@nicolaib 👍

lacivert commented 7 years ago

Waiting for this 👍

baonhan commented 7 years ago

+1

baonhan commented 7 years ago

You can also disable it by accessing the underlying summernote element:

$scope.init = function() {
  $timeout(function() {
    $scope.editor.summernote('disable');
  }, 0);
});
<summernote on-init="init()" editor="editor" ... ></summernote>
j0131n commented 7 years ago

Any updates on this?

KamranMaqbool commented 4 years ago

Any solution here ????

Crzech commented 4 years ago

216 I've made a pull request to fix this, that workaround fixed my problem so I wanted to share.