autumnnote 1.6.7 → 1.8.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 +580 -39
- package/dist/autumnnote.es.js.map +1 -1
- package/dist/autumnnote.umd.js +658 -100
- package/dist/autumnnote.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/js/Context.js +63 -2
- package/src/js/editing/History.js +10 -0
- package/src/js/i18n/de.js +14 -0
- package/src/js/i18n/en.js +22 -0
- package/src/js/i18n/es.js +14 -0
- package/src/js/i18n/fr.js +15 -1
- package/src/js/i18n/ja.js +14 -0
- package/src/js/i18n/ko.js +14 -0
- package/src/js/i18n/vi.js +14 -0
- package/src/js/i18n/zh.js +14 -0
- package/src/js/index.js +5 -2
- package/src/js/module/BaseDialog.js +7 -0
- package/src/js/module/Buttons.js +49 -0
- package/src/js/module/Clipboard.js +12 -0
- package/src/js/module/CodeTooltip.js +23 -0
- package/src/js/module/Editor.js +8 -0
- package/src/js/module/FindReplace.js +50 -6
- package/src/js/module/ImageResizer.js +8 -7
- package/src/js/module/Mention.js +9 -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 +99 -4
package/dist/autumnnote.es.js
CHANGED
|
@@ -1458,6 +1458,48 @@ var defaultToolbar = [
|
|
|
1458
1458
|
shortcutsBtn
|
|
1459
1459
|
]
|
|
1460
1460
|
];
|
|
1461
|
+
var buttons = {
|
|
1462
|
+
boldBtn,
|
|
1463
|
+
italicBtn,
|
|
1464
|
+
underlineBtn,
|
|
1465
|
+
strikeBtn,
|
|
1466
|
+
superscriptBtn,
|
|
1467
|
+
subscriptBtn,
|
|
1468
|
+
alignLeftBtn,
|
|
1469
|
+
alignCenterBtn,
|
|
1470
|
+
alignRightBtn,
|
|
1471
|
+
alignJustifyBtn,
|
|
1472
|
+
ulBtn,
|
|
1473
|
+
olBtn,
|
|
1474
|
+
indentBtn,
|
|
1475
|
+
outdentBtn,
|
|
1476
|
+
undoBtn,
|
|
1477
|
+
redoBtn,
|
|
1478
|
+
hrBtn,
|
|
1479
|
+
linkBtn,
|
|
1480
|
+
imageBtn,
|
|
1481
|
+
videoBtn,
|
|
1482
|
+
emojiBtn,
|
|
1483
|
+
iconBtn,
|
|
1484
|
+
tableBtn,
|
|
1485
|
+
fontSizeBtn,
|
|
1486
|
+
removeFormatBtn,
|
|
1487
|
+
directionBtn,
|
|
1488
|
+
fontFamilyBtn,
|
|
1489
|
+
paragraphStyleBtn,
|
|
1490
|
+
lineHeightBtn,
|
|
1491
|
+
codeviewBtn,
|
|
1492
|
+
fullscreenBtn,
|
|
1493
|
+
shortcutsBtn,
|
|
1494
|
+
findBtn,
|
|
1495
|
+
findReplaceBtn,
|
|
1496
|
+
inlineCodeBtn,
|
|
1497
|
+
checklistBtn,
|
|
1498
|
+
printBtn,
|
|
1499
|
+
foreColorBtn,
|
|
1500
|
+
backColorBtn,
|
|
1501
|
+
defaultToolbar
|
|
1502
|
+
};
|
|
1461
1503
|
//#endregion
|
|
1462
1504
|
//#region src/js/settings.js
|
|
1463
1505
|
/**
|
|
@@ -1752,6 +1794,7 @@ var en = {
|
|
|
1752
1794
|
findPlaceholder: "Find…",
|
|
1753
1795
|
searchAriaLabel: "Search text",
|
|
1754
1796
|
caseSensitive: "\xA0Case sensitive",
|
|
1797
|
+
wholeWord: "Whole Word",
|
|
1755
1798
|
prevBtn: "← Prev",
|
|
1756
1799
|
nextBtn: "Next →",
|
|
1757
1800
|
replacePlaceholder: "Replace with…",
|
|
@@ -1759,8 +1802,15 @@ var en = {
|
|
|
1759
1802
|
replaceBtn: "Replace",
|
|
1760
1803
|
replaceAllBtn: "Replace All",
|
|
1761
1804
|
noResults: "No results",
|
|
1805
|
+
useRegex: "Use Regular Expression",
|
|
1762
1806
|
close: "×"
|
|
1763
1807
|
},
|
|
1808
|
+
autoSaveRestore: {
|
|
1809
|
+
found: "Draft found. Restore?",
|
|
1810
|
+
foundAt: "Draft from {date}. Restore?",
|
|
1811
|
+
restore: "Restore",
|
|
1812
|
+
discard: "Discard"
|
|
1813
|
+
},
|
|
1764
1814
|
shortcutsDialog: {
|
|
1765
1815
|
title: "Keyboard Shortcuts",
|
|
1766
1816
|
ariaLabel: "Keyboard Shortcuts",
|
|
@@ -1904,7 +1954,8 @@ var en = {
|
|
|
1904
1954
|
enableWordWrap: "Enable Word Wrap",
|
|
1905
1955
|
disableWordWrap: "Disable Word Wrap",
|
|
1906
1956
|
convertToParagraph: "Convert to Paragraph",
|
|
1907
|
-
deleteCodeBlock: "Delete Code Block"
|
|
1957
|
+
deleteCodeBlock: "Delete Code Block",
|
|
1958
|
+
lineNumbers: "Toggle Line Numbers"
|
|
1908
1959
|
},
|
|
1909
1960
|
table: {
|
|
1910
1961
|
ariaLabel: "Table actions",
|
|
@@ -1921,14 +1972,26 @@ var en = {
|
|
|
1921
1972
|
columnWidth: "Column Width",
|
|
1922
1973
|
rowHeight: "Row Height",
|
|
1923
1974
|
tableBorderWidth: "Table Border Width",
|
|
1975
|
+
tableBorderColor: "Table Border Color",
|
|
1924
1976
|
deleteTable: "Delete Table",
|
|
1977
|
+
cellAlignLeft: "Align Left",
|
|
1978
|
+
cellAlignCenter: "Align Center",
|
|
1979
|
+
cellAlignRight: "Align Right",
|
|
1980
|
+
cellAlignJustify: "Align Justify",
|
|
1981
|
+
toggleHeaderRow: "Toggle Header Row",
|
|
1925
1982
|
cellBackground: "Cell Background",
|
|
1926
1983
|
noShading: "No Shading",
|
|
1984
|
+
noBorderColor: "No Border Color",
|
|
1927
1985
|
columnWidthPx: "Column Width (px)",
|
|
1928
1986
|
rowHeightPx: "Row Height (px)",
|
|
1929
1987
|
tableBorderWidthPx: "Table Border Width (px)",
|
|
1930
1988
|
cancelBtn: "Cancel",
|
|
1931
|
-
applyBtn: "Apply"
|
|
1989
|
+
applyBtn: "Apply",
|
|
1990
|
+
sortAsc: "Sort Ascending",
|
|
1991
|
+
sortDesc: "Sort Descending",
|
|
1992
|
+
exportCSV: "Export as CSV",
|
|
1993
|
+
cellPadding: "Cell Padding",
|
|
1994
|
+
cellPaddingPx: "Cell Padding (px)"
|
|
1932
1995
|
},
|
|
1933
1996
|
video: {
|
|
1934
1997
|
ariaLabel: "Video actions",
|
|
@@ -2120,6 +2183,7 @@ var locales = {
|
|
|
2120
2183
|
replaceBtn: "Thay thế",
|
|
2121
2184
|
replaceAllBtn: "Thay thế tất cả",
|
|
2122
2185
|
noResults: "Không có kết quả",
|
|
2186
|
+
useRegex: "Dùng biểu thức chính quy",
|
|
2123
2187
|
close: "×"
|
|
2124
2188
|
},
|
|
2125
2189
|
shortcutsDialog: {
|
|
@@ -2261,7 +2325,8 @@ var locales = {
|
|
|
2261
2325
|
enableWordWrap: "Bật xuống dòng",
|
|
2262
2326
|
disableWordWrap: "Tắt xuống dòng",
|
|
2263
2327
|
convertToParagraph: "Chuyển thành đoạn văn",
|
|
2264
|
-
deleteCodeBlock: "Xóa khối mã"
|
|
2328
|
+
deleteCodeBlock: "Xóa khối mã",
|
|
2329
|
+
lineNumbers: "Bật/Tắt số dòng"
|
|
2265
2330
|
},
|
|
2266
2331
|
table: {
|
|
2267
2332
|
ariaLabel: "Hành động bảng",
|
|
@@ -2285,7 +2350,12 @@ var locales = {
|
|
|
2285
2350
|
rowHeightPx: "Chiều cao hàng (px)",
|
|
2286
2351
|
tableBorderWidthPx: "Độ rộng viền bảng (px)",
|
|
2287
2352
|
cancelBtn: "Hủy",
|
|
2288
|
-
applyBtn: "Áp dụng"
|
|
2353
|
+
applyBtn: "Áp dụng",
|
|
2354
|
+
sortAsc: "Sắp xếp tăng dần",
|
|
2355
|
+
sortDesc: "Sắp xếp giảm dần",
|
|
2356
|
+
exportCSV: "Xuất CSV",
|
|
2357
|
+
cellPadding: "Khoảng đệm ô",
|
|
2358
|
+
cellPaddingPx: "Khoảng đệm ô (px)"
|
|
2289
2359
|
},
|
|
2290
2360
|
video: {
|
|
2291
2361
|
ariaLabel: "Hành động video",
|
|
@@ -2303,6 +2373,12 @@ var locales = {
|
|
|
2303
2373
|
errors: {
|
|
2304
2374
|
imageFormat: (type) => `Định dạng "${type}" không được hỗ trợ hiển thị trên trình duyệt. Vui lòng chuyển đổi sang JPEG, PNG hoặc WebP.`,
|
|
2305
2375
|
imageSize: (maxSize) => `Tệp hình ảnh quá lớn. Kích thước tối đa cho phép là ${maxSize} MB.`
|
|
2376
|
+
},
|
|
2377
|
+
autoSaveRestore: {
|
|
2378
|
+
found: "Tìm thấy bản nháp. Khôi phục?",
|
|
2379
|
+
foundAt: "Bản nháp từ {date}. Khôi phục?",
|
|
2380
|
+
restore: "Khôi phục",
|
|
2381
|
+
discard: "Bỏ qua"
|
|
2306
2382
|
}
|
|
2307
2383
|
},
|
|
2308
2384
|
ja: {
|
|
@@ -2452,6 +2528,7 @@ var locales = {
|
|
|
2452
2528
|
replaceAriaLabel: "置換後のテキスト",
|
|
2453
2529
|
replaceBtn: "置換",
|
|
2454
2530
|
noResults: "結果なし",
|
|
2531
|
+
useRegex: "正規表現を使用",
|
|
2455
2532
|
replaceAllBtn: "すべて置換",
|
|
2456
2533
|
close: "×"
|
|
2457
2534
|
},
|
|
@@ -2594,7 +2671,8 @@ var locales = {
|
|
|
2594
2671
|
enableWordWrap: "折り返しを有効にする",
|
|
2595
2672
|
disableWordWrap: "折り返しを無効にする",
|
|
2596
2673
|
convertToParagraph: "段落に変換",
|
|
2597
|
-
deleteCodeBlock: "コードブロックを削除"
|
|
2674
|
+
deleteCodeBlock: "コードブロックを削除",
|
|
2675
|
+
lineNumbers: "行番号を切り替え"
|
|
2598
2676
|
},
|
|
2599
2677
|
table: {
|
|
2600
2678
|
ariaLabel: "テーブル操作",
|
|
@@ -2616,7 +2694,12 @@ var locales = {
|
|
|
2616
2694
|
rowHeightPx: "行の高さ (px)",
|
|
2617
2695
|
tableBorderWidthPx: "テーブルの枠幅 (px)",
|
|
2618
2696
|
cancelBtn: "キャンセル",
|
|
2619
|
-
applyBtn: "適用"
|
|
2697
|
+
applyBtn: "適用",
|
|
2698
|
+
sortAsc: "昇順で並べ替え",
|
|
2699
|
+
sortDesc: "降順で並べ替え",
|
|
2700
|
+
exportCSV: "CSVとしてエクスポート",
|
|
2701
|
+
cellPadding: "セルの余白",
|
|
2702
|
+
cellPaddingPx: "セルの余白 (px)"
|
|
2620
2703
|
},
|
|
2621
2704
|
video: {
|
|
2622
2705
|
ariaLabel: "動画操作",
|
|
@@ -2634,6 +2717,12 @@ var locales = {
|
|
|
2634
2717
|
errors: {
|
|
2635
2718
|
imageFormat: (type) => `形式 "${type}" はブラウザでの表示をサポートしていません。JPEG、PNG、または WebP に変換してください。`,
|
|
2636
2719
|
imageSize: (maxSize) => `画像ファイルが大きすぎます。最大許容サイズは ${maxSize} MB です。`
|
|
2720
|
+
},
|
|
2721
|
+
autoSaveRestore: {
|
|
2722
|
+
found: "下書きが見つかりました。復元しますか?",
|
|
2723
|
+
foundAt: "{date} の下書きが見つかりました。復元しますか?",
|
|
2724
|
+
restore: "復元",
|
|
2725
|
+
discard: "破棄"
|
|
2637
2726
|
}
|
|
2638
2727
|
},
|
|
2639
2728
|
zh: {
|
|
@@ -2783,6 +2872,7 @@ var locales = {
|
|
|
2783
2872
|
replaceAriaLabel: "替换为",
|
|
2784
2873
|
replaceBtn: "替换",
|
|
2785
2874
|
noResults: "没有结果",
|
|
2875
|
+
useRegex: "使用正则表达式",
|
|
2786
2876
|
replaceAllBtn: "全部替换",
|
|
2787
2877
|
close: "×"
|
|
2788
2878
|
},
|
|
@@ -2925,7 +3015,8 @@ var locales = {
|
|
|
2925
3015
|
enableWordWrap: "启用自动换行",
|
|
2926
3016
|
disableWordWrap: "禁用自动换行",
|
|
2927
3017
|
convertToParagraph: "转换为段落",
|
|
2928
|
-
deleteCodeBlock: "删除代码块"
|
|
3018
|
+
deleteCodeBlock: "删除代码块",
|
|
3019
|
+
lineNumbers: "切换行号"
|
|
2929
3020
|
},
|
|
2930
3021
|
table: {
|
|
2931
3022
|
ariaLabel: "表格操作",
|
|
@@ -2947,7 +3038,12 @@ var locales = {
|
|
|
2947
3038
|
rowHeightPx: "行高 (px)",
|
|
2948
3039
|
tableBorderWidthPx: "表格边框宽度 (px)",
|
|
2949
3040
|
cancelBtn: "取消",
|
|
2950
|
-
applyBtn: "应用"
|
|
3041
|
+
applyBtn: "应用",
|
|
3042
|
+
sortAsc: "升序排列",
|
|
3043
|
+
sortDesc: "降序排列",
|
|
3044
|
+
exportCSV: "导出为 CSV",
|
|
3045
|
+
cellPadding: "单元格内边距",
|
|
3046
|
+
cellPaddingPx: "单元格内边距 (px)"
|
|
2951
3047
|
},
|
|
2952
3048
|
video: {
|
|
2953
3049
|
ariaLabel: "视频操作",
|
|
@@ -2965,6 +3061,12 @@ var locales = {
|
|
|
2965
3061
|
errors: {
|
|
2966
3062
|
imageFormat: (type) => `格式 "${type}" 不支持在浏览器中显示。请转换为 JPEG、PNG 或 WebP。`,
|
|
2967
3063
|
imageSize: (maxSize) => `图片文件过大。最大允许大小为 ${maxSize} MB。`
|
|
3064
|
+
},
|
|
3065
|
+
autoSaveRestore: {
|
|
3066
|
+
found: "找到草稿。是否恢复?",
|
|
3067
|
+
foundAt: "发现 {date} 的草稿。是否恢复?",
|
|
3068
|
+
restore: "恢复",
|
|
3069
|
+
discard: "放弃"
|
|
2968
3070
|
}
|
|
2969
3071
|
},
|
|
2970
3072
|
fr: {
|
|
@@ -3114,6 +3216,7 @@ var locales = {
|
|
|
3114
3216
|
replaceAriaLabel: "Remplacer par",
|
|
3115
3217
|
replaceBtn: "Remplacer",
|
|
3116
3218
|
noResults: "Aucun résultat",
|
|
3219
|
+
useRegex: "Utiliser une expression régulière",
|
|
3117
3220
|
replaceAllBtn: "Tout remplacer",
|
|
3118
3221
|
close: "×"
|
|
3119
3222
|
},
|
|
@@ -3256,7 +3359,8 @@ var locales = {
|
|
|
3256
3359
|
enableWordWrap: "Activer le retour à la ligne",
|
|
3257
3360
|
disableWordWrap: "Désactiver le retour à la ligne",
|
|
3258
3361
|
convertToParagraph: "Convertir en paragraphe",
|
|
3259
|
-
deleteCodeBlock: "Supprimer le bloc de code"
|
|
3362
|
+
deleteCodeBlock: "Supprimer le bloc de code",
|
|
3363
|
+
lineNumbers: "Activer/désactiver les numéros de ligne"
|
|
3260
3364
|
},
|
|
3261
3365
|
table: {
|
|
3262
3366
|
ariaLabel: "Actions du tableau",
|
|
@@ -3278,7 +3382,12 @@ var locales = {
|
|
|
3278
3382
|
rowHeightPx: "Hauteur de ligne (px)",
|
|
3279
3383
|
tableBorderWidthPx: "Épaisseur des bordures (px)",
|
|
3280
3384
|
cancelBtn: "Annuler",
|
|
3281
|
-
applyBtn: "Appliquer"
|
|
3385
|
+
applyBtn: "Appliquer",
|
|
3386
|
+
sortAsc: "Trier par ordre croissant",
|
|
3387
|
+
sortDesc: "Trier par ordre décroissant",
|
|
3388
|
+
exportCSV: "Exporter en CSV",
|
|
3389
|
+
cellPadding: "Rembourrage des cellules",
|
|
3390
|
+
cellPaddingPx: "Rembourrage des cellules (px)"
|
|
3282
3391
|
},
|
|
3283
3392
|
video: {
|
|
3284
3393
|
ariaLabel: "Actions de la vidéo",
|
|
@@ -3296,6 +3405,12 @@ var locales = {
|
|
|
3296
3405
|
errors: {
|
|
3297
3406
|
imageFormat: (type) => `Le format "${type}" n'est pas pris en charge par le navigateur. Veuillez le convertir en JPEG, PNG ou WebP.`,
|
|
3298
3407
|
imageSize: (maxSize) => `Le fichier image est trop volumineux. La taille maximale autorisée est de ${maxSize}\u00a0Mo.`
|
|
3408
|
+
},
|
|
3409
|
+
autoSaveRestore: {
|
|
3410
|
+
found: "Brouillon trouvé. Restaurer ?",
|
|
3411
|
+
foundAt: "Brouillon du {date}. Restaurer ?",
|
|
3412
|
+
restore: "Restaurer",
|
|
3413
|
+
discard: "Ignorer"
|
|
3299
3414
|
}
|
|
3300
3415
|
},
|
|
3301
3416
|
de: {
|
|
@@ -3445,6 +3560,7 @@ var locales = {
|
|
|
3445
3560
|
replaceAriaLabel: "Ersetzen durch",
|
|
3446
3561
|
replaceBtn: "Ersetzen",
|
|
3447
3562
|
noResults: "Keine Ergebnisse",
|
|
3563
|
+
useRegex: "Regulären Ausdruck verwenden",
|
|
3448
3564
|
replaceAllBtn: "Alle ersetzen",
|
|
3449
3565
|
close: "×"
|
|
3450
3566
|
},
|
|
@@ -3587,7 +3703,8 @@ var locales = {
|
|
|
3587
3703
|
enableWordWrap: "Zeilenumbruch aktivieren",
|
|
3588
3704
|
disableWordWrap: "Zeilenumbruch deaktivieren",
|
|
3589
3705
|
convertToParagraph: "In Absatz umwandeln",
|
|
3590
|
-
deleteCodeBlock: "Codeblock löschen"
|
|
3706
|
+
deleteCodeBlock: "Codeblock löschen",
|
|
3707
|
+
lineNumbers: "Zeilennummern umschalten"
|
|
3591
3708
|
},
|
|
3592
3709
|
table: {
|
|
3593
3710
|
ariaLabel: "Tabellen-Aktionen",
|
|
@@ -3609,7 +3726,12 @@ var locales = {
|
|
|
3609
3726
|
rowHeightPx: "Zeilenhöhe (px)",
|
|
3610
3727
|
tableBorderWidthPx: "Tabellenrahmenbreite (px)",
|
|
3611
3728
|
cancelBtn: "Abbrechen",
|
|
3612
|
-
applyBtn: "Anwenden"
|
|
3729
|
+
applyBtn: "Anwenden",
|
|
3730
|
+
sortAsc: "Aufsteigend sortieren",
|
|
3731
|
+
sortDesc: "Absteigend sortieren",
|
|
3732
|
+
exportCSV: "Als CSV exportieren",
|
|
3733
|
+
cellPadding: "Zellauffüllung",
|
|
3734
|
+
cellPaddingPx: "Zellauffüllung (px)"
|
|
3613
3735
|
},
|
|
3614
3736
|
video: {
|
|
3615
3737
|
ariaLabel: "Video-Aktionen",
|
|
@@ -3627,6 +3749,12 @@ var locales = {
|
|
|
3627
3749
|
errors: {
|
|
3628
3750
|
imageFormat: (type) => `Das Format „${type}" wird in Webbrowsern nicht unterstützt. Bitte konvertieren Sie es zuerst in JPEG, PNG oder WebP.`,
|
|
3629
3751
|
imageSize: (maxSize) => `Die Bilddatei ist zu groß. Die maximal zulässige Größe beträgt ${maxSize} MB.`
|
|
3752
|
+
},
|
|
3753
|
+
autoSaveRestore: {
|
|
3754
|
+
found: "Entwurf gefunden. Wiederherstellen?",
|
|
3755
|
+
foundAt: "Entwurf vom {date}. Wiederherstellen?",
|
|
3756
|
+
restore: "Wiederherstellen",
|
|
3757
|
+
discard: "Verwerfen"
|
|
3630
3758
|
}
|
|
3631
3759
|
},
|
|
3632
3760
|
es: {
|
|
@@ -3776,6 +3904,7 @@ var locales = {
|
|
|
3776
3904
|
replaceAriaLabel: "Reemplazar con",
|
|
3777
3905
|
replaceBtn: "Reemplazar",
|
|
3778
3906
|
noResults: "Sin resultados",
|
|
3907
|
+
useRegex: "Usar expresión regular",
|
|
3779
3908
|
replaceAllBtn: "Reemplazar todo",
|
|
3780
3909
|
close: "×"
|
|
3781
3910
|
},
|
|
@@ -3918,7 +4047,8 @@ var locales = {
|
|
|
3918
4047
|
enableWordWrap: "Activar ajuste de línea",
|
|
3919
4048
|
disableWordWrap: "Desactivar ajuste de línea",
|
|
3920
4049
|
convertToParagraph: "Convertir en párrafo",
|
|
3921
|
-
deleteCodeBlock: "Eliminar bloque de código"
|
|
4050
|
+
deleteCodeBlock: "Eliminar bloque de código",
|
|
4051
|
+
lineNumbers: "Alternar números de línea"
|
|
3922
4052
|
},
|
|
3923
4053
|
table: {
|
|
3924
4054
|
ariaLabel: "Acciones de tabla",
|
|
@@ -3940,7 +4070,12 @@ var locales = {
|
|
|
3940
4070
|
rowHeightPx: "Alto de fila (px)",
|
|
3941
4071
|
tableBorderWidthPx: "Grosor del borde (px)",
|
|
3942
4072
|
cancelBtn: "Cancelar",
|
|
3943
|
-
applyBtn: "Aplicar"
|
|
4073
|
+
applyBtn: "Aplicar",
|
|
4074
|
+
sortAsc: "Ordenar ascendente",
|
|
4075
|
+
sortDesc: "Ordenar descendente",
|
|
4076
|
+
exportCSV: "Exportar como CSV",
|
|
4077
|
+
cellPadding: "Relleno de celda",
|
|
4078
|
+
cellPaddingPx: "Relleno de celda (px)"
|
|
3944
4079
|
},
|
|
3945
4080
|
video: {
|
|
3946
4081
|
ariaLabel: "Acciones de vídeo",
|
|
@@ -3958,6 +4093,12 @@ var locales = {
|
|
|
3958
4093
|
errors: {
|
|
3959
4094
|
imageFormat: (type) => `El formato "${type}" no es compatible con los navegadores web. Por favor, conviértalo primero a JPEG, PNG o WebP.`,
|
|
3960
4095
|
imageSize: (maxSize) => `El archivo de imagen es demasiado grande. El tamaño máximo permitido es ${maxSize} MB.`
|
|
4096
|
+
},
|
|
4097
|
+
autoSaveRestore: {
|
|
4098
|
+
found: "Borrador encontrado. ¿Restaurar?",
|
|
4099
|
+
foundAt: "Borrador del {date}. ¿Restaurar?",
|
|
4100
|
+
restore: "Restaurar",
|
|
4101
|
+
discard: "Descartar"
|
|
3961
4102
|
}
|
|
3962
4103
|
},
|
|
3963
4104
|
ko: {
|
|
@@ -4107,6 +4248,7 @@ var locales = {
|
|
|
4107
4248
|
replaceAriaLabel: "바꿀 내용",
|
|
4108
4249
|
replaceBtn: "바꾸기",
|
|
4109
4250
|
noResults: "결과 없음",
|
|
4251
|
+
useRegex: "정규식 사용",
|
|
4110
4252
|
replaceAllBtn: "모두 바꾸기",
|
|
4111
4253
|
close: "×"
|
|
4112
4254
|
},
|
|
@@ -4249,7 +4391,8 @@ var locales = {
|
|
|
4249
4391
|
enableWordWrap: "줄 바꿈 사용",
|
|
4250
4392
|
disableWordWrap: "줄 바꿈 해제",
|
|
4251
4393
|
convertToParagraph: "단락으로 변환",
|
|
4252
|
-
deleteCodeBlock: "코드 블록 삭제"
|
|
4394
|
+
deleteCodeBlock: "코드 블록 삭제",
|
|
4395
|
+
lineNumbers: "줄 번호 전환"
|
|
4253
4396
|
},
|
|
4254
4397
|
table: {
|
|
4255
4398
|
ariaLabel: "표 작업",
|
|
@@ -4271,7 +4414,12 @@ var locales = {
|
|
|
4271
4414
|
rowHeightPx: "행 높이 (px)",
|
|
4272
4415
|
tableBorderWidthPx: "표 테두리 너비 (px)",
|
|
4273
4416
|
cancelBtn: "취소",
|
|
4274
|
-
applyBtn: "적용"
|
|
4417
|
+
applyBtn: "적용",
|
|
4418
|
+
sortAsc: "오름차순 정렬",
|
|
4419
|
+
sortDesc: "내림차순 정렬",
|
|
4420
|
+
exportCSV: "CSV로 내보내기",
|
|
4421
|
+
cellPadding: "셀 패딩",
|
|
4422
|
+
cellPaddingPx: "셀 패딩 (px)"
|
|
4275
4423
|
},
|
|
4276
4424
|
video: {
|
|
4277
4425
|
ariaLabel: "동영상 작업",
|
|
@@ -4289,6 +4437,12 @@ var locales = {
|
|
|
4289
4437
|
errors: {
|
|
4290
4438
|
imageFormat: (type) => `"${type}" 형식은 웹 브라우저에서 지원되지 않습니다. JPEG, PNG 또는 WebP로 변환해 주세요.`,
|
|
4291
4439
|
imageSize: (maxSize) => `이미지 파일이 너무 큽니다. 최대 허용 크기는 ${maxSize} MB입니다.`
|
|
4440
|
+
},
|
|
4441
|
+
autoSaveRestore: {
|
|
4442
|
+
found: "초안을 찾았습니다. 복원하시겠습니까?",
|
|
4443
|
+
foundAt: "{date}의 초안을 찾았습니다. 복원하시겠습니까?",
|
|
4444
|
+
restore: "복원",
|
|
4445
|
+
discard: "삭제"
|
|
4292
4446
|
}
|
|
4293
4447
|
}
|
|
4294
4448
|
};
|
|
@@ -4485,6 +4639,9 @@ function renderLayout(targetEl, options) {
|
|
|
4485
4639
|
if (options.theme === "dark") {
|
|
4486
4640
|
container.classList.add("an-theme-dark");
|
|
4487
4641
|
document.body.classList.add("an-theme-dark");
|
|
4642
|
+
} else if (options.theme === "auto") {
|
|
4643
|
+
container.classList.add("an-theme-auto");
|
|
4644
|
+
document.body.classList.add("an-theme-auto");
|
|
4488
4645
|
}
|
|
4489
4646
|
if (options.readOnly) {
|
|
4490
4647
|
container.classList.add("an-disabled");
|
|
@@ -4710,6 +4867,14 @@ var History = class {
|
|
|
4710
4867
|
canRedo() {
|
|
4711
4868
|
return this.stackOffset < this.stack.length - 1;
|
|
4712
4869
|
}
|
|
4870
|
+
/** @returns {number} */
|
|
4871
|
+
getUndoCount() {
|
|
4872
|
+
return Math.max(0, this.stackOffset);
|
|
4873
|
+
}
|
|
4874
|
+
/** @returns {number} */
|
|
4875
|
+
getRedoCount() {
|
|
4876
|
+
return Math.max(0, this.stack.length - 1 - this.stackOffset);
|
|
4877
|
+
}
|
|
4713
4878
|
};
|
|
4714
4879
|
//#endregion
|
|
4715
4880
|
//#region src/js/editing/Table.js
|
|
@@ -5782,6 +5947,12 @@ var Editor = class {
|
|
|
5782
5947
|
canRedo() {
|
|
5783
5948
|
return this._history ? this._history.canRedo() : false;
|
|
5784
5949
|
}
|
|
5950
|
+
getUndoCount() {
|
|
5951
|
+
return this._history ? this._history.getUndoCount() : 0;
|
|
5952
|
+
}
|
|
5953
|
+
getRedoCount() {
|
|
5954
|
+
return this._history ? this._history.getRedoCount() : 0;
|
|
5955
|
+
}
|
|
5785
5956
|
bold() {
|
|
5786
5957
|
bold();
|
|
5787
5958
|
this.afterCommand();
|
|
@@ -6643,9 +6814,21 @@ var Statusbar = class {
|
|
|
6643
6814
|
this._bindResize(handle);
|
|
6644
6815
|
this.el.appendChild(handle);
|
|
6645
6816
|
}
|
|
6646
|
-
this._wordCountEl = createElement("span", {
|
|
6647
|
-
|
|
6648
|
-
|
|
6817
|
+
this._wordCountEl = createElement("span", {
|
|
6818
|
+
class: "an-word-count",
|
|
6819
|
+
role: "status",
|
|
6820
|
+
"aria-live": "polite",
|
|
6821
|
+
"aria-atomic": "true"
|
|
6822
|
+
});
|
|
6823
|
+
this._charCountEl = createElement("span", {
|
|
6824
|
+
class: "an-char-count",
|
|
6825
|
+
"aria-live": "polite",
|
|
6826
|
+
"aria-atomic": "true"
|
|
6827
|
+
});
|
|
6828
|
+
const info = createElement("div", {
|
|
6829
|
+
class: "an-status-info",
|
|
6830
|
+
"aria-label": "Editor statistics"
|
|
6831
|
+
});
|
|
6649
6832
|
info.appendChild(this._wordCountEl);
|
|
6650
6833
|
info.appendChild(this._charCountEl);
|
|
6651
6834
|
this.el.appendChild(info);
|
|
@@ -6885,6 +7068,15 @@ var Clipboard = class {
|
|
|
6885
7068
|
if (!clipboardData) return;
|
|
6886
7069
|
const forcePlain = this._forcePlain;
|
|
6887
7070
|
this._forcePlain = false;
|
|
7071
|
+
const maxBytes = (this.options.maxPasteSize ?? 5) * 1024 * 1024;
|
|
7072
|
+
if (maxBytes > 0) {
|
|
7073
|
+
const text = clipboardData.getData("text/plain") || "";
|
|
7074
|
+
const html = clipboardData.getData("text/html") || "";
|
|
7075
|
+
if (Math.max(text.length, html.length) > maxBytes) {
|
|
7076
|
+
event.preventDefault();
|
|
7077
|
+
return;
|
|
7078
|
+
}
|
|
7079
|
+
}
|
|
6888
7080
|
if (clipboardData.items) {
|
|
6889
7081
|
const imageItems = Array.from(clipboardData.items).filter((item) => item.kind === "file" && item.type.startsWith("image/"));
|
|
6890
7082
|
if (imageItems.length > 0) {
|
|
@@ -7303,6 +7495,10 @@ var BaseDialog = class {
|
|
|
7303
7495
|
this._firstInput = null;
|
|
7304
7496
|
this._removeTrap = null;
|
|
7305
7497
|
}
|
|
7498
|
+
/** @returns {HTMLElement} */
|
|
7499
|
+
_buildDialog() {
|
|
7500
|
+
throw new Error("_buildDialog() must be implemented by subclass");
|
|
7501
|
+
}
|
|
7306
7502
|
initialize() {
|
|
7307
7503
|
this._dialog = this._buildDialog();
|
|
7308
7504
|
document.body.appendChild(this._dialog);
|
|
@@ -8003,6 +8199,7 @@ var ImageResizer = class {
|
|
|
8003
8199
|
const aspectRatio = startW / (startH || 1);
|
|
8004
8200
|
const isCorner = pos.length === 2;
|
|
8005
8201
|
const editable = this.context.layoutInfo.editable;
|
|
8202
|
+
const minSz = this.context.options?.minImageSize ?? 20;
|
|
8006
8203
|
let _raf = null;
|
|
8007
8204
|
const onMove = (me) => {
|
|
8008
8205
|
if (_raf !== null) return;
|
|
@@ -8015,15 +8212,15 @@ var ImageResizer = class {
|
|
|
8015
8212
|
const maxW = editable.clientWidth || Infinity;
|
|
8016
8213
|
let newW = startW;
|
|
8017
8214
|
let newH = startH;
|
|
8018
|
-
if (pos.includes("e")) newW = Math.max(
|
|
8019
|
-
if (pos.includes("w")) newW = Math.max(
|
|
8020
|
-
if (pos.includes("s")) newH = Math.max(
|
|
8021
|
-
if (pos.includes("n")) newH = Math.max(
|
|
8215
|
+
if (pos.includes("e")) newW = Math.max(minSz, startW + dx);
|
|
8216
|
+
if (pos.includes("w")) newW = Math.max(minSz, startW - dx);
|
|
8217
|
+
if (pos.includes("s")) newH = Math.max(minSz, startH + dy);
|
|
8218
|
+
if (pos.includes("n")) newH = Math.max(minSz, startH - dy);
|
|
8022
8219
|
newW = Math.min(newW, maxW);
|
|
8023
|
-
if (isCorner) if (Math.abs(dx) >= Math.abs(dy)) newH = Math.max(
|
|
8220
|
+
if (isCorner) if (Math.abs(dx) >= Math.abs(dy)) newH = Math.max(minSz, Math.round(newW / aspectRatio));
|
|
8024
8221
|
else {
|
|
8025
|
-
newW = Math.min(Math.max(
|
|
8026
|
-
newH = Math.max(
|
|
8222
|
+
newW = Math.min(Math.max(minSz, Math.round(newH * aspectRatio)), maxW);
|
|
8223
|
+
newH = Math.max(minSz, Math.round(newW / aspectRatio));
|
|
8027
8224
|
}
|
|
8028
8225
|
img.style.width = `${newW}px`;
|
|
8029
8226
|
img.style.height = `${newH}px`;
|
|
@@ -9085,7 +9282,17 @@ var ICONS$2 = {
|
|
|
9085
9282
|
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
9283
|
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
9284
|
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
|
|
9285
|
+
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>`,
|
|
9286
|
+
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>`,
|
|
9287
|
+
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>`,
|
|
9288
|
+
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>`,
|
|
9289
|
+
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>`,
|
|
9290
|
+
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>`,
|
|
9291
|
+
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>`,
|
|
9292
|
+
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>`,
|
|
9293
|
+
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>`,
|
|
9294
|
+
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>`,
|
|
9295
|
+
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
9296
|
};
|
|
9090
9297
|
var SHADE_PRESETS = [
|
|
9091
9298
|
"#000000",
|
|
@@ -9130,6 +9337,10 @@ var TableTooltip = class {
|
|
|
9130
9337
|
this._shadePopover = null;
|
|
9131
9338
|
this._shadeTitleEl = null;
|
|
9132
9339
|
this._shadeColorStrip = null;
|
|
9340
|
+
this._borderColorPopover = null;
|
|
9341
|
+
this._borderColorTitleEl = null;
|
|
9342
|
+
this._borderColorStrip = null;
|
|
9343
|
+
this._borderColorNoBtn = null;
|
|
9133
9344
|
this._selectMode = false;
|
|
9134
9345
|
this._selectedCells = [];
|
|
9135
9346
|
this._selectStart = null;
|
|
@@ -9144,6 +9355,8 @@ var TableTooltip = class {
|
|
|
9144
9355
|
document.body.appendChild(this._sizePopover);
|
|
9145
9356
|
this._shadePopover = this._buildCellShadePopover();
|
|
9146
9357
|
document.body.appendChild(this._shadePopover);
|
|
9358
|
+
this._borderColorPopover = this._buildBorderColorPopover();
|
|
9359
|
+
document.body.appendChild(this._borderColorPopover);
|
|
9147
9360
|
const editable = this.context.layoutInfo.editable;
|
|
9148
9361
|
this._editable = editable;
|
|
9149
9362
|
const onSelMousedown = (e) => {
|
|
@@ -9185,7 +9398,7 @@ var TableTooltip = class {
|
|
|
9185
9398
|
}, { passive: true }), on(document, "click", (e) => {
|
|
9186
9399
|
const et = e.target;
|
|
9187
9400
|
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();
|
|
9401
|
+
if (this._activeTable && !this._activeTable.contains(et) && !this._el.contains(et) && !this._sizePopover?.contains(et) && !this._borderColorPopover?.contains(et)) this._hide();
|
|
9189
9402
|
}), on(document, "selectionchange", () => this._syncShadeStrip()), on(globalThis, "scroll", () => this._hide(), { passive: true }), on(globalThis, "resize", () => this._hide(), { passive: true }));
|
|
9190
9403
|
this._initResize();
|
|
9191
9404
|
return this;
|
|
@@ -9320,6 +9533,8 @@ var TableTooltip = class {
|
|
|
9320
9533
|
this._sizePopover = null;
|
|
9321
9534
|
if (this._shadePopover?.parentNode) this._shadePopover.remove();
|
|
9322
9535
|
this._shadePopover = null;
|
|
9536
|
+
if (this._borderColorPopover?.parentNode) this._borderColorPopover.remove();
|
|
9537
|
+
this._borderColorPopover = null;
|
|
9323
9538
|
}
|
|
9324
9539
|
_buildTooltip() {
|
|
9325
9540
|
const L = this.context.locale.tooltips.table;
|
|
@@ -9343,10 +9558,18 @@ var TableTooltip = class {
|
|
|
9343
9558
|
el.appendChild(this._makeBtn(ICONS$2.colLeft, L.addColumnLeft, () => this._addColumn("left")));
|
|
9344
9559
|
el.appendChild(this._makeBtn(ICONS$2.colRight, L.addColumnRight, () => this._addColumn("right")));
|
|
9345
9560
|
el.appendChild(this._makeBtn(ICONS$2.deleteCol, L.deleteColumn, () => this._deleteColumn()));
|
|
9561
|
+
el.appendChild(this._makeBtn(ICONS$2.sortAsc, L.sortAsc, () => this._sortColumn("asc")));
|
|
9562
|
+
el.appendChild(this._makeBtn(ICONS$2.sortDesc, L.sortDesc, () => this._sortColumn("desc")));
|
|
9346
9563
|
el.appendChild(this._sep());
|
|
9347
9564
|
el.appendChild(this._makeBtn(ICONS$2.mergeCells, L.mergeCells, () => this._mergeCells()));
|
|
9348
9565
|
el.appendChild(this._makeBtn(ICONS$2.unmergeCells, L.unmergeCells, () => this._unmergeCells()));
|
|
9349
9566
|
el.appendChild(this._sep());
|
|
9567
|
+
el.appendChild(this._makeBtn(ICONS$2.alignLeft, L.cellAlignLeft, () => this._applyCellAlign("left")));
|
|
9568
|
+
el.appendChild(this._makeBtn(ICONS$2.alignCenter, L.cellAlignCenter, () => this._applyCellAlign("center")));
|
|
9569
|
+
el.appendChild(this._makeBtn(ICONS$2.alignRight, L.cellAlignRight, () => this._applyCellAlign("right")));
|
|
9570
|
+
el.appendChild(this._makeBtn(ICONS$2.alignJustify, L.cellAlignJustify, () => this._applyCellAlign("justify")));
|
|
9571
|
+
el.appendChild(this._makeBtn(ICONS$2.headerRow, L.toggleHeaderRow, () => this._toggleHeaderRow()));
|
|
9572
|
+
el.appendChild(this._sep());
|
|
9350
9573
|
const shadeBtn = createElement("button", {
|
|
9351
9574
|
type: "button",
|
|
9352
9575
|
class: "an-link-tooltip-btn an-link-tooltip-btn--shade",
|
|
@@ -9368,12 +9591,33 @@ var TableTooltip = class {
|
|
|
9368
9591
|
el.appendChild(this._makeBtn(ICONS$2.colWidth, L.columnWidth, () => this._openSizePopover("col")));
|
|
9369
9592
|
el.appendChild(this._makeBtn(ICONS$2.rowHeight, L.rowHeight, () => this._openSizePopover("row")));
|
|
9370
9593
|
el.appendChild(this._makeBtn(ICONS$2.tableBorder, L.tableBorderWidth, () => this._openSizePopover("border")));
|
|
9594
|
+
el.appendChild(this._makeBtn(ICONS$2.cellPadding, L.cellPadding, () => this._openSizePopover("cellPadding")));
|
|
9595
|
+
const borderColorBtn = createElement("button", {
|
|
9596
|
+
type: "button",
|
|
9597
|
+
class: "an-link-tooltip-btn an-link-tooltip-btn--shade",
|
|
9598
|
+
title: L.tableBorderColor
|
|
9599
|
+
});
|
|
9600
|
+
const borderColorSvgWrap = createElement("span", { class: "an-bubble-btn-svg" });
|
|
9601
|
+
borderColorSvgWrap.innerHTML = ICONS$2.borderColor;
|
|
9602
|
+
const borderColorStrip = createElement("span", { class: "an-link-tooltip-color-strip" });
|
|
9603
|
+
borderColorBtn.appendChild(borderColorSvgWrap);
|
|
9604
|
+
borderColorBtn.appendChild(borderColorStrip);
|
|
9605
|
+
this._borderColorStrip = borderColorStrip;
|
|
9606
|
+
this._disposers.push(on(borderColorBtn, "click", (e) => {
|
|
9607
|
+
e.preventDefault();
|
|
9608
|
+
e.stopPropagation();
|
|
9609
|
+
this._openBorderColorPopover();
|
|
9610
|
+
}));
|
|
9611
|
+
el.appendChild(borderColorBtn);
|
|
9371
9612
|
el.appendChild(this._sep());
|
|
9372
9613
|
el.appendChild(this._makeBtn(ICONS$2.deleteTable, L.deleteTable, () => this._deleteTable(), true));
|
|
9614
|
+
el.appendChild(this._sep());
|
|
9615
|
+
el.appendChild(this._makeBtn(ICONS$2.exportCSV, L.exportCSV, () => this._exportTableCSV()));
|
|
9373
9616
|
this._disposers.push(on(el, "mouseenter", () => this._clearTimers()), on(el, "mouseleave", () => {
|
|
9374
9617
|
if (this._selectMode) return;
|
|
9375
9618
|
if (this._sizePopover && this._sizePopover.style.display !== "none") return;
|
|
9376
9619
|
if (this._shadePopover && this._shadePopover.style.display !== "none") return;
|
|
9620
|
+
if (this._borderColorPopover && this._borderColorPopover.style.display !== "none") return;
|
|
9377
9621
|
this._scheduleHide();
|
|
9378
9622
|
}));
|
|
9379
9623
|
return el;
|
|
@@ -9421,6 +9665,7 @@ var TableTooltip = class {
|
|
|
9421
9665
|
if (!this._activeTable) return;
|
|
9422
9666
|
this._el.style.display = "flex";
|
|
9423
9667
|
this._syncShadeStrip();
|
|
9668
|
+
this._syncBorderColorStrip();
|
|
9424
9669
|
requestAnimationFrame(() => {
|
|
9425
9670
|
if (this._activeTable) this._positionNear(this._activeTable);
|
|
9426
9671
|
});
|
|
@@ -9442,6 +9687,7 @@ var TableTooltip = class {
|
|
|
9442
9687
|
this._clearSelection();
|
|
9443
9688
|
this._clearTimers();
|
|
9444
9689
|
this._hideSizePopover();
|
|
9690
|
+
this._hideBorderColorPopover();
|
|
9445
9691
|
}
|
|
9446
9692
|
_clearTimers() {
|
|
9447
9693
|
clearTimeout(this._showTimer);
|
|
@@ -9841,6 +10087,19 @@ var TableTooltip = class {
|
|
|
9841
10087
|
});
|
|
9842
10088
|
this.context.invoke("editor.afterCommand");
|
|
9843
10089
|
};
|
|
10090
|
+
} else if (type === "cellPadding") {
|
|
10091
|
+
const firstCell = this._getSelectedCells()[0] || this._getCell();
|
|
10092
|
+
const currentPad = firstCell ? Number.parseInt(firstCell.style.padding, 10) || Number.parseInt(firstCell.style.paddingTop, 10) || 4 : 4;
|
|
10093
|
+
this._sizeTitleEl.textContent = this.context.locale.tooltips.table.cellPaddingPx;
|
|
10094
|
+
this._sizeInputEl.min = "0";
|
|
10095
|
+
this._sizeInputEl.max = "40";
|
|
10096
|
+
this._sizeInputEl.value = String(currentPad);
|
|
10097
|
+
this._sizeApply = (val) => {
|
|
10098
|
+
this._getSelectedCells().forEach((c) => {
|
|
10099
|
+
if (c) c.style.padding = `${val}px`;
|
|
10100
|
+
});
|
|
10101
|
+
this.context.invoke("editor.afterCommand");
|
|
10102
|
+
};
|
|
9844
10103
|
} else {
|
|
9845
10104
|
const isCol = type === "col";
|
|
9846
10105
|
const activeCells = this._getSelectedCells().filter((c) => {
|
|
@@ -9937,7 +10196,7 @@ var TableTooltip = class {
|
|
|
9937
10196
|
value: "#ffffff"
|
|
9938
10197
|
});
|
|
9939
10198
|
const customLabel = createElement("span");
|
|
9940
|
-
customLabel.textContent =
|
|
10199
|
+
customLabel.textContent = this.context.locale.contextMenu.customColorLabel;
|
|
9941
10200
|
this._disposers.push(on(colorInput, "change", () => this._applyCellShade(colorInput.value)));
|
|
9942
10201
|
customRow.appendChild(colorInput);
|
|
9943
10202
|
customRow.appendChild(customLabel);
|
|
@@ -9978,6 +10237,172 @@ var TableTooltip = class {
|
|
|
9978
10237
|
this._hideCellShadePopover();
|
|
9979
10238
|
this.context.invoke("editor.afterCommand");
|
|
9980
10239
|
}
|
|
10240
|
+
_buildBorderColorPopover() {
|
|
10241
|
+
const pop = createElement("div", { class: "an-cell-shade-popover" });
|
|
10242
|
+
pop.style.display = "none";
|
|
10243
|
+
const title = createElement("div", { class: "an-size-popover-title" });
|
|
10244
|
+
pop.appendChild(title);
|
|
10245
|
+
this._borderColorTitleEl = title;
|
|
10246
|
+
const palette = createElement("div", { class: "an-context-color-palette" });
|
|
10247
|
+
SHADE_PRESETS.forEach((color) => {
|
|
10248
|
+
const sw = createElement("div", {
|
|
10249
|
+
class: "an-context-color-swatch",
|
|
10250
|
+
title: color
|
|
10251
|
+
});
|
|
10252
|
+
sw.style.background = color;
|
|
10253
|
+
this._disposers.push(on(sw, "click", (e) => {
|
|
10254
|
+
e.stopPropagation();
|
|
10255
|
+
this._applyBorderColor(color);
|
|
10256
|
+
}));
|
|
10257
|
+
palette.appendChild(sw);
|
|
10258
|
+
});
|
|
10259
|
+
pop.appendChild(palette);
|
|
10260
|
+
const noColorRow = createElement("div", { class: "an-context-color-custom" });
|
|
10261
|
+
const noColorBtn = createElement("button", {
|
|
10262
|
+
type: "button",
|
|
10263
|
+
class: "an-shade-no-color"
|
|
10264
|
+
});
|
|
10265
|
+
this._disposers.push(on(noColorBtn, "click", () => this._applyBorderColor("")));
|
|
10266
|
+
noColorRow.appendChild(noColorBtn);
|
|
10267
|
+
pop.appendChild(noColorRow);
|
|
10268
|
+
this._borderColorNoBtn = noColorBtn;
|
|
10269
|
+
const customRow = createElement("div", { class: "an-context-color-custom" });
|
|
10270
|
+
const colorInput = createElement("input", {
|
|
10271
|
+
type: "color",
|
|
10272
|
+
class: "an-shade-color-input",
|
|
10273
|
+
value: "#000000"
|
|
10274
|
+
});
|
|
10275
|
+
const customLabel = createElement("span");
|
|
10276
|
+
customLabel.textContent = this.context.locale.contextMenu.customColorLabel;
|
|
10277
|
+
this._disposers.push(on(colorInput, "change", () => this._applyBorderColor(colorInput.value)));
|
|
10278
|
+
customRow.appendChild(colorInput);
|
|
10279
|
+
customRow.appendChild(customLabel);
|
|
10280
|
+
pop.appendChild(customRow);
|
|
10281
|
+
this._disposers.push(on(pop, "mousedown", (e) => e.preventDefault()), on(pop, "mouseenter", () => this._clearTimers()), on(pop, "mouseleave", () => this._scheduleHide()), on(document, "click", (e) => {
|
|
10282
|
+
const et = e.target;
|
|
10283
|
+
if (this._borderColorPopover && this._borderColorPopover.style.display !== "none" && !this._borderColorPopover.contains(et) && !this._el?.contains(et)) this._hideBorderColorPopover();
|
|
10284
|
+
}));
|
|
10285
|
+
return pop;
|
|
10286
|
+
}
|
|
10287
|
+
_openBorderColorPopover() {
|
|
10288
|
+
if (!this._borderColorPopover) return;
|
|
10289
|
+
const L = this.context.locale.tooltips.table;
|
|
10290
|
+
if (this._borderColorTitleEl) this._borderColorTitleEl.textContent = L.tableBorderColor;
|
|
10291
|
+
if (this._borderColorNoBtn) this._borderColorNoBtn.textContent = L.noBorderColor;
|
|
10292
|
+
this._borderColorPopover.style.display = "block";
|
|
10293
|
+
requestAnimationFrame(() => {
|
|
10294
|
+
if (!this._borderColorPopover || !this._el) return;
|
|
10295
|
+
const pw = this._borderColorPopover.offsetWidth || 170;
|
|
10296
|
+
const ph = this._borderColorPopover.offsetHeight || 120;
|
|
10297
|
+
const tipRect = this._el.getBoundingClientRect();
|
|
10298
|
+
let left = tipRect.left;
|
|
10299
|
+
let top = tipRect.bottom + 6;
|
|
10300
|
+
if (left + pw > globalThis.innerWidth - 8) left = globalThis.innerWidth - pw - 8;
|
|
10301
|
+
if (top + ph > globalThis.innerHeight - 8) top = tipRect.top - ph - 6;
|
|
10302
|
+
this._borderColorPopover.style.left = `${Math.max(8, left)}px`;
|
|
10303
|
+
this._borderColorPopover.style.top = `${Math.max(8, top)}px`;
|
|
10304
|
+
});
|
|
10305
|
+
}
|
|
10306
|
+
_hideBorderColorPopover() {
|
|
10307
|
+
if (this._borderColorPopover) this._borderColorPopover.style.display = "none";
|
|
10308
|
+
}
|
|
10309
|
+
_applyBorderColor(color) {
|
|
10310
|
+
const table = this._activeTable;
|
|
10311
|
+
if (!table) return;
|
|
10312
|
+
Array.from(table.querySelectorAll("td, th")).forEach((c) => {
|
|
10313
|
+
c.style.borderColor = color;
|
|
10314
|
+
});
|
|
10315
|
+
if (this._borderColorStrip) this._borderColorStrip.style.background = color || "transparent";
|
|
10316
|
+
this._hideBorderColorPopover();
|
|
10317
|
+
this.context.invoke("editor.afterCommand");
|
|
10318
|
+
}
|
|
10319
|
+
_syncBorderColorStrip() {
|
|
10320
|
+
if (!this._borderColorStrip || !this._el || this._el.style.display === "none") return;
|
|
10321
|
+
const firstCell = this._activeTable?.querySelector("td, th");
|
|
10322
|
+
this._borderColorStrip.style.background = firstCell?.style.borderColor || "transparent";
|
|
10323
|
+
}
|
|
10324
|
+
_applyCellAlign(align) {
|
|
10325
|
+
this._getSelectedCells().forEach((c) => {
|
|
10326
|
+
if (c) c.style.textAlign = align;
|
|
10327
|
+
});
|
|
10328
|
+
this.context.invoke("editor.afterCommand");
|
|
10329
|
+
}
|
|
10330
|
+
_toggleHeaderRow() {
|
|
10331
|
+
const table = this._activeTable;
|
|
10332
|
+
if (!table) return;
|
|
10333
|
+
const firstRow = table.querySelector("tr");
|
|
10334
|
+
if (!firstRow) return;
|
|
10335
|
+
if (firstRow.closest("thead") !== null) {
|
|
10336
|
+
let tbody = table.querySelector("tbody");
|
|
10337
|
+
if (!tbody) {
|
|
10338
|
+
tbody = document.createElement("tbody");
|
|
10339
|
+
table.appendChild(tbody);
|
|
10340
|
+
}
|
|
10341
|
+
Array.from(firstRow.cells).forEach((cell) => {
|
|
10342
|
+
const td = document.createElement("td");
|
|
10343
|
+
td.innerHTML = cell.innerHTML;
|
|
10344
|
+
td.style.cssText = cell.style.cssText;
|
|
10345
|
+
firstRow.replaceChild(td, cell);
|
|
10346
|
+
});
|
|
10347
|
+
tbody.insertBefore(firstRow, tbody.firstChild);
|
|
10348
|
+
const thead = table.querySelector("thead");
|
|
10349
|
+
if (thead && thead.rows.length === 0) thead.remove();
|
|
10350
|
+
} else {
|
|
10351
|
+
let thead = table.querySelector("thead");
|
|
10352
|
+
if (!thead) {
|
|
10353
|
+
thead = document.createElement("thead");
|
|
10354
|
+
table.insertBefore(thead, table.firstChild);
|
|
10355
|
+
}
|
|
10356
|
+
Array.from(firstRow.cells).forEach((cell) => {
|
|
10357
|
+
const th = document.createElement("th");
|
|
10358
|
+
th.innerHTML = cell.innerHTML;
|
|
10359
|
+
th.style.cssText = cell.style.cssText;
|
|
10360
|
+
firstRow.replaceChild(th, cell);
|
|
10361
|
+
});
|
|
10362
|
+
thead.appendChild(firstRow);
|
|
10363
|
+
}
|
|
10364
|
+
this.context.invoke("editor.afterCommand");
|
|
10365
|
+
}
|
|
10366
|
+
_sortColumn(direction) {
|
|
10367
|
+
const table = this._activeTable;
|
|
10368
|
+
if (!table) return;
|
|
10369
|
+
const cell = this._getCell();
|
|
10370
|
+
if (!cell) return;
|
|
10371
|
+
const colIdx = getVisualColIndex(cell);
|
|
10372
|
+
if (colIdx === -1) return;
|
|
10373
|
+
const tbody = table.querySelector("tbody") || table;
|
|
10374
|
+
const rows = Array.from(tbody.querySelectorAll(":scope > tr"));
|
|
10375
|
+
if (rows.length < 2) return;
|
|
10376
|
+
rows.sort((a, b) => {
|
|
10377
|
+
const aCell = getCellAtVisualCol(a, colIdx);
|
|
10378
|
+
const bCell = getCellAtVisualCol(b, colIdx);
|
|
10379
|
+
const aText = (aCell?.textContent || "").trim();
|
|
10380
|
+
const bText = (bCell?.textContent || "").trim();
|
|
10381
|
+
const aNum = parseFloat(aText);
|
|
10382
|
+
const bNum = parseFloat(bText);
|
|
10383
|
+
if (!isNaN(aNum) && !isNaN(bNum)) return direction === "asc" ? aNum - bNum : bNum - aNum;
|
|
10384
|
+
return direction === "asc" ? aText.localeCompare(bText) : bText.localeCompare(aText);
|
|
10385
|
+
});
|
|
10386
|
+
rows.forEach((row) => tbody.appendChild(row));
|
|
10387
|
+
this.context.invoke("editor.afterCommand");
|
|
10388
|
+
}
|
|
10389
|
+
_exportTableCSV() {
|
|
10390
|
+
const table = this._activeTable;
|
|
10391
|
+
if (!table) return;
|
|
10392
|
+
const csv = Array.from(table.querySelectorAll("tr")).map((row) => Array.from(row.querySelectorAll("td, th")).map((cell) => {
|
|
10393
|
+
return `"${(cell.textContent || "").trim().replace(/"/g, "\"\"")}"`;
|
|
10394
|
+
}).join(",")).join("\n");
|
|
10395
|
+
const blob = new Blob(["" + csv], { type: "text/csv;charset=utf-8;" });
|
|
10396
|
+
const url = URL.createObjectURL(blob);
|
|
10397
|
+
const a = document.createElement("a");
|
|
10398
|
+
a.href = url;
|
|
10399
|
+
a.download = "table.csv";
|
|
10400
|
+
a.style.display = "none";
|
|
10401
|
+
document.body.appendChild(a);
|
|
10402
|
+
a.click();
|
|
10403
|
+
a.remove();
|
|
10404
|
+
URL.revokeObjectURL(url);
|
|
10405
|
+
}
|
|
9981
10406
|
};
|
|
9982
10407
|
//#endregion
|
|
9983
10408
|
//#region src/js/module/CodeTooltip.js
|
|
@@ -9988,7 +10413,8 @@ var ICONS$1 = {
|
|
|
9988
10413
|
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
10414
|
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
10415
|
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
|
|
10416
|
+
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>`,
|
|
10417
|
+
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
10418
|
};
|
|
9993
10419
|
var CodeTooltip = class {
|
|
9994
10420
|
/** @param {import('../Context.js').Context} context */
|
|
@@ -10000,6 +10426,8 @@ var CodeTooltip = class {
|
|
|
10000
10426
|
this._hideTimer = null;
|
|
10001
10427
|
this._disposers = [];
|
|
10002
10428
|
this._copyBtn = null;
|
|
10429
|
+
this._wrapBtn = null;
|
|
10430
|
+
this._lineNumbersBtn = null;
|
|
10003
10431
|
this._langSelect = null;
|
|
10004
10432
|
this._prismScript = null;
|
|
10005
10433
|
}
|
|
@@ -10080,6 +10508,8 @@ var CodeTooltip = class {
|
|
|
10080
10508
|
el.appendChild(this._sep());
|
|
10081
10509
|
this._wrapBtn = this._makeBtn(ICONS$1.wrapOn, L.toggleWordWrap, () => this._toggleWrap());
|
|
10082
10510
|
el.appendChild(this._wrapBtn);
|
|
10511
|
+
this._lineNumbersBtn = this._makeBtn(ICONS$1.lineNumbers, L.lineNumbers, () => this._toggleLineNumbers());
|
|
10512
|
+
el.appendChild(this._lineNumbersBtn);
|
|
10083
10513
|
el.appendChild(this._sep());
|
|
10084
10514
|
el.appendChild(this._makeBtn(ICONS$1.toParagraph, L.convertToParagraph, () => this._toParagraph()));
|
|
10085
10515
|
el.appendChild(this._sep());
|
|
@@ -10118,6 +10548,7 @@ var CodeTooltip = class {
|
|
|
10118
10548
|
this._showTimer = setTimeout(() => {
|
|
10119
10549
|
this._activePre = pre;
|
|
10120
10550
|
this._syncWrapBtn();
|
|
10551
|
+
this._syncLineNumbersBtn();
|
|
10121
10552
|
this._syncLangSelect();
|
|
10122
10553
|
this._show(pre);
|
|
10123
10554
|
}, SHOW_DELAY);
|
|
@@ -10162,6 +10593,12 @@ var CodeTooltip = class {
|
|
|
10162
10593
|
this._wrapBtn.classList.toggle("active", wrapped);
|
|
10163
10594
|
this._wrapBtn.title = wrapped ? this.context.locale.tooltips.code.disableWordWrap : this.context.locale.tooltips.code.enableWordWrap;
|
|
10164
10595
|
}
|
|
10596
|
+
_syncLineNumbersBtn() {
|
|
10597
|
+
if (!this._activePre || !this._lineNumbersBtn) return;
|
|
10598
|
+
const on = this._activePre.classList.contains("an-code-line-numbers");
|
|
10599
|
+
this._lineNumbersBtn.classList.toggle("active", on);
|
|
10600
|
+
this._lineNumbersBtn.title = this.context.locale.tooltips.code.lineNumbers;
|
|
10601
|
+
}
|
|
10165
10602
|
_syncLangSelect() {
|
|
10166
10603
|
if (!this._activePre || !this._langSelect) return;
|
|
10167
10604
|
const codeEl = this._activePre.querySelector("code");
|
|
@@ -10208,6 +10645,13 @@ var CodeTooltip = class {
|
|
|
10208
10645
|
this.context.invoke("editor.afterCommand");
|
|
10209
10646
|
this._positionNear(pre);
|
|
10210
10647
|
}
|
|
10648
|
+
_toggleLineNumbers() {
|
|
10649
|
+
const pre = this._activePre;
|
|
10650
|
+
if (!pre) return;
|
|
10651
|
+
pre.classList.toggle("an-code-line-numbers");
|
|
10652
|
+
this._syncLineNumbersBtn();
|
|
10653
|
+
this.context.invoke("editor.afterCommand");
|
|
10654
|
+
}
|
|
10211
10655
|
/**
|
|
10212
10656
|
* Applies a language to a given <pre> element: sets classes, data-language,
|
|
10213
10657
|
* and triggers Prism highlighting. Called by the auto-detect flow.
|
|
@@ -14218,12 +14662,16 @@ var FindReplace = class extends BaseDialog {
|
|
|
14218
14662
|
this._matches = [];
|
|
14219
14663
|
this._currentIndex = -1;
|
|
14220
14664
|
this._caseSensitive = false;
|
|
14665
|
+
this._useRegex = false;
|
|
14666
|
+
this._wholeWord = false;
|
|
14221
14667
|
/** @type {'find'|'replace'} */
|
|
14222
14668
|
this._mode = "find";
|
|
14223
14669
|
/** Cached compiled regex — reused when query and case-sensitivity are unchanged */
|
|
14224
14670
|
this._queryRegex = null;
|
|
14225
14671
|
this._lastQuery = null;
|
|
14226
14672
|
this._lastCaseSensitive = null;
|
|
14673
|
+
this._lastUseRegex = null;
|
|
14674
|
+
this._lastWholeWord = null;
|
|
14227
14675
|
this._focusTimer = null;
|
|
14228
14676
|
}
|
|
14229
14677
|
destroy() {
|
|
@@ -14327,6 +14775,20 @@ var FindReplace = class extends BaseDialog {
|
|
|
14327
14775
|
"aria-label": "Case sensitive"
|
|
14328
14776
|
});
|
|
14329
14777
|
caseBtn.textContent = "Aa";
|
|
14778
|
+
const regexBtn = createElement("button", {
|
|
14779
|
+
type: "button",
|
|
14780
|
+
class: "an-fr-icon-btn",
|
|
14781
|
+
title: L.useRegex,
|
|
14782
|
+
"aria-label": L.useRegex
|
|
14783
|
+
});
|
|
14784
|
+
regexBtn.textContent = ".*";
|
|
14785
|
+
const wholeWordBtn = createElement("button", {
|
|
14786
|
+
type: "button",
|
|
14787
|
+
class: "an-fr-icon-btn",
|
|
14788
|
+
title: L.wholeWord,
|
|
14789
|
+
"aria-label": L.wholeWord
|
|
14790
|
+
});
|
|
14791
|
+
wholeWordBtn.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" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="7" width="18" height="10" rx="2"/><line x1="7" y1="21" x2="7" y2="17"/><line x1="17" y1="21" x2="17" y2="17"/></svg>`;
|
|
14330
14792
|
const prevBtn = createElement("button", {
|
|
14331
14793
|
type: "button",
|
|
14332
14794
|
class: "an-fr-icon-btn",
|
|
@@ -14343,7 +14805,7 @@ var FindReplace = class extends BaseDialog {
|
|
|
14343
14805
|
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
14806
|
const counter = createElement("span", { class: "an-fr-counter" });
|
|
14345
14807
|
this._counterEl = counter;
|
|
14346
|
-
searchBar.append(findInput, caseCheckbox, caseBtn, prevBtn, nextBtn, counter);
|
|
14808
|
+
searchBar.append(findInput, caseCheckbox, caseBtn, regexBtn, wholeWordBtn, prevBtn, nextBtn, counter);
|
|
14347
14809
|
box.appendChild(searchBar);
|
|
14348
14810
|
const replaceRow = createElement("div", { class: "an-fr-replace-row" });
|
|
14349
14811
|
replaceRow.style.display = "none";
|
|
@@ -14404,7 +14866,21 @@ var FindReplace = class extends BaseDialog {
|
|
|
14404
14866
|
this._replace();
|
|
14405
14867
|
}
|
|
14406
14868
|
});
|
|
14407
|
-
|
|
14869
|
+
const dRegex = on(regexBtn, "click", () => {
|
|
14870
|
+
this._useRegex = !this._useRegex;
|
|
14871
|
+
regexBtn.classList.toggle("an-fr-icon-btn--active", this._useRegex);
|
|
14872
|
+
this._queryRegex = null;
|
|
14873
|
+
this._lastQuery = null;
|
|
14874
|
+
this._onSearch();
|
|
14875
|
+
});
|
|
14876
|
+
const dWholeWord = on(wholeWordBtn, "click", () => {
|
|
14877
|
+
this._wholeWord = !this._wholeWord;
|
|
14878
|
+
wholeWordBtn.classList.toggle("an-fr-icon-btn--active", this._wholeWord);
|
|
14879
|
+
this._queryRegex = null;
|
|
14880
|
+
this._lastQuery = null;
|
|
14881
|
+
this._onSearch();
|
|
14882
|
+
});
|
|
14883
|
+
this._disposers.push(d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, dRegex, dWholeWord);
|
|
14408
14884
|
return overlay;
|
|
14409
14885
|
}
|
|
14410
14886
|
_onSearch() {
|
|
@@ -14462,13 +14938,21 @@ var FindReplace = class extends BaseDialog {
|
|
|
14462
14938
|
*/
|
|
14463
14939
|
_findRawMatches(query, root) {
|
|
14464
14940
|
const results = [];
|
|
14465
|
-
if (this._lastQuery !== query || this._lastCaseSensitive !== this._caseSensitive) {
|
|
14941
|
+
if (this._lastQuery !== query || this._lastCaseSensitive !== this._caseSensitive || this._lastUseRegex !== this._useRegex || this._lastWholeWord !== this._wholeWord) {
|
|
14466
14942
|
const flags = this._caseSensitive ? "g" : "gi";
|
|
14467
|
-
|
|
14468
|
-
|
|
14943
|
+
try {
|
|
14944
|
+
let pattern = this._useRegex ? query : query.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
14945
|
+
if (this._wholeWord) pattern = `\\b${pattern}\\b`;
|
|
14946
|
+
this._queryRegex = new RegExp(pattern, flags);
|
|
14947
|
+
} catch (_) {
|
|
14948
|
+
this._queryRegex = null;
|
|
14949
|
+
}
|
|
14469
14950
|
this._lastQuery = query;
|
|
14470
14951
|
this._lastCaseSensitive = this._caseSensitive;
|
|
14952
|
+
this._lastUseRegex = this._useRegex;
|
|
14953
|
+
this._lastWholeWord = this._wholeWord;
|
|
14471
14954
|
}
|
|
14955
|
+
if (!this._queryRegex) return results;
|
|
14472
14956
|
const re = this._queryRegex;
|
|
14473
14957
|
const MAX_RESULTS = 500;
|
|
14474
14958
|
const walker = document.createTreeWalker(root, 4);
|
|
@@ -16004,13 +16488,18 @@ var Mention = class {
|
|
|
16004
16488
|
this._query = query;
|
|
16005
16489
|
clearTimeout(this._debounceTimer);
|
|
16006
16490
|
this._debounceTimer = setTimeout(() => {
|
|
16007
|
-
|
|
16491
|
+
const cb = (items) => {
|
|
16008
16492
|
if (!Array.isArray(items) || items.length === 0) {
|
|
16009
16493
|
this._hideDropdown();
|
|
16010
16494
|
return;
|
|
16011
16495
|
}
|
|
16012
16496
|
this._renderItems(items);
|
|
16013
16497
|
this._showDropdown();
|
|
16498
|
+
};
|
|
16499
|
+
const result = this._cfg.onSearch(this._query, cb);
|
|
16500
|
+
if (result && typeof result.then === "function") result.then(cb).catch((err) => {
|
|
16501
|
+
this._hideDropdown();
|
|
16502
|
+
if (typeof this._cfg.onError === "function") this._cfg.onError(err);
|
|
16014
16503
|
});
|
|
16015
16504
|
}, this._cfg.debounce);
|
|
16016
16505
|
}
|
|
@@ -16279,10 +16768,13 @@ var Context = class {
|
|
|
16279
16768
|
}
|
|
16280
16769
|
/**
|
|
16281
16770
|
* Returns the current HTML content of the editor.
|
|
16771
|
+
* Zero-width spaces (U+200B) inserted by inline editing helpers are stripped
|
|
16772
|
+
* from the output so they don't leak into the consumer's HTML.
|
|
16282
16773
|
* @returns {string}
|
|
16283
16774
|
*/
|
|
16284
16775
|
getHTML() {
|
|
16285
|
-
|
|
16776
|
+
const html = this.invoke("editor.getHTML");
|
|
16777
|
+
return typeof html === "string" ? html.replace(//g, "") : html;
|
|
16286
16778
|
}
|
|
16287
16779
|
/**
|
|
16288
16780
|
* Sets the HTML content of the editor.
|
|
@@ -16320,6 +16812,20 @@ var Context = class {
|
|
|
16320
16812
|
this.invoke("editor.clearHistory");
|
|
16321
16813
|
}
|
|
16322
16814
|
/**
|
|
16815
|
+
* Returns the number of available undo steps.
|
|
16816
|
+
* @returns {number}
|
|
16817
|
+
*/
|
|
16818
|
+
getUndoCount() {
|
|
16819
|
+
return this.invoke("editor.getUndoCount") ?? 0;
|
|
16820
|
+
}
|
|
16821
|
+
/**
|
|
16822
|
+
* Returns the number of available redo steps.
|
|
16823
|
+
* @returns {number}
|
|
16824
|
+
*/
|
|
16825
|
+
getRedoCount() {
|
|
16826
|
+
return this.invoke("editor.getRedoCount") ?? 0;
|
|
16827
|
+
}
|
|
16828
|
+
/**
|
|
16323
16829
|
* Returns true when the editor has no meaningful content.
|
|
16324
16830
|
* @returns {boolean}
|
|
16325
16831
|
*/
|
|
@@ -16427,6 +16933,37 @@ var Context = class {
|
|
|
16427
16933
|
});
|
|
16428
16934
|
}
|
|
16429
16935
|
/**
|
|
16936
|
+
* Returns an array of heading objects representing the table of contents.
|
|
16937
|
+
* Each entry has: level (1-6), text (heading text), element (DOM element).
|
|
16938
|
+
* @returns {{ level: number, text: string, element: HTMLElement }[]}
|
|
16939
|
+
*/
|
|
16940
|
+
getTableOfContents() {
|
|
16941
|
+
return Array.from(this.layoutInfo.editable.querySelectorAll("h1,h2,h3,h4,h5,h6")).map((el) => ({
|
|
16942
|
+
level: parseInt(el.tagName[1], 10),
|
|
16943
|
+
text: el.textContent?.trim() ?? "",
|
|
16944
|
+
element: el
|
|
16945
|
+
}));
|
|
16946
|
+
}
|
|
16947
|
+
/**
|
|
16948
|
+
* Moves focus into the editable area.
|
|
16949
|
+
*/
|
|
16950
|
+
focus() {
|
|
16951
|
+
this.layoutInfo.editable.focus();
|
|
16952
|
+
}
|
|
16953
|
+
/**
|
|
16954
|
+
* Removes focus from the editable area.
|
|
16955
|
+
*/
|
|
16956
|
+
blur() {
|
|
16957
|
+
this.layoutInfo.editable.blur();
|
|
16958
|
+
}
|
|
16959
|
+
/**
|
|
16960
|
+
* Returns true when the editor is currently in fullscreen mode.
|
|
16961
|
+
* @returns {boolean}
|
|
16962
|
+
*/
|
|
16963
|
+
isFullscreen() {
|
|
16964
|
+
return this.invoke("fullscreen.isActive") === true;
|
|
16965
|
+
}
|
|
16966
|
+
/**
|
|
16430
16967
|
* Sets whether the editor is disabled (readonly).
|
|
16431
16968
|
* @param {boolean} disabled
|
|
16432
16969
|
*/
|
|
@@ -16463,11 +17000,13 @@ var Context = class {
|
|
|
16463
17000
|
this._disposers = [];
|
|
16464
17001
|
const container = this.layoutInfo.container;
|
|
16465
17002
|
const wasDark = container?.classList.contains("an-theme-dark");
|
|
17003
|
+
const wasAuto = container?.classList.contains("an-theme-auto");
|
|
16466
17004
|
if (container?.parentNode) {
|
|
16467
17005
|
this.targetEl.style.display = "";
|
|
16468
17006
|
container.remove();
|
|
16469
17007
|
}
|
|
16470
17008
|
if (wasDark && !document.querySelector(".an-container.an-theme-dark")) document.body.classList.remove("an-theme-dark");
|
|
17009
|
+
if (wasAuto && !document.querySelector(".an-container.an-theme-auto")) document.body.classList.remove("an-theme-auto");
|
|
16471
17010
|
if (typeof this.options.onDestroy === "function") this.options.onDestroy(this);
|
|
16472
17011
|
this._alive = false;
|
|
16473
17012
|
this._listeners.clear();
|
|
@@ -16720,8 +17259,10 @@ var AutumnNote = {
|
|
|
16720
17259
|
registerButton(btnDef);
|
|
16721
17260
|
return this;
|
|
16722
17261
|
},
|
|
17262
|
+
/** All pre-built button definitions — accessible in every module format including UMD/CJS. */
|
|
17263
|
+
buttons,
|
|
16723
17264
|
/** Library version */
|
|
16724
|
-
version: "1.
|
|
17265
|
+
version: "1.8.0"
|
|
16725
17266
|
};
|
|
16726
17267
|
/**
|
|
16727
17268
|
* @param {string|Element|NodeList|Element[]} selector
|
|
@@ -16734,6 +17275,6 @@ function resolveElements(selector) {
|
|
|
16734
17275
|
return [];
|
|
16735
17276
|
}
|
|
16736
17277
|
//#endregion
|
|
16737
|
-
export { Context, ELEMENT_NODE, TEXT_NODE, WrappedRange, _buttonRegistry, alignCenterBtn, alignJustifyBtn, alignLeftBtn, alignRightBtn, all, ancestors, any, backColorBtn, boldBtn, checklistBtn, children, chunk, clamp, closest, closestPara, codeviewBtn, collapsedRange, compose, createElement, currentRange, debounce, AutumnNote as default, defaultOptions, defaultToolbar, directionBtn, emojiBtn, env, findBtn, findReplaceBtn, first, flatten, fontFamilyBtn, fontSizeBtn, foreColorBtn, fromNativeRange, fullscreenBtn, getButton, groupBy, hrBtn, iconBtn, identity, imageBtn, indentBtn, initial, inlineCodeBtn, insertAfter, isAnchor, isEditable, isElement, isEmpty, isFunction, isImage, isInline, isInsideEditable, isKey, isLi, isList, isModifier, isNil, isPara, isPlainObject, isSelectionInside, isString, isTable, isText, isVoid, italicBtn, key, last, lineHeightBtn, linkBtn, locales, makeDraggable, mergeDeep, nextElement, nodeValue, olBtn, on, outdentBtn, outerHtml, paragraphStyleBtn, placeCaret, prevElement, printBtn, rangeFromElement, rect2bnd, redoBtn, registerButton, remove, removeFormatBtn, resolveLocale, sanitiseHTML, sanitiseUrl, shortcutsBtn, splitText, strikeBtn, subscriptBtn, superscriptBtn, tableBtn, tail, throttle, trapFocus, ulBtn, underlineBtn, undoBtn, unique, unwrap, videoBtn, withSavedRange, wrap };
|
|
17278
|
+
export { Context, ELEMENT_NODE, TEXT_NODE, WrappedRange, _buttonRegistry, alignCenterBtn, alignJustifyBtn, alignLeftBtn, alignRightBtn, all, ancestors, any, backColorBtn, boldBtn, buttons, checklistBtn, children, chunk, clamp, closest, closestPara, codeviewBtn, collapsedRange, compose, createElement, currentRange, debounce, AutumnNote as default, defaultOptions, defaultToolbar, directionBtn, emojiBtn, env, findBtn, findReplaceBtn, first, flatten, fontFamilyBtn, fontSizeBtn, foreColorBtn, fromNativeRange, fullscreenBtn, getButton, groupBy, hrBtn, iconBtn, identity, imageBtn, indentBtn, initial, inlineCodeBtn, insertAfter, isAnchor, isEditable, isElement, isEmpty, isFunction, isImage, isInline, isInsideEditable, isKey, isLi, isList, isModifier, isNil, isPara, isPlainObject, isSelectionInside, isString, isTable, isText, isVoid, italicBtn, key, last, lineHeightBtn, linkBtn, locales, makeDraggable, mergeDeep, nextElement, nodeValue, olBtn, on, outdentBtn, outerHtml, paragraphStyleBtn, placeCaret, prevElement, printBtn, rangeFromElement, rect2bnd, redoBtn, registerButton, remove, removeFormatBtn, resolveLocale, sanitiseHTML, sanitiseUrl, shortcutsBtn, splitText, strikeBtn, subscriptBtn, superscriptBtn, tableBtn, tail, throttle, trapFocus, ulBtn, underlineBtn, undoBtn, unique, unwrap, videoBtn, withSavedRange, wrap };
|
|
16738
17279
|
|
|
16739
17280
|
//# sourceMappingURL=autumnnote.es.js.map
|