QuickAdd Plugin, get MarkdownView for replaceSelection

Things I have tried

1. const obsidian = require('obsidian')
2. import MarkdownView from 'obsidian'

My Function:
function url_encode_selection(params) {
	const {
    } = params
	let selection = app.workspace.activeEditor.getSelection()
	let encodedSelection = encodeURI(selection)

What I’m trying to do

I’m trying to replace a not uri encoded selection with its uri encoded version via quickAdd.

Thank you!

Instead of an macro, I used the capture template with the following capture format:

// Inside a codeblock annotated with "js quickadd"
const input = await app.workspace.activeEditor.getSelection()
return encodeURI(input)

But would be nice to know how to access MarkdownView for further little scripts.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.