_on-edit.scss 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  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. $editor-margin-sm: $header-plus-footer;
  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. // slack
  119. .input-group-slack {
  120. .input-group-addon {
  121. padding: 2px 8px;
  122. line-height: 1em;
  123. img, input {
  124. vertical-align: middle;
  125. }
  126. }
  127. }
  128. .btn-submit {
  129. width: 100px;
  130. }
  131. }
  132. &.builtin-editor #edit-form {
  133. @extend %expand-by-flex;
  134. #page-editor {
  135. // right(preview)
  136. &,
  137. .row,
  138. .page-editor-preview-container,
  139. .page-editor-preview-body {
  140. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  141. height: calc(100vh - #{$header-plus-footer});
  142. }
  143. // left(editor)
  144. .page-editor-editor-container {
  145. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  146. height: calc(100vh - #{$header-plus-footer});
  147. .react-codemirror2, .CodeMirror, .CodeMirror-scroll,
  148. .textarea-editor {
  149. height: calc(100vh - #{$editor-margin});
  150. // less than smartphone
  151. @media (max-width: $screen-xs) {
  152. height: calc(100vh - #{$editor-margin-sm});
  153. }
  154. }
  155. }
  156. }
  157. /*****************
  158. * Editor styles
  159. *****************/
  160. .page-editor-editor-container {
  161. border-right: 1px solid transparent;
  162. padding-right: 0;
  163. // override CodeMirror styles
  164. .CodeMirror {
  165. .cm-matchhighlight {
  166. background-color: cyan;
  167. }
  168. .CodeMirror-selection-highlight-scrollbar {
  169. background-color: darkcyan;
  170. }
  171. }
  172. .overlay {
  173. // layout
  174. display: flex;
  175. justify-content: center;
  176. align-items: center;
  177. // style
  178. margin: 0 15px;
  179. }
  180. .overlay-content {
  181. font-size: 2.5em;
  182. padding: 0.5em;
  183. }
  184. @mixin overlay-processing-style() {
  185. .overlay {
  186. background: rgba(255,255,255,0.5);
  187. }
  188. .overlay-content {
  189. padding: 0.3em;
  190. background: rgba(200,200,200,0.5);
  191. color: #444;
  192. }
  193. }
  194. // add icon on cursor
  195. .autoformat-markdown-table-activated .CodeMirror-cursor {
  196. &:after {
  197. font-family: 'FontAwesome';
  198. content: '\f0ce';
  199. }
  200. }
  201. // for Dropzone
  202. .dropzone {
  203. @mixin insertSimpleLineIcons($code) {
  204. &:before {
  205. margin-right: 0.2em;
  206. font-family: 'simple-line-icons';
  207. content: $code;
  208. }
  209. }
  210. // unuploadable or rejected
  211. &.dropzone-unuploadable, &.dropzone-rejected {
  212. .overlay {
  213. background: rgba(200,200,200,0.8);
  214. }
  215. .overlay-content {
  216. color: #444;
  217. }
  218. }
  219. // uploading
  220. &.dropzone-uploading {
  221. @include overlay-processing-style();
  222. }
  223. // unuploadable
  224. &.dropzone-unuploadable {
  225. .overlay-content {
  226. // insert content
  227. @include insertSimpleLineIcons("\e617"); // icon-exclamation
  228. &:after {
  229. content: "File uploading is disabled";
  230. }
  231. }
  232. }
  233. // uploadable
  234. &.dropzone-uploadable {
  235. // accepted
  236. &.dropzone-accepted:not(.dropzone-rejected) {
  237. .overlay {
  238. border: 4px dashed #ccc;
  239. }
  240. .overlay-content {
  241. // insert content
  242. @include insertSimpleLineIcons("\e084"); // icon-cloud-upload
  243. &:after {
  244. content: "Drop here to upload";
  245. }
  246. // style
  247. color: #666;
  248. background: rgba(200,200,200,0.8);
  249. }
  250. }
  251. // file type mismatch
  252. &.dropzone-rejected:not(.dropzone-uploadablefile) .overlay-content {
  253. // insert content
  254. @include insertSimpleLineIcons("\e032"); // icon-picture
  255. &:after {
  256. content: "Only an image file is allowed";
  257. }
  258. }
  259. // multiple files
  260. &.dropzone-accepted.dropzone-rejected .overlay-content {
  261. // insert content
  262. @include insertSimpleLineIcons("\e617"); // icon-exclamation
  263. &:after {
  264. content: "Only 1 file is allowed";
  265. }
  266. }
  267. }
  268. } // end of.dropzone
  269. .textarea-editor {
  270. border: none;
  271. font-family: monospace;
  272. }
  273. .loading-keymap {
  274. @include overlay-processing-style();
  275. }
  276. .btn-open-dropzone {
  277. z-index: 2;
  278. font-size: small;
  279. text-align: right;
  280. padding-top: 3px;
  281. padding-bottom: 0;
  282. border: none;
  283. border-radius: 0;
  284. border-top: 1px dotted #ccc;
  285. &:active {
  286. box-shadow: none;
  287. }
  288. // hide if screen size is less than smartphone
  289. @media (max-width: $screen-xs) {
  290. display: none;
  291. }
  292. }
  293. }
  294. .page-editor-preview-container {
  295. }
  296. .page-editor-preview-body {
  297. padding-top: 18px;
  298. padding-right: 15px;
  299. overflow-y: scroll;
  300. }
  301. #page-editor-options-selector {
  302. label {
  303. margin-right: 0.5em;
  304. }
  305. // configuration dropdown
  306. .configuration-dropdown {
  307. .icon-container {
  308. display: inline-block;
  309. width: 20px;
  310. }
  311. .dropdown-menu > li > a {
  312. display: flex;
  313. justify-content: space-between;
  314. align-items: center;
  315. .menuitem-label {
  316. flex: 1;
  317. margin-right: 10px;
  318. }
  319. }
  320. }
  321. @media (max-width: $screen-xs-max) { // {{{ less than smartphone size
  322. display: none;
  323. }
  324. }
  325. #page-grant-selector {
  326. .btn-group {
  327. min-width: 150px;
  328. }
  329. }
  330. } // .builtin-editor #edit-form
  331. &.hackmd #hackmd {
  332. @extend %expand-by-flex;
  333. #hackmd-editor,
  334. iframe {
  335. width: 100vw;
  336. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  337. height: calc(100vh - #{$header-plus-footer});
  338. border: none;
  339. }
  340. }
  341. }
  342. /*
  343. * for creating portal
  344. */
  345. .nav-tabs-create-portal {
  346. display: none;
  347. }
  348. .on-edit .nav-tabs-create-portal {
  349. display: block;
  350. }
  351. // overwrite .CodeMirror-hints
  352. .CodeMirror-hints {
  353. // FIXME: required because .content-main.on-edit has 'z-index:1050'
  354. // z-index: 1060 !important;
  355. max-height: 30em !important;
  356. .CodeMirror-hint.crowi-emoji-autocomplete {
  357. font-family: $font-family-monospace-not-strictly;
  358. line-height: 1.6em;
  359. .img-container {
  360. display: inline-block;
  361. width: 30px;
  362. }
  363. }
  364. // active line
  365. .CodeMirror-hint-active.crowi-emoji-autocomplete {
  366. .img-container {
  367. font-size: 15px; // adjust to .wiki
  368. padding-top: 0.3em;
  369. padding-bottom: 0.3em;
  370. }
  371. }
  372. }