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

feat: plugin-api.ts executeInline() #2077

Merged
merged 2 commits into from
Oct 6, 2023

Conversation

MarioRicalde
Copy link
Contributor

With this you can evaluate =this.file.name for example.

With this you can evaluate `=this.file.name` for example.
@MarioRicalde
Copy link
Contributor Author

@blacksmithgu is there anything else I can do to expedite this merge? I have been writing some helpers using this change already. Thank you.

@blacksmithgu
Copy link
Owner

Does this actually work as is? I believe you need to explicitly specify this when calling API methods.

@MarioRicalde
Copy link
Contributor Author

Yes sir. I have the following line working for my "inline burner" methods:

app.plugins.plugins["dataview"].api.executeInline("this.file.name", file.path)

This returns the file name of the given file path.

@MarioRicalde
Copy link
Contributor Author

Ah, my bad. I have to do some adjustments to this PR. I worked with .obsidian/plugin JS to get this, which loads everything in a single js.

@MarioRicalde
Copy link
Contributor Author

@blacksmithgu should be good to go now.

Console test:

app.plugins.plugins["dataview"].api.executeInline("this.file.name", 'Testing/UNO.md')

Outputs:

Success {value: 'UNO', successful: true}

@Mara-Li
Copy link

Mara-Li commented Oct 3, 2023

Can this work on inlineJS ?

@MarioRicalde
Copy link
Contributor Author

Can this work on inlineJS ?

I have seen some of the methods, but I have yet to use them for my needs, so I didn't expose them to the API. If this PR gets approved and merged by @blacksmithgu I can circle back and implement them next weekend.

@blacksmithgu blacksmithgu merged commit ee535bf into blacksmithgu:master Oct 6, 2023
2 of 3 checks passed
@blacksmithgu
Copy link
Owner

The code as written does not work since it was built against the raw JS file and not the actual typescript source. I've amended it to properly compile and adjusted it to be more idiomatic.

It is available as api.evaluateInline("expression", "source file path").

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

Successfully merging this pull request may close these issues.

3 participants