Activating the editor when it appears in the view port.

17 views
Skip to first unread message

parallel32

unread,
Sep 20, 2013, 4:11:39 AM9/20/13
to snape...@googlegroups.com
Most of my users are not accustomed to clicking on text to edit it.  They are used to seeing an editor already there and ready.  I've come up with a simple solution  to activate the editor when the editable text appears in to view.

Using the jQuery appear plugin:  https://github.com/morr/jquery.appear

I did this:

window.editor = new SnapEditor.InPlace("aboutMe", {
  path: "/assets/snapeditor",
  toolbar: {
   items: [
    "styleBlock", "|",
    "bold", "italic", "underline", "|",
    "alignLeft", "alignCentre", "alignRight", "alignJustify", "|",
    "orderedList", "unorderedList", "indent", "outdent", "|",
    "link", "table", "horizontalRule", "|"
   ],
  }
  ,snap: false
 });
            
$('#aboutMe').appear();
$('#aboutMe').on('appear', function(event, $all_appeared_elements) {
  window.editor.api.activate();    
});

Hope this helps someone.

So far I've been very happy with the SnapEditor.

Wesley Wong

unread,
Sep 20, 2013, 1:07:18 PM9/20/13
to snape...@googlegroups.com
Cool! Thanks for posting this!
Reply all
Reply to author
Forward
0 new messages