pdf.scss 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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. }
  178. .pdf {
  179. background-color: var(--pdf-bg);
  180. }
  181. .pdf-viewer,
  182. .pdf-errors,
  183. .pdf-uncompiled {
  184. @extend .full-size;
  185. top: var(--toolbar-small-height);
  186. }
  187. .pdf-viewer {
  188. isolation: isolate;
  189. iframe {
  190. width: 100%;
  191. height: 100%;
  192. border: none;
  193. }
  194. .pdfjs-viewer {
  195. @extend .full-size;
  196. background-color: transparent;
  197. overflow: scroll;
  198. /* stylelint-disable-next-line selector-class-pattern */
  199. .canvasWrapper > canvas,
  200. div.pdf-canvas {
  201. background: white;
  202. box-shadow: 0 0 10px rgb(0 0 0 / 50%);
  203. }
  204. div.pdf-canvas.pdfng-empty {
  205. background-color: var(--white);
  206. }
  207. div.pdf-canvas.pdfng-loading {
  208. background-color: var(--white);
  209. }
  210. .page-container {
  211. margin: var(--spacing-05) auto;
  212. padding: 0 var(--spacing-05);
  213. box-sizing: content-box;
  214. user-select: none;
  215. }
  216. .page {
  217. box-sizing: content-box;
  218. margin: var(--spacing-05) auto;
  219. box-shadow: 0 0 8px #bbb;
  220. border: none;
  221. }
  222. .pdfjs-viewer-inner {
  223. position: absolute;
  224. overflow-y: scroll;
  225. width: 100%;
  226. height: 100%;
  227. -webkit-font-smoothing: initial;
  228. -moz-osx-font-smoothing: initial;
  229. /* fix review-panel overflow issue, see: https://github.com/overleaf/internal/issues/6781#issuecomment-1112708638 */
  230. /* stylelint-disable-next-line selector-class-pattern */
  231. .pdfViewer {
  232. min-height: 100%;
  233. }
  234. }
  235. &:focus-within {
  236. outline: none;
  237. }
  238. /* Avoid slowdown in Safari when text layers are reset on selection change */
  239. /* stylelint-disable-next-line selector-class-pattern */
  240. .textLayer {
  241. will-change: transform;
  242. }
  243. /* Avoid multiple small layers within annotation layer */
  244. /* stylelint-disable-next-line selector-class-pattern */
  245. .annotationLayer {
  246. will-change: transform;
  247. }
  248. /* Avoids https://github.com/mozilla/pdf.js/issues/13840 in Chrome */
  249. /* stylelint-disable-next-line selector-class-pattern */
  250. .textLayer br::selection {
  251. background: transparent;
  252. }
  253. }
  254. .progress-thin {
  255. position: absolute;
  256. top: -2px;
  257. height: 3px;
  258. left: 0;
  259. right: 0;
  260. .progress-bar {
  261. height: 100%;
  262. background-color: var(--link-color);
  263. }
  264. }
  265. }
  266. .pdfjs-viewer-controls {
  267. display: flex;
  268. align-items: center;
  269. justify-content: flex-end;
  270. width: 100%;
  271. }
  272. .pdfjs-zoom-controls {
  273. display: inline-flex;
  274. border-left: 1px solid rgb(125 125 125 / 30%);
  275. }
  276. .pdfjs-toolbar-buttons {
  277. display: flex;
  278. gap: var(--spacing-04);
  279. margin-left: var(--spacing-04);
  280. margin-right: var(--spacing-04);
  281. .btn {
  282. border-radius: var(--border-radius-base) !important;
  283. }
  284. }
  285. .pdfjs-toolbar-button {
  286. padding: var(--spacing-01) !important;
  287. display: flex;
  288. align-items: center;
  289. }
  290. .pdfjs-zoom-dropdown-button {
  291. width: 60px;
  292. text-align: right;
  293. font-weight: normal;
  294. }
  295. .pdfjs-zoom-dropdown-mac-shortcut-char {
  296. display: inline-block;
  297. width: 1em;
  298. text-align: center;
  299. }
  300. .pdfjs-custom-zoom-menu-item {
  301. display: block;
  302. pointer-events: initial !important;
  303. &:hover {
  304. background-color: initial !important;
  305. color: initial !important;
  306. cursor: initial !important;
  307. }
  308. }
  309. .pdfjs-page-number-input {
  310. color: var(--toolbar-btn-color);
  311. font-size: var(--font-size-02);
  312. padding-right: var(--spacing-04);
  313. display: flex;
  314. align-items: center;
  315. gap: var(--spacing-02);
  316. input {
  317. border: 1px solid var(--neutral-60);
  318. width: 32px;
  319. height: 24px;
  320. border-radius: var(--border-radius-base);
  321. text-align: center;
  322. }
  323. }
  324. .pdfjs-viewer-controls-small {
  325. display: flex;
  326. align-items: center;
  327. gap: var(--spacing-04);
  328. }
  329. .pdfjs-toolbar-popover-button {
  330. padding: var(--spacing-01) !important;
  331. }
  332. .pdfjs-toolbar-popover {
  333. background-color: var(--editor-toolbar-bg);
  334. border-radius: var(--border-radius-base);
  335. .popover-arrow {
  336. display: none;
  337. }
  338. button {
  339. background-color: transparent;
  340. color: var(--toolbar-btn-color);
  341. }
  342. .popover-body {
  343. display: flex;
  344. align-items: center;
  345. padding: var(--spacing-04) 0;
  346. }
  347. }
  348. // The new viewer UI has overflow on the inner element,
  349. // so disable the overflow on the outer element
  350. .pdf-viewer .pdfjs-viewer.pdfjs-viewer-outer {
  351. overflow: hidden;
  352. }
  353. :fullscreen {
  354. /* stylelint-disable selector-class-pattern */
  355. .pdfViewer {
  356. min-height: auto !important;
  357. }
  358. .pdfjs-viewer-inner {
  359. overflow-y: hidden !important;
  360. display: flex;
  361. align-items: center;
  362. justify-content: center;
  363. }
  364. }
  365. .synctex-controls {
  366. margin-right: calc(var(--spacing-04) * -1);
  367. position: absolute;
  368. z-index: 6;
  369. padding: 0;
  370. top: 68px;
  371. }
  372. .synctex-control:not(.detach-synctex-control) {
  373. align-items: center;
  374. background-color: rgba($bg-dark-tertiary, 0.8);
  375. border-color: transparent;
  376. border-radius: var(--border-radius-full);
  377. color: var(--content-primary-dark);
  378. display: flex !important;
  379. height: var(--synctex-control-size);
  380. justify-content: center;
  381. margin-bottom: var(--spacing-05);
  382. padding: 0;
  383. transition: background 0.15s ease;
  384. width: var(--synctex-control-size);
  385. &:focus:not(:focus-visible) {
  386. outline: none;
  387. }
  388. &:active {
  389. background-color: rgba($bg-dark-tertiary, 0.8);
  390. color: var(--content-primary-dark);
  391. }
  392. }
  393. .synctex-control {
  394. .synctex-control-icon {
  395. font-weight: 700;
  396. font-size: var(--font-size-06);
  397. }
  398. }
  399. .keyboard-tooltip {
  400. .tooltip-inner {
  401. max-width: none;
  402. }
  403. }
  404. #dropdown-files-logs-pane-list {
  405. overflow-y: auto;
  406. .dropdown-header {
  407. white-space: nowrap;
  408. }
  409. // This keeps the dropdown menu inside the Logs div.
  410. // "spacing-11" is there to compensate the button height and the margin around the logs.
  411. max-height: calc(
  412. 100vh - #{$toolbar-small-height + $toolbar-height + $spacing-11}
  413. );
  414. }
  415. .pdf-preview-messages {
  416. position: absolute;
  417. right: var(--spacing-06);
  418. left: var(--spacing-06);
  419. top: var(--spacing-10);
  420. z-index: 1;
  421. }
  422. .synctex-error-toast-content {
  423. display: flex;
  424. gap: 20px;
  425. }