2
0

CodeMirrorEditor.module.scss 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. @use '~/styles/variables' as var;
  2. @use '~/styles/bootstrap/init' as bs;
  3. .grw-codemirror-editor :global {
  4. @import '~codemirror/lib/codemirror';
  5. // addons
  6. @import '~codemirror/addon/hint/show-hint';
  7. @import '~codemirror/addon/fold/foldgutter';
  8. @import '~codemirror/addon/lint/lint';
  9. // themes
  10. @import '~codemirror/theme/elegant';
  11. @import '~codemirror/theme/eclipse';
  12. .CodeMirror {
  13. pre.CodeMirror-line.grw-cm-header-line {
  14. padding-top: 0.16em;
  15. padding-bottom: 0.08em;
  16. font-family: bs.$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. }
  54. // patch to fix https://github.com/codemirror/CodeMirror/issues/4089
  55. // see also https://github.com/codemirror/CodeMirror/commit/51a1e7da60a99e019f026a118dc7c98c2b1f9d62
  56. .CodeMirror-wrap > div > textarea {
  57. font-size: #{bs.$line-height-base}rem;
  58. }
  59. // overwrite .CodeMirror-hints
  60. .CodeMirror-hints {
  61. max-height: 30em !important;
  62. .CodeMirror-hint.crowi-emoji-autocomplete {
  63. font-family: var.$font-family-monospace-not-strictly;
  64. line-height: 1.6em;
  65. .img-container {
  66. display: inline-block;
  67. width: 30px;
  68. }
  69. }
  70. // active line
  71. .CodeMirror-hint-active.crowi-emoji-autocomplete {
  72. .img-container {
  73. padding-top: 0.3em;
  74. padding-bottom: 0.3em;
  75. font-size: 15px; // adjust to .wiki
  76. }
  77. }
  78. }
  79. // cheat sheat
  80. .overlay.overlay-gfm-cheatsheet {
  81. align-items: flex-end;
  82. justify-content: flex-end;
  83. pointer-events: none;
  84. .card.gfm-cheatsheet {
  85. box-shadow: unset;
  86. opacity: 0.6;
  87. .card-body {
  88. min-width: 30em;
  89. padding-bottom: 0;
  90. font-family: monospace;
  91. color: bs.$text-muted;
  92. }
  93. ul > li {
  94. list-style: none;
  95. }
  96. }
  97. .gfm-cheatsheet-modal-link {
  98. color: bs.$text-muted;
  99. pointer-events: all;
  100. cursor: pointer;
  101. background-color: transparent;
  102. border: none;
  103. opacity: 0.6;
  104. &:hover,
  105. &:focus {
  106. opacity: 1;
  107. }
  108. }
  109. }
  110. }