Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexSizeError in Chrome : Still Occuring #1759

Open
jcberquist opened this issue Mar 14, 2016 · 21 comments
Open

IndexSizeError in Chrome : Still Occuring #1759

jcberquist opened this issue Mar 14, 2016 · 21 comments

Comments

@jcberquist
Copy link

steps to reproduce

Using empty editor instance on summernote.org which currently has v0.8.1 of summernote.js

If I do the following:
a -> SPACE - > CTRL + b -> SPACE
(code view shows <p>a <b>&nbsp;</b></p> in Chrome at this point)

I get this error:

Uncaught IndexSizeError: Failed to execute 'setStart' on 'Range': 
The offset 2 is larger than or equal to the node's length (1).

There is a similar error in Microsoft Edge; Firefox is unaffected. I do see that the generated HTML is slightly different in each case.

If I do the following:
CTRL + b -> a -> a -> CTRL + b -> SPACE
(code view shows <p><b>aa</b>&nbsp;</p> in Chrome at this point)

I get this error:

Uncaught IndexSizeError: Failed to execute 'setEnd' on 'Range': 
The offset 2 is larger than or equal to the node's length (1).

I see this error only in Chrome.

browser version and os version

Windows 10
Chrome 48

@gianniskonomis
Copy link

I have the same issue, any suggestion

@owlstronaut
Copy link

I did find that the error is in the autoLink module. Luckily I don't need it. If you don't need it either, you can do this after initialization --

$('.summernote').summernote('removeModule', 'autoLink');

@jsanchezs
Copy link

I'm still having the same issue :/

@pumzx
Copy link

pumzx commented Dec 20, 2016

any suggestion?

@mkoch42
Copy link

mkoch42 commented Feb 7, 2017

Disabling it works, but what if you want it... does anyone know how to fix this in the auto link module itself?

@Levinta
Copy link

Levinta commented Mar 20, 2017

Hi, I also have this issue.
Uncaught DOMException: Failed to execute 'setStart' on 'Range': The offset 2 is larger than or equal to the node's length (1).
Did anyone found the resolution?
Thanks

@balramkhichar
Copy link

Steps to reproduce.

  • Press tab 5-6 times in empty doc
  • Press ctrl+z

screen shot 2017-03-24 at 4 37 41 pm

@raphaelarias
Copy link

Same error

@jakub-zawislak
Copy link

@balramkhichar your error cannot be even fixed by removing autoLink because it's caused by another module

@lqez lqez added the Bug label Nov 23, 2017
@lqez
Copy link
Member

lqez commented Nov 23, 2017

Confirmed.

@lqez
Copy link
Member

lqez commented Nov 23, 2017

@easylogic Could you address this issue?

@easylogic
Copy link
Member

@lqez yes.

If solved, I will send PR

@ghost
Copy link

ghost commented Feb 2, 2018

What is the status on this? Is this fixed?

@kdonovan
Copy link

kdonovan commented Feb 22, 2018

Reproducing @balramkhichar 's instructions from above on the official https://summernote.org/ instance shows the issue isn't yet fixed (and the removeModule trick from above doesn't seem to have any impact either).

@DennisSuitters
Copy link
Member

DennisSuitters commented Nov 27, 2020

@lqez I just tested this, and is still happening with the latest version in Linux Chrome, was there a fix for this, or has this been forgotten, I'd like to see this resolved if possible so it can me migrated into Skunkworks and get rid of this bug for that release. TIA.

Sorry, it was @easylogic that I should have tagged.

@jakub-zawislak
Copy link

I wanted to say that I have switched to trix editor because of such errors in Summernote

@DennisSuitters DennisSuitters added this to To do in Bugs Dec 5, 2020
@DennisSuitters
Copy link
Member

DennisSuitters commented Dec 5, 2020

This has been added to the Projects List, you can check the progress here https://github.com/summernote/summernote/projects/3
You can continue to discuss this issue here, but this is marked as closed to make it easier to manage new issues, thank you.

@126pikaqiu
Copy link

                            uploadFile(file).then(res => {
                                console.log(res);
                                if(!$(id).summernote('code')){
                                    // 加入空格,否则插入会失败
                                    $(id).summernote('code',' ')
                                }
                                $(id).summernote('insertImage', res.file_access, res.file_name);
                            }).catch(()=>{
                                vm.showError('上传的照片过大');
                            })

@DennisSuitters DennisSuitters reopened this Feb 5, 2024
@DennisSuitters DennisSuitters reopened this Feb 5, 2024
@DennisSuitters DennisSuitters changed the title IndexSizeError in Chrome IndexSizeError in Chrome : Still Occuring Feb 5, 2024
@DennisSuitters
Copy link
Member

This issue is still happening with all versions, something to do with src/js/core/range.js
image

@DennisSuitters DennisSuitters moved this from To do to Needs Help in Bugs Feb 5, 2024
@DennisSuitters DennisSuitters pinned this issue Feb 7, 2024
@DennisSuitters DennisSuitters moved this from Needs Help to In progress in Bugs Feb 7, 2024
@DennisSuitters DennisSuitters moved this from In progress to To do in Bugs Feb 7, 2024
@1der1
Copy link

1der1 commented Mar 12, 2024

The Autolink.replace throws the error when this.lastWordRange contains invalid data.

After the check

if (!this.lastWordRange) {
    return;
}

Add another check, please:

if (this.lastWordRange.so > this.lastWordRange.sc.length) {
    return;
}

@DennisSuitters
Copy link
Member

You're welcome to do PR's @1der1, I appreciate the code tips, however, it would help even more if you could do PR's to add the changes, or indicate what source file, and line to add the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Bugs
To do
Development

No branches or pull requests