Skip to content

Commit f8f6adc

Browse files
authored
Add button to revert SimpleMDE to plain textarea (#10099)
1 parent 6dcf110 commit f8f6adc

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

web_src/js/index.js

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,16 @@ function initWikiForm() {
13691369
}, '|',
13701370
'unordered-list', 'ordered-list', '|',
13711371
'link', 'image', 'table', 'horizontal-rule', '|',
1372-
'clean-block', 'preview', 'fullscreen', 'side-by-side']
1372+
'clean-block', 'preview', 'fullscreen', 'side-by-side', '|',
1373+
{
1374+
name: 'revert-to-textarea',
1375+
action(e) {
1376+
e.toTextArea();
1377+
},
1378+
className: 'fa fa-file',
1379+
title: 'Revert to simple textarea',
1380+
},
1381+
]
13731382
});
13741383
$(simplemde.codemirror.getInputField()).addClass('js-quick-submit');
13751384

@@ -1473,7 +1482,16 @@ function setSimpleMDE($editArea) {
14731482
'code', 'quote', '|',
14741483
'unordered-list', 'ordered-list', '|',
14751484
'link', 'image', 'table', 'horizontal-rule', '|',
1476-
'clean-block', 'preview', 'fullscreen', 'side-by-side']
1485+
'clean-block', 'preview', 'fullscreen', 'side-by-side', '|',
1486+
{
1487+
name: 'revert-to-textarea',
1488+
action(e) {
1489+
e.toTextArea();
1490+
},
1491+
className: 'fa fa-file',
1492+
title: 'Revert to simple textarea',
1493+
},
1494+
]
14771495
});
14781496

14791497
return true;
@@ -1495,7 +1513,16 @@ function setCommentSimpleMDE($editArea) {
14951513
'code', 'quote', '|',
14961514
'unordered-list', 'ordered-list', '|',
14971515
'link', 'image', 'table', 'horizontal-rule', '|',
1498-
'clean-block']
1516+
'clean-block', '|',
1517+
{
1518+
name: 'revert-to-textarea',
1519+
action(e) {
1520+
e.toTextArea();
1521+
},
1522+
className: 'fa fa-file',
1523+
title: 'Revert to simple textarea',
1524+
},
1525+
]
14991526
});
15001527
simplemde.codemirror.setOption('extraKeys', {
15011528
Enter: () => {

0 commit comments

Comments
 (0)