md-editor-v3 4.16.1-0 → 4.16.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1417,15 +1417,11 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
1417
1417
  let scale = 0;
1418
1418
  const { start, end } = blockMap[Number(realEleStart.dataset.line || 0)];
1419
1419
  const firstLineScrollTop = getTopByLine(start);
1420
- let endLineScrollTop = getTopByLine(end === view2.state.doc.lines ? end : end + 1);
1420
+ const endLineScrollTop = getTopByLine(end === view2.state.doc.lines ? end : end + 1);
1421
1421
  let blockHeight = 0;
1422
1422
  if (endLineScrollTop > scrollDOM.scrollHeight - scrollDOM.clientHeight || realEleEnd.scrollTop > cEle.scrollHeight - cEle.clientHeight) {
1423
- scale = Math.max(
1424
- (cScrollTop - eleStartOffsetTop) / (cEle.scrollHeight - eleStartOffsetTop - cEle.clientHeight),
1425
- 0
1426
- );
1427
- endLineScrollTop = getTopByLine(view2.state.doc.lines) + getHeightByLine(view2.state.doc.lines);
1428
- blockHeight = 8 + endLineScrollTop - firstLineScrollTop - pEle.clientHeight;
1423
+ scale = (cScrollTop + cEle.clientHeight - eleStartOffsetTop) / (cEle.scrollHeight - eleStartOffsetTop);
1424
+ blockHeight = pEle.scrollHeight - firstLineScrollTop - pEle.clientHeight;
1429
1425
  } else if (realEleStart === ((_f = cEle.firstElementChild) == null ? void 0 : _f.firstElementChild)) {
1430
1426
  if (realEleStart === realEleEnd) {
1431
1427
  eleEndOffsetTop = realEleEnd.offsetTop + realEleEnd.offsetHeight + +getComputedStyle(realEleEnd).marginBottom.replace("px", "");
@@ -641,6 +641,7 @@ const codetabs = (md, _opts) => {
641
641
  const codeCodeText = (_a = _opts.usedLanguageTextRef.value) == null ? void 0 : _a.copyCode.text;
642
642
  const copyBtnHtml = _opts.customIconRef.value.copy || codeCodeText;
643
643
  const isIcon = !!_opts.customIconRef.value.copy;
644
+ const collapseTips = `<span class="${config.prefix}-collapse-tips">${StrIcon$1("collapse-tips", _opts.customIconRef.value)}</span>`;
644
645
  const [GROUP] = getGroupAndTab(tokens[idx]);
645
646
  if (GROUP === null) {
646
647
  const { open: open2, tagContainer: tagContainer2, tagHeader: tagHeader2 } = getTagType(tokens[idx]);
@@ -657,7 +658,7 @@ const codetabs = (md, _opts) => {
657
658
  <div class="${config.prefix}-code-action">
658
659
  <span class="${config.prefix}-code-lang">${tokens[idx].info.trim()}</span>
659
660
  <span class="${config.prefix}-copy-button" data-tips="${codeCodeText}"${isIcon ? " data-is-icon=true" : ""}">${copyBtnHtml}</span>
660
- <span class="${config.prefix}-collapse-tips">${StrIcon$1("collapse-tips", _opts.customIconRef.value)}</span>
661
+ ${tagContainer2 === "details" ? collapseTips : ""}
661
662
  </div>
662
663
  </${tagHeader2}>${codeRendered}</${tagContainer2}>`;
663
664
  }
@@ -695,7 +696,7 @@ const codetabs = (md, _opts) => {
695
696
  <div class="${config.prefix}-code-action">
696
697
  <span class="${config.prefix}-codetab-lang">${langs}</span>
697
698
  <span class="${config.prefix}-copy-button" data-tips="${codeCodeText}"${isIcon ? " data-is-icon=true" : ""}">${copyBtnHtml}</span>
698
- <span class="${config.prefix}-collapse-tips">${StrIcon$1("collapse-tips", _opts.customIconRef.value)}</span>
699
+ ${tagContainer === "details" ? collapseTips : ""}
699
700
  </div>
700
701
  </${tagHeader}>${pres}</${tagContainer}>`;
701
702
  };
@@ -1416,15 +1416,11 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
1416
1416
  let scale = 0;
1417
1417
  const { start, end } = blockMap[Number(realEleStart.dataset.line || 0)];
1418
1418
  const firstLineScrollTop = getTopByLine(start);
1419
- let endLineScrollTop = getTopByLine(end === view.state.doc.lines ? end : end + 1);
1419
+ const endLineScrollTop = getTopByLine(end === view.state.doc.lines ? end : end + 1);
1420
1420
  let blockHeight = 0;
1421
1421
  if (endLineScrollTop > scrollDOM.scrollHeight - scrollDOM.clientHeight || realEleEnd.scrollTop > cEle.scrollHeight - cEle.clientHeight) {
1422
- scale = Math.max(
1423
- (cScrollTop - eleStartOffsetTop) / (cEle.scrollHeight - eleStartOffsetTop - cEle.clientHeight),
1424
- 0
1425
- );
1426
- endLineScrollTop = getTopByLine(view.state.doc.lines) + getHeightByLine(view.state.doc.lines);
1427
- blockHeight = 8 + endLineScrollTop - firstLineScrollTop - pEle.clientHeight;
1422
+ scale = (cScrollTop + cEle.clientHeight - eleStartOffsetTop) / (cEle.scrollHeight - eleStartOffsetTop);
1423
+ blockHeight = pEle.scrollHeight - firstLineScrollTop - pEle.clientHeight;
1428
1424
  } else if (realEleStart === ((_f = cEle.firstElementChild) == null ? void 0 : _f.firstElementChild)) {
1429
1425
  if (realEleStart === realEleEnd) {
1430
1426
  eleEndOffsetTop = realEleEnd.offsetTop + realEleEnd.offsetHeight + +getComputedStyle(realEleEnd).marginBottom.replace("px", "");
@@ -640,6 +640,7 @@ const codetabs = (md, _opts) => {
640
640
  const codeCodeText = (_a = _opts.usedLanguageTextRef.value) == null ? void 0 : _a.copyCode.text;
641
641
  const copyBtnHtml = _opts.customIconRef.value.copy || codeCodeText;
642
642
  const isIcon = !!_opts.customIconRef.value.copy;
643
+ const collapseTips = `<span class="${prefix}-collapse-tips">${StrIcon$1("collapse-tips", _opts.customIconRef.value)}</span>`;
643
644
  const [GROUP] = getGroupAndTab(tokens[idx]);
644
645
  if (GROUP === null) {
645
646
  const { open: open2, tagContainer: tagContainer2, tagHeader: tagHeader2 } = getTagType(tokens[idx]);
@@ -656,7 +657,7 @@ const codetabs = (md, _opts) => {
656
657
  <div class="${prefix}-code-action">
657
658
  <span class="${prefix}-code-lang">${tokens[idx].info.trim()}</span>
658
659
  <span class="${prefix}-copy-button" data-tips="${codeCodeText}"${isIcon ? " data-is-icon=true" : ""}">${copyBtnHtml}</span>
659
- <span class="${prefix}-collapse-tips">${StrIcon$1("collapse-tips", _opts.customIconRef.value)}</span>
660
+ ${tagContainer2 === "details" ? collapseTips : ""}
660
661
  </div>
661
662
  </${tagHeader2}>${codeRendered}</${tagContainer2}>`;
662
663
  }
@@ -694,7 +695,7 @@ const codetabs = (md, _opts) => {
694
695
  <div class="${prefix}-code-action">
695
696
  <span class="${prefix}-codetab-lang">${langs}</span>
696
697
  <span class="${prefix}-copy-button" data-tips="${codeCodeText}"${isIcon ? " data-is-icon=true" : ""}">${copyBtnHtml}</span>
697
- <span class="${prefix}-collapse-tips">${StrIcon$1("collapse-tips", _opts.customIconRef.value)}</span>
698
+ ${tagContainer === "details" ? collapseTips : ""}
698
699
  </div>
699
700
  </${tagHeader}>${pres}</${tagContainer}>`;
700
701
  };