CodeMirrorEditor.module.scss 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. @use '@growi/core/scss/bootstrap/init' as bs;
  2. .grw-codemirror-editor :global {
  3. @import '~codemirror/lib/codemirror';
  4. // addons
  5. @import '~codemirror/addon/fold/foldgutter';
  6. @import '~codemirror/addon/lint/lint';
  7. // themes
  8. @import '~codemirror/theme/elegant';
  9. @import '~codemirror/theme/eclipse';
  10. .CodeMirror {
  11. font-family: var(--font-family-monospace);
  12. font-size: 15px;
  13. pre.CodeMirror-line.grw-cm-header-line {
  14. padding-top: 0.16em;
  15. padding-bottom: 0.08em;
  16. font-family: var(--font-family-monospace);
  17. // '#'
  18. .cm-formatting-header {
  19. font-style: italic;
  20. font-weight: bold;
  21. opacity: 0.5;
  22. }
  23. .cm-header-1 {
  24. font-size: 1.9em;
  25. }
  26. .cm-header-2 {
  27. font-size: 1.6em;
  28. }
  29. .cm-header-3 {
  30. font-size: 1.4em;
  31. }
  32. .cm-header-4 {
  33. font-size: 1.35em;
  34. }
  35. .cm-header-5 {
  36. font-size: 1.25em;
  37. }
  38. .cm-header-6 {
  39. font-size: 1.2em;
  40. }
  41. }
  42. .cm-matchhighlight {
  43. color: bs.$gray-900 !important;
  44. background-color: cyan;
  45. }
  46. .CodeMirror-selection-highlight-scrollbar {
  47. background-color: darkcyan;
  48. }
  49. // overwrite .CodeMirror-placeholder
  50. pre.CodeMirror-line-like.CodeMirror-placeholder {
  51. color: bs.$text-muted;
  52. }
  53. // overwrite .CodeMirror-scroll
  54. .CodeMirror-scroll {
  55. box-sizing: border-box;
  56. }
  57. }
  58. // patch to fix https://github.com/codemirror/CodeMirror/issues/4089
  59. // see also https://github.com/codemirror/CodeMirror/commit/51a1e7da60a99e019f026a118dc7c98c2b1f9d62
  60. .CodeMirror-wrap > div > textarea {
  61. font-size: #{bs.$line-height-base}rem;
  62. }
  63. // overwrite .CodeMirror-hints
  64. .CodeMirror-hints {
  65. max-height: 30em !important;
  66. // active line
  67. .CodeMirror-hint-active.crowi-emoji-autocomplete {
  68. .img-container {
  69. padding-top: 0.3em;
  70. padding-bottom: 0.3em;
  71. font-size: 15px; // adjust to .wiki
  72. }
  73. }
  74. }
  75. // cheat sheat
  76. .overlay.overlay-gfm-cheatsheet {
  77. align-items: flex-end;
  78. justify-content: flex-end;
  79. pointer-events: none;
  80. .card.gfm-cheatsheet {
  81. box-shadow: unset;
  82. opacity: 0.6;
  83. .card-body {
  84. min-width: 30em;
  85. padding-bottom: 0;
  86. font-family: var(--font-family-monospace);
  87. color: bs.$text-muted;
  88. }
  89. ul > li {
  90. list-style: none;
  91. }
  92. }
  93. .gfm-cheatsheet-modal-link {
  94. color: bs.$text-muted;
  95. pointer-events: all;
  96. cursor: pointer;
  97. background-color: transparent;
  98. border: none;
  99. opacity: 0.6;
  100. &:hover,
  101. &:focus {
  102. opacity: 1;
  103. }
  104. }
  105. }
  106. }