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

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

Open
welpdx opened this issue Jun 30, 2021 · 6 comments

Comments

@welpdx
Copy link

welpdx commented Jun 30, 2021

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

@firinael
Copy link

firinael commented Sep 9, 2021

Pretty sure the project has been abandoned. I'm gonna ask someone on the Discord's #plugin-dev channel to see if they can take over. Shouldn't be too much to take care of.

Also, that gif of yours was super pretty, what did you use for it?

@welpdx
Copy link
Author

welpdx commented Sep 9, 2021

Pretty sure the project has been abandoned. I'm gonna ask someone on the Discord's #plugin-dev channel to see if they can take over. Shouldn't be too much to take care of.

That'll be cool!
And if they ask for someone to take over, maybe we can!

Also, that gif of yours was super pretty, what did you use for it?

Aw thanks! I use ShareX to take the gif and upload it to imgur; and I use Crealesson to show keyboard and mouse activities on screen.

@pjeby
Copy link

pjeby commented Sep 10, 2021

May I suggest using Mod-K Mod-V instead of this plugin? I'm not sure if Mod-K is Obsidian's default binding for "Insert Markdown link", it might just be what I've personally set it to, but if you use that command (i.e. Insert Markdown link) followed by pasting, then the selected text will become a link and the cursor will be positioned just right to paste in the URL.

@welpdx
Copy link
Author

welpdx commented Sep 10, 2021

Hi @pjeby, thanks for the suggestion. Is Mod a mac shortcut?

Anyways, I currently use this script below and I use the Hotkeys for templates plugin to trigger this Templater script with Ctrl + Shift + B.

<%*
var clip = await tp.system.clipboard();

if (tp.file.selection() !== "" ) { 
// If there is text selected
    %>[<%  tp.file.selection() %>](<% clip %>)<%*
} else  if (clip.charAt(0) !== '"'){  
// If no text selection and clipboard not empty, just paste it in set format, add text later
	%>[](<% clip %>)<%*
} else { 
// toast error message
	new Notice('Somefing Wong!',3000);
}
%>

Above script is barebones because I can't figure out how to process C:/foo/bar and zotero://foo/bar links together with html links yet. This plugin has a isUrl() function which uses regex to test if clipboard contains an url. So I guess I am stuck figuring out a regex line that accepts the typical windows file path, zotero links, and html. Yea, that is waaay down at the bottom of my to do list rn. Either that or I use some switch statements...

~welp

@pjeby
Copy link

pjeby commented Sep 10, 2021

Mod is Obsidian's official way of describing "Control on PC / Cmd on Mac".

So, Ctrl-K, Ctrl-V does the equivalent of this plugin (on PC), or Cmd-K, Cmd-V on Mac.

@welpdx
Copy link
Author

welpdx commented Sep 10, 2021

Oh I see, I didn't know that! Yea Ctrl + K works great, but I still prefer this plugin or the script I posted though, cause it skips a few clickity clicks

welp

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

No branches or pull requests

3 participants