pdf.scss 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. :root {
  2. --pdf-bg: var(--bg-dark-secondary);
  3. --pdf-toolbar-btn-hover-color: rgb(125 125 125 / 20%);
  4. --synctex-control-size: 24px;
  5. }
  6. @include theme('light') {
  7. --pdf-toolbar-btn-hover-color: var(--neutral-10);
  8. --pdf-bg: var(--neutral-10);
  9. }
  10. .pdf-code-check-failed-banner-container {
  11. position: absolute;
  12. top: calc(var(--toolbar-small-height) + var(--spacing-04));
  13. left: 0;
  14. right: 0;
  15. z-index: 1;
  16. display: flex;
  17. justify-content: center;
  18. padding: 0 var(--spacing-06);
  19. }
  20. .pdf-code-check-failed-banner {
  21. display: flex;
  22. align-items: center;
  23. gap: var(--spacing-02);
  24. background-color: var(--bg-light-primary);
  25. color: var(--content-primary);
  26. border: 1px solid var(--border-divider);
  27. padding: var(--spacing-02) var(--spacing-03) var(--spacing-02)
  28. var(--spacing-02);
  29. border-radius: var(--border-radius-full);
  30. box-shadow: 0 2px 4px 0 #1e253029;
  31. }
  32. .pdf .toolbar.toolbar-pdf {
  33. @include toolbar-sm-height;
  34. @include toolbar-alt-bg;
  35. padding-right: var(--spacing-03);
  36. margin-left: 0;
  37. .btn.disabled,
  38. .btn[disabled] {
  39. pointer-events: auto;
  40. cursor: not-allowed;
  41. opacity: 1;
  42. }
  43. }
  44. .toolbar-pdf-left {
  45. gap: var(--spacing-02);
  46. .compile-button-group {
  47. height: 24px;
  48. background-color: var(--bg-accent-01);
  49. border-radius: 12px;
  50. margin-left: var(--spacing-02);
  51. .btn-primary:hover {
  52. z-index: auto; // prevents border from being hidden
  53. }
  54. }
  55. .dropdown > .btn {
  56. border-top-left-radius: 0;
  57. border-bottom-left-radius: 0;
  58. &[disabled],
  59. &[disabled]:active {
  60. background-color: var(--bs-btn-bg);
  61. color: var(--bs-btn-color);
  62. opacity: 1;
  63. pointer-events: auto;
  64. cursor: not-allowed;
  65. }
  66. }
  67. .dropdown > .compile-button {
  68. border-top-left-radius: 12px;
  69. border-bottom-left-radius: 12px;
  70. font-size: var(--font-size-02);
  71. }
  72. .dropdown > .compile-dropdown-toggle {
  73. width: 26px;
  74. padding: var(--spacing-01);
  75. }
  76. }
  77. .toolbar-pdf-left,
  78. .toolbar-pdf-right,
  79. .toolbar-pdf-controls {
  80. display: flex;
  81. align-items: center;
  82. align-self: stretch;
  83. }
  84. .toolbar-pdf-controls {
  85. margin-right: var(--spacing-02);
  86. justify-content: flex-end;
  87. flex: 1 1 100%;
  88. }
  89. .toolbar-pdf-right {
  90. flex: 1;
  91. justify-content: flex-end;
  92. }
  93. .btn.pdf-toolbar-btn {
  94. display: inline-block;
  95. color: var(--toolbar-btn-color);
  96. background-color: transparent;
  97. padding: 0 var(--spacing-01);
  98. line-height: 1;
  99. height: 24px;
  100. border-radius: var(--border-radius-base);
  101. text-decoration: none;
  102. &:hover,
  103. &:active,
  104. &:focus {
  105. color: var(--toolbar-btn-color);
  106. }
  107. &:hover {
  108. &:not(:disabled) {
  109. background-color: var(--pdf-toolbar-btn-hover-color);
  110. }
  111. }
  112. &:active {
  113. background-color: transparent;
  114. }
  115. .button-content {
  116. align-self: center;
  117. }
  118. .badge {
  119. font-size: 60%;
  120. }
  121. &.log-btn {
  122. border: none;
  123. &.active {
  124. color: var(--white);
  125. background-color: var(--link-color);
  126. box-shadow: none;
  127. opacity: 0.65;
  128. &:hover {
  129. &:not(:disabled) {
  130. background-color: transparent;
  131. color: var(--toolbar-btn-color);
  132. }
  133. }
  134. }
  135. &:focus {
  136. outline: none;
  137. }
  138. }
  139. &.theme-toggle-btn {
  140. border: none;
  141. border-radius: var(--border-radius-full);
  142. &.active {
  143. color: var(--white);
  144. background-color: var(--green-70);
  145. &:hover {
  146. background-color: var(--green-60);
  147. }
  148. }
  149. &:focus {
  150. outline: none;
  151. }
  152. }
  153. }
  154. .pdf {
  155. background-color: var(--pdf-bg);
  156. &.pdf-dark-mode {
  157. --pdf-bg: var(--bg-dark-secondary);
  158. .pdfjs-viewer {
  159. --canvas-box-shadow: none;
  160. .page {
  161. filter: invert(95%) hue-rotate(180deg) brightness(90%) contrast(90%);
  162. }
  163. }
  164. }
  165. }
  166. .pdf-viewer,
  167. .pdf-errors,
  168. .pdf-uncompiled {
  169. @extend .full-size;
  170. top: var(--toolbar-small-height);
  171. }
  172. .pdf-viewer {
  173. isolation: isolate;
  174. iframe {
  175. width: 100%;
  176. height: 100%;
  177. border: none;
  178. }
  179. .pdfjs-viewer {
  180. @extend .full-size;
  181. --canvas-box-shadow: 0 0 10px rgb(0 0 0 / 50%);
  182. background-color: transparent;
  183. overflow: scroll;
  184. /* stylelint-disable-next-line selector-class-pattern */
  185. .canvasWrapper > canvas,
  186. div.pdf-canvas {
  187. background: white;
  188. box-shadow: var(--canvas-box-shadow);
  189. }
  190. div.pdf-canvas.pdfng-empty {
  191. background-color: var(--white);
  192. }
  193. div.pdf-canvas.pdfng-loading {
  194. background-color: var(--white);
  195. }
  196. .page-container {
  197. margin: var(--spacing-05) auto;
  198. padding: 0 var(--spacing-05);
  199. box-sizing: content-box;
  200. user-select: none;
  201. }
  202. .page {
  203. box-sizing: content-box;
  204. margin: var(--spacing-05) auto;
  205. box-shadow:
  206. 0 5px 5px 0 #23282f0d,
  207. 0 3px 14px 0 #23282f08,
  208. 0 8px 10px 0 #23282f14;
  209. border: none;
  210. }
  211. .pdfjs-viewer-inner {
  212. position: absolute;
  213. overflow-y: scroll;
  214. width: 100%;
  215. height: 100%;
  216. -webkit-font-smoothing: initial;
  217. -moz-osx-font-smoothing: initial;
  218. /* fix review-panel overflow issue, see: https://github.com/overleaf/internal/issues/6781#issuecomment-1112708638 */
  219. /* stylelint-disable-next-line selector-class-pattern */
  220. .pdfViewer {
  221. min-height: 100%;
  222. }
  223. }
  224. &:focus-within {
  225. outline: none;
  226. }
  227. /* Avoid slowdown in Safari when text layers are reset on selection change */
  228. /* stylelint-disable-next-line selector-class-pattern */
  229. .textLayer {
  230. will-change: transform;
  231. }
  232. /* Avoid multiple small layers within annotation layer */
  233. /* stylelint-disable-next-line selector-class-pattern */
  234. .annotationLayer {
  235. will-change: transform;
  236. }
  237. /* Avoids https://github.com/mozilla/pdf.js/issues/13840 in Chrome */
  238. /* stylelint-disable-next-line selector-class-pattern */
  239. .textLayer br::selection {
  240. background: transparent;
  241. }
  242. }
  243. .progress-thin {
  244. position: absolute;
  245. top: -2px;
  246. height: 3px;
  247. left: 0;
  248. right: 0;
  249. .progress-bar {
  250. height: 100%;
  251. background-color: var(--link-color);
  252. }
  253. }
  254. }
  255. .pdfjs-viewer-controls {
  256. display: flex;
  257. align-items: center;
  258. justify-content: flex-end;
  259. width: 100%;
  260. }
  261. .pdfjs-zoom-controls {
  262. display: inline-flex;
  263. border-left: 1px solid rgb(125 125 125 / 30%);
  264. }
  265. .pdfjs-toolbar-buttons {
  266. display: flex;
  267. gap: var(--spacing-04);
  268. margin-left: var(--spacing-04);
  269. margin-right: var(--spacing-04);
  270. .btn {
  271. border-radius: var(--border-radius-base) !important;
  272. }
  273. }
  274. .pdfjs-toolbar-button {
  275. padding: var(--spacing-01) !important;
  276. display: flex;
  277. align-items: center;
  278. }
  279. .pdfjs-zoom-dropdown-button {
  280. width: 60px;
  281. text-align: right;
  282. font-weight: normal;
  283. }
  284. .pdfjs-custom-zoom-menu-item {
  285. display: block;
  286. pointer-events: initial !important;
  287. &:hover {
  288. background-color: initial !important;
  289. color: initial !important;
  290. cursor: initial !important;
  291. }
  292. }
  293. .pdfjs-page-number-input {
  294. color: var(--toolbar-btn-color);
  295. font-size: var(--font-size-02);
  296. padding-right: var(--spacing-04);
  297. display: flex;
  298. align-items: center;
  299. gap: var(--spacing-02);
  300. input {
  301. background-color: var(--bg-primary-themed);
  302. color: var(--content-primary-themed);
  303. border: 1px solid var(--border-primary-themed);
  304. width: 32px;
  305. height: 24px;
  306. border-radius: var(--border-radius-base);
  307. text-align: center;
  308. }
  309. }
  310. .pdfjs-viewer-controls-small {
  311. display: flex;
  312. align-items: center;
  313. gap: var(--spacing-04);
  314. }
  315. .pdfjs-toolbar-popover-button {
  316. padding: var(--spacing-01) !important;
  317. }
  318. .pdfjs-toolbar-popover {
  319. background-color: var(--editor-toolbar-bg);
  320. border-radius: var(--border-radius-base);
  321. .popover-arrow {
  322. display: none;
  323. }
  324. button {
  325. background-color: transparent;
  326. color: var(--toolbar-btn-color);
  327. }
  328. .popover-body {
  329. display: flex;
  330. align-items: center;
  331. padding: var(--spacing-04) 0;
  332. }
  333. }
  334. // The new viewer UI has overflow on the inner element,
  335. // so disable the overflow on the outer element
  336. .pdf-viewer .pdfjs-viewer.pdfjs-viewer-outer {
  337. overflow: hidden;
  338. }
  339. :fullscreen {
  340. /* stylelint-disable selector-class-pattern */
  341. .pdfViewer {
  342. min-height: auto !important;
  343. }
  344. .pdfjs-viewer-inner {
  345. overflow-y: hidden !important;
  346. display: flex;
  347. align-items: center;
  348. justify-content: center;
  349. }
  350. }
  351. .synctex-controls {
  352. margin-right: calc(var(--spacing-04) * -1);
  353. position: absolute;
  354. z-index: 6;
  355. padding: 0;
  356. top: 68px;
  357. }
  358. .synctex-control:not(.detach-synctex-control) {
  359. align-items: center;
  360. background-color: rgba($bg-dark-tertiary, 0.8);
  361. border-color: transparent;
  362. border-radius: var(--border-radius-full);
  363. color: var(--content-primary-dark);
  364. display: flex !important;
  365. height: var(--synctex-control-size);
  366. justify-content: center;
  367. margin-bottom: var(--spacing-05);
  368. padding: 0;
  369. transition: background 0.15s ease;
  370. width: var(--synctex-control-size);
  371. &:focus:not(:focus-visible) {
  372. outline: none;
  373. }
  374. &:active {
  375. background-color: rgba($bg-dark-tertiary, 0.8);
  376. color: var(--content-primary-dark);
  377. }
  378. }
  379. .synctex-control {
  380. .synctex-control-icon {
  381. font-size: var(--font-size-06);
  382. font-weight: normal;
  383. }
  384. }
  385. .keyboard-tooltip {
  386. .tooltip-inner {
  387. max-width: none;
  388. }
  389. }
  390. #dropdown-files-logs-pane-list {
  391. overflow-y: auto;
  392. .dropdown-header {
  393. white-space: nowrap;
  394. }
  395. // This keeps the dropdown menu inside the Logs div.
  396. // "spacing-11" is there to compensate the button height and the margin around the logs.
  397. max-height: calc(
  398. 100vh - #{$toolbar-small-height + $toolbar-height + $spacing-11}
  399. );
  400. }
  401. .pdf-preview-messages {
  402. position: absolute;
  403. right: var(--spacing-06);
  404. left: var(--spacing-06);
  405. top: var(--spacing-10);
  406. z-index: 1;
  407. }
  408. .synctex-error-toast-content {
  409. display: flex;
  410. gap: 20px;
  411. }