Skip to content

Commit

Permalink
pulling in the latest changes from the scholar repo
Browse files Browse the repository at this point in the history
  • Loading branch information
smitar committed Feb 15, 2024
1 parent 7c843a4 commit 1bb7709
Show file tree
Hide file tree
Showing 48 changed files with 1,302 additions and 855 deletions.
8 changes: 4 additions & 4 deletions ui/library/less/colors.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@pdflib-page-shadow: #000000;
@pdflib-highlight-background: #ccb300;
@pdflib-grey-0: #d9dadb;
@pdflib-grey-3: #2E3743;
@initial-blue: #1857B6;
@hover-active-blue: #5492EF;
@loading-outline-yellow: #F4D35E;
@pdflib-grey-3: #2e3743;
@initial-blue: #1857b6;
@hover-active-blue: #5492ef;
@loading-outline-yellow: #f4d35e;
12 changes: 6 additions & 6 deletions ui/library/less/index.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import 'colors.less';
@import 'links.less';
@import 'text-layer.less';
@import 'styles.less';
@import 'zindex.less';
@import 'print.less';
@import "colors.less";
@import "links.less";
@import "text-layer.less";
@import "styles.less";
@import "zindex.less";
@import "print.less";
2 changes: 1 addition & 1 deletion ui/library/less/links.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This rule overwrites default react-pdf styles for links
.annotationLayer {
& section {
border: none!important;
border: none !important;
z-index: @z-index-annotation-link;
}

Expand Down
76 changes: 40 additions & 36 deletions ui/library/less/print.less
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
@media print {
::-webkit-scrollbar {
display: none;
}

html, body { height: auto, }

@page{
size: auto;
margin: 0;
overflow:hidden;
}

html, body {
margin: 0 !important;
padding: 0 !important;
}

.no-break{ page-break-before: always; }

.reader__page {
margin: 0;
}

.reader .reader__main {
margin-top: 0px;
}

.reader__header {
display: none;
}

hypothesis-sidebar {
display: none;
}
::-webkit-scrollbar {
display: none;
}

html,
body {
height: auto;
}

@page {
size: auto;
margin: 0;
overflow: hidden;
}

html,
body {
margin: 0 !important;
padding: 0 !important;
}

.no-break {
page-break-before: always;
}

.reader__page {
margin: 0;
}

.reader .reader__main {
margin-top: 0px;
}

.reader__header {
display: none;
}

hypothesis-sidebar {
display: none;
}
}


35 changes: 18 additions & 17 deletions ui/library/less/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
cursor: pointer;
}

&:hover, &.selected {
&:hover,
&.selected {
background-color: @hover-active-blue;
mix-blend-mode: screen;
}

}

.pdf-reader__overlay-bounding-box-underline {
Expand Down Expand Up @@ -71,7 +71,7 @@
z-index: @z-index-multicanvas;
}
}

&.pdf-reader__page--no-page-image {
.react-pdf__Page__textContent {
color: transparent;
Expand All @@ -83,7 +83,7 @@
left: 50%;
margin: 0 auto;
position: absolute;
transform: translateX(-50%);
transform: translateX(-50%);
z-index: @z-index-loading-content;

.reader__page--is-loading-image-content {
Expand Down Expand Up @@ -119,16 +119,17 @@
}

// HACK: avoid mis-alignment of selected texts
.react-pdf__Page__textContent>span {
height: 0em!important;
.react-pdf__Page__textContent > span {
height: 0em !important;
}

.pdf-reader__download-btn, .pdf-reader__print-btn {
.pdf-reader__download-btn,
.pdf-reader__print-btn {
align-items: center;
display: flex;
}

.pdf-reader__page-number-control__current-page[type="number"] {
.pdf-reader__page-number-control__current-page[type="number"] {
border-radius: 3px;
height: 24px;
-moz-appearance: textfield;
Expand All @@ -145,28 +146,28 @@
}

.pdf-reader__page-number-control__current-page::-webkit-inner-spin-button,
.pdf-reader__page-number-control__current-page::-webkit-outer-spin-button {
-webkit-appearance: none;
.pdf-reader__page-number-control__current-page::-webkit-outer-spin-button {
-webkit-appearance: none;
}

.pdf-reader__thumbnail {
box-shadow: 2px 2px 8px rgba(0, 0, 0, .8);
box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
cursor: pointer;
min-height: 250px;
opacity: .5;
opacity: 0.5;
transition: opacity 400ms ease-in-out;
width: 100%;

&.pdf-reader__thumbnail--no-image {
background-color: rgba(0, 0, 0, .1);
background-color: rgba(0, 0, 0, 0.1);
}

&:hover {
opacity: .75;
opacity: 0.75;
transition-duration: 75ms;
}

&.pdf-reader__thumbnail--is-visible {
&.pdf-reader__thumbnail--full-opacity {
opacity: 1;
transition-duration: 200ms;
}
Expand All @@ -182,7 +183,7 @@

.pdf-reader__thumbnail-image {
width: 100%;
}
}

.reader__thumbnail-list__item:nth-of-type(n + 1) {
margin-top: 16px;
Expand Down Expand Up @@ -306,7 +307,7 @@
.pdf-reader__arrow-flag-base__flag {
position: absolute;
z-index: @z-index-arrow-flag;

.pdf-reader__arrow-flag-base__flag-icon {
position: absolute;
fill: @pdflib-page-background;
Expand Down
151 changes: 74 additions & 77 deletions ui/library/less/text-layer.less
Original file line number Diff line number Diff line change
@@ -1,82 +1,79 @@


// this was taken directly from the react-pdf file at: 'react-pdf/dist/esm/Page/TextLayer.css';
// me and other users experienced issues with bundling this file with webpack.
// me and other users experienced issues with bundling this file with webpack.
// since this is a requirement of the latest beta version of 6.0.0-beta.2, we should monitor this and remove if these issues are resolved

.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; // we are removing this because we show the text layer until the background image is rendered
position: absolute;
white-space: pre;
cursor: text;
transform-origin: 0% 0%;
}
/* Only necessary in Google Chrome, see issue 14205, and most unfortunately
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; // we are removing this because we show the text layer until the background image is rendered
position: absolute;
white-space: pre;
cursor: default;
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;
}

.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;
}
2 changes: 1 addition & 1 deletion ui/library/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@allenai/pdf-components",
"version": "0.0.1",
"version": "1.0.2",
"license": "Apache-2.0",
"author": "[email protected]",
"scripts": {
Expand Down
Loading

0 comments on commit 1bb7709

Please sign in to comment.