From 5f15dc202309386b9d2f528318fb4defde2180d9 Mon Sep 17 00:00:00 2001 From: PalmerAL Date: Sun, 18 Nov 2018 08:54:08 -0600 Subject: [PATCH] Use `span` instead of `div` in the text layer This improves copy/pasting text content since it reduces the amount of unnecessary newlines. --- src/display/text_layer.js | 2 +- test/text_layer_test.css | 2 +- web/text_layer_builder.css | 2 +- web/viewer.css | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/display/text_layer.js b/src/display/text_layer.js index b676d89df83c4..6abd23e42c37c 100644 --- a/src/display/text_layer.js +++ b/src/display/text_layer.js @@ -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, diff --git a/test/text_layer_test.css b/test/text_layer_test.css index ed62e6c99b703..7ab4f648379e7 100644 --- a/test/text_layer_test.css +++ b/test/text_layer_test.css @@ -22,7 +22,7 @@ right: 0; bottom: 0; } -.textLayer > div { +.textLayer > span { position: absolute; white-space: pre; -webkit-transform-origin: 0% 0%; diff --git a/web/text_layer_builder.css b/web/text_layer_builder.css index 230b5d24d83a1..83c2beda4884c 100644 --- a/web/text_layer_builder.css +++ b/web/text_layer_builder.css @@ -24,7 +24,7 @@ line-height: 1.0; } -.textLayer > div { +.textLayer > span { color: transparent; position: absolute; white-space: pre; diff --git a/web/viewer.css b/web/viewer.css index 72230783dd3e3..b283360640682 100644 --- a/web/viewer.css +++ b/web/viewer.css @@ -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; } @@ -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; }