-
Notifications
You must be signed in to change notification settings - Fork 8
Allow removal and adding for plugins in iconMenu #861
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
base: next
Are you sure you want to change the base?
Changes from all commits
e14ded9
8f36876
4888d29
866b395
d7e23ae
b47d6cf
28a8ef6
bb128d2
1d136e7
fe13760
d2b0008
ee8f935
962aa61
441b0be
42c1204
b6d0d30
7b57647
b44a099
7bbdec2
c1552fb
6872561
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ import type { | |
| import { toMerged } from 'es-toolkit' | ||
| import i18next from 'i18next' | ||
| import { acceptHMRUpdate, defineStore } from 'pinia' | ||
| import { markRaw, reactive } from 'vue' | ||
| import { markRaw, reactive, readonly } from 'vue' | ||
|
|
||
| import { useMainStore } from './main' | ||
|
|
||
|
|
@@ -67,20 +67,17 @@ export const usePluginStore = defineStore('plugin', () => { | |
| plugins.splice(pluginIndex, 1) | ||
| } | ||
|
|
||
| function getPluginStore<T extends PluginId>( | ||
| function getPluginStore<T extends BundledPluginId>( | ||
| id: T | ||
| ): ReturnType< | ||
| T extends BundledPluginId | ||
| ? BundledPluginStores<typeof id> | ||
| : PolarPluginStore | ||
| > | null { | ||
| ): ReturnType<BundledPluginStores<T>> | null | ||
| function getPluginStore(id: PluginId): ReturnType<PolarPluginStore> | null | ||
| function getPluginStore(id: PluginId): unknown { | ||
| const plugin = plugins.find((plugin) => plugin.id === id) | ||
| // @ts-expect-error | We trust that our internal IDs work. | ||
| return plugin?.storeModule?.(mainStore._instance) || null | ||
| } | ||
|
|
||
| return { | ||
| plugins, | ||
| plugins: readonly(plugins) as readonly PluginContainer[], | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the same as using a
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is...well it is mostly. |
||
| addPlugin, | ||
| removePlugin, | ||
| getPluginStore, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't it the intention of the function to also be able to retrieve the store of custom plugins with this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is; see line 73