[ 5 posts ]

mrcoder

  • Joined: Mon Apr 18, 2011 10:04 pm
  • Posts: 6
  • Offline
  • Profile

EditorWindow usage in YUI 2.8.1 RTE

Post Posted: Wed Apr 20, 2011 1:41 am
+0-
Hi,

I've a requirement like when I hit Ctrl + Space combination, I need to show a EditorWindow which will populates few suggestions from web service call. Once the user clicks a suggestion, I need to place that string in place in the editor.

I've tried by looking into EditorWindow.js & Editor.js, SimpleEditor.js source files and by following few other similar issues posted in this forum (viewtopic.php?p=3427) and Dav's post (http://new.davglass.com/files/yui/editor41/).

My code: https://gist.github.com/930837
When I type some key, those two methods are get invoked (verified by keeping console.log). But the EditorWindow is not shown.

The difference between the code in http://gist.github.com/194304 (posted in viewtopic.php?p=3427#p3427) and mine is there image insertion is done and it'll be replaced with span. Is that mandatory to use
Code:
executeCommand('insertimage', 'none');


I couldn't find a good guide on using EditorWindow's. If some knew one, please recommend the link.

Any help is appreciated.

ManiKanta

mrcoder

  • Joined: Mon Apr 18, 2011 10:04 pm
  • Posts: 6
  • Offline
  • Profile
Tags:

[SOLVED] Re: EditorWindow usage in YUI 2.8.1 RTE

Post Posted: Wed Apr 20, 2011 4:29 am
+0-
I think I m answering my own question.

The culprit is
Code:
YAHOO.util.Event.preventDefault(event)


I need return false from the method in order to stop the even bubbling. Corrected the code in the Gist version 3.

Working YUI RTE EditorWindow

Click here to see the revision history on this Gist.

Hope this helps some one who struck up with the same issue :p

ManiKanta

mrcoder

  • Joined: Mon Apr 18, 2011 10:04 pm
  • Posts: 6
  • Offline
  • Profile
Tags:

Re: EditorWindow usage in YUI 2.8.1 RTE

Post Posted: Wed Apr 20, 2011 4:57 am
+0-
Thats leave the issue - Do we really need to use
Code:
executeCommand('insertimage', 'none');
always if we want to open EditorWindow?

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile
Tags:

Re: EditorWindow usage in YUI 2.8.1 RTE

Post Posted: Wed Apr 20, 2011 5:01 am
+0-
You don't need to call execCommand to open the window, the openWindow command should work just fine.

See this example:
http://new.davglass.com/files/yui/editor42/

mrcoder

  • Joined: Mon Apr 18, 2011 10:04 pm
  • Posts: 6
  • Offline
  • Profile

Re: EditorWindow usage in YUI 2.8.1 RTE

Post Posted: Thu Apr 21, 2011 12:38 am
+0-
Thanks Dave. Example looks promising. I'll look into it.

Thanks.
ManiKanta
  [ 5 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum