pdf.scss 9.7 KB

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