Closed ksdavidc closed 6 days ago
Hi, thanks for the report!
I'm not sure how to solve it properly though.
However, if you are ok with modifying the paste-mode plugin and the paste-mode plugin not modifying any links, Here's a quick workaround:
// Line 4336-4339
this.app.workspace.on("editor-paste", (evt, editor) => __async(this, null, function* () {
if (evt.defaultPrevented) {
return;
}
this.app.workspace.on("editor-paste", (evt, editor) => __async(this, null, function* () {
var _a;
if (evt.defaultPrevented) {
return;
}
{
let isURL = function(str) {
if (str.startsWith("app://")) {
return false;
}
try {
new URL(str);
return true;
} catch (e) {
return false;
}
}, isLinkToImage = function(url) {
return /\.(jpg|jpeg|png|webp|avif|gif)$/.test(url);
};
const clipboardData = (_a = evt.clipboardData) == null ? void 0 : _a.getData("text/plain");
if (!(!clipboardData || clipboardData === "" || !isURL(clipboardData) || isLinkToImage(clipboardData)))
return;
}
A quick explanation of the code: It just checks if the pasted text is an URL. If it is a URL, return out of the paste event function.
The other plugin looks like it isn't maintained so I don't think you have to worry about any updates that will overwrite the code.
Let me work if it works for you!
Thanks, I appreciate it. I'll try your fix, but am using your plugin quite a bit more, so that's my priority. The last update on the other was about a year and half, but you never know :-) Thanks.
What happened?
(cross posted at https://github.com/jglev/obsidian-paste-mode/issues/35#issue-2597852935)
conflict with paste mode plugin.
see attached vault. paste mode.zip
If you paste a link like https://www.youtube.com/watch?v=FQboGAF3fOg you will get the "embed" popup.
If enable paste mode, and try to paste, no popup appears.
If you disable paste mode and IMPORTANT reload the vault, popup returns.
Sample Markdown
https://www.youtube.com/watch?v=FQboGAF3fOg
Errors
none
Obsidian Version
Version 1.7.4 (Installer 1.6.5)
Plugin Version
latest
OS
MacOS