@@ -33,6 +33,12 @@ let isLoading = false;
3333let currentFilter = null ;
3434let filterHasMore = true ;
3535let isFilterLoading = false ;
36+ const SUPPORTED_EDITOR = "cm" ;
37+
38+ function withSupportedEditor ( url ) {
39+ const separator = url . includes ( "?" ) ? "&" : "?" ;
40+ return `${ url } ${ separator } supported_editor=${ SUPPORTED_EDITOR } ` ;
41+ }
3642
3743const $header = (
3844 < div className = "header" >
@@ -140,7 +146,9 @@ async function loadMorePlugins() {
140146 startLoading ( $explore ) ;
141147
142148 const response = await fetch (
143- `${ constants . API_BASE } /plugins?page=${ currentPage } &limit=${ LIMIT } ` ,
149+ withSupportedEditor (
150+ `${ constants . API_BASE } /plugins?page=${ currentPage } &limit=${ LIMIT } ` ,
151+ ) ,
144152 ) ;
145153 const newPlugins = await response . json ( ) ;
146154
@@ -224,7 +232,9 @@ async function searchPlugin() {
224232 try {
225233 $searchResult . classList . add ( "loading" ) ;
226234 const plugins = await fsOperation (
227- Url . join ( constants . API_BASE , `plugins?name=${ query } ` ) ,
235+ withSupportedEditor (
236+ Url . join ( constants . API_BASE , `plugins?name=${ query } ` ) ,
237+ ) ,
228238 ) . readFile ( "json" ) ;
229239
230240 installedPlugins = await listInstalledPlugins ( ) ;
@@ -411,7 +421,9 @@ async function loadExplore() {
411421 hasMore = true ;
412422
413423 const response = await fetch (
414- `${ constants . API_BASE } /plugins?page=${ currentPage } &limit=${ LIMIT } ` ,
424+ withSupportedEditor (
425+ `${ constants . API_BASE } /plugins?page=${ currentPage } &limit=${ LIMIT } ` ,
426+ ) ,
415427 ) ;
416428 const plugins = await response . json ( ) ;
417429
@@ -454,11 +466,15 @@ async function getFilteredPlugins(filterState) {
454466 let response ;
455467 if ( filterState . value === "top_rated" ) {
456468 response = await fetch (
457- `${ constants . API_BASE } /plugins?explore=random&page=${ page } &limit=${ LIMIT } ` ,
469+ withSupportedEditor (
470+ `${ constants . API_BASE } /plugins?explore=random&page=${ page } &limit=${ LIMIT } ` ,
471+ ) ,
458472 ) ;
459473 } else {
460474 response = await fetch (
461- `${ constants . API_BASE } /plugin?orderBy=${ filterState . value } &page=${ page } &limit=${ LIMIT } ` ,
475+ withSupportedEditor (
476+ `${ constants . API_BASE } /plugin?orderBy=${ filterState . value } &page=${ page } &limit=${ LIMIT } ` ,
477+ ) ,
462478 ) ;
463479 }
464480 const items = await response . json ( ) ;
@@ -497,7 +513,9 @@ async function getFilteredPlugins(filterState) {
497513 try {
498514 const page = filterState . nextPage ;
499515 const response = await fetch (
500- `${ constants . API_BASE } /plugins?page=${ page } &limit=${ LIMIT } ` ,
516+ withSupportedEditor (
517+ `${ constants . API_BASE } /plugins?page=${ page } &limit=${ LIMIT } ` ,
518+ ) ,
501519 ) ;
502520 const data = await response . json ( ) ;
503521 filterState . nextPage = page + 1 ;
0 commit comments