wiki - add 'write' 'preview' buttons to wiki edit like in issues (#7241)
* Add add 'write' 'preview' buttons to wiki edit like in issues affects #6975 Signed-off-by: Michael Gnehr <michael@gnehr.de> * update dark theme Signed-off-by: Michael Gnehr <michael@gnehr.de> * fix css lint warnings - missing spaces Signed-off-by: Michael Gnehr <michael@gnehr.de> * hide preview button on no fullscreen toolbar Signed-off-by: Michael Gnehr <michael@gnehr.de>
This commit is contained in:
parent
9275390423
commit
1c911aa825
8 changed files with 72 additions and 2 deletions
|
@ -1232,6 +1232,46 @@ function initWikiForm() {
|
|||
'clean-block', 'preview', 'fullscreen', 'side-by-side']
|
||||
});
|
||||
$(simplemde.codemirror.getInputField()).addClass('js-quick-submit');
|
||||
|
||||
setTimeout(() => {
|
||||
const $bEdit = $('.repository.wiki.new .previewtabs a[data-tab="write"]');
|
||||
const $bPrev = $('.repository.wiki.new .previewtabs a[data-tab="preview"]');
|
||||
const $toolbar = $('.editor-toolbar');
|
||||
const $bPreview = $('.editor-toolbar a.fa-eye');
|
||||
const $bSideBySide = $('.editor-toolbar a.fa-columns');
|
||||
$bEdit.on('click', () => {
|
||||
if ($toolbar.hasClass('disabled-for-preview')) {
|
||||
$bPreview.click();
|
||||
}
|
||||
});
|
||||
$bPrev.on('click', () => {
|
||||
if (!$toolbar.hasClass('disabled-for-preview')) {
|
||||
$bPreview.click();
|
||||
}
|
||||
});
|
||||
$bPreview.on('click', () => {
|
||||
setTimeout(() => {
|
||||
if ($toolbar.hasClass('disabled-for-preview')) {
|
||||
if ($bEdit.hasClass('active')) {
|
||||
$bEdit.removeClass('active');
|
||||
}
|
||||
if (!$bPrev.hasClass('active')) {
|
||||
$bPrev.addClass('active');
|
||||
}
|
||||
} else {
|
||||
if (!$bEdit.hasClass('active')) {
|
||||
$bEdit.addClass('active');
|
||||
}
|
||||
if ($bPrev.hasClass('active')) {
|
||||
$bPrev.removeClass('active');
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
$bSideBySide.on('click', () => {
|
||||
sideBySideChanges = 10;
|
||||
});
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1717,6 +1717,14 @@
|
|||
.editor-preview {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.ui.attached.tabular.menu.previewtabs {
|
||||
margin-bottom: 15px;
|
||||
|
||||
& + .field .editor-toolbar:not(.fullscreen) a.fa-eye {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.view {
|
||||
|
|
|
@ -516,6 +516,19 @@ a.ui.basic.green.label:hover {
|
|||
border-bottom: 1px solid #304251;
|
||||
}
|
||||
|
||||
.repository.wiki.new .ui.container form .ui.tabular.menu {
|
||||
border-bottom: 1px solid rgba(187, 187, 187, 0.6);
|
||||
|
||||
.active.item {
|
||||
border-top: 1px solid rgba(187, 187, 187, 0.6);
|
||||
border-left: 1px solid rgba(187, 187, 187, 0.6);
|
||||
border-right: 1px solid rgba(187, 187, 187, 0.6);
|
||||
&:hover {
|
||||
background: #4b5162;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.hljs,
|
||||
.hljs-keyword,
|
||||
.hljs-selector-tag,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue