Skip to content

wymeditor: Automatically generate link when pasting URL #379

@matthijskooijman

Description

@matthijskooijman

To make it easier to put proper links in articles, it would be nice if pasting a URL would automatically become a link.

Some constraints:

  • This should probably happen exclusively when the entire clipboard text is a link, trying to find links in a larger piece of text is prone to be wrong.
  • This should probably be limited to http:// and https:// links, trying to handle arbitrary protocols probably leads to false positives.
  • There is the question of what text to use for the link. Just the URL itself is always possible, but for internal links the page name would be nice (this would require adding an AJAX endpoint or so to retrieve it). For external links, maybe the browser could fetch the page in the background and use the title, though I'm not sure if that's feasible (or really adds something).
  • This bypasses the regular link dialog, so you cannot add a title or relation to the link (unless you somehow open the link editor/inserter after/instead of inserting the link maybe).
  • This can probably be done in the paste handler that was added as part of wymeditor: Adds paste listener to strip superfluous code #345. Since that already lives in Hypha code (not wymeditor code), adding hypha-specific things (such as page title lookups for internal links) is not a problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions