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

NotFoundError: Failed to execute 'insertNode' on 'Range': The node provided is null #6

Open
chandrewz opened this issue Jun 9, 2014 · 7 comments

Comments

@chandrewz
Copy link

When inserting a space:

$rich_textarea.rich_textarea('insertObject', ' ');

an error is thrown.

@chandrewz
Copy link
Author

Hi Yermo, this is a bump since you were on vacation. This is kind of odd, but rich_textarea does not like spaces.

@Yermo
Copy link
Owner

Yermo commented Jun 27, 2014

The intent of insertObject() was to insert a block of HTML to represent some "thing" you want to embed in the text such as an image, a description of a link, etc. It's not intended to insert a single blank space.

Do you just want to insert a space at some location?

@chandrewz
Copy link
Author

I was trying to reconstruct a rich textarea based on plaintext. So I parsed '[o=object1] [o=object2]', needing to use insertObject on object 1, followed by a space, then insertObject on object2.

I also noticed that you can insert text (e.g. 'This is an object: '). If the last character is a space, it gets dropped. Only if the last character is a space.

@chandrewz
Copy link
Author

But actually, I brought up this issue about 2-3 weeks ago. Since then, I ended up inserting & nbsp; instead of a whitespace, which allows that as an insert in the single case.

And I started appending &npsp ; to make up for the missing last space.

These are workarounds and if you want handle some edge cases. Still really appreciate your plugin!

@Yermo
Copy link
Owner

Yermo commented Jun 27, 2014

Encase your objects in some tag. I didn't anticipate plain text for
insertObject().

e.g. This is an object

On 06/27/2014 01:55 PM, Andrew Chan wrote:

I was trying to reconstruct a rich textarea based on plaintext. So I
parsed '[o=object1] [o=object2]', needing to use insertObject on object
1, followed by a space, then insertObject on object2.

I also noticed that you can insert text (e.g. 'This is an object: '). If
the last character is a space, it gets dropped. Only if the last
character is a space.


Reply to this email directly or view it on GitHub
#6 (comment).


Yermo Lamers Software Guy, Motorcyclist and Reluctant Writer

            http://miles-by-motorcycle.com

A social network for the lucky few who travel by motorcycle

and those who care about them.

@chandrewz
Copy link
Author

Ah, I see. I thought it was an insert for plaintext OR objects.

@Yermo
Copy link
Owner

Yermo commented Jun 27, 2014

You can just insert a DOM text node for that or I could add a separate convenience method for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants