Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

6.8 KB
Raw Blame
.files-viewer-markdown {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;

  .files-markdown-toolbar {
    position: relative;
    z-index: 3;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    row-gap: 4px;
    overflow: visible;
  }

  .files-markdown-toolbar-group,
  .files-markdown-mode-group {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
  }

  .files-markdown-toolbar-separator,
  .files-markdown-mode-separator {
    align-self: center;
    min-height: 1.45rem;
  }

  .files-markdown-toolbar-separator {
    margin: 0 0.5rem 0 0.3rem;
  }

  .files-markdown-mode-separator-end {
    margin-left: 0.5rem;
    margin-right: 0.5rem;
  }

  .files-markdown-heading-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .files-markdown-heading-menu,
  .files-markdown-list-menu,
  .files-markdown-code-menu,
  .files-markdown-image-menu,
  .files-markdown-table-menu {
    z-index: 4;
  }

  .files-markdown-heading-menu .dropdown-item,
  .files-markdown-list-menu .dropdown-item,
  .files-markdown-code-menu .dropdown-item,
  .files-markdown-image-menu .dropdown-item {
    padding: 0.5rem 0.65rem;
  }

  .files-markdown-heading-menu {
    background: var(--files-markdown-heading-active-bg, rgba(127, 127, 127, 0.18));
    color: inherit;
  }

  .files-markdown-content {
    position: relative;
    z-index: 1;
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .files-markdown-content.is-visual .files-markdown-source-pane,
  .files-markdown-content.is-source .files-markdown-visual-pane {
    display: none;
  }

  .files-markdown-visual-pane,
  .files-markdown-source-pane {
    min-height: 0;
    overflow: hidden;
  }

  .files-markdown-source-pane .code-editor {
    height: 100%;
  }

  .files-markdown-visual-editor {
    display: block;
    height: 100%;
    overflow: auto;
    background: #fff;
  }

  .code-editor {
    font-size: 0.85rem;
  }

  .ProseMirror {
    width: 100%;
    max-width: 1000px;
    min-height: 100%;
    margin: 0 auto;
    padding: 1rem;
    outline: none;
    font-size: 0.92rem;
    line-height: 1.58;

    > *:first-child {
      margin-top: 0 !important;
    }

    > *:last-child {
      margin-bottom: 0 !important;
    }

    h1,
    h2,
    h3,
    h4,
    .h1,
    .h2,
    .h3,
    .h4 {
      margin: 1.5rem 0 1rem;
      font-weight: 600;
      line-height: 1.25;
    }

    h1,
    .h1 {
      font-size: 2em;
    }

    h2,
    .h2 {
      font-size: 1.5em;
    }

    h3,
    .h3 {
      font-size: 1.25em;
    }

    h4,
    .h4 {
      font-size: 1em;
    }

    p,
    ul,
    ol,
    blockquote,
    img,
    pre,
    .tableWrapper {
      margin: 0 0 0.75rem;
    }

    ul,
    ol {
      padding-left: 2em;
    }

    ul ul,
    ul ol,
    ol ol,
    ol ul {
      margin-top: 0;
      margin-bottom: 0;
    }

    li + li {
      margin-top: 0.25em;
    }

    li > p {
      margin: 0;
    }

    li > p + p {
      margin-top: 1rem;
    }

    ul[data-type='taskList'] {
      padding-left: 0;
      list-style: none;

      li {
        display: flex;
        gap: 0.55rem;
        align-items: flex-start;

        > label {
          flex: 0 0 auto;
          margin-top: 0.1rem;
          user-select: none;
        }

        > div {
          flex: 1 1 auto;
          min-width: 0;

          > p {
            margin: 0;
          }
        }
      }

      li + li {
        margin-top: 0.15rem;
      }
    }

    blockquote {
      padding-left: 0.85rem;
      border-left: 3px solid #8aa4c8;
      color: #53657d;

      > :first-child {
        margin-top: 0;
      }

      > :last-child {
        margin-bottom: 0;
      }
    }

    img {
      display: block;
      max-width: 100%;
      height: auto;
      border-radius: 4px;

      &.ProseMirror-selectednode {
        outline: 2px solid #5f84bd;
      }
    }

    pre {
      padding: 0.85rem 1rem;
      overflow: auto;
      border-radius: 6px;
      background: rgba(115, 132, 156, 0.12);
      color: inherit;
      font-size: 0.85em;
      line-height: 1.45;

      code {
        padding: 0;
        border-radius: 0;
        background: transparent;
        color: inherit;
      }
    }

    code {
      padding: 0.08rem 0.28rem;
      border-radius: 4px;
      background: rgba(115, 132, 156, 0.16);
      color: #2563eb;
    }

    .files-viewer-search-match {
      background: rgba(255, 214, 10, 0.42);

      &.is-current {
        background: rgba(255, 149, 0, 0.5);
      }
    }

    hr {
      margin: 1.5rem 0;
      border: 0;
      border-top: 1px solid rgba(128, 128, 128, 0.35);
    }

    .tableWrapper {
      overflow-x: auto;
    }

    table {
      width: 100%;
      table-layout: fixed;
      border-collapse: collapse;

      th,
      td {
        position: relative;
        min-width: 6rem;
        padding: 0.45rem 0.55rem;
        border: 1px solid rgba(128, 128, 128, 0.35);
        vertical-align: top;

        > *:first-child {
          margin-top: 0;
        }

        > *:last-child {
          margin-bottom: 0;
        }
      }

      th {
        background: rgba(115, 132, 156, 0.12);
        font-weight: 700;
      }

      .selectedCell::after {
        position: absolute;
        inset: 0;
        z-index: 2;
        pointer-events: none;
        content: '';
        background: rgba(95, 132, 189, 0.18);
      }

      .column-resize-handle {
        position: absolute;
        top: 0;
        right: -2px;
        bottom: 0;
        z-index: 3;
        width: 4px;
        pointer-events: none;
        background: #5f84bd;
      }
    }

    &.resize-cursor {
      cursor: col-resize;
    }
  }

  .cm-focused {
    outline: none !important;
  }

  .cm-panel.cm-search {
    display: none;
  }

  @media (max-width: 767.98px) {
    .files-markdown-toolbar {
      flex-wrap: wrap !important;
      height: auto;
      min-height: 40px;
    }

    .files-markdown-toolbar-group,
    .files-markdown-mode-group {
      display: contents;
    }
  }
}

body.theme-dark {
  .files-viewer-markdown {
    .files-markdown-visual-editor {
      background: #161b22;
      color: #d7dde8;
    }

    .ProseMirror {
      blockquote {
        border-left-color: #58739a;
        color: #aeb9ca;
      }

      pre {
        background: rgba(156, 171, 194, 0.12);

        code {
          background: transparent;
          color: inherit;
        }
      }

      code {
        background: rgba(156, 171, 194, 0.18);
        color: #60a5fa;
      }

      .files-viewer-search-match {
        background: rgba(255, 214, 10, 0.32);

        &.is-current {
          background: rgba(255, 159, 10, 0.45);
        }
      }

      table {
        th,
        td {
          border-color: rgba(156, 171, 194, 0.28);
        }

        th {
          background: rgba(156, 171, 194, 0.12);
        }
      }
    }
  }
}