@@ -1422,6 +1422,8 @@ async function loadFileInHTML(fileEl, fileSha) {
14221422
14231423 resp = { content : fileSizeText } ;
14241424
1425+ cd . textContent = '' ;
1426+
14251427 // if on mobile device
14261428 if ( isMobile ) {
14271429
@@ -1438,7 +1440,6 @@ async function loadFileInHTML(fileEl, fileSha) {
14381440 } else {
14391441
14401442 liveToggle . classList . add ( 'file-open' ) ;
1441- updateScrollbarArrow ( ) ;
14421443
14431444 onNextFrame ( ( ) => {
14441445 liveView . classList . remove ( 'notransition' ) ;
@@ -1583,7 +1584,6 @@ function loadBinaryFileHTML(file, toggled) {
15831584 if ( ! isMobile ) {
15841585
15851586 liveToggle . classList . add ( 'file-open' ) ;
1586- updateScrollbarArrow ( ) ;
15871587
15881588 }
15891589
@@ -1945,6 +1945,18 @@ sidebarTitle.addEventListener('click', (e) => {
19451945
19461946 sidebar . classList . add ( 'learn' ) ;
19471947
1948+
1949+ // if adding a repository
1950+
1951+ const focusedRepo = fileWrapper . querySelector ( '.repo.focused' ) ;
1952+
1953+ if ( focusedRepo ) {
1954+
1955+ // remove it
1956+ focusedRepo . remove ( ) ;
1957+
1958+ }
1959+
19481960 /*
19491961 // if there are no modified files
19501962 // and no pending promises
@@ -3010,6 +3022,7 @@ function onEditorScroll() {
30103022
30113023}
30123024
3025+
30133026function updateScrollbarArrow ( ) {
30143027
30153028 // if codeit is horizontally scrollable
@@ -3027,6 +3040,10 @@ function updateScrollbarArrow() {
30273040
30283041}
30293042
3043+ // when codeit resizes, update
3044+ new ResizeObserver ( updateScrollbarArrow ) . observe ( cd ) ;
3045+
3046+
30303047// check for meta key (Ctrl/Command)
30313048function isKeyEventMeta ( event ) {
30323049 return event . metaKey || event . ctrlKey ;
@@ -3217,8 +3234,6 @@ function setupEditor() {
32173234 cd . on ( 'scroll' , onEditorScroll ) ;
32183235 cd . on ( 'caretmove' , saveSelectedFileCaretPos ) ;
32193236
3220- if ( ! isMobile ) cd . on ( 'type' , updateScrollbarArrow ) ;
3221-
32223237 // update on screen resize
32233238
32243239 const landscape = window . matchMedia ( '(orientation: landscape)' ) ;
@@ -3372,7 +3387,7 @@ function setupEditor() {
33723387 if ( shownMessages . beautifySelect < 2 ) {
33733388
33743389 // show beautify select message
3375- showMessage ( 'Try selecting some text.' , 3500 ) ;
3390+ showMessage ( 'Try selecting some text first .' , 4100 ) ;
33763391
33773392 // bump counter
33783393 shownMessages . beautifySelect ++ ;
@@ -3440,7 +3455,6 @@ function updateLineNumbersHTML() {
34403455
34413456 if ( ! isMobile ) {
34423457
3443- updateScrollbarArrow ( ) ;
34443458 updateLiveViewArrow ( ) ;
34453459
34463460 }
0 commit comments