Is it possible to use the default pasting behavior or Turndown in a cusotm transform?
YousufSSyed opened this issue · comments
I want to extend the default pasting behavior instead of outright replacing it in my custom transforms. And ideally without importing all of TurndownJS into my script (if that's possible, I haven't quite looked at it).
The default paste contains some dirty hacks and uses obsidian's private APIs. It can't serve as a stable API so I won't expose it to custom transforms.
obsidian-advanced-paste/src/main.ts
Lines 220 to 284 in cfb0491
But if your goal is to extend the default pasting behavior, you can fork this repo and modify it directly.
Can you still expose it and add a disclaimer that it "contains some dirty hacks and uses obsidian's private APIs" and that it can change at any time without notice?
I'd still like to use it even if that's the case, maybe other users too. I want to extend whatever the default pasting behavior is with this plugin.
Either way, how could I use Turndown without including my own copy of it?
Either way, how could I use Turndown without including my own copy of it?
It's documented in the README: https://github.com/kxxt/obsidian-advanced-paste#advanced-utilities
Can you still expose it and add a disclaimer that it "contains some dirty hacks and uses obsidian's private APIs" and that it can change at any time without notice?
I'd still like to use it even if that's the case, maybe other users too. I want to extend whatever the default pasting behavior is with this plugin.
Can you still expose it and add a disclaimer that it "contains some dirty hacks and uses obsidian's private APIs" and that it can change at any time without notice?
I'd still like to use it even if that's the case, maybe other users too. I want to extend whatever the default pasting behavior is with this plugin.
And because of the above reason, the default pasting is tightly coupled to the Plugin class itself. Exposing it through a sane API will be difficult. It even uses a different clipboard API which takes ClipboardEvent
instead of ClipboardItem
.
@kxxt How hard would it be to make a function that could be called one from a custom transform which uses the plugin's default pasting behavior? Wouldn't it be a wrapper or whatnot? I haven't looked at the source code but I don't think it would be that hard, unless it is.
@kxxt How hard would it be to make a function that could be called one from a custom transform which uses the plugin's default pasting behavior? Wouldn't it be a wrapper or whatnot? I haven't looked at the source code but I don't think it would be that hard, unless it is.
It's not exposing the function directly is hard. It's exposing it through a sane API is hard. If you really want it you should fork this repo and modify it directly.
@kxxt Alright, thanks for answering though.