BUG With : Merge pull request #3113 from gioboa/bugfix/#3112
See original GitHub issueDescription of your Issue or Request:
I just installed the last summnote version 0.8.12 and what a surprise when I use my customs buttons that use range selection.
I have a button that change “case”. It doesn’t work anymore because of the merge #3113
steps to reproduce (Add more if necessary):
In my custom button :
click: function () {
var rangeSelection = $('#' + $('#localActiveId').val()).summernote('createRange');
console.log(rangeSelection)
var searchSelection = rangeSelection.toString();
console.log(searchSelection);
if(typeof searchSelection !== 'undefined' && searchSelection.trim() != "") {
//-- si première lettre minuscule : majuscule
if(searchSelection.trim()[0].toLowerCase() == searchSelection.trim()[0]) {
searchSelection = searchSelection.toUpperCase();
}
else{
searchSelection = searchSelection.toLowerCase();
}
context.invoke("editor.insertText", searchSelection);
}
}
searchSelection is cutted… It missed some text. With the version 0.8.11 it works perfectly then I searched a little.
In the merge pull I see this :
w3cRange.setEnd(this.ec, this.sc.data ? Math.min(this.eo, this.sc.data.length) : this.eo);
This doesn’t work on long text (more than one node !)
I think It must be :
w3cRange.setEnd(this.ec, this.ec.data ? Math.min(this.eo, this.ec.data.length) : this.eo);
(or
w3cRange.setEnd(this.ec, this.sc.data ? Math.max(this.eo, this.sc.data.length) : this.eo);
)
What is your Operating System, Browser and Version and Summernote Version you are using:
This can help find and resolve any issues.
-
Operating System: w10
-
Browser and Version: All
-
Summernote Version: 0.8.12
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
@DiemenDesign I don’t know why exactly but with the v0.8.17 : everything is now OK I close the ticket
@DiemenDesign impossible because : #3592
I tried to make a patch but the old correction with #3592 is a problem. Impossible to see if the patch is needed with the new version 😉.
When release with #3592 is OK : I see