File tree Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,16 @@ const conversationSearchOptionKey = "conversation_search_option";
99const conversationUserMessageKey = "conversation_user_messages" ;
1010
1111/** @type {Writable<import('$commonTypes').GlobalEvent> } */
12- export const globalEventStore = writable ( { name : "" , payload : { } } ) ;
12+ const createGlobalEventStore = ( ) => {
13+ const { subscribe, set } = writable ( { name : "" , payload : { } } ) ;
14+ return {
15+ subscribe,
16+ set,
17+ reset : ( ) => set ( { } )
18+ } ;
19+ }
20+
21+ export const globalEventStore = createGlobalEventStore ( ) ;
1322
1423
1524/** @type {Writable<import('$userTypes').UserModel> } */
Original file line number Diff line number Diff line change 88 import { page } from ' $app/stores' ;
99 import { browser } from ' $app/environment' ;
1010 import { _ } from ' svelte-i18n' ;
11+ import { globalEventStore } from ' $lib/helpers/store' ;
1112
1213 /** @type {import('$pluginTypes').PluginMenuDefModel[]} */
1314 export let menu;
199200 const path = $page .url .pathname ;
200201 return path? .startsWith (' /' ) ? path .substring (1 ) : path;
201202 };
203+
204+ /** @param {string} link */
205+ const goToPage = (link ) => {
206+ if (! link) return ;
207+
208+ globalEventStore .reset ();
209+ window .open (link, ' _self' );
210+ }
202211< / script>
203212
204213< div class = " vertical-menu" >
225234 < / Link>
226235 < ul class = " sub-menu mm-collapse" >
227236 {#each subMenu .childItems as childItem}
228- < li>< Link href = { childItem .link }> {$_ (childItem .label )}< / Link>< / li>
237+ < li>< Link on : click = {() => goToPage ( childItem .link ) }> {$_ (childItem .label )}< / Link>< / li>
229238 {/ each}
230239 < / ul>
231240 < / li>
232241 {: else }
233- < li>< Link href = { subMenu .link }> {$_ (subMenu .label )}< / Link>< / li>
242+ < li>< Link on : click = {() => goToPage ( subMenu .link ) }> {$_ (subMenu .label )}< / Link>< / li>
234243 {/ if }
235244 {/ each}
236245 < / ul>
237246 < / li>
238247 {: else }
239248 < li>
240- < Link href = { item . link } class = " waves-effect" >
249+ < Link class = " waves-effect" on : click = {() => goToPage ( item . link )} >
241250 < i class = {item .icon } / > < span> {$_ (item .label )}< / span>
242251 < / Link>
243252 < / li>
You can’t perform that action at this time.
0 commit comments