From 2d4c293a274c5f13825c89c6fc04eeefbd488238 Mon Sep 17 00:00:00 2001 From: Rodrigo Fernandes Date: Tue, 27 Oct 2020 20:06:45 +0000 Subject: [PATCH 1/2] fix: Only allow selection line content instead of parent element --- src/ui/css/diff2html.css | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ui/css/diff2html.css b/src/ui/css/diff2html.css index acd5db52..a657891e 100644 --- a/src/ui/css/diff2html.css +++ b/src/ui/css/diff2html.css @@ -107,6 +107,18 @@ padding: 0 4.5em; } +.d2h-code-line, +.d2h-code-side-line { + user-select: none; + width: 100%; +} + +.d2h-code-line-ctn { + display: inline-block; + user-select: text; + width: 100%; +} + .d2h-code-line del, .d2h-code-side-line del { display: inline-block; From 33076dc13e7bb87126bf642ff9b898d0abeb355f Mon Sep 17 00:00:00 2001 From: Rodrigo Fernandes Date: Thu, 29 Oct 2020 08:57:31 +0000 Subject: [PATCH 2/2] fix: Add review suggestions --- src/ui/css/diff2html.css | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/ui/css/diff2html.css b/src/ui/css/diff2html.css index a657891e..8d3e4c9e 100644 --- a/src/ui/css/diff2html.css +++ b/src/ui/css/diff2html.css @@ -96,6 +96,8 @@ .d2h-code-line { display: inline-block; white-space: nowrap; + user-select: none; + width: 100%; /* Compensate for the absolute positioning of the line numbers */ padding: 0 8em; } @@ -103,20 +105,21 @@ .d2h-code-side-line { display: inline-block; white-space: nowrap; - /* Compensate for the absolute positioning of the line numbers */ - padding: 0 4.5em; -} - -.d2h-code-line, -.d2h-code-side-line { user-select: none; width: 100%; + /* Compensate for the absolute positioning of the line numbers */ + padding: 0 4.5em; } .d2h-code-line-ctn { display: inline-block; + background: none; + padding: 0; + word-wrap: normal; + white-space: pre; user-select: text; width: 100%; + vertical-align: middle; } .d2h-code-line del, @@ -126,6 +129,7 @@ text-decoration: none; background-color: #ffb6ba; border-radius: 0.2em; + vertical-align: middle; } .d2h-code-line ins, @@ -136,6 +140,7 @@ background-color: #97f295; border-radius: 0.2em; text-align: left; + vertical-align: middle; } .d2h-code-line-prefix { @@ -146,14 +151,6 @@ white-space: pre; } -.d2h-code-line-ctn { - display: inline; - background: none; - padding: 0; - word-wrap: normal; - white-space: pre; -} - .line-num1 { box-sizing: border-box; float: left;