[Describe the issue]
Steps for Reproduction
Expected behavior: Set the Delta object to my variable
Actual behavior: Uncaught TypeError: Cannot read property 'length' of undefined
Platforms: Chrome 51 on Windows 10
Version: Beta 9
doing something like this I get an error.
data.description = quill.getContents();
But if I do this:
console.log(quill.getContents());
It runs and sends me back the delta object. Am I doing it wrong?
Can you provide a stack trace?
quill.min.js:formatted:2415 Uncaught TypeError: Cannot read property 'length' of undefined
Delta.insert @ quill.min.js:formatted:2415
e @ jquery.min.js:4G
b @ jquery.min.js:4G
b @ jquery.min.js:4n.para
m @ jquery.min.js:4
ajax @ jquery.min.js:4
fetch @ submit-mod.js:18
sendMod @ client.js:96
submission @ client.js:92
dispatch @ jquery.min.js:3
r.handle @ jquery.min.js:3
This gets called on the submission portion when I cam getting all my data together to send off to my server.
Can you use an unminified version? It's otherwise very difficult to glean any insight. Also what do you mean in reproduction step two "trigger that variable set"?
Stack with unminified version:
quill.js:2439 Uncaught TypeError: Cannot read property 'length' of undefined
Delta.insert @ quill.js:2439
e @ jquery.min.js:4G
b @ jquery.min.js:4G
b @ jquery.min.js:4
n.param @ jquery.min.js:4
ajax @ jquery.min.js:4
fetch @ submit-mod.js:18
sendMod @ client.js:96
submission @ client.js:92
dispatch @ jquery.min.js:3
r.handle @ jquery.min.js:3
My wording was a bit funky its just trying to set the contents that return from the getContents() call to a variable.
If you can post a codepen or jsfiddle demonstrating this error with all code including all libraries unobfuscated I will take another look at this. Otherwise there is no indication this is a bug in Quill.
Yeah you're correct it is for sure something I am doing incorrectly. I just need to figure out what lol.
EDIT:
So I fixed it by instead of setting my variable directly to the return of the function like this:
var test = quill.getContents();
To something like this:
var foo = quill.getContents();
var bar = foo.opts;
I am no longer getting my error and everything is processing as intended.
Most helpful comment
Yeah you're correct it is for sure something I am doing incorrectly. I just need to figure out what lol.
EDIT:
So I fixed it by instead of setting my variable directly to the return of the function like this:
To something like this:
I am no longer getting my error and everything is processing as intended.