Coder Social home page Coder Social logo

obsidian-url-into-selection's People

Contributors

aidenlx avatar cito avatar denolehov avatar mikhad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

obsidian-url-into-selection's Issues

Fetching URL title

Hi,
I was looking for plugin that can fetch titles of pages when I paste URLs into the note. I found this but it does it on command. This is too many steps, especially since I paste a lot of URLs.

Your plugin does something similar on paste, I'd like to make a PR for an additional option:

const options: Record<NothingSelected, string> = {
    0: "Do nothing",
    1: "Auto Select",
    2: "Insert [](url)",
    3: "Insert <url>",
    4: "Fetch [<Page title>](url)",
};

Is that something you'd be interested in?

Obsidian Mobile App - URL Paste Deletes Selected Text

Hello,

I have been using Obsidian on mobile and noticed that whenever I highlight text to paste the URL the selected text gets deleted and appears as

It only appears to happen on mobile for me.

All the best,
JS

Request: Option to disable when pasting into code blocks

Thanks for the great plugin. I often highlight text in a code block that I want to replace with clipboard text. It would be nice to have an option to disable this plugin in these situations (interacting with text within a code block) to permit pasting to replace text. You wouldn't want an image within a code block so I don't see a downside to this.

Pasting URL into selected text replaces text instead of creating a link

Issue Description
Pasting a URL into selected text suddenly stopped working.

Steps to Reproduce

  1. Copy a URL
  2. Open an Obsidian note
  3. Select some text
  4. Paste the URL

Expected Behavior
Text is is modified in the following format
[original text](pasted-url)

Observed Issue
Text gets replaced with pasted URL

Additional Data
Obsidian v0.13.19
macOS 12.1
Paste URL into selection Version 1.6.0

Tried restarting Obsidian, un/re-installing plugin. Issue persists across all vaults.

Any ideas for a fix?

Triggering on pasting tags

I have updated to v1.7.0 and I find that when I normally (ctrl + v) paste tags the tag is formatted as .
I have tried altering the regular expression but the undesired behaviour persists.

I have a separate hotkey for triggering this plugin, and I would prefer the option to turn off automatically triggering.

[Feature] Pasting URL directly with title name

