Skip to content

Commit

Permalink
Use span instead of div in the text layer
Browse files Browse the repository at this point in the history
This improves copy/pasting text content since it reduces the amount of unnecessary newlines.
  • Loading branch information
PalmerAL authored and timvandermeij committed Nov 18, 2018
1 parent 4e3d694 commit 5f15dc2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/display/text_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var renderTextLayer = (function renderTextLayerClosure() {

function appendText(task, geom, styles) {
// Initialize all used properties to keep the caches monomorphic.
var textDiv = document.createElement('div');
var textDiv = document.createElement('span');
var textDivProperties = {
style: null,
angle: 0,
Expand Down
2 changes: 1 addition & 1 deletion test/text_layer_test.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
right: 0;
bottom: 0;
}
.textLayer > div {
.textLayer > span {
position: absolute;
white-space: pre;
-webkit-transform-origin: 0% 0%;
Expand Down
2 changes: 1 addition & 1 deletion web/text_layer_builder.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
line-height: 1.0;
}

.textLayer > div {
.textLayer > span {
color: transparent;
position: absolute;
white-space: pre;
Expand Down
10 changes: 5 additions & 5 deletions web/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ select {
display: none;
}

.pdfPresentationMode:fullscreen .textLayer > div {
.pdfPresentationMode:fullscreen .textLayer > span {
cursor: none;
}

.pdfPresentationMode.pdfPresentationModeControls > *,
.pdfPresentationMode.pdfPresentationModeControls .textLayer > div {
.pdfPresentationMode.pdfPresentationModeControls .textLayer > span {
cursor: default;
}

Expand Down Expand Up @@ -1518,19 +1518,19 @@ html[dir='rtl'] #documentPropertiesOverlay .row > * {
mix-blend-mode: screen;
}

#viewer.textLayer-visible .textLayer > div {
#viewer.textLayer-visible .textLayer > span {
background-color: rgba(255, 255, 0, 0.1);
color: black;
border: solid 1px rgba(255, 0, 0, 0.5);
box-sizing: border-box;
}

#viewer.textLayer-hover .textLayer > div:hover {
#viewer.textLayer-hover .textLayer > span:hover {
background-color: white;
color: black;
}

#viewer.textLayer-shadow .textLayer > div {
#viewer.textLayer-shadow .textLayer > span {
background-color: rgba(255,255,255, .6);
color: black;
}
Expand Down

0 comments on commit 5f15dc2

Please sign in to comment.