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

Editor: Prefix non-standalone URLs with "http" #1866

Merged
merged 1 commit into from
Dec 22, 2015

Conversation

aduth
Copy link
Contributor

@aduth aduth commented Dec 19, 2015

Fixes #1846

This pull request seeks to add an "http" prefix to links that cannot be used standalone (i.e. those with schemas, or hashbang/query/slash prefixed URLs).

Implementation notes:

The wplink plugin closely mirrors the behavior of the core equivalent plugin, which is why it is implemented the way it is. See original reference implementation:

https://github.com/WordPress/WordPress/blob/e844695e121c1a01f43f312ecd539affb004f0eb/wp-includes/js/wplink.js#L87-L95

Testing instructions:

  1. Navigate to the Calypso post editor
  2. Select a site, if prompted
  3. Add some text to the editor content
  4. Highlight the text
  5. Click the Insert Link button in the editor toolbar
  6. Add URL text and click Add Link
  7. Note that...
    • If the URL in step 6 includes a schema, that schema is used
    • If the URL in step 6 starts with a hashbang, query parameter, or slash, it is not modified
    • Otherwise, an HTTP schema is prefixed

@aduth aduth added [Feature] Post/Page Editor The editor for editing posts and pages. [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Dec 19, 2015
@lezama
Copy link
Contributor

lezama commented Dec 22, 2015

Works as described!

Not from this PR but is intentional that we don't display the hashbang on the popover?
image

image

@lezama lezama added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Dec 22, 2015
@aduth
Copy link
Contributor Author

aduth commented Dec 22, 2015

Not from this PR but is intentional that we don't display the hashbang on the popover?

Yep, this is how it behaves in wp-admin too. The idea is that in the overlay display, the URL is trimmed to take up as little space is possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Post/Page Editor The editor for editing posts and pages.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Editor: Hyperlinks to external pages route back to internal site
3 participants