_on-edit.scss 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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. @media (min-width: $screen-md) {
  142. padding-right: 0;
  143. }
  144. }
  145. }
  146. /*****************
  147. * Editor styles
  148. *****************/
  149. .page-editor-editor-container {
  150. border-right: 1px solid transparent;
  151. // override CodeMirror styles
  152. .CodeMirror {
  153. .cm-matchhighlight {
  154. background-color: cyan;
  155. }
  156. .CodeMirror-selection-highlight-scrollbar {
  157. background-color: darkcyan;
  158. }
  159. }
  160. // add icon on cursor
  161. .autoformat-markdown-table-activated .CodeMirror-cursor {
  162. &:after {
  163. font-family: 'FontAwesome';
  164. content: '\f0ce';
  165. }
  166. }
  167. .textarea-editor {
  168. border: none;
  169. font-family: monospace;
  170. }
  171. }
  172. .page-editor-preview-container {
  173. }
  174. .page-editor-preview-body {
  175. padding-top: 18px;
  176. padding-right: 15px;
  177. overflow-y: scroll;
  178. }
  179. #page-editor-options-selector {
  180. label {
  181. margin-right: 0.5em;
  182. }
  183. // configuration dropdown
  184. .configuration-dropdown {
  185. .icon-container {
  186. display: inline-block;
  187. width: 20px;
  188. }
  189. .dropdown-menu > li > a {
  190. display: flex;
  191. justify-content: space-between;
  192. align-items: center;
  193. .menuitem-label {
  194. flex: 1;
  195. margin-right: 10px;
  196. }
  197. }
  198. }
  199. @media (max-width: $screen-xs-max) { // {{{ less than smartphone size
  200. display: none;
  201. }
  202. }
  203. #page-grant-selector {
  204. .btn-group {
  205. min-width: 150px;
  206. }
  207. }
  208. } // .builtin-editor .tab-pane#edit
  209. &.hackmd {
  210. #page-editor-options-selector {
  211. display: none;
  212. }
  213. .tab-pane#hackmd {
  214. @extend %expand-by-flex;
  215. #hackmd-editor,
  216. .hackmd-nopage, #iframe-hackmd {
  217. width: 100vw;
  218. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  219. height: calc(100vh - #{$header-plus-footer});
  220. border: none;
  221. }
  222. }
  223. }
  224. }
  225. /*
  226. * for creating portal
  227. */
  228. .nav-tabs-create-portal {
  229. display: none;
  230. }
  231. .on-edit .nav-tabs-create-portal {
  232. display: block;
  233. }
  234. // overwrite .CodeMirror-hints
  235. .CodeMirror-hints {
  236. // FIXME: required because .content-main.on-edit has 'z-index:1050'
  237. // z-index: 1060 !important;
  238. max-height: 30em !important;
  239. .CodeMirror-hint.crowi-emoji-autocomplete {
  240. font-family: $font-family-monospace-not-strictly;
  241. line-height: 1.6em;
  242. .img-container {
  243. display: inline-block;
  244. width: 30px;
  245. }
  246. }
  247. // active line
  248. .CodeMirror-hint-active.crowi-emoji-autocomplete {
  249. .img-container {
  250. font-size: 15px; // adjust to .wiki
  251. padding-top: 0.3em;
  252. padding-bottom: 0.3em;
  253. }
  254. }
  255. }
  256. // overwrite .CodeMirror-placeholder
  257. .CodeMirror pre.CodeMirror-placeholder {
  258. color: $text-muted;
  259. }