@@ -25,6 +25,7 @@ import ActivityTopAuthors from './components/ActivityTopAuthors.vue';
25
25
import { initNotificationsTable , initNotificationCount } from './features/notification.js' ;
26
26
import { createCodeEditor } from './features/codeeditor.js' ;
27
27
import { svg , svgs } from './svg.js' ;
28
+ import { isMobile } from './utils.js' ;
28
29
29
30
const { AppSubUrl, StaticUrlPrefix, csrf} = window . config ;
30
31
@@ -385,8 +386,14 @@ function initCommentForm() {
385
386
if ( $ ( '.comment.form' ) . length === 0 ) {
386
387
return ;
387
388
}
388
-
389
389
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
+
390
397
initBranchSelector ( ) ;
391
398
initCommentPreviewTab ( $ ( '.comment.form' ) ) ;
392
399
initImagePaste ( $ ( '.comment.form textarea' ) ) ;
@@ -1214,16 +1221,21 @@ function initPullRequestReview() {
1214
1221
const form = $ ( this ) . parent ( ) . find ( '.comment-form' ) ;
1215
1222
form . removeClass ( 'hide' ) ;
1216
1223
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 ( ) ;
1220
1235
} else {
1221
1236
attachTribute ( $textarea . get ( ) , { mentions : true , emoji : true } ) ;
1222
- $simplemde = setCommentSimpleMDE ( $textarea ) ;
1223
- $textarea . data ( 'simplemde' , $simplemde ) ;
1237
+ $textarea . focus ( ) ;
1224
1238
}
1225
- $textarea . focus ( ) ;
1226
- $simplemde . codemirror . focus ( ) ;
1227
1239
assingMenuAttributes ( form . find ( '.menu' ) ) ;
1228
1240
} ) ;
1229
1241
// The following part is only for diff views
@@ -1290,9 +1302,13 @@ function initPullRequestReview() {
1290
1302
const $textarea = commentCloud . find ( 'textarea' ) ;
1291
1303
attachTribute ( $textarea . get ( ) , { mentions : true , emoji : true } ) ;
1292
1304
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
+ }
1296
1312
} ) ;
1297
1313
}
1298
1314
@@ -1338,6 +1354,10 @@ function initWikiForm() {
1338
1354
const $editArea = $ ( '.repository.wiki textarea#edit_area' ) ;
1339
1355
let sideBySideChanges = 0 ;
1340
1356
let sideBySideTimeout = null ;
1357
+ if ( $editArea . length > 0 && isMobile ) {
1358
+ $editArea . css ( 'display' , 'inline-block' ) ;
1359
+ return ;
1360
+ }
1341
1361
if ( $editArea . length > 0 ) {
1342
1362
const simplemde = new SimpleMDE ( {
1343
1363
autoDownloadFontAwesome : false ,
@@ -1433,6 +1453,7 @@ function initWikiForm() {
1433
1453
name : 'revert-to-textarea' ,
1434
1454
action ( e ) {
1435
1455
e . toTextArea ( ) ;
1456
+ $editArea . css ( 'display' , 'inline-block' ) ;
1436
1457
} ,
1437
1458
className : 'fa fa-file' ,
1438
1459
title : 'Revert to simple textarea' ,
0 commit comments