Weird behavior

34 views
Skip to first unread message

Dan Mastromonaco

unread,
Jul 21, 2013, 10:21:50 PM7/21/13
to snape...@googlegroups.com
Hello! I just installed SnapEditor and I am trying to figure out exactly how to work the InPlace part.  I included a short screencast I took so you can see what's happening when I click to edit the field.  It seems that it inserts a line break every time I click to edit or backspace a character for some reason.

Also, I noticed that if there's a link or linked image in the field, and you click to edit the field but you click on the link, it'll actually just follow the link instead of taking you into the editor. Any way to fix this?

Lastly, how do I post the edited HTML so I can save it on my server?

Thanks for making this - I'd love to purchase it once I figure this stuff out.
test.mp4

Dan Mastromonaco

unread,
Jul 22, 2013, 10:39:08 AM7/22/13
to snape...@googlegroups.com
I figured out the first part of this myself - it was acting that way because I put the editable div inside my <h1> tag so it would retain the formatting.  Any ideas on better ways to go about this?

Also, can someone explain in more detail about what to put for the directory for image uploading?  The docs didn't make much sense to me.  Right now I have the upload URL and the retrieval URL as the same URL, but I don't know what to put for the directory.

Thanks!

Wesley Wong

unread,
Jul 22, 2013, 1:51:49 PM7/22/13
to snape...@googlegroups.com
Hi Dan,

So if I understand correctly, what you want is an editable H1 header where you can't put anything else in there. We're currently working on a feature right now that would let you do this. However, in the meantime, the only workaround is to only have the H1 button in the toolbar. Unfortunately, with the current version, if someone hits enter, they will get a <p>. This is unavoidable in the current version.

For the links, we had originally made the decision to make links behave as they normally would when the editor was not activated. However, in your use case, it seems like it is an unwanted behaviour. I will discuss with the team about adding a flag to the config to either allow or disallow the following of links.

For saving HTML, you need to specify an "onSave" callback. You can check out the docs.

The "e" that gets passed through has an "html" attribute that has the contents of SnapEditor. Using e.html, you can send the data to your server through AJAX.




Wesley Wong

unread,
Jul 22, 2013, 1:55:23 PM7/22/13
to snape...@googlegroups.com
Hi Dan,

For images, the directory is used to help separate images uploaded from different instances of SnapEditor.

On the server side, the directory comes through as a parameter. If you are using our premade SnapImage gem for Ruby, it will create a directory and store the images there. If you writing your own server code, you can do anything you want with the directory information. You can decide to ignore it or use it. We recommend setting the directory as something unique to this particular instance of SnapEditor so your images are categorized. You could use a user id, user id plus page name, blog post title, etc.

Cheers,
Wesley
Reply all
Reply to author
Forward
0 new messages