Textarea with disable does not break the line automatically

Asked

Viewed 144 times

2

Follows code (with disable):

$('#summernote').summernote({
  toolbar: false,
  height: 100,
  callbacks: {
    onInit: function() {
      $('#summernote').summernote('disable');
      $('#summernote').summernote('code', 'kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk');
    }
  }
});

Follows code (normal) :

$('#summernote1').summernote({
  toolbar: false,
  height: 100,
  callbacks: {
    onInit: function() {
      $('#summernote1').summernote('code', 'kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk');
    }
  }
});

If you prefer Jsfiddle: https://jsfiddle.net/dtgr5q29/204/

With disable the text is horizontal, it should "break the line" as well as the second code.

Some solution ?

1 answer

3


I don’t know if the Summernote has this native option, but you can include a line to add the style word-wrap à div changing the style and forcing the line break:

$('#summernote').summernote({
  toolbar: false,
  height: 100,
  callbacks: {
    onInit: function() {
      $(".note-editable").css('word-wrap','break-word'); // quebra de linha para strings longas
      $('#summernote').summernote('disable');
      $('#summernote').summernote('code', 'kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk');
    }
  }
});

Or else call for everyone with:

$(window).on("load",function() {
  $('.note-editable').css("word-wrap","break-word");
});

JSFIDDLE

UPDATING:

I recommend entering the code $(".note-editable").css('word-wrap','break-word'); so much on the disable how much in the normal (as per the Jsfiddle). In Firefox, without that code, even on normal wasn’t breaking line.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.