_on-edit.scss 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. @import 'editor-overlay';
  2. body:not(.on-edit) {
  3. // hide .page-editor-footer
  4. .page-editor-footer {
  5. display: none !important;
  6. border: none;
  7. }
  8. }
  9. body.on-edit {
  10. overflow-y: hidden !important;
  11. .grw-navbar {
  12. position: fixed !important;
  13. width: 100vw;
  14. }
  15. .page-wrapper {
  16. position: relative;
  17. top: $grw-navbar-border-width;
  18. height: calc(100vh - #{$grw-navbar-border-width});
  19. }
  20. // calculate margin
  21. $editor-header-plus-footer: 42px // .nav-tabs height
  22. + 1px // .page-editor-footer border-top
  23. + $grw-editor-navbar-bottom-height !default; // .EditorNavbarBottom min-height
  24. @include expand-editor($editor-header-plus-footer);
  25. // for growi layout
  26. .main {
  27. .col.grw-page-content-container {
  28. padding: 0;
  29. }
  30. }
  31. // show
  32. .d-edit-block {
  33. display: block !important;
  34. }
  35. .d-edit-sm-block {
  36. @include media-breakpoint-up(sm) {
  37. display: block !important;
  38. }
  39. }
  40. // hide unnecessary elements
  41. .d-edit-none {
  42. display: none !important;
  43. }
  44. // hide when HackMD view
  45. &.hackmd .d-hackmd-none {
  46. display: none;
  47. }
  48. // hide unnecessary elements for growi layout
  49. .revision-toc-container {
  50. display: none !important;
  51. }
  52. // show only either Edit button or HackMD button
  53. &.hackmd .nav-tab-edit {
  54. display: none;
  55. }
  56. &.hackmd .grw-nav-item-edit {
  57. display: none;
  58. }
  59. &:not(.hackmd) .nav-tab-hackmd {
  60. display: none;
  61. }
  62. /*****************
  63. * Expand Editor
  64. *****************/
  65. .container-fluid {
  66. padding-bottom: 0;
  67. }
  68. .row.grw-subnav {
  69. $left-margin: $grw-nav-main-left-tab-width * 2 + 25px; // width of .grw-nav-main-left-tab x 2 + some margin
  70. $right-margin: 128px + 94px + 46px; // width of all of grw-nav-main-right-tab
  71. position: absolute;
  72. left: $left-margin;
  73. z-index: 7; // forward than .CodeMirror-vscrollbar
  74. width: calc(100% - #{$left-margin} - #{$right-margin});
  75. padding-top: 3px;
  76. pointer-events: none; // disable pointer-events because it becomes an obstacle
  77. background: none;
  78. > .grw-subnav-container {
  79. width: 100%; // for crowi layout
  80. padding: 0; // for crowi layout
  81. pointer-events: initial; // enable pointer-events
  82. }
  83. }
  84. .grw-page-path-nav-for-edit {
  85. position: absolute;
  86. .grw-page-path-link {
  87. font-size: 20px;
  88. line-height: 1em;
  89. }
  90. .separator {
  91. margin-right: 0.1em;
  92. margin-left: 0.1em;
  93. }
  94. }
  95. .tag-labels {
  96. line-height: 1em;
  97. }
  98. .grw-editor-navbar-bottom {
  99. height: $grw-editor-navbar-bottom-height;
  100. .grw-slack-notification {
  101. .input-group-addon {
  102. padding: 2px 8px;
  103. line-height: 1em;
  104. img,
  105. input {
  106. vertical-align: middle;
  107. }
  108. }
  109. .form-control {
  110. width: 80px;
  111. @include media-breakpoint-up(sm) {
  112. width: 130px;
  113. }
  114. @include media-breakpoint-up(md) {
  115. width: 180px;
  116. }
  117. }
  118. }
  119. .grw-grant-selector {
  120. @include media-breakpoint-down(sm) {
  121. .btn .label {
  122. display: none;
  123. }
  124. }
  125. @include media-breakpoint-up(md) {
  126. .dropdown-toggle {
  127. min-width: 100px;
  128. // caret
  129. &::after {
  130. margin-left: 1em;
  131. }
  132. }
  133. }
  134. }
  135. .btn-submit {
  136. width: 100px;
  137. }
  138. .btn-expand {
  139. // rotate icon
  140. i {
  141. display: inline-block;
  142. transition: transform 200ms;
  143. }
  144. &.expand i {
  145. transform: rotate(-180deg);
  146. }
  147. }
  148. }
  149. /*********************
  150. * Navigation styles
  151. */
  152. .nav:hover {
  153. .btn-copy,
  154. .btn-edit,
  155. .btn-edit-tags {
  156. // change button opacity
  157. opacity: unset;
  158. }
  159. }
  160. &.builtin-editor {
  161. /*****************
  162. * Editor styles
  163. *****************/
  164. .page-editor-editor-container {
  165. border-right: 1px solid transparent;
  166. // override CodeMirror styles
  167. .CodeMirror {
  168. .cm-matchhighlight {
  169. background-color: cyan;
  170. }
  171. .CodeMirror-selection-highlight-scrollbar {
  172. background-color: darkcyan;
  173. }
  174. }
  175. // add icon on cursor
  176. .markdown-table-activated,
  177. .markdown-link-activated {
  178. .CodeMirror-cursor {
  179. &:after {
  180. position: relative;
  181. top: -1.1em;
  182. left: 0.3em;
  183. display: block;
  184. width: 1em;
  185. height: 1em;
  186. content: ' ';
  187. background-repeat: no-repeat;
  188. background-size: 1em;
  189. }
  190. }
  191. }
  192. .markdown-table-activated .CodeMirror-cursor {
  193. &:after {
  194. background-image: url(/images/icons/editor/table.svg);
  195. }
  196. }
  197. .markdown-link-activated .CodeMirror-cursor {
  198. &:after {
  199. background-image: url(/images/icons/editor/link.svg);
  200. }
  201. }
  202. .textarea-editor {
  203. font-family: monospace;
  204. border: none;
  205. }
  206. }
  207. .page-editor-preview-container {
  208. }
  209. .page-editor-preview-body {
  210. padding-top: 18px;
  211. padding-right: 15px;
  212. padding-left: 15px;
  213. overflow-y: scroll;
  214. }
  215. .grw-editor-configuration-dropdown {
  216. .icon-container {
  217. width: 20px;
  218. }
  219. .menuitem-label {
  220. min-width: 130px;
  221. }
  222. }
  223. }
  224. // .builtin-editor .tab-pane#edit
  225. &.hackmd {
  226. .hackmd-preinit,
  227. #iframe-hackmd-container > iframe {
  228. border: none;
  229. }
  230. .hackmd-error {
  231. top: 0;
  232. background-color: rgba($gray-800, 0.8);
  233. }
  234. .hackmd-status-label {
  235. font-size: 3em;
  236. }
  237. .hackmd-resume-button-container,
  238. .hackmd-discard-button-container {
  239. .btn-text {
  240. display: inline-block;
  241. min-width: 230px;
  242. }
  243. }
  244. .btn-view-outdated-draft {
  245. text-decoration: underline;
  246. vertical-align: unset;
  247. }
  248. }
  249. }
  250. // overwrite .CodeMirror pre
  251. .CodeMirror pre.CodeMirror-line {
  252. font-family: $font-family-monospace;
  253. }
  254. // overwrite .CodeMirror-hints
  255. .CodeMirror-hints {
  256. max-height: 30em !important;
  257. .CodeMirror-hint.crowi-emoji-autocomplete {
  258. font-family: $font-family-monospace-not-strictly;
  259. line-height: 1.6em;
  260. .img-container {
  261. display: inline-block;
  262. width: 30px;
  263. }
  264. }
  265. // active line
  266. .CodeMirror-hint-active.crowi-emoji-autocomplete {
  267. .img-container {
  268. padding-top: 0.3em;
  269. padding-bottom: 0.3em;
  270. font-size: 15px; // adjust to .wiki
  271. }
  272. }
  273. }
  274. // overwrite .CodeMirror-placeholder
  275. .CodeMirror pre.CodeMirror-placeholder {
  276. color: $text-muted;
  277. }
  278. #tag-edit-button-tooltip {
  279. .tooltip-inner {
  280. color: black;
  281. background-color: white;
  282. border: 1px solid $gray-300;
  283. }
  284. .tooltip-arrow {
  285. border-bottom: 5px solid $gray-300;
  286. }
  287. }