@@ -13,7 +13,9 @@ import {
1313 EVENT ,
1414 TYPE ,
1515 ERR ,
16+ ROUTE ,
1617 prettyNum ,
18+ thread2Subpath ,
1719 THREAD ,
1820 cutFrom ,
1921 errRescue ,
@@ -180,17 +182,29 @@ const initSpecCmdResolver = () => {
180182 {
181183 match : SAK . communityLinker ,
182184 action : cmdpath => {
183- debug ( 'communityLinker: ' , cmdpath )
185+ const community = cmdpath [ 0 ]
186+ const { mainPath, subPath } = store . curRoute
187+
188+ if (
189+ R . contains ( mainPath , [ ROUTE . USER , ROUTE . COMMUNITIES ] ) ||
190+ R . contains ( subPath , [ ROUTE . POST , ROUTE . JOB , ROUTE . VIDEO , ROUTE . REPO ] )
191+ ) {
192+ Global . location . href = `/${ community } /posts`
193+ return hidePanel ( )
194+ }
184195
185- // Router.push(url, as)
186- // TODO: use route store method
187- Router . push (
188- {
189- pathname : '/' ,
190- query : { main : cmdpath [ 0 ] } ,
191- } ,
192- cmdpath [ 0 ]
193- )
196+ store . setViewing ( {
197+ community : { raw : community } ,
198+ activeThread : THREAD . POST ,
199+ post : { } ,
200+ } )
201+
202+ store . markRoute ( {
203+ mainPath : community ,
204+ subPath : thread2Subpath ( THREAD . POST ) ,
205+ } )
206+
207+ dispatchEvent ( EVENT . COMMUNITY_CHANGE )
194208 hidePanel ( )
195209 } ,
196210 } ,
@@ -207,6 +221,8 @@ const doSpecCmd = () => {
207221 const cmd = store . curCmdChain
208222 if ( ! cmd ) return
209223
224+ debug ( 'doSpecCmd cmd: ' , cmd )
225+
210226 /* Do not use forEach, cause forEach will not break */
211227 for ( let i = 0 ; i < cmdResolver . length ; i += 1 ) {
212228 if ( cmdResolver [ i ] . match ( cmd ) ) {
@@ -434,7 +450,11 @@ const DataSolver = [
434450 match : asyncRes ( EVENT . QUERY_DORAMON ) ,
435451 action : res => {
436452 const { data } = res [ EVENT . QUERY_DORAMON ]
437- store . open ( )
453+ const forcus = false
454+ store . open ( forcus )
455+
456+ /* "doraemonInputbar" */
457+
438458 store . markState ( { inputValue : data } )
439459 queryPocket ( )
440460 } ,
0 commit comments