@import './theme.less';
// icon tooltip
.quill-icon-tooltip {
  position: absolute;
  z-index: 100;
  border-radius: 6px;
  background-color: @tooltip-color;
  color: #fff;
  padding: 6px 8px;
  font-size: 14px;
  width: max-content;
}
// link的输入框
.ql-snow .ql-tooltip[data-mode='link']::before {
  content: '';
  margin-right: 0;
}
.ql-snow .ql-tooltip::before {
  content: '';
  margin-right: 0;
}
.ql-container .ql-tooltip {
  input.text-input {
    width: 280px;
  }
  .ql-link-save {
    color: @primary-color;
    margin-left: 10px;
  }
  .ql-link-jump,
  .ql-link-clear {
    margin-left: 10px;
    line-height: 0;
  }
  .err-tips {
    margin-left: 40px;
  }
}

// imageDropPaste 图片上传
.ql-container {
  .img-container {
    position: relative;
  }
  .img-container::after {
    content: attr(data-after);
    position: absolute;
    z-index: 11;
    left: 5px;
    top: 5px;
    border-radius: 4px;
    background: rgba(240, 240, 240, 0.6);
    color: @primary-color;
    cursor: pointer;
  }
  .img-container.float-right::after {
    left: unset;
    right: 5px;
  }
  .img-container.img-center::after {
    left: calc(50% - 100px);
    right: unset;
  }
}
/* 图片resize框 */
.resize-box {
  height: 8px;
  width: 8px;
  background-color: #000;
  position: absolute;
  cursor: nwse-resize;
}
.resize-left-top {
  left: -4px;
  top: -4px;
}
.resize-right-bottom {
  bottom: -4px;
  right: -4px;
}

.ql-snow .ql-picker.ql-expanded .ql-picker-options {
  z-index: 100;
}

// 富文本container中的table
.ql-container .qlbt-selection-line {
  &.qlbt-selection-line-left {
    &::before {
      position: absolute;
      left: -2px;
      top: -2px;
      content: '';
      width: 5px;
      height: 5px;
      background-color: @primary-color;
      border-radius: 5px;
    }
  }

  &.qlbt-selection-line-right {
    &::before {
      position: absolute;
      right: -2px;
      bottom: -3px;
      content: '';
      width: 5px;
      height: 5px;
      background-color: @primary-color;
      border-radius: 5px;
    }
  }
}

.quill-better-table-wrapper {
  display: flex;
  overflow-x: auto;
}

table.quill-better-table {
  table-layout: fixed;
  border-collapse: collapse;

  td {
    border: 1px solid #ddd;
    padding: 2px 5px;
  }
  tr:nth-child(odd) {
    background-color: #eee;
  }
  tr:first-child {
    font-weight: bold;
  }
}

.qlbt-operation-menu {
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  z-index: 100;
  overflow: hidden;

  .qlbt-operation-menu-dividing {
    height: 1px;
    background-color: @editor-border;
  }

  .qlbt-operation-menu-subtitle {
    color: #999;
    font-size: 14px;
    padding: 5px 16px;
  }

  .qlbt-operation-color-picker {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding: 0 16px 10px;
    background-color: #fff;
    overflow: hidden;

    .qlbt-operation-color-picker-item {
      width: 20px;
      height: 20px;
      border: 1px solid #595959;
      margin-right: 5px;
      margin-bottom: 5px;
      cursor: pointer;
    }
  }

  .qlbt-operation-menu-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background-color: #fff;
    cursor: pointer;
    color: #595959;
    overflow: hidden;
    text-overflow: ellipsis;

    &:hover {
      background-color: #efefef;
    }

    .qlbt-operation-menu-icon {
      margin-right: 8px;
      height: 18px;
      width: 18px;
      font-size: 0;
    }
  }
}
// table上的宽度调节器
.qlbt-col-tool {
  position: absolute;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  z-index: 99;
  height: 16px;

  .qlbt-col-tool-cell {
    position: relative;
    background-color: #fff;
    border-top: 1px solid #000;
    border-right: 1px solid #000;
    border-bottom: 1px solid #000;

    &:first-child {
      border-left: 1px solid #000;
    }
  }

  .qlbt-col-tool-cell-holder {
    position: absolute;
    right: -1px;
    top: 0;
    bottom: 0;
    z-index: 3;
    width: 1px;
    background-color: transparent;
    cursor: ew-resize;

    &:hover {
      background-color: #0589f3;
    }

    &::before {
      content: '';
      position: absolute;
      top: 0;
      left: -6px;
      display: block;
      width: 8px;
      height: 100%;
    }

    &::after {
      content: '';
      position: absolute;
      top: 0;
      right: -6px;
      display: block;
      width: 8px;
      height: 100%;
    }
  }
}
// 解决疑难bug：table中输入List，下一个cell的有序列表前数字可能会继承上一个cell中的列表数字
.quill-better-table {
  td {
    ol:first-child {
      li:first-child {
        counter-reset: list-0 0;
      }
    }
  }
}

// 代码块UI
.ql-snow .ql-editor .ql-code-block-container {
  background-color: @code-color;
  color: rgb(43, 47, 54);
  padding: 2px 8px 20px;

  .ql-ui {
    position: relative;
    color: rgba(100, 106, 115);
    opacity: 0;
    transition: all 150ms ease-in;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
    right: 0;
    top: 0;

    select {
      outline: none;
      border: 0;
      background: transparent;
      text-align: center;
      color: rgb(100, 106, 115, .8);
      &:focus-visible{
        outline: 0;
      }
    }
    .ql-code-copy {
      display: flex;
      align-items: center;
      padding: 0 3px;
      border-radius: 4px;
      cursor: pointer;
      // span {
      //   width: 50px;
      //   text-align: center;
      // }
      &:hover {
        background-color: rgba(31,35,41,0.1);
      }
    }
  }
  .ql-code-block {
    counter-increment: codeIndex;
    margin-left: 38px;
  }
  .ql-code-block::before {
    content: counter(codeIndex);
    position: absolute;
    left: 0;
    text-align: right;
    width: 36px;
    color: rgb(100, 106, 115);
    word-break: break-word;
    -webkit-user-select: none!important;
    white-space: nowrap;
  }

}
.ql-snow .ql-editor .ql-code-block-container:hover {
  .ql-ui {
    opacity: 1;
  }
}
