@mdaemon/html-editor 1.0.7 → 1.0.8

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/dist/index.js CHANGED
@@ -42464,6 +42464,284 @@ class SearchReplace {
42464
42464
  }
42465
42465
  }
42466
42466
  }
42467
+ class SourceEditor {
42468
+ options;
42469
+ overlay = null;
42470
+ dialog = null;
42471
+ textarea = null;
42472
+ constructor(options) {
42473
+ this.options = options;
42474
+ }
42475
+ get tiptap() {
42476
+ return this.options.editor.getTipTap();
42477
+ }
42478
+ open() {
42479
+ if (this.overlay) {
42480
+ if (this.textarea) {
42481
+ this.textarea.value = this.tiptap?.getHTML() ?? "";
42482
+ }
42483
+ this.overlay.style.display = "flex";
42484
+ this.textarea?.focus();
42485
+ return;
42486
+ }
42487
+ this.createDialog();
42488
+ }
42489
+ close() {
42490
+ if (this.overlay) {
42491
+ this.overlay.style.display = "none";
42492
+ }
42493
+ }
42494
+ save() {
42495
+ if (this.textarea) {
42496
+ this.tiptap?.commands.setContent(this.textarea.value);
42497
+ }
42498
+ this.close();
42499
+ }
42500
+ createDialog() {
42501
+ const trans = this.options.trans;
42502
+ const skin = this.options.editor.getConfig().skin ?? "oxide";
42503
+ this.overlay = document.createElement("div");
42504
+ this.overlay.className = "md-dialog-overlay";
42505
+ this.overlay.addEventListener("click", (e) => {
42506
+ if (e.target === this.overlay) {
42507
+ this.close();
42508
+ }
42509
+ });
42510
+ const themeWrapper = document.createElement("div");
42511
+ themeWrapper.className = `md-editor-${skin}`;
42512
+ themeWrapper.style.display = "contents";
42513
+ this.dialog = document.createElement("div");
42514
+ this.dialog.className = "md-dialog md-source-editor-dialog";
42515
+ const header = document.createElement("div");
42516
+ header.className = "md-dialog-header";
42517
+ header.innerHTML = `
42518
+ <h3>${trans("Source code")}</h3>
42519
+ <button type="button" class="md-dialog-close">×</button>
42520
+ `;
42521
+ header.querySelector(".md-dialog-close")?.addEventListener("click", () => this.close());
42522
+ const body = document.createElement("div");
42523
+ body.className = "md-dialog-body";
42524
+ this.textarea = document.createElement("textarea");
42525
+ this.textarea.className = "md-source-editor-textarea";
42526
+ this.textarea.value = this.tiptap?.getHTML() ?? "";
42527
+ this.textarea.spellcheck = false;
42528
+ this.textarea.addEventListener("keydown", (e) => {
42529
+ if (e.key === "Tab") {
42530
+ e.preventDefault();
42531
+ const start = this.textarea.selectionStart;
42532
+ const end = this.textarea.selectionEnd;
42533
+ this.textarea.value = this.textarea.value.substring(0, start) + " " + this.textarea.value.substring(end);
42534
+ this.textarea.selectionStart = this.textarea.selectionEnd = start + 2;
42535
+ }
42536
+ });
42537
+ body.appendChild(this.textarea);
42538
+ const footer = document.createElement("div");
42539
+ footer.className = "md-source-editor-footer";
42540
+ footer.innerHTML = `
42541
+ <button type="button" class="md-btn md-source-editor-cancel">${trans("Cancel")}</button>
42542
+ <button type="button" class="md-btn md-btn-primary md-source-editor-save">${trans("Save")}</button>
42543
+ `;
42544
+ footer.querySelector(".md-source-editor-cancel")?.addEventListener("click", () => this.close());
42545
+ footer.querySelector(".md-source-editor-save")?.addEventListener("click", () => this.save());
42546
+ body.appendChild(footer);
42547
+ this.dialog.appendChild(header);
42548
+ this.dialog.appendChild(body);
42549
+ themeWrapper.appendChild(this.dialog);
42550
+ this.overlay.appendChild(themeWrapper);
42551
+ this.overlay.addEventListener("keydown", (e) => {
42552
+ if (e.key === "Escape") {
42553
+ this.close();
42554
+ }
42555
+ });
42556
+ document.body.appendChild(this.overlay);
42557
+ this.textarea.focus();
42558
+ }
42559
+ destroy() {
42560
+ if (this.overlay) {
42561
+ this.overlay.remove();
42562
+ this.overlay = null;
42563
+ this.dialog = null;
42564
+ this.textarea = null;
42565
+ }
42566
+ }
42567
+ }
42568
+ class LinkEditor {
42569
+ options;
42570
+ overlay = null;
42571
+ dialog = null;
42572
+ urlInput = null;
42573
+ textInput = null;
42574
+ titleInput = null;
42575
+ targetSelect = null;
42576
+ constructor(options) {
42577
+ this.options = options;
42578
+ }
42579
+ get tiptap() {
42580
+ return this.options.editor.getTipTap();
42581
+ }
42582
+ open() {
42583
+ if (!this.overlay) {
42584
+ this.createDialog();
42585
+ }
42586
+ this.populateFromSelection();
42587
+ this.overlay.style.display = "flex";
42588
+ this.urlInput?.focus();
42589
+ }
42590
+ close() {
42591
+ if (this.overlay) {
42592
+ this.overlay.style.display = "none";
42593
+ }
42594
+ }
42595
+ populateFromSelection() {
42596
+ const tiptap = this.tiptap;
42597
+ if (!tiptap) return;
42598
+ const attrs = tiptap.getAttributes("link");
42599
+ const { from: from2, to } = tiptap.state.selection;
42600
+ const selectedText = tiptap.state.doc.textBetween(from2, to, "");
42601
+ if (this.urlInput) this.urlInput.value = attrs.href ?? "";
42602
+ if (this.textInput) this.textInput.value = selectedText;
42603
+ if (this.titleInput) this.titleInput.value = attrs.title ?? "";
42604
+ if (this.targetSelect) this.targetSelect.value = attrs.target ?? "";
42605
+ }
42606
+ save() {
42607
+ const tiptap = this.tiptap;
42608
+ if (!tiptap) return;
42609
+ const url = this.urlInput?.value.trim() ?? "";
42610
+ const text = this.textInput?.value ?? "";
42611
+ const title = this.titleInput?.value.trim() ?? "";
42612
+ const target = this.targetSelect?.value ?? "";
42613
+ if (!url) {
42614
+ tiptap.chain().focus().unsetLink().run();
42615
+ this.close();
42616
+ return;
42617
+ }
42618
+ const linkAttrs = { href: url };
42619
+ if (target) {
42620
+ linkAttrs.target = target;
42621
+ } else {
42622
+ linkAttrs.target = null;
42623
+ }
42624
+ if (title) {
42625
+ linkAttrs.title = title;
42626
+ } else {
42627
+ linkAttrs.title = null;
42628
+ }
42629
+ const { from: from2, to } = tiptap.state.selection;
42630
+ const currentText = tiptap.state.doc.textBetween(from2, to, "");
42631
+ if (text && text !== currentText) {
42632
+ tiptap.chain().focus().deleteSelection().insertContent({
42633
+ type: "text",
42634
+ text,
42635
+ marks: [{ type: "link", attrs: linkAttrs }]
42636
+ }).run();
42637
+ } else if (from2 === to && text) {
42638
+ tiptap.chain().focus().insertContent({
42639
+ type: "text",
42640
+ text,
42641
+ marks: [{ type: "link", attrs: linkAttrs }]
42642
+ }).run();
42643
+ } else if (from2 === to && !text) {
42644
+ tiptap.chain().focus().insertContent({
42645
+ type: "text",
42646
+ text: url,
42647
+ marks: [{ type: "link", attrs: linkAttrs }]
42648
+ }).run();
42649
+ } else {
42650
+ tiptap.chain().focus().setLink(linkAttrs).run();
42651
+ }
42652
+ this.close();
42653
+ }
42654
+ createDialog() {
42655
+ const trans = this.options.trans;
42656
+ const skin = this.options.editor.getConfig().skin ?? "oxide";
42657
+ this.overlay = document.createElement("div");
42658
+ this.overlay.className = "md-dialog-overlay";
42659
+ this.overlay.addEventListener("click", (e) => {
42660
+ if (e.target === this.overlay) {
42661
+ this.close();
42662
+ }
42663
+ });
42664
+ const themeWrapper = document.createElement("div");
42665
+ themeWrapper.className = `md-editor-${skin}`;
42666
+ themeWrapper.style.display = "contents";
42667
+ this.dialog = document.createElement("div");
42668
+ this.dialog.className = "md-dialog md-link-editor-dialog";
42669
+ const header = document.createElement("div");
42670
+ header.className = "md-dialog-header";
42671
+ header.innerHTML = `
42672
+ <h3>${trans("Insert/Edit Link")}</h3>
42673
+ <button type="button" class="md-dialog-close">×</button>
42674
+ `;
42675
+ header.querySelector(".md-dialog-close")?.addEventListener("click", () => this.close());
42676
+ const body = document.createElement("div");
42677
+ body.className = "md-dialog-body";
42678
+ const urlRow = document.createElement("div");
42679
+ urlRow.className = "md-link-editor-row";
42680
+ urlRow.innerHTML = `<label>${trans("URL")}</label>`;
42681
+ this.urlInput = document.createElement("input");
42682
+ this.urlInput.type = "text";
42683
+ this.urlInput.className = "md-link-editor-input";
42684
+ urlRow.appendChild(this.urlInput);
42685
+ const textRow = document.createElement("div");
42686
+ textRow.className = "md-link-editor-row";
42687
+ textRow.innerHTML = `<label>${trans("Text to display")}</label>`;
42688
+ this.textInput = document.createElement("input");
42689
+ this.textInput.type = "text";
42690
+ this.textInput.className = "md-link-editor-input";
42691
+ textRow.appendChild(this.textInput);
42692
+ const titleRow = document.createElement("div");
42693
+ titleRow.className = "md-link-editor-row";
42694
+ titleRow.innerHTML = `<label>${trans("Title")}</label>`;
42695
+ this.titleInput = document.createElement("input");
42696
+ this.titleInput.type = "text";
42697
+ this.titleInput.className = "md-link-editor-input";
42698
+ titleRow.appendChild(this.titleInput);
42699
+ const targetRow = document.createElement("div");
42700
+ targetRow.className = "md-link-editor-row";
42701
+ targetRow.innerHTML = `<label>${trans("Open link in...")}</label>`;
42702
+ this.targetSelect = document.createElement("select");
42703
+ this.targetSelect.className = "md-link-editor-select";
42704
+ this.targetSelect.innerHTML = `
42705
+ <option value="">${trans("Current window")}</option>
42706
+ <option value="_blank">${trans("New window")}</option>
42707
+ `;
42708
+ targetRow.appendChild(this.targetSelect);
42709
+ body.appendChild(urlRow);
42710
+ body.appendChild(textRow);
42711
+ body.appendChild(titleRow);
42712
+ body.appendChild(targetRow);
42713
+ const footer = document.createElement("div");
42714
+ footer.className = "md-link-editor-footer";
42715
+ footer.innerHTML = `
42716
+ <button type="button" class="md-btn md-link-editor-cancel">${trans("Cancel")}</button>
42717
+ <button type="button" class="md-btn md-btn-primary md-link-editor-save">${trans("Save")}</button>
42718
+ `;
42719
+ footer.querySelector(".md-link-editor-cancel")?.addEventListener("click", () => this.close());
42720
+ footer.querySelector(".md-link-editor-save")?.addEventListener("click", () => this.save());
42721
+ body.appendChild(footer);
42722
+ this.dialog.appendChild(header);
42723
+ this.dialog.appendChild(body);
42724
+ themeWrapper.appendChild(this.dialog);
42725
+ this.overlay.appendChild(themeWrapper);
42726
+ this.overlay.addEventListener("keydown", (e) => {
42727
+ if (e.key === "Escape") {
42728
+ this.close();
42729
+ }
42730
+ });
42731
+ document.body.appendChild(this.overlay);
42732
+ }
42733
+ destroy() {
42734
+ if (this.overlay) {
42735
+ this.overlay.remove();
42736
+ this.overlay = null;
42737
+ this.dialog = null;
42738
+ this.urlInput = null;
42739
+ this.textInput = null;
42740
+ this.titleInput = null;
42741
+ this.targetSelect = null;
42742
+ }
42743
+ }
42744
+ }
42467
42745
  const DEFAULT_COLORS = [
42468
42746
  { value: "#000000", label: "Black" },
42469
42747
  { value: "#434343", label: "Dark Gray 4" },
@@ -42514,6 +42792,8 @@ class Toolbar {
42514
42792
  emojiPicker = null;
42515
42793
  imageUpload = null;
42516
42794
  searchReplace = null;
42795
+ sourceEditor = null;
42796
+ linkEditor = null;
42517
42797
  updateInterval = null;
42518
42798
  boundClickHandler = null;
42519
42799
  boundKeydownHandler = null;
@@ -43117,14 +43397,13 @@ class Toolbar {
43117
43397
  this.imageUpload.open();
43118
43398
  }
43119
43399
  openLinkDialog() {
43120
- const previousUrl = this.tiptap?.getAttributes("link").href ?? "";
43121
- const url = prompt(this.trans("Enter URL:"), previousUrl);
43122
- if (url === null) return;
43123
- if (url === "") {
43124
- this.tiptap?.chain().focus().unsetLink().run();
43125
- } else {
43126
- this.tiptap?.chain().focus().setLink({ href: url }).run();
43400
+ if (!this.linkEditor) {
43401
+ this.linkEditor = new LinkEditor({
43402
+ editor: this.options.editor,
43403
+ trans: this.trans
43404
+ });
43127
43405
  }
43406
+ this.linkEditor.open();
43128
43407
  }
43129
43408
  openCharMap() {
43130
43409
  if (!this.charMap) {
@@ -43158,11 +43437,13 @@ class Toolbar {
43158
43437
  this.searchReplace.open();
43159
43438
  }
43160
43439
  openSourceCode() {
43161
- const html = this.tiptap?.getHTML() ?? "";
43162
- const newHtml = prompt(this.trans("Edit HTML source:"), html);
43163
- if (newHtml !== null) {
43164
- this.tiptap?.commands.setContent(newHtml);
43440
+ if (!this.sourceEditor) {
43441
+ this.sourceEditor = new SourceEditor({
43442
+ editor: this.options.editor,
43443
+ trans: this.trans
43444
+ });
43165
43445
  }
43446
+ this.sourceEditor.open();
43166
43447
  }
43167
43448
  openPreview() {
43168
43449
  const html = this.tiptap?.getHTML() ?? "";
@@ -43510,7 +43791,14 @@ const en = {
43510
43791
  "Invalid image URL": "Invalid image URL",
43511
43792
  "File too large": "File too large",
43512
43793
  "Invalid file type": "Invalid file type",
43513
- "More": "More"
43794
+ "More": "More",
43795
+ "Save": "Save",
43796
+ "Insert/Edit Link": "Insert/Edit Link",
43797
+ "Text to display": "Text to display",
43798
+ "Title": "Title",
43799
+ "Open link in...": "Open link in...",
43800
+ "Current window": "Current window",
43801
+ "New window": "New window"
43514
43802
  };
43515
43803
  const ar = {
43516
43804
  "Bold": "غامق",
@@ -43575,7 +43863,14 @@ const ar = {
43575
43863
  "Invalid image URL": "رابط صورة غير صالح",
43576
43864
  "File too large": "الملف كبير جداً",
43577
43865
  "Invalid file type": "نوع ملف غير صالح",
43578
- "More": "المزيد"
43866
+ "More": "المزيد",
43867
+ "Save": "Save",
43868
+ "Insert/Edit Link": "Insert/Edit Link",
43869
+ "Text to display": "Text to display",
43870
+ "Title": "Title",
43871
+ "Open link in...": "Open link in...",
43872
+ "Current window": "Current window",
43873
+ "New window": "New window"
43579
43874
  };
43580
43875
  const ca = {
43581
43876
  "Bold": "Negreta",
@@ -43640,7 +43935,14 @@ const ca = {
43640
43935
  "Invalid image URL": "URL d'imatge no vàlida",
43641
43936
  "File too large": "Fitxer massa gran",
43642
43937
  "Invalid file type": "Tipus de fitxer no vàlid",
43643
- "More": "Més"
43938
+ "More": "Més",
43939
+ "Save": "Save",
43940
+ "Insert/Edit Link": "Insert/Edit Link",
43941
+ "Text to display": "Text to display",
43942
+ "Title": "Title",
43943
+ "Open link in...": "Open link in...",
43944
+ "Current window": "Current window",
43945
+ "New window": "New window"
43644
43946
  };
43645
43947
  const zh = {
43646
43948
  "Bold": "粗体",
@@ -43705,7 +44007,14 @@ const zh = {
43705
44007
  "Invalid image URL": "无效的图片 URL",
43706
44008
  "File too large": "文件过大",
43707
44009
  "Invalid file type": "无效的文件类型",
43708
- "More": "更多"
44010
+ "More": "更多",
44011
+ "Save": "Save",
44012
+ "Insert/Edit Link": "Insert/Edit Link",
44013
+ "Text to display": "Text to display",
44014
+ "Title": "Title",
44015
+ "Open link in...": "Open link in...",
44016
+ "Current window": "Current window",
44017
+ "New window": "New window"
43709
44018
  };
43710
44019
  const cs = {
43711
44020
  "Bold": "Tučné",
@@ -43770,7 +44079,14 @@ const cs = {
43770
44079
  "Invalid image URL": "Neplatná URL obrázku",
43771
44080
  "File too large": "Soubor je příliš velký",
43772
44081
  "Invalid file type": "Neplatný typ souboru",
43773
- "More": "Více"
44082
+ "More": "Více",
44083
+ "Save": "Save",
44084
+ "Insert/Edit Link": "Insert/Edit Link",
44085
+ "Text to display": "Text to display",
44086
+ "Title": "Title",
44087
+ "Open link in...": "Open link in...",
44088
+ "Current window": "Current window",
44089
+ "New window": "New window"
43774
44090
  };
43775
44091
  const da = {
43776
44092
  "Bold": "Fed",
@@ -43835,7 +44151,14 @@ const da = {
43835
44151
  "Invalid image URL": "Ugyldig billed-URL",
43836
44152
  "File too large": "Filen er for stor",
43837
44153
  "Invalid file type": "Ugyldig filtype",
43838
- "More": "Mere"
44154
+ "More": "Mere",
44155
+ "Save": "Save",
44156
+ "Insert/Edit Link": "Insert/Edit Link",
44157
+ "Text to display": "Text to display",
44158
+ "Title": "Title",
44159
+ "Open link in...": "Open link in...",
44160
+ "Current window": "Current window",
44161
+ "New window": "New window"
43839
44162
  };
43840
44163
  const enGb = {
43841
44164
  "Bold": "Bold",
@@ -43900,7 +44223,14 @@ const enGb = {
43900
44223
  "Invalid image URL": "Invalid image URL",
43901
44224
  "File too large": "File too large",
43902
44225
  "Invalid file type": "Invalid file type",
43903
- "More": "More"
44226
+ "More": "More",
44227
+ "Save": "Save",
44228
+ "Insert/Edit Link": "Insert/Edit Link",
44229
+ "Text to display": "Text to display",
44230
+ "Title": "Title",
44231
+ "Open link in...": "Open link in...",
44232
+ "Current window": "Current window",
44233
+ "New window": "New window"
43904
44234
  };
43905
44235
  const fi = {
43906
44236
  "Bold": "Lihavoitu",
@@ -43965,7 +44295,14 @@ const fi = {
43965
44295
  "Invalid image URL": "Virheellinen kuvan URL",
43966
44296
  "File too large": "Tiedosto on liian suuri",
43967
44297
  "Invalid file type": "Virheellinen tiedostotyyppi",
43968
- "More": "Lisää"
44298
+ "More": "Lisää",
44299
+ "Save": "Save",
44300
+ "Insert/Edit Link": "Insert/Edit Link",
44301
+ "Text to display": "Text to display",
44302
+ "Title": "Title",
44303
+ "Open link in...": "Open link in...",
44304
+ "Current window": "Current window",
44305
+ "New window": "New window"
43969
44306
  };
43970
44307
  const fr = {
43971
44308
  "Bold": "Gras",
@@ -44030,7 +44367,14 @@ const fr = {
44030
44367
  "Invalid image URL": "URL d'image invalide",
44031
44368
  "File too large": "Fichier trop volumineux",
44032
44369
  "Invalid file type": "Type de fichier invalide",
44033
- "More": "Plus"
44370
+ "More": "Plus",
44371
+ "Save": "Save",
44372
+ "Insert/Edit Link": "Insert/Edit Link",
44373
+ "Text to display": "Text to display",
44374
+ "Title": "Title",
44375
+ "Open link in...": "Open link in...",
44376
+ "Current window": "Current window",
44377
+ "New window": "New window"
44034
44378
  };
44035
44379
  const frCa = {
44036
44380
  "Bold": "Gras",
@@ -44095,7 +44439,14 @@ const frCa = {
44095
44439
  "Invalid image URL": "URL d'image invalide",
44096
44440
  "File too large": "Fichier trop volumineux",
44097
44441
  "Invalid file type": "Type de fichier invalide",
44098
- "More": "Plus"
44442
+ "More": "Plus",
44443
+ "Save": "Save",
44444
+ "Insert/Edit Link": "Insert/Edit Link",
44445
+ "Text to display": "Text to display",
44446
+ "Title": "Title",
44447
+ "Open link in...": "Open link in...",
44448
+ "Current window": "Current window",
44449
+ "New window": "New window"
44099
44450
  };
44100
44451
  const de = {
44101
44452
  "Bold": "Fett",
@@ -44160,7 +44511,14 @@ const de = {
44160
44511
  "Invalid image URL": "Ungültige Bild-URL",
44161
44512
  "File too large": "Datei zu groß",
44162
44513
  "Invalid file type": "Ungültiger Dateityp",
44163
- "More": "Mehr"
44514
+ "More": "Mehr",
44515
+ "Save": "Save",
44516
+ "Insert/Edit Link": "Insert/Edit Link",
44517
+ "Text to display": "Text to display",
44518
+ "Title": "Title",
44519
+ "Open link in...": "Open link in...",
44520
+ "Current window": "Current window",
44521
+ "New window": "New window"
44164
44522
  };
44165
44523
  const el = {
44166
44524
  "Bold": "Έντονα",
@@ -44225,7 +44583,14 @@ const el = {
44225
44583
  "Invalid image URL": "Μη έγκυρο URL εικόνας",
44226
44584
  "File too large": "Το αρχείο είναι πολύ μεγάλο",
44227
44585
  "Invalid file type": "Μη έγκυρος τύπος αρχείου",
44228
- "More": "Περισσότερα"
44586
+ "More": "Περισσότερα",
44587
+ "Save": "Save",
44588
+ "Insert/Edit Link": "Insert/Edit Link",
44589
+ "Text to display": "Text to display",
44590
+ "Title": "Title",
44591
+ "Open link in...": "Open link in...",
44592
+ "Current window": "Current window",
44593
+ "New window": "New window"
44229
44594
  };
44230
44595
  const hu = {
44231
44596
  "Bold": "Félkövér",
@@ -44290,7 +44655,14 @@ const hu = {
44290
44655
  "Invalid image URL": "Érvénytelen kép URL",
44291
44656
  "File too large": "A fájl túl nagy",
44292
44657
  "Invalid file type": "Érvénytelen fájltípus",
44293
- "More": "Több"
44658
+ "More": "Több",
44659
+ "Save": "Save",
44660
+ "Insert/Edit Link": "Insert/Edit Link",
44661
+ "Text to display": "Text to display",
44662
+ "Title": "Title",
44663
+ "Open link in...": "Open link in...",
44664
+ "Current window": "Current window",
44665
+ "New window": "New window"
44294
44666
  };
44295
44667
  const id = {
44296
44668
  "Bold": "Tebal",
@@ -44355,7 +44727,14 @@ const id = {
44355
44727
  "Invalid image URL": "URL gambar tidak valid",
44356
44728
  "File too large": "File terlalu besar",
44357
44729
  "Invalid file type": "Jenis file tidak valid",
44358
- "More": "Lainnya"
44730
+ "More": "Lainnya",
44731
+ "Save": "Save",
44732
+ "Insert/Edit Link": "Insert/Edit Link",
44733
+ "Text to display": "Text to display",
44734
+ "Title": "Title",
44735
+ "Open link in...": "Open link in...",
44736
+ "Current window": "Current window",
44737
+ "New window": "New window"
44359
44738
  };
44360
44739
  const it = {
44361
44740
  "Bold": "Grassetto",
@@ -44420,7 +44799,14 @@ const it = {
44420
44799
  "Invalid image URL": "URL immagine non valido",
44421
44800
  "File too large": "File troppo grande",
44422
44801
  "Invalid file type": "Tipo di file non valido",
44423
- "More": "Altro"
44802
+ "More": "Altro",
44803
+ "Save": "Save",
44804
+ "Insert/Edit Link": "Insert/Edit Link",
44805
+ "Text to display": "Text to display",
44806
+ "Title": "Title",
44807
+ "Open link in...": "Open link in...",
44808
+ "Current window": "Current window",
44809
+ "New window": "New window"
44424
44810
  };
44425
44811
  const ja = {
44426
44812
  "Bold": "太字",
@@ -44485,7 +44871,14 @@ const ja = {
44485
44871
  "Invalid image URL": "無効な画像URL",
44486
44872
  "File too large": "ファイルが大きすぎます",
44487
44873
  "Invalid file type": "無効なファイル形式",
44488
- "More": "もっと見る"
44874
+ "More": "もっと見る",
44875
+ "Save": "Save",
44876
+ "Insert/Edit Link": "Insert/Edit Link",
44877
+ "Text to display": "Text to display",
44878
+ "Title": "Title",
44879
+ "Open link in...": "Open link in...",
44880
+ "Current window": "Current window",
44881
+ "New window": "New window"
44489
44882
  };
44490
44883
  const ko = {
44491
44884
  "Bold": "굵게",
@@ -44550,7 +44943,14 @@ const ko = {
44550
44943
  "Invalid image URL": "잘못된 이미지 URL",
44551
44944
  "File too large": "파일이 너무 큽니다",
44552
44945
  "Invalid file type": "잘못된 파일 형식",
44553
- "More": "더 보기"
44946
+ "More": "더 보기",
44947
+ "Save": "Save",
44948
+ "Insert/Edit Link": "Insert/Edit Link",
44949
+ "Text to display": "Text to display",
44950
+ "Title": "Title",
44951
+ "Open link in...": "Open link in...",
44952
+ "Current window": "Current window",
44953
+ "New window": "New window"
44554
44954
  };
44555
44955
  const nl = {
44556
44956
  "Bold": "Vet",
@@ -44615,7 +45015,14 @@ const nl = {
44615
45015
  "Invalid image URL": "Ongeldige afbeeldings-URL",
44616
45016
  "File too large": "Bestand te groot",
44617
45017
  "Invalid file type": "Ongeldig bestandstype",
44618
- "More": "Meer"
45018
+ "More": "Meer",
45019
+ "Save": "Save",
45020
+ "Insert/Edit Link": "Insert/Edit Link",
45021
+ "Text to display": "Text to display",
45022
+ "Title": "Title",
45023
+ "Open link in...": "Open link in...",
45024
+ "Current window": "Current window",
45025
+ "New window": "New window"
44619
45026
  };
44620
45027
  const nb = {
44621
45028
  "Bold": "Fet",
@@ -44680,7 +45087,14 @@ const nb = {
44680
45087
  "Invalid image URL": "Ugyldig bilde-URL",
44681
45088
  "File too large": "Filen er for stor",
44682
45089
  "Invalid file type": "Ugyldig filtype",
44683
- "More": "Mer"
45090
+ "More": "Mer",
45091
+ "Save": "Save",
45092
+ "Insert/Edit Link": "Insert/Edit Link",
45093
+ "Text to display": "Text to display",
45094
+ "Title": "Title",
45095
+ "Open link in...": "Open link in...",
45096
+ "Current window": "Current window",
45097
+ "New window": "New window"
44684
45098
  };
44685
45099
  const pl = {
44686
45100
  "Bold": "Pogrubienie",
@@ -44745,7 +45159,14 @@ const pl = {
44745
45159
  "Invalid image URL": "Nieprawidłowy URL obrazu",
44746
45160
  "File too large": "Plik jest za duży",
44747
45161
  "Invalid file type": "Nieprawidłowy typ pliku",
44748
- "More": "Więcej"
45162
+ "More": "Więcej",
45163
+ "Save": "Save",
45164
+ "Insert/Edit Link": "Insert/Edit Link",
45165
+ "Text to display": "Text to display",
45166
+ "Title": "Title",
45167
+ "Open link in...": "Open link in...",
45168
+ "Current window": "Current window",
45169
+ "New window": "New window"
44749
45170
  };
44750
45171
  const pt = {
44751
45172
  "Bold": "Negrito",
@@ -44810,7 +45231,14 @@ const pt = {
44810
45231
  "Invalid image URL": "URL de imagem inválido",
44811
45232
  "File too large": "Arquivo muito grande",
44812
45233
  "Invalid file type": "Tipo de arquivo inválido",
44813
- "More": "Mais"
45234
+ "More": "Mais",
45235
+ "Save": "Save",
45236
+ "Insert/Edit Link": "Insert/Edit Link",
45237
+ "Text to display": "Text to display",
45238
+ "Title": "Title",
45239
+ "Open link in...": "Open link in...",
45240
+ "Current window": "Current window",
45241
+ "New window": "New window"
44814
45242
  };
44815
45243
  const ro = {
44816
45244
  "Bold": "Îngroșat",
@@ -44875,7 +45303,14 @@ const ro = {
44875
45303
  "Invalid image URL": "URL imagine invalid",
44876
45304
  "File too large": "Fișierul este prea mare",
44877
45305
  "Invalid file type": "Tip de fișier invalid",
44878
- "More": "Mai mult"
45306
+ "More": "Mai mult",
45307
+ "Save": "Save",
45308
+ "Insert/Edit Link": "Insert/Edit Link",
45309
+ "Text to display": "Text to display",
45310
+ "Title": "Title",
45311
+ "Open link in...": "Open link in...",
45312
+ "Current window": "Current window",
45313
+ "New window": "New window"
44879
45314
  };
44880
45315
  const ru = {
44881
45316
  "Bold": "Полужирный",
@@ -44940,7 +45375,14 @@ const ru = {
44940
45375
  "Invalid image URL": "Недопустимый URL изображения",
44941
45376
  "File too large": "Файл слишком большой",
44942
45377
  "Invalid file type": "Недопустимый тип файла",
44943
- "More": "Ещё"
45378
+ "More": "Ещё",
45379
+ "Save": "Save",
45380
+ "Insert/Edit Link": "Insert/Edit Link",
45381
+ "Text to display": "Text to display",
45382
+ "Title": "Title",
45383
+ "Open link in...": "Open link in...",
45384
+ "Current window": "Current window",
45385
+ "New window": "New window"
44944
45386
  };
44945
45387
  const sr = {
44946
45388
  "Bold": "Подебљано",
@@ -45005,7 +45447,14 @@ const sr = {
45005
45447
  "Invalid image URL": "Неважећи URL слике",
45006
45448
  "File too large": "Датотека је превелика",
45007
45449
  "Invalid file type": "Неважећи тип датотеке",
45008
- "More": "Још"
45450
+ "More": "Још",
45451
+ "Save": "Save",
45452
+ "Insert/Edit Link": "Insert/Edit Link",
45453
+ "Text to display": "Text to display",
45454
+ "Title": "Title",
45455
+ "Open link in...": "Open link in...",
45456
+ "Current window": "Current window",
45457
+ "New window": "New window"
45009
45458
  };
45010
45459
  const sl = {
45011
45460
  "Bold": "Krepko",
@@ -45070,7 +45519,14 @@ const sl = {
45070
45519
  "Invalid image URL": "Neveljaven URL slike",
45071
45520
  "File too large": "Datoteka je prevelika",
45072
45521
  "Invalid file type": "Neveljavna vrsta datoteke",
45073
- "More": "Več"
45522
+ "More": "Več",
45523
+ "Save": "Save",
45524
+ "Insert/Edit Link": "Insert/Edit Link",
45525
+ "Text to display": "Text to display",
45526
+ "Title": "Title",
45527
+ "Open link in...": "Open link in...",
45528
+ "Current window": "Current window",
45529
+ "New window": "New window"
45074
45530
  };
45075
45531
  const es = {
45076
45532
  "Bold": "Negrita",
@@ -45135,7 +45591,14 @@ const es = {
45135
45591
  "Invalid image URL": "URL de imagen no válida",
45136
45592
  "File too large": "Archivo demasiado grande",
45137
45593
  "Invalid file type": "Tipo de archivo no válido",
45138
- "More": "Más"
45594
+ "More": "Más",
45595
+ "Save": "Save",
45596
+ "Insert/Edit Link": "Insert/Edit Link",
45597
+ "Text to display": "Text to display",
45598
+ "Title": "Title",
45599
+ "Open link in...": "Open link in...",
45600
+ "Current window": "Current window",
45601
+ "New window": "New window"
45139
45602
  };
45140
45603
  const sv = {
45141
45604
  "Bold": "Fet",
@@ -45200,7 +45663,14 @@ const sv = {
45200
45663
  "Invalid image URL": "Ogiltig bild-URL",
45201
45664
  "File too large": "Filen är för stor",
45202
45665
  "Invalid file type": "Ogiltig filtyp",
45203
- "More": "Mer"
45666
+ "More": "Mer",
45667
+ "Save": "Save",
45668
+ "Insert/Edit Link": "Insert/Edit Link",
45669
+ "Text to display": "Text to display",
45670
+ "Title": "Title",
45671
+ "Open link in...": "Open link in...",
45672
+ "Current window": "Current window",
45673
+ "New window": "New window"
45204
45674
  };
45205
45675
  const zhTw = {
45206
45676
  "Bold": "粗體",
@@ -45265,7 +45735,14 @@ const zhTw = {
45265
45735
  "Invalid image URL": "無效的圖片 URL",
45266
45736
  "File too large": "檔案過大",
45267
45737
  "Invalid file type": "無效的檔案類型",
45268
- "More": "更多"
45738
+ "More": "更多",
45739
+ "Save": "Save",
45740
+ "Insert/Edit Link": "Insert/Edit Link",
45741
+ "Text to display": "Text to display",
45742
+ "Title": "Title",
45743
+ "Open link in...": "Open link in...",
45744
+ "Current window": "Current window",
45745
+ "New window": "New window"
45269
45746
  };
45270
45747
  const th = {
45271
45748
  "Bold": "ตัวหนา",
@@ -45330,7 +45807,14 @@ const th = {
45330
45807
  "Invalid image URL": "URL รูปภาพไม่ถูกต้อง",
45331
45808
  "File too large": "ไฟล์ใหญ่เกินไป",
45332
45809
  "Invalid file type": "ประเภทไฟล์ไม่ถูกต้อง",
45333
- "More": "เพิ่มเติม"
45810
+ "More": "เพิ่มเติม",
45811
+ "Save": "Save",
45812
+ "Insert/Edit Link": "Insert/Edit Link",
45813
+ "Text to display": "Text to display",
45814
+ "Title": "Title",
45815
+ "Open link in...": "Open link in...",
45816
+ "Current window": "Current window",
45817
+ "New window": "New window"
45334
45818
  };
45335
45819
  const tr = {
45336
45820
  "Bold": "Kalın",
@@ -45395,7 +45879,14 @@ const tr = {
45395
45879
  "Invalid image URL": "Geçersiz resim URL'si",
45396
45880
  "File too large": "Dosya çok büyük",
45397
45881
  "Invalid file type": "Geçersiz dosya türü",
45398
- "More": "Daha fazla"
45882
+ "More": "Daha fazla",
45883
+ "Save": "Save",
45884
+ "Insert/Edit Link": "Insert/Edit Link",
45885
+ "Text to display": "Text to display",
45886
+ "Title": "Title",
45887
+ "Open link in...": "Open link in...",
45888
+ "Current window": "Current window",
45889
+ "New window": "New window"
45399
45890
  };
45400
45891
  const vi = {
45401
45892
  "Bold": "In đậm",
@@ -45460,7 +45951,14 @@ const vi = {
45460
45951
  "Invalid image URL": "URL hình ảnh không hợp lệ",
45461
45952
  "File too large": "Tệp quá lớn",
45462
45953
  "Invalid file type": "Loại tệp không hợp lệ",
45463
- "More": "Thêm"
45954
+ "More": "Thêm",
45955
+ "Save": "Save",
45956
+ "Insert/Edit Link": "Insert/Edit Link",
45957
+ "Text to display": "Text to display",
45958
+ "Title": "Title",
45959
+ "Open link in...": "Open link in...",
45960
+ "Current window": "Current window",
45961
+ "New window": "New window"
45464
45962
  };
45465
45963
  const locales = {
45466
45964
  en,
@@ -45772,7 +46270,21 @@ class HTMLEditor {
45772
46270
  TextAlign.configure({
45773
46271
  types: ["heading", "paragraph"]
45774
46272
  }),
45775
- Link.configure({
46273
+ Link.extend({
46274
+ addAttributes() {
46275
+ return {
46276
+ ...this.parent?.(),
46277
+ title: {
46278
+ default: null,
46279
+ parseHTML: (element) => element.getAttribute("title"),
46280
+ renderHTML: (attributes) => {
46281
+ if (!attributes.title) return {};
46282
+ return { title: attributes.title };
46283
+ }
46284
+ }
46285
+ };
46286
+ }
46287
+ }).configure({
45776
46288
  openOnClick: false,
45777
46289
  HTMLAttributes: {
45778
46290
  rel: "noopener noreferrer"
@@ -46006,8 +46518,10 @@ exports.EmojiPicker = EmojiPicker;
46006
46518
  exports.FontSize = FontSize;
46007
46519
  exports.HTMLEditor = HTMLEditor;
46008
46520
  exports.LineHeight = LineHeight;
46521
+ exports.LinkEditor = LinkEditor;
46009
46522
  exports.SearchReplace = SearchReplace;
46010
46523
  exports.SignatureBlock = SignatureBlock;
46524
+ exports.SourceEditor = SourceEditor;
46011
46525
  exports.TRANSLATION_KEYS = TRANSLATION_KEYS;
46012
46526
  exports.TextDirection = TextDirection;
46013
46527
  exports.Toolbar = Toolbar;
@@ -46020,4 +46534,3 @@ exports.getTranslate = getTranslate;
46020
46534
  exports.resetTranslate = resetTranslate;
46021
46535
  exports.setGetFileSrc = setGetFileSrc;
46022
46536
  exports.setTranslate = setTranslate;
46023
- //# sourceMappingURL=index.js.map