It would be a very good idea if we could directly have the title of the page as the url name in just one ctrl + v paste. So all we need to do is copy a URL say https://en.wikipedia.org/wiki/JavaScript and paste in obsidian giving:
[JavaScript - Wikipedia](https://en.wikipedia.org/wiki/JavaScript) -> JavaScript - Wikipedia

Further, if the text inside the square brackets gets highlighted, we could edit and have the name we want. All of this in minimum effort.

Pasting URL which contain certain characters does not work OK (brackets)

Use case:

Paste links with 'highlight text fragment features', like this one:

This one works OK:
https://github.com/denolehov/obsidian-url-into-selection#user-content-paste-url-into-selection:~:text=Also%20works%20the%20other%20way%20around%2C%20inserts%20text%20into%20a%20selected%20link

This one does not:
https://github.com/denolehov/obsidian-url-into-selection#user-content-paste-url-into-selection:~:text=selected%20link%20(URL)%20by%20command
That's the result:
image

I suppose it's the brackets that breaks it.

Expected behaviour:

Link with brackets should work OK.

Pasting additional garbage when copying

I'm getting some additional garbage before and after the copied text when pasting into Obsidian.

"[](<" precedes the copied text, and ">)" follows it. The problem clears up if I disable Paste URL into Selection.

Running Obsidian v0.12.4 and Paste URL into Selection v1.6.0 on macOS Big Sur 11.4 on Intel

Is there some Obsidian setting that I need to tweak?

Work with Vim mode?

Is this plugin supposed to work with Vim mode?

vim-plugin

This is on Windows 10 by the way. It works on macOS though 🤔

Update default fallback regex to be less prone to overtriggering

I've noticed that the plugin overtriggers a lot when copy and pasting code, which has become more frustrating as I've started to use the Templater and Dataview plugins more.

After playing around with the regex tester on https://regexr.com, I found that the default fallback regex would match many function calls or object references. For example, the fairly straight forward templater expression <% tp.date.now(fmt_month, 0, tp.file.title, fmt_week) %> actually matches twice – once on tp.date.now(fmt_month and a second time on tp.file.title. While the second match is more understandable, as it could technically be a real URL with a weird TLD, I think that a fallback expression should not be prone to overtriggering.

As a less sensitive option, I'm suggesting that ((\w+:\/\/)[-a-zA-Z0-9:@;?&=\/%\+\.\*!'\(\),\$_\{\}\^~\[\]#|]+)` be used at the default fall back regex. In my (albeit brief) testing, I've found this to be much less prone to overtriggering and overall less frustrating to use copy and paste in my notes when working with templates and queries.

Add ! in front (extended image syntax) for whitelisted sites

I'm using this is conjunction with the media-extended plugin, and it's so close to working great.

However, when pasting embeddable links with this plugin I still need to manually add a ! in front of every pasted link, to create the ![]() extended image syntax.

It would be great if you could whitelist certain sites with this plugin to automatically add the ! in front when pasting.

That way you could embed Youtube links (for example) as quick as you could paste them, would be really useful.

Feature: Allow Non-Formatted Pasting with Ctrl + Shift + V

There are some bugs when pasting raw URLs into the example.com portion of [example](example.com).

Demo: paste google.com into [example](paste_here). It will format as [example]([ ](google.com)).

I propose allowing for the standard use of Ctrl + Shift + V for non-formatted pasting. This could be a great workaround for some issues other people are having in some of the other requests. Current I have to disable the plugin when editing a lot of hyperlinks.

Pasting urls without selection still results in ()[url]

Me and phnx#9804 experienced this after updating the plugin. Happens whenever the plugin is enabled, stops happening when you disable & then restart obsidian.

Apologies if this is a duplicate issue or already known.

Mentioned in the obsidian discord here and here

2021-04-21_08-04-39

don't require selection, use cursor position

esp with long urls, it is some work to select and paste. How nice would it be to support pasting into cursor position, expanding to the surrounding space (and/or other regex) separated bit, then business as usual?

Don't override standard ctrl+v functionality

This plugin is awesome as it implements one of my preferred Typora's functionalities : automatic handling of URL pasting.
I love being able to copy a URL, select some text (or not if I just want one word) then ctrl+K to automagically make a perfect Markdown link.

However, I really don't want to use ctrl+v for that, and this plugin even though I set a hotkey to ctrl+k continues to override ctrl+v and it shows each time I paste something that is detected wrongfully or not as an URL : as an example, pasting <% tp.file.cursor() %> anywhere gives [](<%3C% tp.file.cursor() %%3E>) and using shift+ctrl+v doesn't bypass this, so I have to either manually delete all the junk added by the plugin or stop using the plugin :'(

Please, just use the hotkey setting to activate the plugin !

Bug: Does not work on alternate pastes

I'm suddenly encountering a strange problem wherein the paste does not work to paste-as-link on every other paste.

See this...

Screen.Recording.2022-12-02.at.08.52.52.mov

Love this plugin otherwise.

Links to headers rename text

I have a string of text that I highlight, and use CTRL+V to paste the link. It changes the text to the name of the note and the link rather than leaving just the highlighted text.

Example:
Click Link Here

when highlighted and paste the new link, it changes it to:
[[10. Links#Header1]]

It should make it:
[[10. Links#Header1|Click Link Here]]

any way to keep the highlighted text without having to manually enter it in every time?

Overrides default "Paste as text" and does not have a way to resolve this conflict

I do not know since what version, but Obsidian's Paste action (Cmd+V) is now smart. If I copy a link, it will create me a link with a text taken from page heading. Or if I copy a clickable text, Obsidian will preserve the link. Sometimes I just want to paste something as a raw text from my clipboard. And there is a Cmd+Shift+V for this:
image

But with this plugin the default shortcut does not work and I have to Right-click and use the above menu to paste raw text.
I like this plugin and still want to use it, but I would like to have a way to resolve the conflict with a default Cmd+Shift+V behavior.
Possible solution: if no text is selected by cursor, preserve the original behavior

Plugin activates on Ctrl + V even after the hotkey is changed to something else

Issue / Actual Behavior

I changed the hotkey from Ctrl + V to Ctrl + Shift + V. While Ctrl + Shift + V now activates the plugin, Ctrl + V also activates the plugin.

Expected Behaviour

After changing the hotkey from Ctrl + V to Ctrl + Shift + V, Ctrl + V should paste as normal and not activate the plugin.

Steps to Reproduce the problem

  1. Activate plugin
  2. Go to Settings -> Hotkeys -> Paste URL into selection: -> Customize this command -> Ctrl + Shift + V
  3. Pasting url (using Ctrl + V) when selecting "word" results in [word](url) instead of just url.

Specifications

Plugin Version: 1.6.0
Obsidian Version: 0.12.5

Note

It looks like this issue was noted here... But the issue still persists


gif

Feature Request: Wiki Link into Selection

It would be a very useful feature to be able to use this plugin on Wiki Links, so that you could select some text that you would like to be the alias, which would be automatically added to a new link you create.
It might work like this:

  1. User selects text alias
  2. User enters square brackets to create a new link, and types it's name Note
  3. User hits enter to complete the Wiki Link
  4. Plugin automatically appends the previously selected text that was replaced with the link, as an alias [[Note|alias]]

Incorrectly detects text as URL

I'm pasting my public key signature:

SHA256:+LMe8hqm106I3FUuQrqBBSLPffRHf8GgnL+fPunc7ek 2022-02-11 obsidian-main repo

What gets inserted:

[](<SHA256:+LMe8hqm106I3FUuQrqBBSLPffRHf8GgnL+fPunc7ek 2022-02-11 obsidian-main repo>)

I'm curious as to why the < and > are in there.

My config:
image

Doesn't work if page pinned to the side

OS: Windows 10
Obsidian Version: 0.9.11

This plugin works great when a page I'm working on is one of the main pages. But if the page I'm working on is pinned to the side, it simply pastes the links. (i.e. ctrl + shift + v acts like ctrl + v). An image is shown below of what I mean by having the page pinned to the side.

image

Add support for Live Preview

This is a very useful plug-in. Unfortunately it does not work with Live Preview (code mirror6).
Could you add support for LP?

Bug: 插件media extended bilibili plugin大量打开新增窗口

你好,感谢你所写的obsidian插件!我在使用过程中,发现media extended bilibili plugin这个插件,在obsidian内部 在新窗口打开视频后,只要在原始日志中切换编辑和阅读状态,就会在打开的视频窗口下面新增窗口,数量 上不封顶。新增窗口似乎和视频窗口是一体的,关闭任意一个,都会全部关掉。请问这个问题可以解决嘛?

Ignore leading whitespace in URL

The plugin doesn't recognize URLs if the clipboard content starts with whitespace. This might be intentional, but it would be nice if URL recognition was more lenient in this way.

Add “link” icon for use in toolbar

Thanks for this helpful plugin: it’s especially useful on mobile to simplify creating links. I’ve added this action to my toolbar, but the icon is a question mark. Any way to make it a link icon instead?

Support file URLs and non-http URIs

As far as I see, this plugin checks if the clipboard contains a valid http/https URL and does not paste otherwise.

  • It would be nice if the plugin would also check if this is a valid file path (either POSIX or Windows) and then paste it as a link with the file URI scheme. This way you can create links to other documents or directories on your local filesystem.

  • It should also url encode blanks to %20 (maybe also other special characters), and in case of a Windows path, it should also convert backslashes to forward slashes.

  • There should be an option to use the angle bracket notation of CommonMark for links that contain spaces, instead of url encoding them. This makes the link better readable.

  • Also, if the clipboard content is neither a valid URL nor file path, maybe it should show an error message explaining what is wrong instead of simply doing nothing.

  • Maybe, if the clipboard content is a valid URI with a different scheme than http: or https: (like ftp: or mailto:) it should also be pasted. Registered and unregistered schemes (e.g. for opening certain apps) should be recognized.

Appreciation post and design questions

Hi @denolehov,

I'm on a journey to learn typescript while developing plugins because obsidian doesn't have a lot of doc about creating plugins yet, what I'm trying to learn with the work of others, writing line by line each plugin available (locally in my machine) and documenting my learnings in obsidian :D

With your plugin, I learned to create commands with hotkeys, some of the code mirror API (like getting the cursor position and updating the selected element), and what is an active leaf and different types of leaf.

I had a question though, I tried to replicate using electron but couldn't due to an error in npm install (every time I tried :F) so I use the clipboard web API of the navigator, is there a reason why you use the electron API instead.

Would love to hear back from you, thanks for the contribution :D

Request: formatting exisiting links

this plugin is great, I find it extremely useful.

Currently the url is pasted into existing text

Would it be possible to do the reverse?

adding text to an existing url

this is due to my current situation where I have some unformulated urls in my notes

So if for instance if I have the URL https://github.com/denolehov/obsidian-url-into-selection

in obsidian there's the shortcut to format urls,
through ctrl+k would format it like this

[https://github.com/denolehov/obsidian-url-into-selection]()

what's I'd need is the opposite, a shortcut to

format things like this

[](https://github.com/denolehov/obsidian-url-into-selection)

I know this might be out of the scope of your plug in, but I'd love to know if your existing code would allow for such an additional option

Thanks for the great plugin again!

Bug: Extension kills tilde on Windows GB key layout

On the Windows GB key layout, the tilde is Shift-hash, at the extreme right of the middle keyboard row. If this extension is loaded, that key simply stops working at all.

Steps to repeat:

  • Switch to an en-GB keyboard layout
  • press the Tilde key

Expected: a tilde signe appears on screen
Actual: nothing happens on screen at all

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.