CodeMirrorEditor.module.scss 2.6 KB

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