_on-edit.scss 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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-grant-selector {
  101. @include media-breakpoint-down(sm) {
  102. .btn .label {
  103. display: none;
  104. }
  105. }
  106. @include media-breakpoint-up(md) {
  107. .dropdown-toggle {
  108. min-width: 100px;
  109. // caret
  110. &::after {
  111. margin-left: 1em;
  112. }
  113. }
  114. }
  115. }
  116. .btn-submit {
  117. width: 100px;
  118. }
  119. .btn-expand {
  120. // rotate icon
  121. i {
  122. display: inline-block;
  123. transition: transform 200ms;
  124. }
  125. &.expand i {
  126. transform: rotate(-180deg);
  127. }
  128. }
  129. }
  130. /*********************
  131. * Navigation styles
  132. */
  133. .nav:hover {
  134. .btn-copy,
  135. .btn-edit,
  136. .btn-edit-tags {
  137. // change button opacity
  138. opacity: unset;
  139. }
  140. }
  141. &.builtin-editor {
  142. /*****************
  143. * Editor styles
  144. *****************/
  145. .page-editor-editor-container {
  146. border-right: 1px solid transparent;
  147. // override CodeMirror styles
  148. .CodeMirror {
  149. .cm-matchhighlight {
  150. background-color: cyan;
  151. }
  152. .CodeMirror-selection-highlight-scrollbar {
  153. background-color: darkcyan;
  154. }
  155. }
  156. // add icon on cursor
  157. .markdown-table-activated, .markdown-link-activated {
  158. .CodeMirror-cursor {
  159. &:after {
  160. position: relative;
  161. top: -1.1em;
  162. left: 0.3em;
  163. display: block;
  164. width: 1em;
  165. height: 1em;
  166. content: ' ';
  167. background-repeat: no-repeat;
  168. background-size: 1em;
  169. }
  170. }
  171. }
  172. .markdown-table-activated .CodeMirror-cursor {
  173. &:after {
  174. background-image: url(/images/icons/editor/table.svg);
  175. }
  176. }
  177. .markdown-link-activated .CodeMirror-cursor {
  178. &:after {
  179. background-image: url(/images/icons/editor/link.svg);
  180. }
  181. }
  182. .textarea-editor {
  183. font-family: monospace;
  184. border: none;
  185. }
  186. }
  187. .page-editor-preview-container {
  188. }
  189. .page-editor-preview-body {
  190. padding-top: 18px;
  191. padding-right: 15px;
  192. padding-left: 15px;
  193. overflow-y: scroll;
  194. }
  195. .grw-editor-configuration-dropdown {
  196. .icon-container {
  197. width: 20px;
  198. }
  199. .menuitem-label {
  200. min-width: 130px;
  201. }
  202. }
  203. }
  204. // .builtin-editor .tab-pane#edit
  205. &.hackmd {
  206. .hackmd-preinit,
  207. #iframe-hackmd-container > iframe {
  208. border: none;
  209. }
  210. .hackmd-error {
  211. top: 0;
  212. background-color: rgba($gray-800, 0.8);
  213. }
  214. .hackmd-status-label {
  215. font-size: 3em;
  216. }
  217. .hackmd-resume-button-container,
  218. .hackmd-discard-button-container {
  219. .btn-text {
  220. display: inline-block;
  221. min-width: 230px;
  222. }
  223. }
  224. .btn-view-outdated-draft {
  225. text-decoration: underline;
  226. vertical-align: unset;
  227. }
  228. }
  229. }
  230. // overwrite .CodeMirror pre
  231. .CodeMirror pre.CodeMirror-line {
  232. font-family: $font-family-monospace;
  233. }
  234. // overwrite .CodeMirror-hints
  235. .CodeMirror-hints {
  236. max-height: 30em !important;
  237. .CodeMirror-hint.crowi-emoji-autocomplete {
  238. font-family: $font-family-monospace-not-strictly;
  239. line-height: 1.6em;
  240. .img-container {
  241. display: inline-block;
  242. width: 30px;
  243. }
  244. }
  245. // active line
  246. .CodeMirror-hint-active.crowi-emoji-autocomplete {
  247. .img-container {
  248. padding-top: 0.3em;
  249. padding-bottom: 0.3em;
  250. font-size: 15px; // adjust to .wiki
  251. }
  252. }
  253. }
  254. // overwrite .CodeMirror-placeholder
  255. .CodeMirror pre.CodeMirror-placeholder {
  256. color: $text-muted;
  257. }
  258. #tag-edit-button-tooltip {
  259. .tooltip-inner {
  260. color: #000;
  261. background-color: #fff;
  262. border: 1px solid #ccc;
  263. }
  264. .tooltip-arrow {
  265. border-bottom: 5px solid #ccc;
  266. }
  267. }