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

need .focus() method #223

Closed
relipse opened this issue Apr 20, 2013 · 7 comments
Closed

need .focus() method #223

relipse opened this issue Apr 20, 2013 · 7 comments

Comments

@relipse
Copy link

relipse commented Apr 20, 2013

I am trying to set focus right when the user opens a bug
currently I am using this code:

epicAddEditBug.editorIframeDocument.body.focus();

but I suppose it is better to add a .focus() method?

@OscarGodson
Copy link
Owner

This is a good idea. I'll try to get it into the next release. Until then, does focusOnLoad: true not work for you in your case?

@relipse
Copy link
Author

relipse commented Apr 20, 2013

no it didn't work so i had to do a combination of both:

        open: function (ev, ui) {
          if (epicAddEditBug){
             //already loaded, go ahead and focus it
             epicAddEditBug.editorIframeDocument.body.focus();
          }else{
             epicAddEditBug = new EpicEditor(epicAddEditBugOpts);
          }
          epicAddEditBug.load();
           },

...your quick responses are very nice by the way, thank you

@OscarGodson
Copy link
Owner

I'd have to try this, but triggering .edit() should make it focus:

https://github.com/OscarGodson/EpicEditor/blob/develop/src/editor.js#L1194

That should work. Let me know if it doesn't. If it doesn't I think it's this issue:

#134

Which is because IE wants to focus on the iframe and FF/Chrome wants to focus on the body.

OscarGodson added a commit that referenced this issue Apr 20, 2013
…getting

focus to work across browsers. This also fixes the problem with IE9/10 where
the shortcuts only worked the first time and you had to click into the editor
to get them to work again.

To do: docs and tests
@OscarGodson
Copy link
Owner

OK, you can see commit 531a978 above. It's not in develop yet as I need to write tests and docs for it before, but this allowed me to fix another bug too so I'll just get it into this release.

@relipse
Copy link
Author

relipse commented Apr 20, 2013

Thank you very much, let me know when the release is up and ready (or is there a way i can get a notification?)
Jim

@OscarGodson
Copy link
Owner

When I close this issue and/or comment you will get an email notification unless you've manually unwatched this thread. :)

OscarGodson added a commit that referenced this issue May 17, 2013
OscarGodson added a commit that referenced this issue May 17, 2013
… Removed

is() support since it was turning out to be too much work. It's now it's own
ticket (#229).

This fixes the IE9/10 issue where the editor was not focused so you could
keep typing after switching over to the preview() (through clicking the icons
or doing a key command).
@OscarGodson
Copy link
Owner

This is now in develop. Let me know if it works well! You can now just call editor.focus() whenever you want.

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

No branches or pull requests

2 participants