|
|
|
@ -1414,6 +1414,7 @@ function initWikiForm() { |
|
|
|
|
const $editArea = $('.repository.wiki textarea#edit_area'); |
|
|
|
|
let sideBySideChanges = 0; |
|
|
|
|
let sideBySideTimeout = null; |
|
|
|
|
let hasSimpleMDE = true; |
|
|
|
|
if ($editArea.length > 0) { |
|
|
|
|
const simplemde = new SimpleMDE({ |
|
|
|
|
autoDownloadFontAwesome: false, |
|
|
|
@ -1510,6 +1511,12 @@ function initWikiForm() { |
|
|
|
|
name: 'revert-to-textarea', |
|
|
|
|
action(e) { |
|
|
|
|
e.toTextArea(); |
|
|
|
|
hasSimpleMDE = false; |
|
|
|
|
const $form = $('.repository.wiki.new .ui.form'); |
|
|
|
|
const $root = $form.find('.field.content'); |
|
|
|
|
const loading = $root.data('loading'); |
|
|
|
|
$root.append(`<div class="ui bottom tab markdown" data-tab="preview">${loading}</div>`); |
|
|
|
|
initCommentPreviewTab($form); |
|
|
|
|
}, |
|
|
|
|
className: 'fa fa-file', |
|
|
|
|
title: 'Revert to simple textarea', |
|
|
|
@ -1524,15 +1531,26 @@ function initWikiForm() { |
|
|
|
|
const $toolbar = $('.editor-toolbar'); |
|
|
|
|
const $bPreview = $('.editor-toolbar button.preview'); |
|
|
|
|
const $bSideBySide = $('.editor-toolbar a.fa-columns'); |
|
|
|
|
$bEdit.on('click', () => { |
|
|
|
|
$bEdit.on('click', (e) => { |
|
|
|
|
if (!hasSimpleMDE) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
e.stopImmediatePropagation(); |
|
|
|
|
if ($toolbar.hasClass('disabled-for-preview')) { |
|
|
|
|
$bPreview.trigger('click'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
}); |
|
|
|
|
$bPrev.on('click', () => { |
|
|
|
|
$bPrev.on('click', (e) => { |
|
|
|
|
if (!hasSimpleMDE) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
e.stopImmediatePropagation(); |
|
|
|
|
if (!$toolbar.hasClass('disabled-for-preview')) { |
|
|
|
|
$bPreview.trigger('click'); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
}); |
|
|
|
|
$bPreview.on('click', () => { |
|
|
|
|
setTimeout(() => { |
|
|
|
@ -1552,6 +1570,8 @@ function initWikiForm() { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, 0); |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
}); |
|
|
|
|
$bSideBySide.on('click', () => { |
|
|
|
|
sideBySideChanges = 10; |
|
|
|
|