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

Anchors (not links) shouldn't open in a new tab #96

Closed
OscarGodson opened this issue May 9, 2012 · 11 comments
Closed

Anchors (not links) shouldn't open in a new tab #96

OscarGodson opened this issue May 9, 2012 · 11 comments

Comments

@OscarGodson
Copy link
Owner

If you copy and paste our README then click on the on() link in the Events section it'll open a new page. It's just a #link anchor so it shouldn't do this.

@johnmdonahue
Copy link
Collaborator

Just to clarify: This is an issue on EE? So copying and pasting anchor links into an EE instance makes the links open new tabs, correct?

If so, it looks like it's an issue with the target attr. If it seems like a big enough issue maybe could catch clicks and force the target to _self if the link appears to be internal (i.e. begins with "#*").

<a href="#onevent-handler" target="_self">

As a side note when looking at this I ran into an interesting bug. If you click a link that opens a new tab while in full screen mode, it obviously kicks you out of fullscreen. If you then try to switch back to edit mode, any key press will return you to preview mode until you refresh the EE instance. Let me know if you can reproduce. (Chrome)

@OscarGodson
Copy link
Owner Author

Yes. Ticket #76 fixed external links. I did a easy fix by adding a base tag:

Commit:
989ffa1

Current src:
https://github.com/OscarGodson/EpicEditor/blob/0.1.0-build-refactor/src/editor.js#L417-L420

I did this because the alternative would be to inject a script that traverses all the <a>s and that seemed icky and exactly what the <base> tag is for. I think we should inject some script that looks for a[href^="#"] and adds target="_self" to them.

@OscarGodson
Copy link
Owner Author

Also @johnmdonahue I can't repro what you explained, however I might be taking the wrong steps:

  1. Open the EE docs with our EE README as the content
  2. Click full screen
  3. Click the github link
  4. After it loads github, go back to my EE tab
  5. I press alt+p and it previews
  6. I press alt+o and it goes back to edit

@johnmdonahue
Copy link
Collaborator

Hmm very strange. It happens on my end every time. Here is what I am doing in Chrome(18.0.1025.168):

  1. Copy https://raw.github.com/OscarGodson/EpicEditor/0.1.0-build-refactor/README.md into a local 0.1.0-build-refactor EE index.html editor.
  2. Click on fullscreen.
  3. Click on on() anchor in events section (Or any other link that opens a new tab)
  4. Go back to EE tab
  5. If not already in edit mode, go to edit mode by clicking edit/preview toggle or shortcut
  6. Start typing anything (e.g. space bar)
  7. Switches back to preview mode

Same behavior occurs in Safari except opening the new tab does not close fullscreen. Also it doesn't seem to matter if shortcuts are used or UI buttons.

@OscarGodson
Copy link
Owner Author

Awh, yep. Shit, actually even just closing full screen with esc does this. This is most likely from:

https://github.com/OscarGodson/EpicEditor/blob/0.1.0-build-refactor/src/editor.js#L568

We need to remove that handler when fullscreen is closed is all (probably). I'd make a new ticket tho. This affects IE9, FF, and Chrome. And make it important ;)

@OscarGodson
Copy link
Owner Author

@johnmdonahue added what you reported to ticket #97 and fixed it.

@johnmdonahue
Copy link
Collaborator

@OscarGodson So this is closed right?

@OscarGodson
Copy link
Owner Author

No. The other one you reported in this ticket was.

On May 13, 2012, at 8:42 PM, John Donahue
reply@reply.github.com
wrote:

@OscarGodson So this is closed right?


Reply to this email directly or view it on GitHub:
#96 (comment)

@johnmdonahue johnmdonahue reopened this May 14, 2012
@johnmdonahue
Copy link
Collaborator

Whoops. :)

hongymagic added a commit to hongymagic/EpicEditor that referenced this issue Jul 29, 2012
* upstream/develop:
  Ticket OscarGodson#96 - Make hash links scroll the iframe, not open a new browser window
  Ticket OscarGodson#6 - Shitty patch for Safari fullscreen. Using faux fullscreen until Safari gets fixed
  Prevent loading the editor when it's already loaded
  Typo in comment
  Ticket OscarGodson#161 - Remember the edit or preview state on unloading so when you load again its where you left it. Also added a guard for calling load when its already loaded to save on memory and changed all _eeState checks internally to use is() instead
  Ticket OscarGodson#88 - Added public is() method to check the state of EE. Added docs and tests and changed eeState to _eeState

Conflicts:
	epiceditor/js/epiceditor.js
	epiceditor/js/epiceditor.min.js
	src/editor.js
@OscarGodson
Copy link
Owner Author

This isn't working on Firefox. GOD.

@OscarGodson OscarGodson reopened this Dec 22, 2012
@OscarGodson
Copy link
Owner Author

Going to reclose this since this is a long outstanding Firefox bug. Theres no decent way to hack it either. The hack would be gnarly and only for Firefox so instead I reported it and they seem to be looking at it now, hopefully.

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