From 9ffc5253915afa9afe80e504a1ed983646c0ecc5 Mon Sep 17 00:00:00 2001 From: tophf Date: Tue, 27 Jun 2017 18:55:17 +0300 Subject: [PATCH] editor: horizontal resize grip --- edit.html | 33 +++++++++++++++++++++++++++------ edit.js | 14 -------------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/edit.html b/edit.html index c8ae2927..d770fd14 100644 --- a/edit.html +++ b/edit.html @@ -192,7 +192,13 @@ background: none; } .CodeMirror-vscrollbar { - margin-bottom: 8px; /* make space for resize-grip */ + margin-bottom: 7px; /* make space for resize-grip */ + } + .CodeMirror-hscrollbar { + bottom: 7px; /* make space for resize-grip */ + } + .CodeMirror-scrollbar-filler { + bottom: 7px; /* make space for resize-grip */ } .CodeMirror-dialog { -webkit-animation: highlight 3s ease-out; @@ -242,14 +248,29 @@ .resize-grip { position: absolute; display: block; - width: 8px; - height: 8px; - content: " "; + height: 6px; + content: ""; + left: 0; right: 0; bottom: 0; - z-index: 99; + z-index: 9; cursor: n-resize; - background: linear-gradient(-45deg, transparent 2px, rgba(0,0,0,0.5) 2px, transparent 3px, transparent 4.5px, rgba(0,0,0,0.5) 5px, transparent 5.5px); + background-color: inherit; + border-top-width: 1px; + border-top-style: solid; + border-top-color: inherit; + } + .resize-grip:after { + content: ""; + bottom: 2px; + left: 0; + right: 0; + margin: 0 8px; + display: block; + position: absolute; + border-top-width: 2px; + border-top-style: dotted; + border-top-color: inherit; } /* applies-to */ .applies-to { diff --git a/edit.js b/edit.js index 61c1e9f8..bd60f56f 100644 --- a/edit.js +++ b/edit.js @@ -390,20 +390,6 @@ function setupCodeMirror(textarea, index) { document.body.style.cursor = ''; }); }); - // resizeGrip has enough space when scrollbars.horiz is visible - if (cm.display.scrollbars.horiz.style.display != "") { - cm.display.scrollbars.vert.style.marginBottom = "0"; - } - // resizeGrip space adjustment in case a long line was entered/deleted by a user - new MutationObserver(function(mutations) { - var hScrollbar = mutations[0].target; - var hScrollbarVisible = hScrollbar.style.display != ""; - var vScrollbar = hScrollbar.parentNode.CodeMirror.display.scrollbars.vert; - vScrollbar.style.marginBottom = hScrollbarVisible ? "0" : ""; - }).observe(cm.display.scrollbars.horiz, { - attributes: true, - attributeFilter: ["style"] - }); editors.splice(index || editors.length, 0, cm); return cm;