From be0dceb358c4ae072e7ae35ecbc5413ab0e59faa Mon Sep 17 00:00:00 2001 From: Michael Gnehr Date: Tue, 18 Jun 2019 17:00:55 +0200 Subject: [PATCH 1/4] Add add 'write' 'preview' buttons to wiki edit like in issues affects #6975 Signed-off-by: Michael Gnehr --- public/css/index.css | 1 + public/js/index.js | 38 +++++++++++++++++++++++++++++++++++- public/less/_repository.less | 4 ++++ templates/repo/wiki/new.tmpl | 4 ++++ 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/public/css/index.css b/public/css/index.css index 8f575fcd95dcf..cc515d6a74cf8 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -693,6 +693,7 @@ footer .ui.left,footer .ui.right{line-height:40px} .repository.wiki.new .CodeMirror .CodeMirror-code{font-family:'SF Mono',Consolas,Menlo,'Liberation Mono',Monaco,'Lucida Console',monospace} .repository.wiki.new .CodeMirror .CodeMirror-code .cm-comment{background:inherit} .repository.wiki.new .editor-preview{background-color:#fff} +.repository.wiki.new .ui.attached.tabular.menu.previewtabs{margin-bottom:15px} .repository.wiki.view .choose.page{margin-top:-5px} .repository.wiki.view .ui.sub.header{text-transform:none} .repository.wiki.view>.markdown{padding:15px 30px} diff --git a/public/js/index.js b/public/js/index.js index 28023e1061bbf..4317997ee0917 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1164,8 +1164,44 @@ function initWikiForm() { "unordered-list", "ordered-list", "|", "link", "image", "table", "horizontal-rule", "|", "clean-block", "preview", "fullscreen"] - }) + }); $(simplemde.codemirror.getInputField()).addClass("js-quick-submit"); + + setTimeout(function(){ + let $bEdit = $('.repository.wiki.new .previewtabs a[data-tab="write"]'); + let $bPrev = $('.repository.wiki.new .previewtabs a[data-tab="preview"]'); + let $toolbar = $('.editor-toolbar'); + let $bPreview = $('.editor-toolbar a.fa-eye'); + $bEdit.on('click', function () { + if ($toolbar.hasClass('disabled-for-preview')){ + $bPreview.click(); + } + }); + $bPrev.on('click', function () { + if (!$toolbar.hasClass('disabled-for-preview')){ + $bPreview.click(); + } + }); + $bPreview.on('click', function(){ + setTimeout(function(){ + 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'); + } + } + }, 5); + }); + },5); } } diff --git a/public/less/_repository.less b/public/less/_repository.less index acf8d7b870b74..bba1b4c44f194 100644 --- a/public/less/_repository.less +++ b/public/less/_repository.less @@ -1680,6 +1680,10 @@ .editor-preview { background-color: white; } + + .ui.attached.tabular.menu.previewtabs { + margin-bottom: 15px; + } } &.view { diff --git a/templates/repo/wiki/new.tmpl b/templates/repo/wiki/new.tmpl index bf6c24220bdde..276ea54f3a210 100644 --- a/templates/repo/wiki/new.tmpl +++ b/templates/repo/wiki/new.tmpl @@ -16,6 +16,10 @@
+
From 6d832d9f28514207767d85d1199a229684a8ab57 Mon Sep 17 00:00:00 2001 From: Michael Gnehr Date: Thu, 20 Jun 2019 17:26:02 +0200 Subject: [PATCH 2/4] update dark theme Signed-off-by: Michael Gnehr --- public/css/theme-arc-green.css | 2 ++ public/less/themes/arc-green.less | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/public/css/theme-arc-green.css b/public/css/theme-arc-green.css index dd2b13542a4de..ba97e4fa5ac63 100644 --- a/public/css/theme-arc-green.css +++ b/public/css/theme-arc-green.css @@ -90,6 +90,8 @@ footer{background:#2e323e;border-top:1px solid #313131} .ui .text.grey{color:#808084!important} .ui.attached.table.segment{background:#353945;color:#dbdbdb!important} .markdown:not(code) h2{border-bottom:1px solid #304251} +.repository.wiki.new .ui.container form .ui.tabular.menu{border-bottom:1px solid rgba(187,187,187,.6)} +.repository.wiki.new .ui.container form .ui.tabular.menu .active.item{border-top:1px solid rgba(187,187,187,.6);border-left:1px solid rgba(187,187,187,.6);border-right:1px solid rgba(187,187,187,.6)} .hljs,.hljs-keyword,.hljs-selector-tag,.hljs-subst{color:#9daccc} .markdown:not(code) .highlight pre,.markdown:not(code) pre{background-color:#2a2e3a;border:1px solid #404552} .markdown:not(code) table tr:nth-child(2n){background-color:#474d61} diff --git a/public/less/themes/arc-green.less b/public/less/themes/arc-green.less index 6d13bb2e5217e..e21fbee4167bd 100644 --- a/public/less/themes/arc-green.less +++ b/public/less/themes/arc-green.less @@ -487,6 +487,16 @@ 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); + } +} + .hljs, .hljs-keyword, .hljs-selector-tag, From a52b141146ba74c8d3f0e0436f242349a0864a28 Mon Sep 17 00:00:00 2001 From: Michael Gnehr Date: Thu, 27 Jun 2019 23:13:15 +0200 Subject: [PATCH 3/4] fix css lint warnings - missing spaces Signed-off-by: Michael Gnehr --- public/less/themes/arc-green.less | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/less/themes/arc-green.less b/public/less/themes/arc-green.less index 54b97ac4ec516..31d09406d93a7 100644 --- a/public/less/themes/arc-green.less +++ b/public/less/themes/arc-green.less @@ -485,12 +485,12 @@ a.ui.basic.green.label:hover { } .repository.wiki.new .ui.container form .ui.tabular.menu { - border-bottom: 1px solid rgba(187,187,187, 0.6); + 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); + 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); } } From 8e288ebb2d300dd9043eae8528caff669bec7fbf Mon Sep 17 00:00:00 2001 From: Michael Gnehr Date: Fri, 28 Jun 2019 00:22:43 +0200 Subject: [PATCH 4/4] hide preview button on no fullscreen toolbar Signed-off-by: Michael Gnehr --- public/css/index.css | 1 + public/less/_repository.less | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/public/css/index.css b/public/css/index.css index 05841c0dec913..048235adf8ff2 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -695,6 +695,7 @@ footer .ui.left,footer .ui.right{line-height:40px} .repository.wiki.new .CodeMirror .CodeMirror-code .cm-comment{background:inherit} .repository.wiki.new .editor-preview{background-color:#fff} .repository.wiki.new .ui.attached.tabular.menu.previewtabs{margin-bottom:15px} +.repository.wiki.new .ui.attached.tabular.menu.previewtabs+.field .editor-toolbar:not(.fullscreen) a.fa-eye{display:none} .repository.wiki.view .choose.page{margin-top:-5px} .repository.wiki.view .ui.sub.header{text-transform:none} .repository.wiki.view>.markdown{padding:15px 30px} diff --git a/public/less/_repository.less b/public/less/_repository.less index 506dd66bb3ec7..fb0c0bf443423 100644 --- a/public/less/_repository.less +++ b/public/less/_repository.less @@ -1701,6 +1701,10 @@ .ui.attached.tabular.menu.previewtabs { margin-bottom: 15px; + + & + .field .editor-toolbar:not(.fullscreen) a.fa-eye { + display: none; + } } }