8000 fix: Only allow selection line content instead of parent element by rtfpessoa · Pull Request #348 · rtfpessoa/diff2html · GitHub
[go: up one dir, main page]

Skip to content

fix: Only allow selection line content instead of parent element #348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions src/ui/css/diff2html.css
Original file line number Diff line number Diff line change
Expand Up @@ -96,24 +96,40 @@
.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;
}

.d2h-code-side-line {
display: inline-block;
white-space: nowrap;
user-select: none;
width: 100%;
/* Compensate for the absolute positioning of the line numbers */
padding: 0 4.5em;
}

.d2h-code-line-ctn {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason this isn't working as good is that these rules are currently partly overridden by the ones in line 149.
Also it looks like this then needs the following style so it is aliged correctly. (On both .d2h-code-line-ctn and .d2h-code-line-prefix):

    vertical-align: middle;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diff --git a/src/ui/css/diff2html.css b/src/ui/css/diff2html.css
index a657891..bc267dc 100644
--- a/src/ui/css/diff2html.css
+++ b/src/ui/css/diff2html.css
@@ -113,12 +113,6 @@
   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;
@@ -144,14 +138,18 @@
   padding: 0;
   word-wrap: normal;
   white-space: pre;
+  vertical-align: middle;
 }
 
 .d2h-code-line-ctn {
-  display: inline;
+  display: inline-block;
   background: none;
   padding: 0;
   word-wrap: normal;
   white-space: pre;
+  user-select: text;
+  width: 100%;
+  vertical-align: middle;
 }
 
 .line-num1 {

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, this works fine. I just did not understand the difference caused by the vertical-align.
Maybe it matters for different font sizes or other changes in the style?

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,
.d2h-code-side-line del {
display: inline-block;
margin-top: -1px;
text-decoration: none;
background-color: #ffb6ba;
border-radius: 0.2em;
vertical-align: middle;
}

.d2h-code-line ins,
Expand All @@ -124,6 +140,7 @@
background-color: #97f295;
border-radius: 0.2em;
text-align: left;
vertical-align: middle;
}

.d2h-code-line-prefix {
Expand All @@ -134,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;
Expand Down
0