@@ -245,6 +245,19 @@ const fillSyncProviderPanelValues = (panel: Element) => {
245245 }
246246} ;
247247
248+ const getReposDataLoadingHTML = ( ) =>
249+ `<div class="fn__flex">
250+ <div class="fn__flex-1">
251+ ${ window . siyuan . languages . cloudStorage }
252+ </div>
253+ <div class="fn__flex-1">
254+ ${ window . siyuan . languages . trafficStat }
255+ </div>
256+ </div>
257+ <div style="min-height: 180px; display: flex; justify-content: center;" id="reposLoading">
258+ <img src="/stage/loading-pure.svg">
259+ </div>` ;
260+
248261const bindProviderEvent = ( ) => {
249262 const importElement = repos . element . querySelector ( "#importData" ) as HTMLInputElement ;
250263 if ( importElement ) {
@@ -267,24 +280,22 @@ const bindProviderEvent = () => {
267280 }
268281
269282 const reposDataElement = repos . element . querySelector ( "#reposData" ) ;
270- const loadingElement = repos . element . querySelector ( "#reposLoading" ) ;
271283 if ( window . siyuan . config . sync . provider === 0 ) {
272284 if ( needSubscribe ( "" ) ) {
273- loadingElement . classList . add ( "fn__none" ) ;
274285 let nextElement = reposDataElement ;
275286 while ( nextElement ) {
276287 nextElement . classList . add ( "fn__none" ) ;
277288 nextElement = nextElement . nextElementSibling ;
278289 }
279290 return ;
280291 }
292+ reposDataElement . innerHTML = getReposDataLoadingHTML ( ) ;
281293 fetchPost ( "/api/cloud/getCloudSpace" , { } , ( response ) => {
282- loadingElement . classList . add ( "fn__none" ) ;
283294 if ( response . code === 1 ) {
284295 reposDataElement . innerHTML = response . msg ;
285296 return ;
286- } else {
287- reposDataElement . innerHTML = `<div class="fn__flex">
297+ }
298+ reposDataElement . innerHTML = `<div class="fn__flex">
288299 <div class="fn__flex-1">
289300 ${ window . siyuan . languages . cloudStorage }
290301 <div class="fn__hr"></div>
@@ -308,13 +319,11 @@ const bindProviderEvent = () => {
308319 </ul>
309320 </div>
310321</div>` ;
311- }
312322 } ) ;
313323 reposDataElement . classList . remove ( "fn__none" ) ;
314324 return ;
315325 }
316326
317- loadingElement . classList . add ( "fn__none" ) ;
318327 let nextElement = reposDataElement . nextElementSibling ;
319328 while ( nextElement ) {
320329 if ( isPaidUser ( ) ) {
@@ -447,11 +456,7 @@ const bindProviderEvent = () => {
447456export const repos = {
448457 element : undefined as Element ,
449458 genHTML : ( ) => {
450- return `<div>
451- <div style="position: fixed;width: 800px;height: 434px;box-sizing: border-box;text-align: center;display: flex;align-items: center;justify-content: center;z-index: 1;" id="reposLoading">
452- <img src="/stage/loading-pure.svg">
453- </div>
454- <div class="fn__flex b3-label config__item">
459+ return `<div class="fn__flex b3-label config__item">
455460 <div class="fn__flex-1">
456461 ${ window . siyuan . languages . syncProvider }
457462 <div class="b3-label__text">${ window . siyuan . languages . syncProviderTip } </div>
@@ -468,14 +473,7 @@ export const repos = {
468473 ${ renderProvider ( window . siyuan . config . sync . provider ) }
469474</div>
470475<div id="reposData" class="b3-label">
471- <div class="fn__flex">
472- <div class="fn__flex-1">
473- ${ window . siyuan . languages . cloudStorage }
474- </div>
475- <div class="fn__flex-1">
476- ${ window . siyuan . languages . trafficStat }
477- </div>
478- </div>
476+ ${ getReposDataLoadingHTML ( ) }
479477</div>
480478<label class="fn__flex b3-label">
481479 <div class="fn__flex-1">
@@ -541,7 +539,6 @@ export const repos = {
541539<div class="b3-label fn__flex">
542540 <div class="fn__flex-center">${ window . siyuan . languages . cloudBackup } </div>
543541 <div class="b3-list-item__meta fn__flex-center">${ window . siyuan . languages . cloudBackupTip } </div>
544- </div>
545542</div>` ;
546543 } ,
547544 bindEvent : ( ) => {
@@ -629,9 +626,6 @@ export const repos = {
629626 }
630627 } ) ;
631628 } ) ;
632- const loadingElement = repos . element . querySelector ( "#reposLoading" ) as HTMLElement ;
633- loadingElement . style . width = repos . element . clientWidth + "px" ;
634- loadingElement . style . height = repos . element . clientHeight + "px" ;
635629 bindSyncCloudListEvent ( syncConfigElement ) ;
636630 repos . element . firstElementChild . addEventListener ( "click" , ( event ) => {
637631 let target = event . target as HTMLElement ;
0 commit comments