_on-edit.scss 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. body:not(.on-edit) {
  2. // hide #page-form
  3. #page-form {
  4. display: none;
  5. }
  6. }
  7. body.on-edit {
  8. %expand-by-flex {
  9. display: flex;
  10. flex-direction: column;
  11. flex: 1;
  12. }
  13. // calculate margin
  14. $header-plus-footer: 2px // .main padding-top
  15. + 42px // .nav height
  16. + 1px // .page-editor-footer border-top
  17. + 40px; // .page-editor-footer min-height
  18. $editor-margin: $header-plus-footer + 22px; // .btn-open-dropzone height
  19. // hide unnecessary elements
  20. .navbar.navbar-static-top,
  21. .row.row-alerts,
  22. .row.page-list,
  23. .row.page-comments-row,
  24. .row.page-attachments-row,
  25. .row.not-found-message-row,
  26. .users-meta,
  27. .user-page-content-container,
  28. .portal-form-button,
  29. .alert-info.alert-moved,
  30. .alert-info.alert-unlinked,
  31. .like-button, .bookmark-link, .btn-edit,
  32. .authors,
  33. footer {
  34. display: none !important;
  35. }
  36. // hide unnecessary elements for growi layout
  37. .revision-toc-container {
  38. display: none;
  39. }
  40. // hide unnecessary elements for crowi layout
  41. #toggle-sidebar,
  42. .crowi-sidebar {
  43. display: none;
  44. }
  45. // show only either Edit button or HackMD button
  46. &.hackmd .nav-tab-edit {
  47. display: none;
  48. }
  49. &:not(.hackmd) .nav-tab-hackmd {
  50. display: none;
  51. }
  52. /*****************
  53. * Expand Editor
  54. *****************/
  55. .container-fluid {
  56. padding-bottom: 0;
  57. }
  58. .main {
  59. width: 100%;
  60. height: 100vh;
  61. margin-top: 0px !important;
  62. padding-top: 2px;
  63. padding-left: 0;
  64. padding-right: 0;
  65. // for growi layout
  66. > .row {
  67. margin: 0;
  68. > .col-lg-10, > .col-md-9 {
  69. width: 100%;
  70. padding: 0;
  71. }
  72. }
  73. &,
  74. .content-main,
  75. .tab-content {
  76. @extend %expand-by-flex;
  77. }
  78. }
  79. .row.bg-title {
  80. $left-margin: $nav-main-left-tab-width * 2 + 25px; // width of .nav-main-left-tab x 2 + some margin
  81. $right-margin: 128px + 94px + 46px; // width of all of nav-main-right-tab
  82. position: absolute;
  83. z-index: 1;
  84. left: $left-margin;
  85. width: calc(100% - #{$left-margin} - #{$right-margin});
  86. // for crowi layout
  87. > .col-md-9, .col-xs-12 {
  88. padding: 0;
  89. width: 100%;
  90. }
  91. background: none;
  92. .header-wrap {
  93. overflow-x: hidden;
  94. }
  95. h1#revision-path {
  96. @include variable-font-size(20px);
  97. line-height: 1em;
  98. // nowrap even if the path is too long
  99. .d-flex {
  100. flex-wrap: nowrap;
  101. }
  102. .path-segment {
  103. white-space: nowrap;
  104. }
  105. }
  106. // hide if screen size is less than tablet
  107. @media (max-width: $screen-sm) {
  108. display: none;
  109. }
  110. }
  111. .page-editor-footer {
  112. width: 100%;
  113. margin: 0;
  114. padding: 3px;
  115. min-height: 40px;
  116. border-top: solid 1px transparent;
  117. .btn-submit {
  118. width: 100px;
  119. }
  120. }
  121. &.builtin-editor .tab-pane#edit {
  122. @extend %expand-by-flex;
  123. #page-editor {
  124. // right(preview)
  125. &,
  126. .row,
  127. .page-editor-preview-container,
  128. .page-editor-preview-body {
  129. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  130. height: calc(100vh - #{$header-plus-footer});
  131. }
  132. // left(editor)
  133. .page-editor-editor-container {
  134. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  135. height: calc(100vh - #{$header-plus-footer});
  136. .react-codemirror2, .CodeMirror, .CodeMirror-scroll,
  137. .textarea-editor {
  138. height: calc(100vh - #{$editor-margin});
  139. }
  140. }
  141. }
  142. /*****************
  143. * Editor styles
  144. *****************/
  145. .page-editor-editor-container {
  146. border-right: 1px solid transparent;
  147. padding-right: 0;
  148. // override CodeMirror styles
  149. .CodeMirror {
  150. .cm-matchhighlight {
  151. background-color: cyan;
  152. }
  153. .CodeMirror-selection-highlight-scrollbar {
  154. background-color: darkcyan;
  155. }
  156. }
  157. .overlay {
  158. // layout
  159. display: flex;
  160. justify-content: center;
  161. align-items: center;
  162. // style
  163. margin: 0 15px;
  164. }
  165. .overlay-content {
  166. font-size: 2.5em;
  167. padding: 0.5em;
  168. }
  169. @mixin overlay-processing-style() {
  170. .overlay {
  171. background: rgba(255,255,255,0.5);
  172. }
  173. .overlay-content {
  174. padding: 0.3em;
  175. background: rgba(200,200,200,0.5);
  176. color: #444;
  177. }
  178. }
  179. // add icon on cursor
  180. .autoformat-markdown-table-activated .CodeMirror-cursor {
  181. &:after {
  182. font-family: 'FontAwesome';
  183. content: '\f0ce';
  184. }
  185. }
  186. // for Dropzone
  187. .dropzone {
  188. @mixin insertSimpleLineIcons($code) {
  189. &:before {
  190. margin-right: 0.2em;
  191. font-family: 'simple-line-icons';
  192. content: $code;
  193. }
  194. }
  195. // unuploadable or rejected
  196. &.dropzone-unuploadable, &.dropzone-rejected {
  197. .overlay {
  198. background: rgba(200,200,200,0.8);
  199. }
  200. .overlay-content {
  201. color: #444;
  202. }
  203. }
  204. // uploading
  205. &.dropzone-uploading {
  206. @include overlay-processing-style();
  207. }
  208. // unuploadable
  209. &.dropzone-unuploadable {
  210. .overlay-content {
  211. // insert content
  212. @include insertSimpleLineIcons("\e617"); // icon-exclamation
  213. &:after {
  214. content: "File uploading is disabled";
  215. }
  216. }
  217. }
  218. // uploadable
  219. &.dropzone-uploadable {
  220. // accepted
  221. &.dropzone-accepted:not(.dropzone-rejected) {
  222. .overlay {
  223. border: 4px dashed #ccc;
  224. }
  225. .overlay-content {
  226. // insert content
  227. @include insertSimpleLineIcons("\e084"); // icon-cloud-upload
  228. &:after {
  229. content: "Drop here to upload";
  230. }
  231. // style
  232. color: #666;
  233. background: rgba(200,200,200,0.8);
  234. }
  235. }
  236. // file type mismatch
  237. &.dropzone-rejected:not(.dropzone-uploadablefile) .overlay-content {
  238. // insert content
  239. @include insertSimpleLineIcons("\e032"); // icon-picture
  240. &:after {
  241. content: "Only an image file is allowed";
  242. }
  243. }
  244. // multiple files
  245. &.dropzone-accepted.dropzone-rejected .overlay-content {
  246. // insert content
  247. @include insertSimpleLineIcons("\e617"); // icon-exclamation
  248. &:after {
  249. content: "Only 1 file is allowed";
  250. }
  251. }
  252. }
  253. } // end of.dropzone
  254. .textarea-editor {
  255. border: none;
  256. font-family: monospace;
  257. }
  258. .loading-keymap {
  259. @include overlay-processing-style();
  260. }
  261. }
  262. .page-editor-preview-container {
  263. }
  264. .page-editor-preview-body {
  265. padding-top: 18px;
  266. padding-right: 15px;
  267. overflow-y: scroll;
  268. }
  269. #page-editor-options-selector {
  270. label {
  271. margin-right: 0.5em;
  272. }
  273. // configuration dropdown
  274. .configuration-dropdown {
  275. .icon-container {
  276. display: inline-block;
  277. width: 20px;
  278. }
  279. .dropdown-menu > li > a {
  280. display: flex;
  281. justify-content: space-between;
  282. align-items: center;
  283. .menuitem-label {
  284. flex: 1;
  285. margin-right: 10px;
  286. }
  287. }
  288. }
  289. @media (max-width: $screen-xs-max) { // {{{ less than smartphone size
  290. display: none;
  291. }
  292. }
  293. #page-grant-selector {
  294. .btn-group {
  295. min-width: 150px;
  296. }
  297. }
  298. } // .builtin-editor .tab-pane#edit
  299. &.hackmd {
  300. #page-editor-options-selector {
  301. display: none;
  302. }
  303. .tab-pane#hackmd {
  304. @extend %expand-by-flex;
  305. #hackmd-editor,
  306. .hackmd-nopage, #iframe-hackmd {
  307. width: 100vw;
  308. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  309. height: calc(100vh - #{$header-plus-footer});
  310. border: none;
  311. }
  312. }
  313. }
  314. }
  315. /*
  316. * for creating portal
  317. */
  318. .nav-tabs-create-portal {
  319. display: none;
  320. }
  321. .on-edit .nav-tabs-create-portal {
  322. display: block;
  323. }
  324. // overwrite .CodeMirror-hints
  325. .CodeMirror-hints {
  326. // FIXME: required because .content-main.on-edit has 'z-index:1050'
  327. // z-index: 1060 !important;
  328. max-height: 30em !important;
  329. .CodeMirror-hint.crowi-emoji-autocomplete {
  330. font-family: $font-family-monospace-not-strictly;
  331. line-height: 1.6em;
  332. .img-container {
  333. display: inline-block;
  334. width: 30px;
  335. }
  336. }
  337. // active line
  338. .CodeMirror-hint-active.crowi-emoji-autocomplete {
  339. .img-container {
  340. font-size: 15px; // adjust to .wiki
  341. padding-top: 0.3em;
  342. padding-bottom: 0.3em;
  343. }
  344. }
  345. }