md-editor-v3 4.21.0 → 4.21.1
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.
- package/lib/cjs/MdEditor.cjs +73 -27
- package/lib/cjs/chunks/index.cjs +63 -29
- package/lib/cjs/chunks/index3.cjs +11 -11
- package/lib/es/MdEditor.mjs +73 -27
- package/lib/es/chunks/index.mjs +63 -29
- package/lib/es/chunks/index3.mjs +11 -11
- package/lib/umd/index.js +85 -51
- package/package.json +1 -9
package/lib/es/chunks/index.mjs
CHANGED
|
@@ -130,7 +130,7 @@ const useHighlight = (props) => {
|
|
|
130
130
|
watch(
|
|
131
131
|
() => highlight.value.css,
|
|
132
132
|
() => {
|
|
133
|
-
if (props.noHighlight ||
|
|
133
|
+
if (props.noHighlight || configOption.editorExtensions.highlight.instance) {
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
136
|
updateHandler("link", {
|
|
@@ -656,15 +656,19 @@ const codetabs = (md, _opts) => {
|
|
|
656
656
|
};
|
|
657
657
|
tokens[idx].info = tokens[idx].info.replace(mandatoryRe, "");
|
|
658
658
|
const codeRendered = defaultRender(tokens, idx, options, env, slf);
|
|
659
|
-
return
|
|
660
|
-
<${
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
<
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
659
|
+
return `
|
|
660
|
+
<${tagContainer2} ${slf.renderAttrs(tmpToken2)}>
|
|
661
|
+
<${tagHeader2} class="${prefix}-code-head">
|
|
662
|
+
<div class="${prefix}-code-flag"><span></span><span></span><span></span></div>
|
|
663
|
+
<div class="${prefix}-code-action">
|
|
664
|
+
<span class="${prefix}-code-lang">${tokens[idx].info.trim()}</span>
|
|
665
|
+
<span class="${prefix}-copy-button" data-tips="${codeCodeText}"${isIcon ? " data-is-icon=true" : ""}>${copyBtnHtml}</span>
|
|
666
|
+
${tagContainer2 === "details" ? collapseTips : ""}
|
|
667
|
+
</div>
|
|
668
|
+
</${tagHeader2}>
|
|
669
|
+
${codeRendered}
|
|
670
|
+
</${tagContainer2}>
|
|
671
|
+
`;
|
|
668
672
|
}
|
|
669
673
|
let token, group, tab, checked, labels = "", pres = "", langs = "";
|
|
670
674
|
const { open, tagContainer, tagHeader } = getTagType(tokens[idx]);
|
|
@@ -683,26 +687,56 @@ const codetabs = (md, _opts) => {
|
|
|
683
687
|
token.hidden = true;
|
|
684
688
|
const className = `${prefix}-codetab-${_opts.editorId}-${idx}-${i - idx}`;
|
|
685
689
|
checked = i - idx > 0 ? "" : "checked";
|
|
686
|
-
labels +=
|
|
687
|
-
|
|
688
|
-
<
|
|
690
|
+
labels += `
|
|
691
|
+
<li>
|
|
692
|
+
<input
|
|
693
|
+
type="radio"
|
|
694
|
+
id="label-${prefix}-codetab-label-1-${_opts.editorId}-${idx}-${i - idx}"
|
|
695
|
+
name="${prefix}-codetab-label-${_opts.editorId}-${idx}"
|
|
696
|
+
class="${className}"
|
|
697
|
+
${checked}
|
|
698
|
+
>
|
|
699
|
+
<label
|
|
700
|
+
for="label-${prefix}-codetab-label-1-${_opts.editorId}-${idx}-${i - idx}"
|
|
701
|
+
onclick="this.getRootNode().querySelectorAll('.${className}').forEach(e => e.click())"
|
|
702
|
+
>
|
|
703
|
+
${tab || getLangName(token)}
|
|
704
|
+
</label>
|
|
689
705
|
</li>`;
|
|
690
|
-
pres +=
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
<
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
+
pres += `
|
|
707
|
+
<div role="tabpanel">
|
|
708
|
+
<input
|
|
709
|
+
type="radio"
|
|
710
|
+
name="${prefix}-codetab-pre-${_opts.editorId}-${idx}"
|
|
711
|
+
class="${className}"
|
|
712
|
+
${checked}
|
|
713
|
+
role="presentation">
|
|
714
|
+
${defaultRender(tokens, i, options, env, slf)}
|
|
715
|
+
</div>`;
|
|
716
|
+
langs += `
|
|
717
|
+
<input
|
|
718
|
+
type="radio"
|
|
719
|
+
name="${prefix}-codetab-lang-${_opts.editorId}-${idx}"
|
|
720
|
+
class="${className}"
|
|
721
|
+
${checked}
|
|
722
|
+
role="presentation">
|
|
723
|
+
<span class=${prefix}-code-lang role="note">${getLangName(token)}</span>`;
|
|
724
|
+
}
|
|
725
|
+
return `
|
|
726
|
+
<${tagContainer} ${slf.renderAttrs(tmpToken)}>
|
|
727
|
+
<${tagHeader} class="${prefix}-code-head">
|
|
728
|
+
<div class="${prefix}-code-flag">
|
|
729
|
+
<ul class="${prefix}-codetab-label" role="tablist">${labels}</ul>
|
|
730
|
+
</div>
|
|
731
|
+
<div class="${prefix}-code-action">
|
|
732
|
+
<span class="${prefix}-codetab-lang">${langs}</span>
|
|
733
|
+
<span class="${prefix}-copy-button" data-tips="${codeCodeText}"${isIcon ? " data-is-icon=true" : ""}>${copyBtnHtml}</span>
|
|
734
|
+
${tagContainer === "details" ? collapseTips : ""}
|
|
735
|
+
</div>
|
|
736
|
+
</${tagHeader}>
|
|
737
|
+
${pres}
|
|
738
|
+
</${tagContainer}>
|
|
739
|
+
`;
|
|
706
740
|
};
|
|
707
741
|
md.renderer.rules.fence = fenceGroup;
|
|
708
742
|
md.renderer.rules.code_block = fenceGroup;
|
package/lib/es/chunks/index3.mjs
CHANGED
|
@@ -509,6 +509,15 @@ const MdCatalog = /* @__PURE__ */ defineComponent({
|
|
|
509
509
|
const scrollHandler = () => {
|
|
510
510
|
findActiveHeading(state.list);
|
|
511
511
|
};
|
|
512
|
+
const catalogChangedHandler = (_list) => {
|
|
513
|
+
var _a, _b;
|
|
514
|
+
const scrollElement = getScrollElement();
|
|
515
|
+
scrollElementRef.value = scrollElement;
|
|
516
|
+
scrollContainerRef.value = scrollElement === document.documentElement ? document : scrollElement;
|
|
517
|
+
(_a = scrollContainerRef.value) == null ? void 0 : _a.removeEventListener("scroll", scrollHandler);
|
|
518
|
+
findActiveHeading(_list);
|
|
519
|
+
(_b = scrollContainerRef.value) == null ? void 0 : _b.addEventListener("scroll", scrollHandler);
|
|
520
|
+
};
|
|
512
521
|
watch(() => activeItem.value, (nVal) => {
|
|
513
522
|
const activeHeading = nVal ? {
|
|
514
523
|
...nVal
|
|
@@ -521,24 +530,15 @@ const MdCatalog = /* @__PURE__ */ defineComponent({
|
|
|
521
530
|
});
|
|
522
531
|
onMounted(() => {
|
|
523
532
|
rootNodeRef.value = catalogRef.value.getRootNode();
|
|
524
|
-
let scrollElement = getScrollElement();
|
|
525
|
-
scrollElementRef.value = scrollElement;
|
|
526
533
|
bus.on(editorId, {
|
|
527
534
|
name: CATALOG_CHANGED,
|
|
528
|
-
callback:
|
|
529
|
-
var _a, _b;
|
|
530
|
-
scrollElement = getScrollElement();
|
|
531
|
-
scrollElementRef.value = scrollElement;
|
|
532
|
-
scrollContainerRef.value = scrollElement === document.documentElement ? document : scrollElement;
|
|
533
|
-
(_a = scrollContainerRef.value) == null ? void 0 : _a.removeEventListener("scroll", scrollHandler);
|
|
534
|
-
findActiveHeading(_list);
|
|
535
|
-
(_b = scrollContainerRef.value) == null ? void 0 : _b.addEventListener("scroll", scrollHandler);
|
|
536
|
-
}
|
|
535
|
+
callback: catalogChangedHandler
|
|
537
536
|
});
|
|
538
537
|
bus.emit(editorId, PUSH_CATALOG);
|
|
539
538
|
});
|
|
540
539
|
onBeforeUnmount(() => {
|
|
541
540
|
var _a;
|
|
541
|
+
bus.remove(editorId, CATALOG_CHANGED, catalogChangedHandler);
|
|
542
542
|
(_a = scrollContainerRef.value) == null ? void 0 : _a.removeEventListener("scroll", scrollHandler);
|
|
543
543
|
});
|
|
544
544
|
return () => createVNode("div", {
|