vditor 3.11.1 → 3.11.2
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/README.md +2 -1
- package/dist/index.css +2 -2
- package/dist/index.js +132 -25
- package/dist/index.min.js +1 -1
- package/dist/js/i18n/es_ES.js +86 -0
- package/dist/js/i18n/vi_VN.js +86 -0
- package/dist/js/icons/ant.js +1 -1
- package/dist/js/icons/material.js +1 -1
- package/dist/js/lute/lute.min.js +72 -71
- package/dist/method.js +11 -5
- package/dist/method.min.js +1 -1
- package/dist/types/index.d.ts +32 -3
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/ts/markdown/previewRender.ts +1 -1
- package/src/ts/util/fixBrowserBehavior.ts +74 -6
- package/src/ts/util/selection.ts +7 -2
- package/src/ts/wysiwyg/highlightToolbarWYSIWYG.ts +19 -4
|
@@ -65,6 +65,7 @@ export const highlightToolbarWYSIWYG = (vditor: IVditor) => {
|
|
|
65
65
|
if (footnotesElement) {
|
|
66
66
|
vditor.wysiwyg.popover.innerHTML = "";
|
|
67
67
|
genClose(footnotesElement, vditor);
|
|
68
|
+
customWysiwygToolbar(vditor, "footnotes-block")
|
|
68
69
|
setPopoverPosition(vditor, footnotesElement);
|
|
69
70
|
return;
|
|
70
71
|
}
|
|
@@ -195,6 +196,7 @@ export const highlightToolbarWYSIWYG = (vditor: IVditor) => {
|
|
|
195
196
|
if (tocElement) {
|
|
196
197
|
vditor.wysiwyg.popover.innerHTML = "";
|
|
197
198
|
genClose(tocElement, vditor);
|
|
199
|
+
customWysiwygToolbar(vditor, "vditor-toc")
|
|
198
200
|
setPopoverPosition(vditor, tocElement);
|
|
199
201
|
return;
|
|
200
202
|
}
|
|
@@ -206,6 +208,7 @@ export const highlightToolbarWYSIWYG = (vditor: IVditor) => {
|
|
|
206
208
|
genUp(range, blockquoteElement, vditor);
|
|
207
209
|
genDown(range, blockquoteElement, vditor);
|
|
208
210
|
genClose(blockquoteElement, vditor);
|
|
211
|
+
customWysiwygToolbar(vditor, "blockquote")
|
|
209
212
|
setPopoverPosition(vditor, blockquoteElement);
|
|
210
213
|
}
|
|
211
214
|
|
|
@@ -216,7 +219,7 @@ export const highlightToolbarWYSIWYG = (vditor: IVditor) => {
|
|
|
216
219
|
genUp(range, liElement, vditor);
|
|
217
220
|
genDown(range, liElement, vditor);
|
|
218
221
|
genClose(liElement, vditor);
|
|
219
|
-
|
|
222
|
+
customWysiwygToolbar(vditor, "li")
|
|
220
223
|
setPopoverPosition(vditor, liElement);
|
|
221
224
|
}
|
|
222
225
|
|
|
@@ -549,6 +552,7 @@ export const highlightToolbarWYSIWYG = (vditor: IVditor) => {
|
|
|
549
552
|
vditor.wysiwyg.popover.insertAdjacentElement("beforeend", inputWrap);
|
|
550
553
|
vditor.wysiwyg.popover.insertAdjacentHTML("beforeend", " x ");
|
|
551
554
|
vditor.wysiwyg.popover.insertAdjacentElement("beforeend", input2Wrap);
|
|
555
|
+
customWysiwygToolbar(vditor, "table")
|
|
552
556
|
setPopoverPosition(vditor, tableElement);
|
|
553
557
|
}
|
|
554
558
|
|
|
@@ -596,6 +600,7 @@ export const highlightToolbarWYSIWYG = (vditor: IVditor) => {
|
|
|
596
600
|
|
|
597
601
|
genClose(footnotesRefElement, vditor);
|
|
598
602
|
vditor.wysiwyg.popover.insertAdjacentElement("beforeend", inputWrap);
|
|
603
|
+
customWysiwygToolbar(vditor, "footnotes-ref")
|
|
599
604
|
setPopoverPosition(vditor, footnotesRefElement);
|
|
600
605
|
}
|
|
601
606
|
|
|
@@ -684,7 +689,7 @@ export const highlightToolbarWYSIWYG = (vditor: IVditor) => {
|
|
|
684
689
|
}
|
|
685
690
|
const matchLangData: IHintData[] = [];
|
|
686
691
|
const key = language.value.substring(0, language.selectionStart);
|
|
687
|
-
(vditor.options.preview.hljs.langs ||
|
|
692
|
+
(vditor.options.preview.hljs.langs || Constants.ALIAS_CODE_LANGUAGES.concat((window.hljs?.listLanguages() ?? []).sort())).forEach((keyName) => {
|
|
688
693
|
if (keyName.indexOf(key.toLowerCase()) > -1) {
|
|
689
694
|
matchLangData.push({
|
|
690
695
|
html: keyName,
|
|
@@ -696,6 +701,9 @@ export const highlightToolbarWYSIWYG = (vditor: IVditor) => {
|
|
|
696
701
|
event.preventDefault();
|
|
697
702
|
};
|
|
698
703
|
vditor.wysiwyg.popover.insertAdjacentElement("beforeend", languageWrap);
|
|
704
|
+
customWysiwygToolbar(vditor, "code-block")
|
|
705
|
+
} else {
|
|
706
|
+
customWysiwygToolbar(vditor, "block")
|
|
699
707
|
}
|
|
700
708
|
setPopoverPosition(vditor, blockRenderElement);
|
|
701
709
|
} else {
|
|
@@ -735,6 +743,7 @@ export const highlightToolbarWYSIWYG = (vditor: IVditor) => {
|
|
|
735
743
|
genDown(range, headingElement, vditor);
|
|
736
744
|
genClose(headingElement, vditor);
|
|
737
745
|
vditor.wysiwyg.popover.insertAdjacentElement("beforeend", inputWrap);
|
|
746
|
+
customWysiwygToolbar(vditor, "heading")
|
|
738
747
|
setPopoverPosition(vditor, headingElement);
|
|
739
748
|
}
|
|
740
749
|
|
|
@@ -763,7 +772,7 @@ export const highlightToolbarWYSIWYG = (vditor: IVditor) => {
|
|
|
763
772
|
genUp(range, blockElement, vditor);
|
|
764
773
|
genDown(range, blockElement, vditor);
|
|
765
774
|
genClose(blockElement, vditor);
|
|
766
|
-
|
|
775
|
+
customWysiwygToolbar(vditor, "block")
|
|
767
776
|
setPopoverPosition(vditor, blockElement);
|
|
768
777
|
} else {
|
|
769
778
|
vditor.wysiwyg.popover.style.display = "none";
|
|
@@ -864,6 +873,7 @@ export const genLinkRefPopover = (vditor: IVditor, linkRefElement: HTMLElement,
|
|
|
864
873
|
genClose(linkRefElement, vditor);
|
|
865
874
|
vditor.wysiwyg.popover.insertAdjacentElement("beforeend", inputWrap);
|
|
866
875
|
vditor.wysiwyg.popover.insertAdjacentElement("beforeend", input1Wrap);
|
|
876
|
+
customWysiwygToolbar(vditor, "link-ref")
|
|
867
877
|
setPopoverPosition(vditor, linkRefElement);
|
|
868
878
|
};
|
|
869
879
|
|
|
@@ -1058,6 +1068,7 @@ export const genAPopover = (vditor: IVditor, aElement: HTMLElement, range: Range
|
|
|
1058
1068
|
vditor.wysiwyg.popover.insertAdjacentElement("beforeend", inputWrap);
|
|
1059
1069
|
vditor.wysiwyg.popover.insertAdjacentElement("beforeend", input1Wrap);
|
|
1060
1070
|
vditor.wysiwyg.popover.insertAdjacentElement("beforeend", input2Wrap);
|
|
1071
|
+
customWysiwygToolbar(vditor, "a")
|
|
1061
1072
|
setPopoverPosition(vditor, aElement);
|
|
1062
1073
|
};
|
|
1063
1074
|
|
|
@@ -1122,7 +1133,7 @@ export const genImagePopover = (event: Event, vditor: IVditor) => {
|
|
|
1122
1133
|
vditor.wysiwyg.popover.insertAdjacentElement("beforeend", inputWrap);
|
|
1123
1134
|
vditor.wysiwyg.popover.insertAdjacentElement("beforeend", altWrap);
|
|
1124
1135
|
vditor.wysiwyg.popover.insertAdjacentElement("beforeend", titleWrap);
|
|
1125
|
-
|
|
1136
|
+
customWysiwygToolbar(vditor, "image")
|
|
1126
1137
|
setPopoverPosition(vditor, imgElement);
|
|
1127
1138
|
};
|
|
1128
1139
|
|
|
@@ -1137,3 +1148,7 @@ const focusToElement = (event: KeyboardEvent, range: Range) => {
|
|
|
1137
1148
|
return true;
|
|
1138
1149
|
}
|
|
1139
1150
|
};
|
|
1151
|
+
|
|
1152
|
+
const customWysiwygToolbar = (vditor: IVditor, type: TWYSISYGToolbar) => {
|
|
1153
|
+
vditor.options.customWysiwygToolbar(type, vditor.wysiwyg.popover);
|
|
1154
|
+
};
|