Update all and nextSibling Error (including solution)
See original GitHub issueDescription of your Issue or Request:
I am getting the nextSibling error on long articles with pictures. Also, I could not select the entire content and change the font size or font family.
steps to reproduce (Add more if necessary):
-
Write a long article with pictures
-
Select all content with CTRL + A
-
Change the font size or font family
What is your Operating System, Browser and Version and Summernote Version you are using:
-
Operating System: [ ] Microsoft Windows [ ] Apple [x] Linux [ ] All
-
Browser and Version: [ ] Brave [ ] Chrome [ ] Edge [x] Firefox [ ] Internet Explorer [ ] Opera [ ] Safari [ ] Other (Specify):
-
Summernote Version, place an x inside the brackets: [ ] BS3 [x] BS4 [ ] Lite [ ] All
screenshot of issue

the solution I have applied
I realized that this feature was not applied to the parts after the picture when all the articles with pictures were selected and tried to change the text properties. I solved the problem by modifying the dom.js file a bit.
function nextPointWithEmptyNode(point, isSkipInnerOffset) {
let node, offset = 0;
// if node is empty string node, return current node's sibling.
if (isEmpty(point.node)) {
if(point.node === null){
return null;
}
node = point.node.nextSibling;
offset = 0;
return {
node: node,
offset: offset,
};
}
if (nodeLength(point.node) === point.offset) {
if (isEditable(point.node)) {
return null;
}
node = point.node.parentNode;
offset = position(point.node) + 1;
// if next node is editable , return current node's sibling node.
if (isEditable(node)) {
node = point.node.nextSibling;
offset = 0;
}
} else if (hasChildren(point.node)) {
node = point.node.childNodes[point.offset];
offset = 0;
if (isEmpty(node)) {
if (!isEmpty(point.node.nextSibling)) {
return {
node: point.node.nextSibling,
offset: offset,
};
}
return null;
}
} else {
node = point.node;
offset = isSkipInnerOffset ? nodeLength(point.node) : point.offset + 1;
if (isEmpty(node)) {
return null;
}
}
return {
node: node,
offset: offset,
};
}
nextPointWithEmptyNode function to the above code. After updating it fixed my nextSibling problem.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)

Top Related StackOverflow Question
Awesome, thanks for submitting a PR. Once I get time, I’ll get onto testing this out. Not that I doubt that you haven’t done a good job, other devs will also need approve something like this, so I’ll tag them into the PR as well, that way they can check on their systems, pretty sure a couple use Apple, and at this time it seems to be the most problematic, esp. with Safari. I’ll be testing all the browser I can in Linux.
Yes, I did not encounter any problems during my tests. This works… 😃