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

Add plugin: Modal Opener #4186

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

likemuuxi
Copy link

@likemuuxi likemuuxi commented Sep 8, 2024

I am submitting a new Community Plugin

Repo URL

Link to my plugin: https://github.com/likemuuxi/obsidian-modal-opener

Release Checklist

  • I have tested the plugin on
    • Windows
    • macOS
    • Linux
    • Android (if applicable)
    • iOS (if applicable)
  • My GitHub release contains all required files (as individual files, not just in the source.zip / source.tar.gz)
    • main.js
    • manifest.json
    • styles.css (optional)
  • GitHub release name matches the exact version number specified in my manifest.json (Note: Use the exact version number, don't include a prefix v)
  • The id in my manifest.json matches the id in the community-plugins.json file.
  • My README.md describes the plugin's purpose and provides clear usage instructions.
  • I have read the developer policies at https://docs.obsidian.md/Developer+policies, and have assessed my plugins's adherence to these policies.
  • I have read the tips in https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines and have self-reviewed my plugin to avoid these common pitfalls.
  • I have added a license in the LICENSE file.
  • My project respects and is compatible with the original license of any code from other plugins that I'm using.
    I have given proper attribution to these other projects in my README.md.

@github-actions github-actions bot changed the title Add Modal Opener plugin Add plugin: Modal Opener Sep 8, 2024
@ObsidianReviewBot
Copy link
Collaborator

Thank you for your submission, an automated scan of your plugin code's revealed the following issues:

Required

[1][2][3][4][5][6]:You should not cast this, instead use a instanceof check to make sure that it's actually a file/folder.

[1][2][3][4][5][6][7][8][9][10][11][12][13][14][15][16][17][18][19][20][21][22]:You should avoid assigning styles via JavaScript or in HTML and instead move all these styles into CSS so that they are more easily adaptable by themes and snippets.

[1]:Adding command to the command ID is not necessary, please remove it.

[1][2][3][4][5][6][7][8][9][10][11][12][13][14][15][16][17][18][19][20][21][22][23][24][25][26][27][28][29][30] and more :You should consider limiting the number of console.logs in your code, to not pollute the dev console.


Optional

[1][2][3][4][5][6][7][8][9][10][11][12][13][14][15]:Casting to any should be avoided as much as possible.


Do NOT open a new PR for re-validation.
Once you have pushed all of the required changes to your repo, the bot will update the labels on this PR within 6 hours.
If you think some of the required changes are incorrect, please comment with /skip and the reason why you think the results are incorrect.

@ObsidianReviewBot ObsidianReviewBot self-assigned this Sep 11, 2024
@ObsidianReviewBot ObsidianReviewBot added Changes requested Additional review required PR needs to be reviewed by another person, after the currently requested changes have been made and removed Ready for review labels Sep 11, 2024
@likemuuxi
Copy link
Author

/skip [3]
Modifying this style will affect other non plugin modal windows

@github-actions github-actions bot added the Skipped code scan Code scanning skipped because submission is not in TS/author believes result is wrong label Sep 11, 2024
@ObsidianReviewBot ObsidianReviewBot added Ready for review and removed Changes requested Additional review required PR needs to be reviewed by another person, after the currently requested changes have been made labels Sep 11, 2024
@ObsidianReviewBot ObsidianReviewBot removed their assignment Sep 11, 2024
@ObsidianReviewBot
Copy link
Collaborator

Changes requested by bot have been made, assigning human for additional review.

Copy link

Hello!

I found the following issues in your plugin submission

Errors:

❌ Could not parse community-plugins.json, invalid JSON. Expected ',' or ']' after array element in JSON at position 497852


This check was done automatically. Do NOT open a new PR for re-validation. Instead, to trigger this check again, make a change to your PR and wait a few minutes, or close and re-open it.

Copy link

Hello!

I found the following issues in your plugin submission

Errors:

❌ Could not parse community-plugins.json, invalid JSON. Unexpected token ']', ..."n"
},
]
" is not valid JSON


This check was done automatically. Do NOT open a new PR for re-validation. Instead, to trigger this check again, make a change to your PR and wait a few minutes, or close and re-open it.

@joethei joethei added Changes requested and removed Ready for review Skipped code scan Code scanning skipped because submission is not in TS/author believes result is wrong labels Sep 20, 2024
@joethei joethei added the Minor changes requested PR can be merged after some final changes have been requested label Sep 20, 2024
@likemuuxi
Copy link
Author

likemuuxi commented Sep 21, 2024

Hi joethei,

I've made the requested changes. Could you please review the updates at your convenience? Let me know if there's anything else I need to address.

this.addCommand binds the shortcut key in the bindHotkey() function of modal.ts and defines the functionality in the openInNewTab() function.

Thank you!

@ObsidianReviewBot ObsidianReviewBot added Ready for review Changes made and removed Changes requested Minor changes requested PR can be merged after some final changes have been requested labels Sep 21, 2024
@joethei
Copy link
Collaborator

joethei commented Sep 24, 2024

this.app.keymap.popScope(this.scope);, this.app.keymap.pushScope(this.scope);
Modals already manage the scope automatically, no need to do this here.

this.scope.register([], 'Escape', (evt: KeyboardEvent) => {
This is already registered by default

if (savedHotkeys && savedHotkeys.length > 0) {
Remove this code,
You already have a reference to the active modal in the plugin class, use that and a checkCallback to only run that command when the modal is open.

You can use

this.scope = new Scope(this.app.scope); // Allow app commands to work inside modal

To allow commands to be ran inside of your modal.
The way you implemented it currently is just too confusing, since there will be a command on the command pallete that won't do anything-

@joethei joethei added Changes requested Minor changes requested PR can be merged after some final changes have been requested and removed Ready for review Changes made labels Sep 24, 2024
@likemuuxi
Copy link
Author

likemuuxi commented Sep 25, 2024

Hi joethei,
I have made the suggested modifications and rebuilt some of the code to make it more universal.

After testing, if this part of the code is removed, it will not be possible to exit using the ESC key
this.scope.register([], 'Escape', (evt: KeyboardEvent) => {

Could you please review my plugin again?
Thank you!

@ObsidianReviewBot ObsidianReviewBot added Ready for review Changes made and removed Changes requested Minor changes requested PR can be merged after some final changes have been requested labels Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants