pdf.scss 10 KB

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