autumnnote 1.6.6 → 1.7.0
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 +11 -5
- package/dist/autumnnote.css +164 -0
- package/dist/autumnnote.es.js +426 -31
- package/dist/autumnnote.es.js.map +1 -1
- package/dist/autumnnote.umd.js +426 -31
- package/dist/autumnnote.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/js/Context.js +37 -1
- package/src/js/editing/History.js +10 -0
- package/src/js/i18n/de.js +7 -0
- package/src/js/i18n/en.js +14 -0
- package/src/js/i18n/es.js +7 -0
- package/src/js/i18n/fr.js +7 -0
- package/src/js/i18n/ja.js +7 -0
- package/src/js/i18n/ko.js +7 -0
- package/src/js/i18n/vi.js +7 -0
- package/src/js/i18n/zh.js +7 -0
- package/src/js/index.js +1 -1
- package/src/js/module/BaseDialog.js +7 -0
- package/src/js/module/CodeTooltip.js +23 -0
- package/src/js/module/Editor.js +8 -0
- package/src/js/module/FindReplace.js +31 -6
- package/src/js/module/Mention.js +6 -2
- package/src/js/module/Statusbar.js +3 -3
- package/src/js/module/TableTooltip.js +287 -2
- package/src/js/renderer.js +5 -2
- package/src/styles/autumnnote.scss +181 -0
- package/types/index.d.ts +18 -4
package/dist/autumnnote.es.js
CHANGED
|
@@ -1759,6 +1759,7 @@ var en = {
|
|
|
1759
1759
|
replaceBtn: "Replace",
|
|
1760
1760
|
replaceAllBtn: "Replace All",
|
|
1761
1761
|
noResults: "No results",
|
|
1762
|
+
useRegex: "Use Regular Expression",
|
|
1762
1763
|
close: "×"
|
|
1763
1764
|
},
|
|
1764
1765
|
shortcutsDialog: {
|
|
@@ -1904,7 +1905,8 @@ var en = {
|
|
|
1904
1905
|
enableWordWrap: "Enable Word Wrap",
|
|
1905
1906
|
disableWordWrap: "Disable Word Wrap",
|
|
1906
1907
|
convertToParagraph: "Convert to Paragraph",
|
|
1907
|
-
deleteCodeBlock: "Delete Code Block"
|
|
1908
|
+
deleteCodeBlock: "Delete Code Block",
|
|
1909
|
+
lineNumbers: "Toggle Line Numbers"
|
|
1908
1910
|
},
|
|
1909
1911
|
table: {
|
|
1910
1912
|
ariaLabel: "Table actions",
|
|
@@ -1921,14 +1923,26 @@ var en = {
|
|
|
1921
1923
|
columnWidth: "Column Width",
|
|
1922
1924
|
rowHeight: "Row Height",
|
|
1923
1925
|
tableBorderWidth: "Table Border Width",
|
|
1926
|
+
tableBorderColor: "Table Border Color",
|
|
1924
1927
|
deleteTable: "Delete Table",
|
|
1928
|
+
cellAlignLeft: "Align Left",
|
|
1929
|
+
cellAlignCenter: "Align Center",
|
|
1930
|
+
cellAlignRight: "Align Right",
|
|
1931
|
+
cellAlignJustify: "Align Justify",
|
|
1932
|
+
toggleHeaderRow: "Toggle Header Row",
|
|
1925
1933
|
cellBackground: "Cell Background",
|
|
1926
1934
|
noShading: "No Shading",
|
|
1935
|
+
noBorderColor: "No Border Color",
|
|
1927
1936
|
columnWidthPx: "Column Width (px)",
|
|
1928
1937
|
rowHeightPx: "Row Height (px)",
|
|
1929
1938
|
tableBorderWidthPx: "Table Border Width (px)",
|
|
1930
1939
|
cancelBtn: "Cancel",
|
|
1931
|
-
applyBtn: "Apply"
|
|
1940
|
+
applyBtn: "Apply",
|
|
1941
|
+
sortAsc: "Sort Ascending",
|
|
1942
|
+
sortDesc: "Sort Descending",
|
|
1943
|
+
exportCSV: "Export as CSV",
|
|
1944
|
+
cellPadding: "Cell Padding",
|
|
1945
|
+
cellPaddingPx: "Cell Padding (px)"
|
|
1932
1946
|
},
|
|
1933
1947
|
video: {
|
|
1934
1948
|
ariaLabel: "Video actions",
|
|
@@ -2120,6 +2134,7 @@ var locales = {
|
|
|
2120
2134
|
replaceBtn: "Thay thế",
|
|
2121
2135
|
replaceAllBtn: "Thay thế tất cả",
|
|
2122
2136
|
noResults: "Không có kết quả",
|
|
2137
|
+
useRegex: "Dùng biểu thức chính quy",
|
|
2123
2138
|
close: "×"
|
|
2124
2139
|
},
|
|
2125
2140
|
shortcutsDialog: {
|
|
@@ -2261,7 +2276,8 @@ var locales = {
|
|
|
2261
2276
|
enableWordWrap: "Bật xuống dòng",
|
|
2262
2277
|
disableWordWrap: "Tắt xuống dòng",
|
|
2263
2278
|
convertToParagraph: "Chuyển thành đoạn văn",
|
|
2264
|
-
deleteCodeBlock: "Xóa khối mã"
|
|
2279
|
+
deleteCodeBlock: "Xóa khối mã",
|
|
2280
|
+
lineNumbers: "Bật/Tắt số dòng"
|
|
2265
2281
|
},
|
|
2266
2282
|
table: {
|
|
2267
2283
|
ariaLabel: "Hành động bảng",
|
|
@@ -2285,7 +2301,12 @@ var locales = {
|
|
|
2285
2301
|
rowHeightPx: "Chiều cao hàng (px)",
|
|
2286
2302
|
tableBorderWidthPx: "Độ rộng viền bảng (px)",
|
|
2287
2303
|
cancelBtn: "Hủy",
|
|
2288
|
-
applyBtn: "Áp dụng"
|
|
2304
|
+
applyBtn: "Áp dụng",
|
|
2305
|
+
sortAsc: "Sắp xếp tăng dần",
|
|
2306
|
+
sortDesc: "Sắp xếp giảm dần",
|
|
2307
|
+
exportCSV: "Xuất CSV",
|
|
2308
|
+
cellPadding: "Khoảng đệm ô",
|
|
2309
|
+
cellPaddingPx: "Khoảng đệm ô (px)"
|
|
2289
2310
|
},
|
|
2290
2311
|
video: {
|
|
2291
2312
|
ariaLabel: "Hành động video",
|
|
@@ -2452,6 +2473,7 @@ var locales = {
|
|
|
2452
2473
|
replaceAriaLabel: "置換後のテキスト",
|
|
2453
2474
|
replaceBtn: "置換",
|
|
2454
2475
|
noResults: "結果なし",
|
|
2476
|
+
useRegex: "正規表現を使用",
|
|
2455
2477
|
replaceAllBtn: "すべて置換",
|
|
2456
2478
|
close: "×"
|
|
2457
2479
|
},
|
|
@@ -2594,7 +2616,8 @@ var locales = {
|
|
|
2594
2616
|
enableWordWrap: "折り返しを有効にする",
|
|
2595
2617
|
disableWordWrap: "折り返しを無効にする",
|
|
2596
2618
|
convertToParagraph: "段落に変換",
|
|
2597
|
-
deleteCodeBlock: "コードブロックを削除"
|
|
2619
|
+
deleteCodeBlock: "コードブロックを削除",
|
|
2620
|
+
lineNumbers: "行番号を切り替え"
|
|
2598
2621
|
},
|
|
2599
2622
|
table: {
|
|
2600
2623
|
ariaLabel: "テーブル操作",
|
|
@@ -2616,7 +2639,12 @@ var locales = {
|
|
|
2616
2639
|
rowHeightPx: "行の高さ (px)",
|
|
2617
2640
|
tableBorderWidthPx: "テーブルの枠幅 (px)",
|
|
2618
2641
|
cancelBtn: "キャンセル",
|
|
2619
|
-
applyBtn: "適用"
|
|
2642
|
+
applyBtn: "適用",
|
|
2643
|
+
sortAsc: "昇順で並べ替え",
|
|
2644
|
+
sortDesc: "降順で並べ替え",
|
|
2645
|
+
exportCSV: "CSVとしてエクスポート",
|
|
2646
|
+
cellPadding: "セルの余白",
|
|
2647
|
+
cellPaddingPx: "セルの余白 (px)"
|
|
2620
2648
|
},
|
|
2621
2649
|
video: {
|
|
2622
2650
|
ariaLabel: "動画操作",
|
|
@@ -2783,6 +2811,7 @@ var locales = {
|
|
|
2783
2811
|
replaceAriaLabel: "替换为",
|
|
2784
2812
|
replaceBtn: "替换",
|
|
2785
2813
|
noResults: "没有结果",
|
|
2814
|
+
useRegex: "使用正则表达式",
|
|
2786
2815
|
replaceAllBtn: "全部替换",
|
|
2787
2816
|
close: "×"
|
|
2788
2817
|
},
|
|
@@ -2925,7 +2954,8 @@ var locales = {
|
|
|
2925
2954
|
enableWordWrap: "启用自动换行",
|
|
2926
2955
|
disableWordWrap: "禁用自动换行",
|
|
2927
2956
|
convertToParagraph: "转换为段落",
|
|
2928
|
-
deleteCodeBlock: "删除代码块"
|
|
2957
|
+
deleteCodeBlock: "删除代码块",
|
|
2958
|
+
lineNumbers: "切换行号"
|
|
2929
2959
|
},
|
|
2930
2960
|
table: {
|
|
2931
2961
|
ariaLabel: "表格操作",
|
|
@@ -2947,7 +2977,12 @@ var locales = {
|
|
|
2947
2977
|
rowHeightPx: "行高 (px)",
|
|
2948
2978
|
tableBorderWidthPx: "表格边框宽度 (px)",
|
|
2949
2979
|
cancelBtn: "取消",
|
|
2950
|
-
applyBtn: "应用"
|
|
2980
|
+
applyBtn: "应用",
|
|
2981
|
+
sortAsc: "升序排列",
|
|
2982
|
+
sortDesc: "降序排列",
|
|
2983
|
+
exportCSV: "导出为 CSV",
|
|
2984
|
+
cellPadding: "单元格内边距",
|
|
2985
|
+
cellPaddingPx: "单元格内边距 (px)"
|
|
2951
2986
|
},
|
|
2952
2987
|
video: {
|
|
2953
2988
|
ariaLabel: "视频操作",
|
|
@@ -3114,6 +3149,7 @@ var locales = {
|
|
|
3114
3149
|
replaceAriaLabel: "Remplacer par",
|
|
3115
3150
|
replaceBtn: "Remplacer",
|
|
3116
3151
|
noResults: "Aucun résultat",
|
|
3152
|
+
useRegex: "Utiliser une expression régulière",
|
|
3117
3153
|
replaceAllBtn: "Tout remplacer",
|
|
3118
3154
|
close: "×"
|
|
3119
3155
|
},
|
|
@@ -3256,7 +3292,8 @@ var locales = {
|
|
|
3256
3292
|
enableWordWrap: "Activer le retour à la ligne",
|
|
3257
3293
|
disableWordWrap: "Désactiver le retour à la ligne",
|
|
3258
3294
|
convertToParagraph: "Convertir en paragraphe",
|
|
3259
|
-
deleteCodeBlock: "Supprimer le bloc de code"
|
|
3295
|
+
deleteCodeBlock: "Supprimer le bloc de code",
|
|
3296
|
+
lineNumbers: "Activer/désactiver les numéros de ligne"
|
|
3260
3297
|
},
|
|
3261
3298
|
table: {
|
|
3262
3299
|
ariaLabel: "Actions du tableau",
|
|
@@ -3278,7 +3315,12 @@ var locales = {
|
|
|
3278
3315
|
rowHeightPx: "Hauteur de ligne (px)",
|
|
3279
3316
|
tableBorderWidthPx: "Épaisseur des bordures (px)",
|
|
3280
3317
|
cancelBtn: "Annuler",
|
|
3281
|
-
applyBtn: "Appliquer"
|
|
3318
|
+
applyBtn: "Appliquer",
|
|
3319
|
+
sortAsc: "Trier par ordre croissant",
|
|
3320
|
+
sortDesc: "Trier par ordre décroissant",
|
|
3321
|
+
exportCSV: "Exporter en CSV",
|
|
3322
|
+
cellPadding: "Rembourrage des cellules",
|
|
3323
|
+
cellPaddingPx: "Rembourrage des cellules (px)"
|
|
3282
3324
|
},
|
|
3283
3325
|
video: {
|
|
3284
3326
|
ariaLabel: "Actions de la vidéo",
|
|
@@ -3445,6 +3487,7 @@ var locales = {
|
|
|
3445
3487
|
replaceAriaLabel: "Ersetzen durch",
|
|
3446
3488
|
replaceBtn: "Ersetzen",
|
|
3447
3489
|
noResults: "Keine Ergebnisse",
|
|
3490
|
+
useRegex: "Regulären Ausdruck verwenden",
|
|
3448
3491
|
replaceAllBtn: "Alle ersetzen",
|
|
3449
3492
|
close: "×"
|
|
3450
3493
|
},
|
|
@@ -3587,7 +3630,8 @@ var locales = {
|
|
|
3587
3630
|
enableWordWrap: "Zeilenumbruch aktivieren",
|
|
3588
3631
|
disableWordWrap: "Zeilenumbruch deaktivieren",
|
|
3589
3632
|
convertToParagraph: "In Absatz umwandeln",
|
|
3590
|
-
deleteCodeBlock: "Codeblock löschen"
|
|
3633
|
+
deleteCodeBlock: "Codeblock löschen",
|
|
3634
|
+
lineNumbers: "Zeilennummern umschalten"
|
|
3591
3635
|
},
|
|
3592
3636
|
table: {
|
|
3593
3637
|
ariaLabel: "Tabellen-Aktionen",
|
|
@@ -3609,7 +3653,12 @@ var locales = {
|
|
|
3609
3653
|
rowHeightPx: "Zeilenhöhe (px)",
|
|
3610
3654
|
tableBorderWidthPx: "Tabellenrahmenbreite (px)",
|
|
3611
3655
|
cancelBtn: "Abbrechen",
|
|
3612
|
-
applyBtn: "Anwenden"
|
|
3656
|
+
applyBtn: "Anwenden",
|
|
3657
|
+
sortAsc: "Aufsteigend sortieren",
|
|
3658
|
+
sortDesc: "Absteigend sortieren",
|
|
3659
|
+
exportCSV: "Als CSV exportieren",
|
|
3660
|
+
cellPadding: "Zellauffüllung",
|
|
3661
|
+
cellPaddingPx: "Zellauffüllung (px)"
|
|
3613
3662
|
},
|
|
3614
3663
|
video: {
|
|
3615
3664
|
ariaLabel: "Video-Aktionen",
|
|
@@ -3776,6 +3825,7 @@ var locales = {
|
|
|
3776
3825
|
replaceAriaLabel: "Reemplazar con",
|
|
3777
3826
|
replaceBtn: "Reemplazar",
|
|
3778
3827
|
noResults: "Sin resultados",
|
|
3828
|
+
useRegex: "Usar expresión regular",
|
|
3779
3829
|
replaceAllBtn: "Reemplazar todo",
|
|
3780
3830
|
close: "×"
|
|
3781
3831
|
},
|
|
@@ -3918,7 +3968,8 @@ var locales = {
|
|
|
3918
3968
|
enableWordWrap: "Activar ajuste de línea",
|
|
3919
3969
|
disableWordWrap: "Desactivar ajuste de línea",
|
|
3920
3970
|
convertToParagraph: "Convertir en párrafo",
|
|
3921
|
-
deleteCodeBlock: "Eliminar bloque de código"
|
|
3971
|
+
deleteCodeBlock: "Eliminar bloque de código",
|
|
3972
|
+
lineNumbers: "Alternar números de línea"
|
|
3922
3973
|
},
|
|
3923
3974
|
table: {
|
|
3924
3975
|
ariaLabel: "Acciones de tabla",
|
|
@@ -3940,7 +3991,12 @@ var locales = {
|
|
|
3940
3991
|
rowHeightPx: "Alto de fila (px)",
|
|
3941
3992
|
tableBorderWidthPx: "Grosor del borde (px)",
|
|
3942
3993
|
cancelBtn: "Cancelar",
|
|
3943
|
-
applyBtn: "Aplicar"
|
|
3994
|
+
applyBtn: "Aplicar",
|
|
3995
|
+
sortAsc: "Ordenar ascendente",
|
|
3996
|
+
sortDesc: "Ordenar descendente",
|
|
3997
|
+
exportCSV: "Exportar como CSV",
|
|
3998
|
+
cellPadding: "Relleno de celda",
|
|
3999
|
+
cellPaddingPx: "Relleno de celda (px)"
|
|
3944
4000
|
},
|
|
3945
4001
|
video: {
|
|
3946
4002
|
ariaLabel: "Acciones de vídeo",
|
|
@@ -4107,6 +4163,7 @@ var locales = {
|
|
|
4107
4163
|
replaceAriaLabel: "바꿀 내용",
|
|
4108
4164
|
replaceBtn: "바꾸기",
|
|
4109
4165
|
noResults: "결과 없음",
|
|
4166
|
+
useRegex: "정규식 사용",
|
|
4110
4167
|
replaceAllBtn: "모두 바꾸기",
|
|
4111
4168
|
close: "×"
|
|
4112
4169
|
},
|
|
@@ -4249,7 +4306,8 @@ var locales = {
|
|
|
4249
4306
|
enableWordWrap: "줄 바꿈 사용",
|
|
4250
4307
|
disableWordWrap: "줄 바꿈 해제",
|
|
4251
4308
|
convertToParagraph: "단락으로 변환",
|
|
4252
|
-
deleteCodeBlock: "코드 블록 삭제"
|
|
4309
|
+
deleteCodeBlock: "코드 블록 삭제",
|
|
4310
|
+
lineNumbers: "줄 번호 전환"
|
|
4253
4311
|
},
|
|
4254
4312
|
table: {
|
|
4255
4313
|
ariaLabel: "표 작업",
|
|
@@ -4271,7 +4329,12 @@ var locales = {
|
|
|
4271
4329
|
rowHeightPx: "행 높이 (px)",
|
|
4272
4330
|
tableBorderWidthPx: "표 테두리 너비 (px)",
|
|
4273
4331
|
cancelBtn: "취소",
|
|
4274
|
-
applyBtn: "적용"
|
|
4332
|
+
applyBtn: "적용",
|
|
4333
|
+
sortAsc: "오름차순 정렬",
|
|
4334
|
+
sortDesc: "내림차순 정렬",
|
|
4335
|
+
exportCSV: "CSV로 내보내기",
|
|
4336
|
+
cellPadding: "셀 패딩",
|
|
4337
|
+
cellPaddingPx: "셀 패딩 (px)"
|
|
4275
4338
|
},
|
|
4276
4339
|
video: {
|
|
4277
4340
|
ariaLabel: "동영상 작업",
|
|
@@ -4485,6 +4548,9 @@ function renderLayout(targetEl, options) {
|
|
|
4485
4548
|
if (options.theme === "dark") {
|
|
4486
4549
|
container.classList.add("an-theme-dark");
|
|
4487
4550
|
document.body.classList.add("an-theme-dark");
|
|
4551
|
+
} else if (options.theme === "auto") {
|
|
4552
|
+
container.classList.add("an-theme-auto");
|
|
4553
|
+
document.body.classList.add("an-theme-auto");
|
|
4488
4554
|
}
|
|
4489
4555
|
if (options.readOnly) {
|
|
4490
4556
|
container.classList.add("an-disabled");
|
|
@@ -4710,6 +4776,14 @@ var History = class {
|
|
|
4710
4776
|
canRedo() {
|
|
4711
4777
|
return this.stackOffset < this.stack.length - 1;
|
|
4712
4778
|
}
|
|
4779
|
+
/** @returns {number} */
|
|
4780
|
+
getUndoCount() {
|
|
4781
|
+
return Math.max(0, this.stackOffset);
|
|
4782
|
+
}
|
|
4783
|
+
/** @returns {number} */
|
|
4784
|
+
getRedoCount() {
|
|
4785
|
+
return Math.max(0, this.stack.length - 1 - this.stackOffset);
|
|
4786
|
+
}
|
|
4713
4787
|
};
|
|
4714
4788
|
//#endregion
|
|
4715
4789
|
//#region src/js/editing/Table.js
|
|
@@ -5782,6 +5856,12 @@ var Editor = class {
|
|
|
5782
5856
|
canRedo() {
|
|
5783
5857
|
return this._history ? this._history.canRedo() : false;
|
|
5784
5858
|
}
|
|
5859
|
+
getUndoCount() {
|
|
5860
|
+
return this._history ? this._history.getUndoCount() : 0;
|
|
5861
|
+
}
|
|
5862
|
+
getRedoCount() {
|
|
5863
|
+
return this._history ? this._history.getRedoCount() : 0;
|
|
5864
|
+
}
|
|
5785
5865
|
bold() {
|
|
5786
5866
|
bold();
|
|
5787
5867
|
this.afterCommand();
|
|
@@ -6643,9 +6723,21 @@ var Statusbar = class {
|
|
|
6643
6723
|
this._bindResize(handle);
|
|
6644
6724
|
this.el.appendChild(handle);
|
|
6645
6725
|
}
|
|
6646
|
-
this._wordCountEl = createElement("span", {
|
|
6647
|
-
|
|
6648
|
-
|
|
6726
|
+
this._wordCountEl = createElement("span", {
|
|
6727
|
+
class: "an-word-count",
|
|
6728
|
+
role: "status",
|
|
6729
|
+
"aria-live": "polite",
|
|
6730
|
+
"aria-atomic": "true"
|
|
6731
|
+
});
|
|
6732
|
+
this._charCountEl = createElement("span", {
|
|
6733
|
+
class: "an-char-count",
|
|
6734
|
+
"aria-live": "polite",
|
|
6735
|
+
"aria-atomic": "true"
|
|
6736
|
+
});
|
|
6737
|
+
const info = createElement("div", {
|
|
6738
|
+
class: "an-status-info",
|
|
6739
|
+
"aria-label": "Editor statistics"
|
|
6740
|
+
});
|
|
6649
6741
|
info.appendChild(this._wordCountEl);
|
|
6650
6742
|
info.appendChild(this._charCountEl);
|
|
6651
6743
|
this.el.appendChild(info);
|
|
@@ -7303,6 +7395,10 @@ var BaseDialog = class {
|
|
|
7303
7395
|
this._firstInput = null;
|
|
7304
7396
|
this._removeTrap = null;
|
|
7305
7397
|
}
|
|
7398
|
+
/** @returns {HTMLElement} */
|
|
7399
|
+
_buildDialog() {
|
|
7400
|
+
throw new Error("_buildDialog() must be implemented by subclass");
|
|
7401
|
+
}
|
|
7306
7402
|
initialize() {
|
|
7307
7403
|
this._dialog = this._buildDialog();
|
|
7308
7404
|
document.body.appendChild(this._dialog);
|
|
@@ -9085,7 +9181,17 @@ var ICONS$2 = {
|
|
|
9085
9181
|
tableBorder: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6" stroke-width="1"/><line x1="3" y1="13" x2="21" y2="13" stroke-width="2"/><line x1="3" y1="20" x2="21" y2="20" stroke-width="3"/></svg>`,
|
|
9086
9182
|
deleteTable: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/><line x1="9" y1="3" x2="9" y2="21"/><line x1="15" y1="3" x2="15" y2="21"/><line x1="16" y1="16" x2="22" y2="22" stroke="#ef4444"/><line x1="22" y1="16" x2="16" y2="22" stroke="#ef4444"/></svg>`,
|
|
9087
9183
|
selectCells: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 4 L4 20 L9 15 L12 21 L14 20 L11 14 L17 14 Z" fill="currentColor" opacity="0.15"/><path d="M4 4 L4 20 L9 15 L12 21 L14 20 L11 14 L17 14 Z"/></svg>`,
|
|
9088
|
-
cellShade: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 11L8.93 3.36a1 1 0 0 0-1.29.08L3.22 7.8a1 1 0 0 0-.07 1.29L11 20"/><path d="m5 14 5-5"/><path d="M22 22a2 2 0 0 1-2 2h-3a2 2 0 0 1-2-2c0-1.5 2.5-5 3.5-5s3.5 3.5 3.5 5z"/></svg
|
|
9184
|
+
cellShade: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 11L8.93 3.36a1 1 0 0 0-1.29.08L3.22 7.8a1 1 0 0 0-.07 1.29L11 20"/><path d="m5 14 5-5"/><path d="M22 22a2 2 0 0 1-2 2h-3a2 2 0 0 1-2-2c0-1.5 2.5-5 3.5-5s3.5 3.5 3.5 5z"/></svg>`,
|
|
9185
|
+
borderColor: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="14" rx="1"/><line x1="3" y1="10" x2="21" y2="10" stroke-width="1.5"/><line x1="12" y1="3" x2="12" y2="17" stroke-width="1.5"/><path d="M3 21h18" stroke-width="3"/></svg>`,
|
|
9186
|
+
alignLeft: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="21" y1="6" x2="3" y2="6"/><line x1="15" y1="12" x2="3" y2="12"/><line x1="17" y1="18" x2="3" y2="18"/></svg>`,
|
|
9187
|
+
alignCenter: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="21" y1="6" x2="3" y2="6"/><line x1="17" y1="12" x2="7" y2="12"/><line x1="19" y1="18" x2="5" y2="18"/></svg>`,
|
|
9188
|
+
alignRight: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="12" x2="9" y2="12"/><line x1="21" y1="18" x2="7" y2="18"/></svg>`,
|
|
9189
|
+
alignJustify: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="12" x2="3" y2="12"/><line x1="21" y1="18" x2="3" y2="18"/></svg>`,
|
|
9190
|
+
headerRow: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><rect x="3" y="3" width="18" height="8" rx="1" fill="currentColor" opacity="0.2"/><line x1="3" y1="11" x2="21" y2="11"/><line x1="3" y1="16" x2="21" y2="16"/><line x1="9" y1="11" x2="9" y2="21"/><line x1="15" y1="11" x2="15" y2="21"/></svg>`,
|
|
9191
|
+
sortAsc: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" y1="6" x2="11" y2="6"/><line x1="4" y1="12" x2="11" y2="12"/><line x1="4" y1="18" x2="13" y2="18"/><path d="M15 9l3-3 3 3"/><line x1="18" y1="6" x2="18" y2="18"/></svg>`,
|
|
9192
|
+
sortDesc: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" y1="6" x2="13" y2="6"/><line x1="4" y1="12" x2="11" y2="12"/><line x1="4" y1="18" x2="11" y2="18"/><path d="M15 15l3 3 3-3"/><line x1="18" y1="6" x2="18" y2="18"/></svg>`,
|
|
9193
|
+
exportCSV: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>`,
|
|
9194
|
+
cellPadding: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><rect x="7" y="7" width="10" height="10" rx="0.5" stroke-dasharray="2 1.5"/></svg>`
|
|
9089
9195
|
};
|
|
9090
9196
|
var SHADE_PRESETS = [
|
|
9091
9197
|
"#000000",
|
|
@@ -9130,6 +9236,10 @@ var TableTooltip = class {
|
|
|
9130
9236
|
this._shadePopover = null;
|
|
9131
9237
|
this._shadeTitleEl = null;
|
|
9132
9238
|
this._shadeColorStrip = null;
|
|
9239
|
+
this._borderColorPopover = null;
|
|
9240
|
+
this._borderColorTitleEl = null;
|
|
9241
|
+
this._borderColorStrip = null;
|
|
9242
|
+
this._borderColorNoBtn = null;
|
|
9133
9243
|
this._selectMode = false;
|
|
9134
9244
|
this._selectedCells = [];
|
|
9135
9245
|
this._selectStart = null;
|
|
@@ -9144,6 +9254,8 @@ var TableTooltip = class {
|
|
|
9144
9254
|
document.body.appendChild(this._sizePopover);
|
|
9145
9255
|
this._shadePopover = this._buildCellShadePopover();
|
|
9146
9256
|
document.body.appendChild(this._shadePopover);
|
|
9257
|
+
this._borderColorPopover = this._buildBorderColorPopover();
|
|
9258
|
+
document.body.appendChild(this._borderColorPopover);
|
|
9147
9259
|
const editable = this.context.layoutInfo.editable;
|
|
9148
9260
|
this._editable = editable;
|
|
9149
9261
|
const onSelMousedown = (e) => {
|
|
@@ -9185,7 +9297,7 @@ var TableTooltip = class {
|
|
|
9185
9297
|
}, { passive: true }), on(document, "click", (e) => {
|
|
9186
9298
|
const et = e.target;
|
|
9187
9299
|
if (this._selectMode && this._activeTable?.contains(et)) return;
|
|
9188
|
-
if (this._activeTable && !this._activeTable.contains(et) && !this._el.contains(et) && !this._sizePopover?.contains(et)) this._hide();
|
|
9300
|
+
if (this._activeTable && !this._activeTable.contains(et) && !this._el.contains(et) && !this._sizePopover?.contains(et) && !this._borderColorPopover?.contains(et)) this._hide();
|
|
9189
9301
|
}), on(document, "selectionchange", () => this._syncShadeStrip()), on(globalThis, "scroll", () => this._hide(), { passive: true }), on(globalThis, "resize", () => this._hide(), { passive: true }));
|
|
9190
9302
|
this._initResize();
|
|
9191
9303
|
return this;
|
|
@@ -9320,6 +9432,8 @@ var TableTooltip = class {
|
|
|
9320
9432
|
this._sizePopover = null;
|
|
9321
9433
|
if (this._shadePopover?.parentNode) this._shadePopover.remove();
|
|
9322
9434
|
this._shadePopover = null;
|
|
9435
|
+
if (this._borderColorPopover?.parentNode) this._borderColorPopover.remove();
|
|
9436
|
+
this._borderColorPopover = null;
|
|
9323
9437
|
}
|
|
9324
9438
|
_buildTooltip() {
|
|
9325
9439
|
const L = this.context.locale.tooltips.table;
|
|
@@ -9343,10 +9457,18 @@ var TableTooltip = class {
|
|
|
9343
9457
|
el.appendChild(this._makeBtn(ICONS$2.colLeft, L.addColumnLeft, () => this._addColumn("left")));
|
|
9344
9458
|
el.appendChild(this._makeBtn(ICONS$2.colRight, L.addColumnRight, () => this._addColumn("right")));
|
|
9345
9459
|
el.appendChild(this._makeBtn(ICONS$2.deleteCol, L.deleteColumn, () => this._deleteColumn()));
|
|
9460
|
+
el.appendChild(this._makeBtn(ICONS$2.sortAsc, L.sortAsc, () => this._sortColumn("asc")));
|
|
9461
|
+
el.appendChild(this._makeBtn(ICONS$2.sortDesc, L.sortDesc, () => this._sortColumn("desc")));
|
|
9346
9462
|
el.appendChild(this._sep());
|
|
9347
9463
|
el.appendChild(this._makeBtn(ICONS$2.mergeCells, L.mergeCells, () => this._mergeCells()));
|
|
9348
9464
|
el.appendChild(this._makeBtn(ICONS$2.unmergeCells, L.unmergeCells, () => this._unmergeCells()));
|
|
9349
9465
|
el.appendChild(this._sep());
|
|
9466
|
+
el.appendChild(this._makeBtn(ICONS$2.alignLeft, L.cellAlignLeft, () => this._applyCellAlign("left")));
|
|
9467
|
+
el.appendChild(this._makeBtn(ICONS$2.alignCenter, L.cellAlignCenter, () => this._applyCellAlign("center")));
|
|
9468
|
+
el.appendChild(this._makeBtn(ICONS$2.alignRight, L.cellAlignRight, () => this._applyCellAlign("right")));
|
|
9469
|
+
el.appendChild(this._makeBtn(ICONS$2.alignJustify, L.cellAlignJustify, () => this._applyCellAlign("justify")));
|
|
9470
|
+
el.appendChild(this._makeBtn(ICONS$2.headerRow, L.toggleHeaderRow, () => this._toggleHeaderRow()));
|
|
9471
|
+
el.appendChild(this._sep());
|
|
9350
9472
|
const shadeBtn = createElement("button", {
|
|
9351
9473
|
type: "button",
|
|
9352
9474
|
class: "an-link-tooltip-btn an-link-tooltip-btn--shade",
|
|
@@ -9368,12 +9490,33 @@ var TableTooltip = class {
|
|
|
9368
9490
|
el.appendChild(this._makeBtn(ICONS$2.colWidth, L.columnWidth, () => this._openSizePopover("col")));
|
|
9369
9491
|
el.appendChild(this._makeBtn(ICONS$2.rowHeight, L.rowHeight, () => this._openSizePopover("row")));
|
|
9370
9492
|
el.appendChild(this._makeBtn(ICONS$2.tableBorder, L.tableBorderWidth, () => this._openSizePopover("border")));
|
|
9493
|
+
el.appendChild(this._makeBtn(ICONS$2.cellPadding, L.cellPadding, () => this._openSizePopover("cellPadding")));
|
|
9494
|
+
const borderColorBtn = createElement("button", {
|
|
9495
|
+
type: "button",
|
|
9496
|
+
class: "an-link-tooltip-btn an-link-tooltip-btn--shade",
|
|
9497
|
+
title: L.tableBorderColor
|
|
9498
|
+
});
|
|
9499
|
+
const borderColorSvgWrap = createElement("span", { class: "an-bubble-btn-svg" });
|
|
9500
|
+
borderColorSvgWrap.innerHTML = ICONS$2.borderColor;
|
|
9501
|
+
const borderColorStrip = createElement("span", { class: "an-link-tooltip-color-strip" });
|
|
9502
|
+
borderColorBtn.appendChild(borderColorSvgWrap);
|
|
9503
|
+
borderColorBtn.appendChild(borderColorStrip);
|
|
9504
|
+
this._borderColorStrip = borderColorStrip;
|
|
9505
|
+
this._disposers.push(on(borderColorBtn, "click", (e) => {
|
|
9506
|
+
e.preventDefault();
|
|
9507
|
+
e.stopPropagation();
|
|
9508
|
+
this._openBorderColorPopover();
|
|
9509
|
+
}));
|
|
9510
|
+
el.appendChild(borderColorBtn);
|
|
9371
9511
|
el.appendChild(this._sep());
|
|
9372
9512
|
el.appendChild(this._makeBtn(ICONS$2.deleteTable, L.deleteTable, () => this._deleteTable(), true));
|
|
9513
|
+
el.appendChild(this._sep());
|
|
9514
|
+
el.appendChild(this._makeBtn(ICONS$2.exportCSV, L.exportCSV, () => this._exportTableCSV()));
|
|
9373
9515
|
this._disposers.push(on(el, "mouseenter", () => this._clearTimers()), on(el, "mouseleave", () => {
|
|
9374
9516
|
if (this._selectMode) return;
|
|
9375
9517
|
if (this._sizePopover && this._sizePopover.style.display !== "none") return;
|
|
9376
9518
|
if (this._shadePopover && this._shadePopover.style.display !== "none") return;
|
|
9519
|
+
if (this._borderColorPopover && this._borderColorPopover.style.display !== "none") return;
|
|
9377
9520
|
this._scheduleHide();
|
|
9378
9521
|
}));
|
|
9379
9522
|
return el;
|
|
@@ -9421,6 +9564,7 @@ var TableTooltip = class {
|
|
|
9421
9564
|
if (!this._activeTable) return;
|
|
9422
9565
|
this._el.style.display = "flex";
|
|
9423
9566
|
this._syncShadeStrip();
|
|
9567
|
+
this._syncBorderColorStrip();
|
|
9424
9568
|
requestAnimationFrame(() => {
|
|
9425
9569
|
if (this._activeTable) this._positionNear(this._activeTable);
|
|
9426
9570
|
});
|
|
@@ -9442,6 +9586,7 @@ var TableTooltip = class {
|
|
|
9442
9586
|
this._clearSelection();
|
|
9443
9587
|
this._clearTimers();
|
|
9444
9588
|
this._hideSizePopover();
|
|
9589
|
+
this._hideBorderColorPopover();
|
|
9445
9590
|
}
|
|
9446
9591
|
_clearTimers() {
|
|
9447
9592
|
clearTimeout(this._showTimer);
|
|
@@ -9841,6 +9986,19 @@ var TableTooltip = class {
|
|
|
9841
9986
|
});
|
|
9842
9987
|
this.context.invoke("editor.afterCommand");
|
|
9843
9988
|
};
|
|
9989
|
+
} else if (type === "cellPadding") {
|
|
9990
|
+
const firstCell = this._getSelectedCells()[0] || this._getCell();
|
|
9991
|
+
const currentPad = firstCell ? Number.parseInt(firstCell.style.padding, 10) || Number.parseInt(firstCell.style.paddingTop, 10) || 4 : 4;
|
|
9992
|
+
this._sizeTitleEl.textContent = this.context.locale.tooltips.table.cellPaddingPx;
|
|
9993
|
+
this._sizeInputEl.min = "0";
|
|
9994
|
+
this._sizeInputEl.max = "40";
|
|
9995
|
+
this._sizeInputEl.value = String(currentPad);
|
|
9996
|
+
this._sizeApply = (val) => {
|
|
9997
|
+
this._getSelectedCells().forEach((c) => {
|
|
9998
|
+
if (c) c.style.padding = `${val}px`;
|
|
9999
|
+
});
|
|
10000
|
+
this.context.invoke("editor.afterCommand");
|
|
10001
|
+
};
|
|
9844
10002
|
} else {
|
|
9845
10003
|
const isCol = type === "col";
|
|
9846
10004
|
const activeCells = this._getSelectedCells().filter((c) => {
|
|
@@ -9937,7 +10095,7 @@ var TableTooltip = class {
|
|
|
9937
10095
|
value: "#ffffff"
|
|
9938
10096
|
});
|
|
9939
10097
|
const customLabel = createElement("span");
|
|
9940
|
-
customLabel.textContent =
|
|
10098
|
+
customLabel.textContent = this.context.locale.contextMenu.customColorLabel;
|
|
9941
10099
|
this._disposers.push(on(colorInput, "change", () => this._applyCellShade(colorInput.value)));
|
|
9942
10100
|
customRow.appendChild(colorInput);
|
|
9943
10101
|
customRow.appendChild(customLabel);
|
|
@@ -9978,6 +10136,172 @@ var TableTooltip = class {
|
|
|
9978
10136
|
this._hideCellShadePopover();
|
|
9979
10137
|
this.context.invoke("editor.afterCommand");
|
|
9980
10138
|
}
|
|
10139
|
+
_buildBorderColorPopover() {
|
|
10140
|
+
const pop = createElement("div", { class: "an-cell-shade-popover" });
|
|
10141
|
+
pop.style.display = "none";
|
|
10142
|
+
const title = createElement("div", { class: "an-size-popover-title" });
|
|
10143
|
+
pop.appendChild(title);
|
|
10144
|
+
this._borderColorTitleEl = title;
|
|
10145
|
+
const palette = createElement("div", { class: "an-context-color-palette" });
|
|
10146
|
+
SHADE_PRESETS.forEach((color) => {
|
|
10147
|
+
const sw = createElement("div", {
|
|
10148
|
+
class: "an-context-color-swatch",
|
|
10149
|
+
title: color
|
|
10150
|
+
});
|
|
10151
|
+
sw.style.background = color;
|
|
10152
|
+
this._disposers.push(on(sw, "click", (e) => {
|
|
10153
|
+
e.stopPropagation();
|
|
10154
|
+
this._applyBorderColor(color);
|
|
10155
|
+
}));
|
|
10156
|
+
palette.appendChild(sw);
|
|
10157
|
+
});
|
|
10158
|
+
pop.appendChild(palette);
|
|
10159
|
+
const noColorRow = createElement("div", { class: "an-context-color-custom" });
|
|
10160
|
+
const noColorBtn = createElement("button", {
|
|
10161
|
+
type: "button",
|
|
10162
|
+
class: "an-shade-no-color"
|
|
10163
|
+
});
|
|
10164
|
+
this._disposers.push(on(noColorBtn, "click", () => this._applyBorderColor("")));
|
|
10165
|
+
noColorRow.appendChild(noColorBtn);
|
|
10166
|
+
pop.appendChild(noColorRow);
|
|
10167
|
+
this._borderColorNoBtn = noColorBtn;
|
|
10168
|
+
const customRow = createElement("div", { class: "an-context-color-custom" });
|
|
10169
|
+
const colorInput = createElement("input", {
|
|
10170
|
+
type: "color",
|
|
10171
|
+
class: "an-shade-color-input",
|
|
10172
|
+
value: "#000000"
|
|
10173
|
+
});
|
|
10174
|
+
const customLabel = createElement("span");
|
|
10175
|
+
customLabel.textContent = this.context.locale.contextMenu.customColorLabel;
|
|
10176
|
+
this._disposers.push(on(colorInput, "change", () => this._applyBorderColor(colorInput.value)));
|
|
10177
|
+
customRow.appendChild(colorInput);
|
|
10178
|
+
customRow.appendChild(customLabel);
|
|
10179
|
+
pop.appendChild(customRow);
|
|
10180
|
+
this._disposers.push(on(pop, "mousedown", (e) => e.preventDefault()), on(pop, "mouseenter", () => this._clearTimers()), on(pop, "mouseleave", () => this._scheduleHide()), on(document, "click", (e) => {
|
|
10181
|
+
const et = e.target;
|
|
10182
|
+
if (this._borderColorPopover && this._borderColorPopover.style.display !== "none" && !this._borderColorPopover.contains(et) && !this._el?.contains(et)) this._hideBorderColorPopover();
|
|
10183
|
+
}));
|
|
10184
|
+
return pop;
|
|
10185
|
+
}
|
|
10186
|
+
_openBorderColorPopover() {
|
|
10187
|
+
if (!this._borderColorPopover) return;
|
|
10188
|
+
const L = this.context.locale.tooltips.table;
|
|
10189
|
+
if (this._borderColorTitleEl) this._borderColorTitleEl.textContent = L.tableBorderColor;
|
|
10190
|
+
if (this._borderColorNoBtn) this._borderColorNoBtn.textContent = L.noBorderColor;
|
|
10191
|
+
this._borderColorPopover.style.display = "block";
|
|
10192
|
+
requestAnimationFrame(() => {
|
|
10193
|
+
if (!this._borderColorPopover || !this._el) return;
|
|
10194
|
+
const pw = this._borderColorPopover.offsetWidth || 170;
|
|
10195
|
+
const ph = this._borderColorPopover.offsetHeight || 120;
|
|
10196
|
+
const tipRect = this._el.getBoundingClientRect();
|
|
10197
|
+
let left = tipRect.left;
|
|
10198
|
+
let top = tipRect.bottom + 6;
|
|
10199
|
+
if (left + pw > globalThis.innerWidth - 8) left = globalThis.innerWidth - pw - 8;
|
|
10200
|
+
if (top + ph > globalThis.innerHeight - 8) top = tipRect.top - ph - 6;
|
|
10201
|
+
this._borderColorPopover.style.left = `${Math.max(8, left)}px`;
|
|
10202
|
+
this._borderColorPopover.style.top = `${Math.max(8, top)}px`;
|
|
10203
|
+
});
|
|
10204
|
+
}
|
|
10205
|
+
_hideBorderColorPopover() {
|
|
10206
|
+
if (this._borderColorPopover) this._borderColorPopover.style.display = "none";
|
|
10207
|
+
}
|
|
10208
|
+
_applyBorderColor(color) {
|
|
10209
|
+
const table = this._activeTable;
|
|
10210
|
+
if (!table) return;
|
|
10211
|
+
Array.from(table.querySelectorAll("td, th")).forEach((c) => {
|
|
10212
|
+
c.style.borderColor = color;
|
|
10213
|
+
});
|
|
10214
|
+
if (this._borderColorStrip) this._borderColorStrip.style.background = color || "transparent";
|
|
10215
|
+
this._hideBorderColorPopover();
|
|
10216
|
+
this.context.invoke("editor.afterCommand");
|
|
10217
|
+
}
|
|
10218
|
+
_syncBorderColorStrip() {
|
|
10219
|
+
if (!this._borderColorStrip || !this._el || this._el.style.display === "none") return;
|
|
10220
|
+
const firstCell = this._activeTable?.querySelector("td, th");
|
|
10221
|
+
this._borderColorStrip.style.background = firstCell?.style.borderColor || "transparent";
|
|
10222
|
+
}
|
|
10223
|
+
_applyCellAlign(align) {
|
|
10224
|
+
this._getSelectedCells().forEach((c) => {
|
|
10225
|
+
if (c) c.style.textAlign = align;
|
|
10226
|
+
});
|
|
10227
|
+
this.context.invoke("editor.afterCommand");
|
|
10228
|
+
}
|
|
10229
|
+
_toggleHeaderRow() {
|
|
10230
|
+
const table = this._activeTable;
|
|
10231
|
+
if (!table) return;
|
|
10232
|
+
const firstRow = table.querySelector("tr");
|
|
10233
|
+
if (!firstRow) return;
|
|
10234
|
+
if (firstRow.closest("thead") !== null) {
|
|
10235
|
+
let tbody = table.querySelector("tbody");
|
|
10236
|
+
if (!tbody) {
|
|
10237
|
+
tbody = document.createElement("tbody");
|
|
10238
|
+
table.appendChild(tbody);
|
|
10239
|
+
}
|
|
10240
|
+
Array.from(firstRow.cells).forEach((cell) => {
|
|
10241
|
+
const td = document.createElement("td");
|
|
10242
|
+
td.innerHTML = cell.innerHTML;
|
|
10243
|
+
td.style.cssText = cell.style.cssText;
|
|
10244
|
+
firstRow.replaceChild(td, cell);
|
|
10245
|
+
});
|
|
10246
|
+
tbody.insertBefore(firstRow, tbody.firstChild);
|
|
10247
|
+
const thead = table.querySelector("thead");
|
|
10248
|
+
if (thead && thead.rows.length === 0) thead.remove();
|
|
10249
|
+
} else {
|
|
10250
|
+
let thead = table.querySelector("thead");
|
|
10251
|
+
if (!thead) {
|
|
10252
|
+
thead = document.createElement("thead");
|
|
10253
|
+
table.insertBefore(thead, table.firstChild);
|
|
10254
|
+
}
|
|
10255
|
+
Array.from(firstRow.cells).forEach((cell) => {
|
|
10256
|
+
const th = document.createElement("th");
|
|
10257
|
+
th.innerHTML = cell.innerHTML;
|
|
10258
|
+
th.style.cssText = cell.style.cssText;
|
|
10259
|
+
firstRow.replaceChild(th, cell);
|
|
10260
|
+
});
|
|
10261
|
+
thead.appendChild(firstRow);
|
|
10262
|
+
}
|
|
10263
|
+
this.context.invoke("editor.afterCommand");
|
|
10264
|
+
}
|
|
10265
|
+
_sortColumn(direction) {
|
|
10266
|
+
const table = this._activeTable;
|
|
10267
|
+
if (!table) return;
|
|
10268
|
+
const cell = this._getCell();
|
|
10269
|
+
if (!cell) return;
|
|
10270
|
+
const colIdx = getVisualColIndex(cell);
|
|
10271
|
+
if (colIdx === -1) return;
|
|
10272
|
+
const tbody = table.querySelector("tbody") || table;
|
|
10273
|
+
const rows = Array.from(tbody.querySelectorAll(":scope > tr"));
|
|
10274
|
+
if (rows.length < 2) return;
|
|
10275
|
+
rows.sort((a, b) => {
|
|
10276
|
+
const aCell = getCellAtVisualCol(a, colIdx);
|
|
10277
|
+
const bCell = getCellAtVisualCol(b, colIdx);
|
|
10278
|
+
const aText = (aCell?.textContent || "").trim();
|
|
10279
|
+
const bText = (bCell?.textContent || "").trim();
|
|
10280
|
+
const aNum = parseFloat(aText);
|
|
10281
|
+
const bNum = parseFloat(bText);
|
|
10282
|
+
if (!isNaN(aNum) && !isNaN(bNum)) return direction === "asc" ? aNum - bNum : bNum - aNum;
|
|
10283
|
+
return direction === "asc" ? aText.localeCompare(bText) : bText.localeCompare(aText);
|
|
10284
|
+
});
|
|
10285
|
+
rows.forEach((row) => tbody.appendChild(row));
|
|
10286
|
+
this.context.invoke("editor.afterCommand");
|
|
10287
|
+
}
|
|
10288
|
+
_exportTableCSV() {
|
|
10289
|
+
const table = this._activeTable;
|
|
10290
|
+
if (!table) return;
|
|
10291
|
+
const csv = Array.from(table.querySelectorAll("tr")).map((row) => Array.from(row.querySelectorAll("td, th")).map((cell) => {
|
|
10292
|
+
return `"${(cell.textContent || "").trim().replace(/"/g, "\"\"")}"`;
|
|
10293
|
+
}).join(",")).join("\n");
|
|
10294
|
+
const blob = new Blob(["" + csv], { type: "text/csv;charset=utf-8;" });
|
|
10295
|
+
const url = URL.createObjectURL(blob);
|
|
10296
|
+
const a = document.createElement("a");
|
|
10297
|
+
a.href = url;
|
|
10298
|
+
a.download = "table.csv";
|
|
10299
|
+
a.style.display = "none";
|
|
10300
|
+
document.body.appendChild(a);
|
|
10301
|
+
a.click();
|
|
10302
|
+
a.remove();
|
|
10303
|
+
URL.revokeObjectURL(url);
|
|
10304
|
+
}
|
|
9981
10305
|
};
|
|
9982
10306
|
//#endregion
|
|
9983
10307
|
//#region src/js/module/CodeTooltip.js
|
|
@@ -9988,7 +10312,8 @@ var ICONS$1 = {
|
|
|
9988
10312
|
copy: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>`,
|
|
9989
10313
|
wrapOn: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="6" x2="21" y2="6"/><path d="M3 12h15a3 3 0 0 1 0 6H3"/><polyline points="6 15 3 18 6 21"/></svg>`,
|
|
9990
10314
|
toParagraph: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M13 4v16"/><path d="M17 4v16"/><path d="M9 4h8a4 4 0 0 1 0 8H9V4z"/></svg>`,
|
|
9991
|
-
deleteCode: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg
|
|
10315
|
+
deleteCode: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>`,
|
|
10316
|
+
lineNumbers: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1v4"/><path d="M4 10h2"/><path d="M6 18H4c0-1 2-2 2-3s-1-2-2-2"/></svg>`
|
|
9992
10317
|
};
|
|
9993
10318
|
var CodeTooltip = class {
|
|
9994
10319
|
/** @param {import('../Context.js').Context} context */
|
|
@@ -10000,6 +10325,8 @@ var CodeTooltip = class {
|
|
|
10000
10325
|
this._hideTimer = null;
|
|
10001
10326
|
this._disposers = [];
|
|
10002
10327
|
this._copyBtn = null;
|
|
10328
|
+
this._wrapBtn = null;
|
|
10329
|
+
this._lineNumbersBtn = null;
|
|
10003
10330
|
this._langSelect = null;
|
|
10004
10331
|
this._prismScript = null;
|
|
10005
10332
|
}
|
|
@@ -10080,6 +10407,8 @@ var CodeTooltip = class {
|
|
|
10080
10407
|
el.appendChild(this._sep());
|
|
10081
10408
|
this._wrapBtn = this._makeBtn(ICONS$1.wrapOn, L.toggleWordWrap, () => this._toggleWrap());
|
|
10082
10409
|
el.appendChild(this._wrapBtn);
|
|
10410
|
+
this._lineNumbersBtn = this._makeBtn(ICONS$1.lineNumbers, L.lineNumbers, () => this._toggleLineNumbers());
|
|
10411
|
+
el.appendChild(this._lineNumbersBtn);
|
|
10083
10412
|
el.appendChild(this._sep());
|
|
10084
10413
|
el.appendChild(this._makeBtn(ICONS$1.toParagraph, L.convertToParagraph, () => this._toParagraph()));
|
|
10085
10414
|
el.appendChild(this._sep());
|
|
@@ -10118,6 +10447,7 @@ var CodeTooltip = class {
|
|
|
10118
10447
|
this._showTimer = setTimeout(() => {
|
|
10119
10448
|
this._activePre = pre;
|
|
10120
10449
|
this._syncWrapBtn();
|
|
10450
|
+
this._syncLineNumbersBtn();
|
|
10121
10451
|
this._syncLangSelect();
|
|
10122
10452
|
this._show(pre);
|
|
10123
10453
|
}, SHOW_DELAY);
|
|
@@ -10162,6 +10492,12 @@ var CodeTooltip = class {
|
|
|
10162
10492
|
this._wrapBtn.classList.toggle("active", wrapped);
|
|
10163
10493
|
this._wrapBtn.title = wrapped ? this.context.locale.tooltips.code.disableWordWrap : this.context.locale.tooltips.code.enableWordWrap;
|
|
10164
10494
|
}
|
|
10495
|
+
_syncLineNumbersBtn() {
|
|
10496
|
+
if (!this._activePre || !this._lineNumbersBtn) return;
|
|
10497
|
+
const on = this._activePre.classList.contains("an-code-line-numbers");
|
|
10498
|
+
this._lineNumbersBtn.classList.toggle("active", on);
|
|
10499
|
+
this._lineNumbersBtn.title = this.context.locale.tooltips.code.lineNumbers;
|
|
10500
|
+
}
|
|
10165
10501
|
_syncLangSelect() {
|
|
10166
10502
|
if (!this._activePre || !this._langSelect) return;
|
|
10167
10503
|
const codeEl = this._activePre.querySelector("code");
|
|
@@ -10208,6 +10544,13 @@ var CodeTooltip = class {
|
|
|
10208
10544
|
this.context.invoke("editor.afterCommand");
|
|
10209
10545
|
this._positionNear(pre);
|
|
10210
10546
|
}
|
|
10547
|
+
_toggleLineNumbers() {
|
|
10548
|
+
const pre = this._activePre;
|
|
10549
|
+
if (!pre) return;
|
|
10550
|
+
pre.classList.toggle("an-code-line-numbers");
|
|
10551
|
+
this._syncLineNumbersBtn();
|
|
10552
|
+
this.context.invoke("editor.afterCommand");
|
|
10553
|
+
}
|
|
10211
10554
|
/**
|
|
10212
10555
|
* Applies a language to a given <pre> element: sets classes, data-language,
|
|
10213
10556
|
* and triggers Prism highlighting. Called by the auto-detect flow.
|
|
@@ -14218,12 +14561,14 @@ var FindReplace = class extends BaseDialog {
|
|
|
14218
14561
|
this._matches = [];
|
|
14219
14562
|
this._currentIndex = -1;
|
|
14220
14563
|
this._caseSensitive = false;
|
|
14564
|
+
this._useRegex = false;
|
|
14221
14565
|
/** @type {'find'|'replace'} */
|
|
14222
14566
|
this._mode = "find";
|
|
14223
14567
|
/** Cached compiled regex — reused when query and case-sensitivity are unchanged */
|
|
14224
14568
|
this._queryRegex = null;
|
|
14225
14569
|
this._lastQuery = null;
|
|
14226
14570
|
this._lastCaseSensitive = null;
|
|
14571
|
+
this._lastUseRegex = null;
|
|
14227
14572
|
this._focusTimer = null;
|
|
14228
14573
|
}
|
|
14229
14574
|
destroy() {
|
|
@@ -14327,6 +14672,13 @@ var FindReplace = class extends BaseDialog {
|
|
|
14327
14672
|
"aria-label": "Case sensitive"
|
|
14328
14673
|
});
|
|
14329
14674
|
caseBtn.textContent = "Aa";
|
|
14675
|
+
const regexBtn = createElement("button", {
|
|
14676
|
+
type: "button",
|
|
14677
|
+
class: "an-fr-icon-btn",
|
|
14678
|
+
title: L.useRegex,
|
|
14679
|
+
"aria-label": L.useRegex
|
|
14680
|
+
});
|
|
14681
|
+
regexBtn.textContent = ".*";
|
|
14330
14682
|
const prevBtn = createElement("button", {
|
|
14331
14683
|
type: "button",
|
|
14332
14684
|
class: "an-fr-icon-btn",
|
|
@@ -14343,7 +14695,7 @@ var FindReplace = class extends BaseDialog {
|
|
|
14343
14695
|
nextBtn.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>`;
|
|
14344
14696
|
const counter = createElement("span", { class: "an-fr-counter" });
|
|
14345
14697
|
this._counterEl = counter;
|
|
14346
|
-
searchBar.append(findInput, caseCheckbox, caseBtn, prevBtn, nextBtn, counter);
|
|
14698
|
+
searchBar.append(findInput, caseCheckbox, caseBtn, regexBtn, prevBtn, nextBtn, counter);
|
|
14347
14699
|
box.appendChild(searchBar);
|
|
14348
14700
|
const replaceRow = createElement("div", { class: "an-fr-replace-row" });
|
|
14349
14701
|
replaceRow.style.display = "none";
|
|
@@ -14404,7 +14756,14 @@ var FindReplace = class extends BaseDialog {
|
|
|
14404
14756
|
this._replace();
|
|
14405
14757
|
}
|
|
14406
14758
|
});
|
|
14407
|
-
|
|
14759
|
+
const dRegex = on(regexBtn, "click", () => {
|
|
14760
|
+
this._useRegex = !this._useRegex;
|
|
14761
|
+
regexBtn.classList.toggle("an-fr-icon-btn--active", this._useRegex);
|
|
14762
|
+
this._queryRegex = null;
|
|
14763
|
+
this._lastQuery = null;
|
|
14764
|
+
this._onSearch();
|
|
14765
|
+
});
|
|
14766
|
+
this._disposers.push(d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, dRegex);
|
|
14408
14767
|
return overlay;
|
|
14409
14768
|
}
|
|
14410
14769
|
_onSearch() {
|
|
@@ -14462,13 +14821,19 @@ var FindReplace = class extends BaseDialog {
|
|
|
14462
14821
|
*/
|
|
14463
14822
|
_findRawMatches(query, root) {
|
|
14464
14823
|
const results = [];
|
|
14465
|
-
if (this._lastQuery !== query || this._lastCaseSensitive !== this._caseSensitive) {
|
|
14824
|
+
if (this._lastQuery !== query || this._lastCaseSensitive !== this._caseSensitive || this._lastUseRegex !== this._useRegex) {
|
|
14466
14825
|
const flags = this._caseSensitive ? "g" : "gi";
|
|
14467
|
-
|
|
14468
|
-
|
|
14826
|
+
try {
|
|
14827
|
+
const pattern = this._useRegex ? query : query.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
14828
|
+
this._queryRegex = new RegExp(pattern, flags);
|
|
14829
|
+
} catch (_) {
|
|
14830
|
+
this._queryRegex = null;
|
|
14831
|
+
}
|
|
14469
14832
|
this._lastQuery = query;
|
|
14470
14833
|
this._lastCaseSensitive = this._caseSensitive;
|
|
14834
|
+
this._lastUseRegex = this._useRegex;
|
|
14471
14835
|
}
|
|
14836
|
+
if (!this._queryRegex) return results;
|
|
14472
14837
|
const re = this._queryRegex;
|
|
14473
14838
|
const MAX_RESULTS = 500;
|
|
14474
14839
|
const walker = document.createTreeWalker(root, 4);
|
|
@@ -16004,14 +16369,16 @@ var Mention = class {
|
|
|
16004
16369
|
this._query = query;
|
|
16005
16370
|
clearTimeout(this._debounceTimer);
|
|
16006
16371
|
this._debounceTimer = setTimeout(() => {
|
|
16007
|
-
|
|
16372
|
+
const cb = (items) => {
|
|
16008
16373
|
if (!Array.isArray(items) || items.length === 0) {
|
|
16009
16374
|
this._hideDropdown();
|
|
16010
16375
|
return;
|
|
16011
16376
|
}
|
|
16012
16377
|
this._renderItems(items);
|
|
16013
16378
|
this._showDropdown();
|
|
16014
|
-
}
|
|
16379
|
+
};
|
|
16380
|
+
const result = this._cfg.onSearch(this._query, cb);
|
|
16381
|
+
if (result && typeof result.then === "function") result.then(cb).catch(() => this._hideDropdown());
|
|
16015
16382
|
}, this._cfg.debounce);
|
|
16016
16383
|
}
|
|
16017
16384
|
_onKeydown(e) {
|
|
@@ -16320,6 +16687,20 @@ var Context = class {
|
|
|
16320
16687
|
this.invoke("editor.clearHistory");
|
|
16321
16688
|
}
|
|
16322
16689
|
/**
|
|
16690
|
+
* Returns the number of available undo steps.
|
|
16691
|
+
* @returns {number}
|
|
16692
|
+
*/
|
|
16693
|
+
getUndoCount() {
|
|
16694
|
+
return this.invoke("editor.getUndoCount") ?? 0;
|
|
16695
|
+
}
|
|
16696
|
+
/**
|
|
16697
|
+
* Returns the number of available redo steps.
|
|
16698
|
+
* @returns {number}
|
|
16699
|
+
*/
|
|
16700
|
+
getRedoCount() {
|
|
16701
|
+
return this.invoke("editor.getRedoCount") ?? 0;
|
|
16702
|
+
}
|
|
16703
|
+
/**
|
|
16323
16704
|
* Returns true when the editor has no meaningful content.
|
|
16324
16705
|
* @returns {boolean}
|
|
16325
16706
|
*/
|
|
@@ -16427,6 +16808,18 @@ var Context = class {
|
|
|
16427
16808
|
});
|
|
16428
16809
|
}
|
|
16429
16810
|
/**
|
|
16811
|
+
* Returns an array of heading objects representing the table of contents.
|
|
16812
|
+
* Each entry has: level (1-6), text (heading text), element (DOM element).
|
|
16813
|
+
* @returns {{ level: number, text: string, element: HTMLElement }[]}
|
|
16814
|
+
*/
|
|
16815
|
+
getTableOfContents() {
|
|
16816
|
+
return Array.from(this.layoutInfo.editable.querySelectorAll("h1,h2,h3,h4,h5,h6")).map((el) => ({
|
|
16817
|
+
level: parseInt(el.tagName[1], 10),
|
|
16818
|
+
text: el.textContent?.trim() ?? "",
|
|
16819
|
+
element: el
|
|
16820
|
+
}));
|
|
16821
|
+
}
|
|
16822
|
+
/**
|
|
16430
16823
|
* Sets whether the editor is disabled (readonly).
|
|
16431
16824
|
* @param {boolean} disabled
|
|
16432
16825
|
*/
|
|
@@ -16463,11 +16856,13 @@ var Context = class {
|
|
|
16463
16856
|
this._disposers = [];
|
|
16464
16857
|
const container = this.layoutInfo.container;
|
|
16465
16858
|
const wasDark = container?.classList.contains("an-theme-dark");
|
|
16859
|
+
const wasAuto = container?.classList.contains("an-theme-auto");
|
|
16466
16860
|
if (container?.parentNode) {
|
|
16467
16861
|
this.targetEl.style.display = "";
|
|
16468
16862
|
container.remove();
|
|
16469
16863
|
}
|
|
16470
16864
|
if (wasDark && !document.querySelector(".an-container.an-theme-dark")) document.body.classList.remove("an-theme-dark");
|
|
16865
|
+
if (wasAuto && !document.querySelector(".an-container.an-theme-auto")) document.body.classList.remove("an-theme-auto");
|
|
16471
16866
|
if (typeof this.options.onDestroy === "function") this.options.onDestroy(this);
|
|
16472
16867
|
this._alive = false;
|
|
16473
16868
|
this._listeners.clear();
|
|
@@ -16721,7 +17116,7 @@ var AutumnNote = {
|
|
|
16721
17116
|
return this;
|
|
16722
17117
|
},
|
|
16723
17118
|
/** Library version */
|
|
16724
|
-
version: "1.
|
|
17119
|
+
version: "1.7.0"
|
|
16725
17120
|
};
|
|
16726
17121
|
/**
|
|
16727
17122
|
* @param {string|Element|NodeList|Element[]} selector
|