pdf.scss 8.2 KB

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