Textarea with 'disable' does not automatically break the line

2

Follow the code (with disable):

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

Here is the code (normal):

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

If you prefer JSFIddle: link

With disable the text is horizontal, it should "break the line", just like the second code.

Any solution?

    
asked by anonymous 14.11.2017 / 01:05

1 answer

3

I do not know if Summernote has this option native, but you can add a line to add the style word-wrap to div by 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 call everyone with:

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

JSFIDDLE

UPDATE:

I recommend inserting the code $(".note-editable").css('word-wrap','break-word'); into both disable and normal (as per JSFiddle ). In Firefox, without this code, even in normal was not breaking line.

    
14.11.2017 / 01:59