-
-
Notifications
You must be signed in to change notification settings - Fork 901
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[breaking] Refactor TextLayer to use pdfjs.renderTextLayer (#944)
- Text layer alignment significantly improved - New prop: enhanceTextSelection - New prop: onRenderTextLayerError - New prop: onRenderTextLayerSuccess Breaking changes: - onGetTextSuccess is now called with an object containing items and styles - TextLayer.css must be imported for TextLayer to work properly
- Loading branch information
Showing
17 changed files
with
293 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* Copyright 2014 Mozilla Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
.textLayer { | ||
position: absolute; | ||
text-align: initial; | ||
left: 0; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
overflow: hidden; | ||
line-height: 1; | ||
text-size-adjust: none; | ||
} | ||
|
||
.textLayer span, | ||
.textLayer br { | ||
color: transparent; | ||
position: absolute; | ||
white-space: pre; | ||
cursor: text; | ||
transform-origin: 0% 0%; | ||
} | ||
|
||
/* Only necessary in Google Chrome, see issue 14205, and most unfortunately | ||
* the problem doesn't show up in "text" reference tests. */ | ||
.textLayer span.markedContent { | ||
top: 0; | ||
height: 0; | ||
} | ||
|
||
.textLayer .highlight { | ||
margin: -1px; | ||
padding: 1px; | ||
background-color: rgba(180, 0, 170, 1); | ||
border-radius: 4px; | ||
} | ||
|
||
.textLayer .highlight.appended { | ||
position: initial; | ||
} | ||
|
||
.textLayer .highlight.begin { | ||
border-radius: 4px 0 0 4px; | ||
} | ||
|
||
.textLayer .highlight.end { | ||
border-radius: 0 4px 4px 0; | ||
} | ||
|
||
.textLayer .highlight.middle { | ||
border-radius: 0; | ||
} | ||
|
||
.textLayer .highlight.selected { | ||
background-color: rgba(0, 100, 0, 1); | ||
} | ||
|
||
/* Avoids https://github.com/mozilla/pdf.js/issues/13840 in Chrome */ | ||
.textLayer br::selection { | ||
background: transparent; | ||
} | ||
|
||
.textLayer .endOfContent { | ||
display: block; | ||
position: absolute; | ||
left: 0; | ||
top: 100%; | ||
right: 0; | ||
bottom: 0; | ||
z-index: -1; | ||
cursor: default; | ||
user-select: none; | ||
} | ||
|
||
.textLayer .endOfContent.active { | ||
top: 0; | ||
} |
Oops, something went wrong.