@@ -25,6 +25,7 @@ import ActivityTopAuthors from './components/ActivityTopAuthors.vue';
2525import { initNotificationsTable , initNotificationCount } from './features/notification.js' ;
2626import { createCodeEditor } from './features/codeeditor.js' ;
2727import { svg , svgs } from './svg.js' ;
28+ import { isMobile } from './utils.js' ;
2829
2930const { AppSubUrl, StaticUrlPrefix, csrf} = window . config ;
3031
@@ -385,8 +386,14 @@ function initCommentForm() {
385386 if ( $ ( '.comment.form' ) . length === 0 ) {
386387 return ;
387388 }
388-
389389 autoSimpleMDE = setCommentSimpleMDE ( $ ( '.comment.form textarea:not(.review-textarea)' ) ) ;
390+
391+ // Don't use simpleMDE on mobile due to multiple bug reports which go unfixed
392+ // Other sections rely on it being initialized so just set it back to text area here
393+ if ( isMobile ( ) ) {
394+ autoSimpleMDE . toTextArea ( ) ;
395+ }
396+
390397 initBranchSelector ( ) ;
391398 initCommentPreviewTab ( $ ( '.comment.form' ) ) ;
392399 initImagePaste ( $ ( '.comment.form textarea' ) ) ;
@@ -1214,16 +1221,21 @@ function initPullRequestReview() {
12141221 const form = $ ( this ) . parent ( ) . find ( '.comment-form' ) ;
12151222 form . removeClass ( 'hide' ) ;
12161223 const $textarea = form . find ( 'textarea' ) ;
1217- let $simplemde ;
1218- if ( $textarea . data ( 'simplemde' ) ) {
1219- $simplemde = $textarea . data ( 'simplemde' ) ;
1224+ if ( ! isMobile ( ) ) {
1225+ let $simplemde ;
1226+ if ( $textarea . data ( 'simplemde' ) ) {
1227+ $simplemde = $textarea . data ( 'simplemde' ) ;
1228+ } else {
1229+ attachTribute ( $textarea . get ( ) , { mentions : true , emoji : true } ) ;
1230+ $simplemde = setCommentSimpleMDE ( $textarea ) ;
1231+ $textarea . data ( 'simplemde' , $simplemde ) ;
1232+ }
1233+ $textarea . focus ( ) ;
1234+ $simplemde . codemirror . focus ( ) ;
12201235 } else {
12211236 attachTribute ( $textarea . get ( ) , { mentions : true , emoji : true } ) ;
1222- $simplemde = setCommentSimpleMDE ( $textarea ) ;
1223- $textarea . data ( 'simplemde' , $simplemde ) ;
1237+ $textarea . focus ( ) ;
12241238 }
1225- $textarea . focus ( ) ;
1226- $simplemde . codemirror . focus ( ) ;
12271239 assingMenuAttributes ( form . find ( '.menu' ) ) ;
12281240 } ) ;
12291241 // The following part is only for diff views
@@ -1290,9 +1302,13 @@ function initPullRequestReview() {
12901302 const $textarea = commentCloud . find ( 'textarea' ) ;
12911303 attachTribute ( $textarea . get ( ) , { mentions : true , emoji : true } ) ;
12921304
1293- const $simplemde = setCommentSimpleMDE ( $textarea ) ;
1294- $textarea . focus ( ) ;
1295- $simplemde . codemirror . focus ( ) ;
1305+ if ( ! isMobile ( ) ) {
1306+ const $simplemde = setCommentSimpleMDE ( $textarea ) ;
1307+ $textarea . focus ( ) ;
1308+ $simplemde . codemirror . focus ( ) ;
1309+ } else {
1310+ $textarea . focus ( ) ;
1311+ }
12961312 } ) ;
12971313}
12981314
@@ -1338,6 +1354,10 @@ function initWikiForm() {
13381354 const $editArea = $ ( '.repository.wiki textarea#edit_area' ) ;
13391355 let sideBySideChanges = 0 ;
13401356 let sideBySideTimeout = null ;
1357+ if ( $editArea . length > 0 && isMobile ) {
1358+ $editArea . css ( 'display' , 'inline-block' ) ;
1359+ return ;
1360+ }
13411361 if ( $editArea . length > 0 ) {
13421362 const simplemde = new SimpleMDE ( {
13431363 autoDownloadFontAwesome : false ,
@@ -1433,6 +1453,7 @@ function initWikiForm() {
14331453 name : 'revert-to-textarea' ,
14341454 action ( e ) {
14351455 e . toTextArea ( ) ;
1456+ $editArea . css ( 'display' , 'inline-block' ) ;
14361457 } ,
14371458 className : 'fa fa-file' ,
14381459 title : 'Revert to simple textarea' ,
0 commit comments