summaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authorCherrg <michael@gnehr.de>2019-11-17 20:42:44 +0100
committertechknowlogick <techknowlogick@gitea.io>2019-11-17 14:42:44 -0500
commit1c911aa82545741e249d6cb24990c6e8565fccee (patch)
tree4739949f8a671fdef115bd649b41662c24701df0 /web_src
parent9275390423fc252a74a50414eb872434dc945b1a (diff)
downloadgitea-1c911aa82545741e249d6cb24990c6e8565fccee.tar.gz
gitea-1c911aa82545741e249d6cb24990c6e8565fccee.zip
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>
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/index.js40
-rw-r--r--web_src/less/_repository.less8
-rw-r--r--web_src/less/themes/arc-green.less13
3 files changed, 61 insertions, 0 deletions
diff --git a/web_src/js/index.js b/web_src/js/index.js
index 8ca46832d5..704647d9c4 100644
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -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);
}
}
diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less
index 14bb5e9003..5830fb2fd3 100644
--- a/web_src/less/_repository.less
+++ b/web_src/less/_repository.less
@@ -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 {
diff --git a/web_src/less/themes/arc-green.less b/web_src/less/themes/arc-green.less
index 7ff9eacf09..43f4d9d147 100644
--- a/web_src/less/themes/arc-green.less
+++ b/web_src/less/themes/arc-green.less
@@ -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,