_on-edit.scss 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. @import 'editor-overlay';
  2. body:not(.on-edit) {
  3. // hide #page-form
  4. #page-form {
  5. display: none;
  6. }
  7. }
  8. body.on-edit {
  9. %expand-by-flex {
  10. display: flex;
  11. flex-direction: column;
  12. flex: 1;
  13. }
  14. // calculate margin
  15. $header-plus-footer: 2px // .main padding-top
  16. + 42px // .nav height
  17. + 1px // .page-editor-footer border-top
  18. + 40px; // .page-editor-footer min-height
  19. $editor-margin: $header-plus-footer + 26px; // .btn-open-dropzone height
  20. // hide unnecessary elements
  21. .navbar.navbar-static-top,
  22. .row.row-alerts,
  23. .row.page-list,
  24. .row.page-comments-row,
  25. .row.page-attachments-row,
  26. .row.not-found-message-row,
  27. .users-meta,
  28. .user-page-content-container,
  29. .portal-form-button,
  30. .alert-info.alert-moved,
  31. .alert-info.alert-unlinked,
  32. .like-button, .bookmark-link, .btn-edit,
  33. .authors,
  34. footer {
  35. display: none !important;
  36. }
  37. // hide unnecessary elements for growi layout
  38. .revision-toc-container {
  39. display: none;
  40. }
  41. // hide unnecessary elements for crowi layout
  42. #toggle-sidebar,
  43. .crowi-sidebar {
  44. display: none;
  45. }
  46. // show only either Edit button or HackMD button
  47. &.hackmd .nav-tab-edit {
  48. display: none;
  49. }
  50. &:not(.hackmd) .nav-tab-hackmd {
  51. display: none;
  52. }
  53. /*****************
  54. * Expand Editor
  55. *****************/
  56. .container-fluid {
  57. padding-bottom: 0;
  58. }
  59. .main {
  60. width: 100%;
  61. height: 100vh;
  62. margin-top: 0px !important;
  63. padding-top: 2px;
  64. padding-left: 0;
  65. padding-right: 0;
  66. // for growi layout
  67. > .row {
  68. margin: 0;
  69. > .col-lg-10, > .col-md-9 {
  70. width: 100%;
  71. padding: 0;
  72. }
  73. }
  74. &,
  75. .content-main,
  76. .tab-content {
  77. @extend %expand-by-flex;
  78. }
  79. }
  80. .row.bg-title {
  81. $left-margin: $nav-main-left-tab-width * 2 + 25px; // width of .nav-main-left-tab x 2 + some margin
  82. $right-margin: 128px + 94px + 46px; // width of all of nav-main-right-tab
  83. position: absolute;
  84. z-index: 1;
  85. left: $left-margin;
  86. width: calc(100% - #{$left-margin} - #{$right-margin});
  87. // for crowi layout
  88. > .col-md-9, .col-xs-12 {
  89. padding: 0;
  90. width: 100%;
  91. }
  92. background: none;
  93. .header-wrap {
  94. overflow-x: hidden;
  95. }
  96. h1#revision-path {
  97. @include variable-font-size(20px);
  98. line-height: 1em;
  99. // nowrap even if the path is too long
  100. .d-flex {
  101. flex-wrap: nowrap;
  102. }
  103. .path-segment {
  104. white-space: nowrap;
  105. }
  106. }
  107. // hide if screen size is less than tablet
  108. @media (max-width: $screen-sm) {
  109. display: none;
  110. }
  111. }
  112. .page-editor-footer {
  113. width: 100%;
  114. margin: 0;
  115. padding: 3px;
  116. min-height: 40px;
  117. border-top: solid 1px transparent;
  118. .btn-submit {
  119. width: 100px;
  120. }
  121. }
  122. &.builtin-editor .tab-pane#edit {
  123. @extend %expand-by-flex;
  124. #page-editor {
  125. // right(preview)
  126. &,
  127. .row,
  128. .page-editor-preview-container,
  129. .page-editor-preview-body {
  130. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  131. height: calc(100vh - #{$header-plus-footer});
  132. }
  133. // left(editor)
  134. .page-editor-editor-container {
  135. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  136. height: calc(100vh - #{$header-plus-footer});
  137. .react-codemirror2, .CodeMirror, .CodeMirror-scroll,
  138. .textarea-editor {
  139. height: calc(100vh - #{$editor-margin});
  140. }
  141. }
  142. }
  143. /*****************
  144. * Editor styles
  145. *****************/
  146. .page-editor-editor-container {
  147. border-right: 1px solid transparent;
  148. padding-right: 0;
  149. // override CodeMirror styles
  150. .CodeMirror {
  151. .cm-matchhighlight {
  152. background-color: cyan;
  153. }
  154. .CodeMirror-selection-highlight-scrollbar {
  155. background-color: darkcyan;
  156. }
  157. }
  158. // add icon on cursor
  159. .autoformat-markdown-table-activated .CodeMirror-cursor {
  160. &:after {
  161. font-family: 'FontAwesome';
  162. content: '\f0ce';
  163. }
  164. }
  165. .textarea-editor {
  166. border: none;
  167. font-family: monospace;
  168. }
  169. }
  170. .page-editor-preview-container {
  171. }
  172. .page-editor-preview-body {
  173. padding-top: 18px;
  174. padding-right: 15px;
  175. overflow-y: scroll;
  176. }
  177. #page-editor-options-selector {
  178. label {
  179. margin-right: 0.5em;
  180. }
  181. // configuration dropdown
  182. .configuration-dropdown {
  183. .icon-container {
  184. display: inline-block;
  185. width: 20px;
  186. }
  187. .dropdown-menu > li > a {
  188. display: flex;
  189. justify-content: space-between;
  190. align-items: center;
  191. .menuitem-label {
  192. flex: 1;
  193. margin-right: 10px;
  194. }
  195. }
  196. }
  197. @media (max-width: $screen-xs-max) { // {{{ less than smartphone size
  198. display: none;
  199. }
  200. }
  201. #page-grant-selector {
  202. .btn-group {
  203. min-width: 150px;
  204. }
  205. }
  206. } // .builtin-editor .tab-pane#edit
  207. &.hackmd {
  208. #page-editor-options-selector {
  209. display: none;
  210. }
  211. .tab-pane#hackmd {
  212. @extend %expand-by-flex;
  213. #hackmd-editor,
  214. .hackmd-nopage, #iframe-hackmd {
  215. width: 100vw;
  216. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  217. height: calc(100vh - #{$header-plus-footer});
  218. border: none;
  219. }
  220. }
  221. }
  222. }
  223. /*
  224. * for creating portal
  225. */
  226. .nav-tabs-create-portal {
  227. display: none;
  228. }
  229. .on-edit .nav-tabs-create-portal {
  230. display: block;
  231. }
  232. // overwrite .CodeMirror-hints
  233. .CodeMirror-hints {
  234. // FIXME: required because .content-main.on-edit has 'z-index:1050'
  235. // z-index: 1060 !important;
  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. font-size: 15px; // adjust to .wiki
  249. padding-top: 0.3em;
  250. padding-bottom: 0.3em;
  251. }
  252. }
  253. }
  254. // overwrite .CodeMirror-placeholder
  255. .CodeMirror pre.CodeMirror-placeholder {
  256. color: $text-muted;
  257. }