summernote rich text editor character length limit input

The project requires a relatively simple rich text editor, then select the summernote.
Although relatively lightweight, but also in the development we encountered a few problems in this record it.

1: Style and bootstrap conflict, after initialization appears as:image description

.note-editor .note-toolbar .btn-group {
    float: none !important;
    margin: 0 5px;
}

Join this style coverage solutions

2: Enter the length restrictions, see the official website found and did not say this, after baidu, Google, also did not find the solution, then studied at the source

image description

image description

OK, this.options.maxTextLength is what we need. So this parameter is set, we found a problem, and did not enter into force in the case of the Chinese, only become effective when the numbers in English after the operation. Found set during initialization callback, listening onkeyup events, to get the current value, and then determine the length of the re-assignment in Stack Overflow found after trying an English appears at the end after the replacement, then display Chinese characters I enter at the beginning. . . . Probably because the time to re-assign text to the div cursor automatically to the beginning.

(∙ ̆ .̯ ∙ ̆) mmp, give up. . .

Guess you like

Origin www.cnblogs.com/jlfw/p/12038815.html