CodeMirrorEditor.module.scss 2.5 KB

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