pdf.scss 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. :root {
  2. --pdf-bg: var(--neutral-10);
  3. --pdf-toolbar-btn-hover-color: rgb(125 125 125 / 20%);
  4. }
  5. @include theme('light') {
  6. --pdf-toolbar-btn-hover-color: var(--neutral-10);
  7. }
  8. .pdf .toolbar.toolbar-pdf {
  9. @include toolbar-sm-height;
  10. @include toolbar-alt-bg;
  11. padding-right: var(--spacing-03);
  12. margin-left: 0;
  13. .btn.disabled,
  14. .btn[disabled] {
  15. pointer-events: auto;
  16. cursor: not-allowed;
  17. opacity: 1;
  18. }
  19. }
  20. .toolbar-pdf-left {
  21. gap: var(--spacing-02);
  22. .dropdown > .btn {
  23. border-top-left-radius: 0;
  24. border-bottom-left-radius: 0;
  25. &[disabled],
  26. &[disabled]:active {
  27. background-color: var(--bs-btn-bg);
  28. color: var(--bs-btn-color);
  29. opacity: 1;
  30. pointer-events: auto;
  31. cursor: not-allowed;
  32. }
  33. }
  34. }
  35. .toolbar-pdf-orphan,
  36. .toolbar-pdf-left,
  37. .toolbar-pdf-right,
  38. .toolbar-pdf-controls {
  39. display: flex;
  40. align-items: center;
  41. align-self: stretch;
  42. }
  43. .toolbar-pdf-orphan,
  44. .toolbar-pdf-controls {
  45. flex: 1 1 100%;
  46. }
  47. .toolbar-pdf-controls {
  48. margin-right: var(--spacing-02);
  49. justify-content: flex-end;
  50. }
  51. .toolbar-pdf-right {
  52. flex: 1;
  53. justify-content: flex-end;
  54. }
  55. .toolbar-pdf-orphan {
  56. justify-content: center;
  57. color: var(--toolbar-btn-color);
  58. .btn {
  59. margin-left: var(--spacing-03);
  60. }
  61. }
  62. .btn.pdf-toolbar-btn {
  63. display: inline-block;
  64. color: var(--toolbar-btn-color);
  65. background-color: transparent;
  66. padding: 0 var(--spacing-01);
  67. line-height: 1;
  68. height: 24px;
  69. border-radius: var(--border-radius-base);
  70. text-decoration: none;
  71. &:hover,
  72. &:active,
  73. &:focus {
  74. color: var(--toolbar-btn-color);
  75. }
  76. &:hover {
  77. &:not(:disabled) {
  78. background-color: var(--pdf-toolbar-btn-hover-color);
  79. }
  80. }
  81. &:active {
  82. background-color: transparent;
  83. }
  84. .button-content {
  85. align-self: center;
  86. }
  87. .badge {
  88. font-size: 60%;
  89. }
  90. &.log-btn {
  91. border: none;
  92. &.active {
  93. color: var(--white);
  94. background-color: var(--link-color);
  95. box-shadow: none;
  96. opacity: 0.65;
  97. &:hover {
  98. &:not(:disabled) {
  99. background-color: transparent;
  100. color: var(--toolbar-btn-color);
  101. }
  102. }
  103. }
  104. &:focus {
  105. outline: none;
  106. }
  107. }
  108. }
  109. .pdf {
  110. background-color: var(--pdf-bg);
  111. }
  112. .pdf-viewer,
  113. .pdf-logs,
  114. .pdf-errors,
  115. .pdf-uncompiled {
  116. @extend .full-size;
  117. top: var(--toolbar-small-height);
  118. }
  119. .pdf-viewer {
  120. iframe {
  121. width: 100%;
  122. height: 100%;
  123. border: none;
  124. }
  125. .pdfjs-viewer {
  126. @extend .full-size;
  127. background-color: transparent;
  128. overflow: scroll;
  129. /* stylelint-disable-next-line selector-class-pattern */
  130. .canvasWrapper > canvas,
  131. div.pdf-canvas {
  132. background: white;
  133. box-shadow: 0 0 10px rgb(0 0 0 / 50%);
  134. }
  135. div.pdf-canvas.pdfng-empty {
  136. background-color: var(--white);
  137. }
  138. div.pdf-canvas.pdfng-loading {
  139. background-color: var(--white);
  140. }
  141. .page-container {
  142. margin: var(--spacing-05) auto;
  143. padding: 0 var(--spacing-05);
  144. box-sizing: content-box;
  145. user-select: none;
  146. }
  147. .page {
  148. box-sizing: content-box;
  149. margin: var(--spacing-05) auto;
  150. box-shadow: 0 0 8px #bbb;
  151. border: none;
  152. }
  153. .pdfjs-viewer-inner {
  154. position: absolute;
  155. overflow-y: scroll;
  156. width: 100%;
  157. height: 100%;
  158. -webkit-font-smoothing: initial;
  159. -moz-osx-font-smoothing: initial;
  160. /* fix review-panel overflow issue, see: https://github.com/overleaf/internal/issues/6781#issuecomment-1112708638 */
  161. /* stylelint-disable-next-line selector-class-pattern */
  162. .pdfViewer {
  163. min-height: 100%;
  164. }
  165. }
  166. &:focus-within {
  167. outline: none;
  168. }
  169. /* Avoids https://github.com/mozilla/pdf.js/issues/13840 in Chrome */
  170. /* stylelint-disable-next-line selector-class-pattern */
  171. .textLayer br::selection {
  172. background: transparent;
  173. }
  174. }
  175. .progress-thin {
  176. position: absolute;
  177. top: -2px;
  178. height: 3px;
  179. left: 0;
  180. right: 0;
  181. .progress-bar {
  182. height: 100%;
  183. background-color: var(--link-color);
  184. }
  185. }
  186. }
  187. .pdfjs-viewer-controls {
  188. display: flex;
  189. align-items: center;
  190. justify-content: flex-end;
  191. width: 100%;
  192. }
  193. .pdfjs-zoom-controls {
  194. display: inline-flex;
  195. border-left: 1px solid rgb(125 125 125 / 30%);
  196. }
  197. .pdfjs-toolbar-buttons {
  198. display: flex;
  199. gap: var(--spacing-04);
  200. margin-left: var(--spacing-04);
  201. margin-right: var(--spacing-04);
  202. }
  203. .pdfjs-toolbar-button {
  204. padding: var(--spacing-01) !important;
  205. display: flex;
  206. align-items: center;
  207. }
  208. .pdfjs-zoom-dropdown-button {
  209. width: 60px;
  210. text-align: right;
  211. font-weight: normal;
  212. }
  213. .pdfjs-zoom-dropdown-mac-shortcut-char {
  214. display: inline-block;
  215. width: 1em;
  216. text-align: center;
  217. }
  218. .pdfjs-custom-zoom-menu-item {
  219. display: block;
  220. pointer-events: initial !important;
  221. &:hover {
  222. background-color: initial !important;
  223. color: initial !important;
  224. cursor: initial !important;
  225. }
  226. }
  227. .pdfjs-page-number-input {
  228. color: var(--toolbar-btn-color);
  229. font-size: var(--font-size-02);
  230. padding-right: var(--spacing-04);
  231. display: flex;
  232. align-items: center;
  233. gap: var(--spacing-02);
  234. input {
  235. color: initial;
  236. border: 1px solid var(--neutral-60);
  237. width: 32px;
  238. height: 24px;
  239. border-radius: var(--border-radius-base);
  240. text-align: center;
  241. }
  242. }
  243. .pdfjs-viewer-controls-small {
  244. display: flex;
  245. align-items: center;
  246. gap: var(--spacing-04);
  247. }
  248. .pdfjs-toolbar-popover-button {
  249. padding: var(--spacing-01) !important;
  250. }
  251. .pdfjs-toolbar-popover {
  252. background-color: var(--editor-toolbar-bg);
  253. border-radius: var(--border-radius-base);
  254. .popover-arrow {
  255. display: none;
  256. }
  257. button {
  258. background-color: transparent;
  259. color: var(--toolbar-btn-color);
  260. }
  261. .popover-body {
  262. display: flex;
  263. align-items: center;
  264. padding: var(--spacing-04) 0;
  265. }
  266. }
  267. // The new viewer UI has overflow on the inner element,
  268. // so disable the overflow on the outer element
  269. .pdf-viewer .pdfjs-viewer.pdfjs-viewer-outer {
  270. overflow: hidden;
  271. }
  272. :fullscreen {
  273. .pdfjs-viewer-inner {
  274. overflow-y: hidden !important;
  275. }
  276. }
  277. .synctex-control {
  278. > .synctex-control-icon {
  279. display: inline-block;
  280. font:
  281. normal normal normal 14px/1 FontAwesome,
  282. sans-serif;
  283. font-size: inherit;
  284. text-rendering: auto;
  285. -webkit-font-smoothing: antialiased;
  286. -moz-osx-font-smoothing: grayscale;
  287. }
  288. > .synctex-spin-icon {
  289. margin-top: var(--spacing-01);
  290. }
  291. }
  292. .keyboard-tooltip {
  293. .tooltip-inner {
  294. max-width: none;
  295. }
  296. }