pdf.scss 8.1 KB

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