autumnnote 1.6.2 → 1.6.3

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.
@@ -7097,7 +7097,7 @@
7097
7097
  * LinkDialog.js - Dialog for inserting / editing hyperlinks
7098
7098
  * Inspired by Summernote's LinkDialog — rewritten without jQuery
7099
7099
  */
7100
- var ICON_SVG$2 = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`;
7100
+ var ICON_SVG$3 = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`;
7101
7101
  var LinkDialog = class extends BaseDialog {
7102
7102
  /**
7103
7103
  * Opens the link dialog.
@@ -7110,7 +7110,7 @@
7110
7110
  }
7111
7111
  _buildDialog() {
7112
7112
  const L = this.context.locale.linkDialog;
7113
- const { overlay, box } = this._buildDialogShell(L.ariaLabel, ICON_SVG$2, L.title);
7113
+ const { overlay, box } = this._buildDialogShell(L.ariaLabel, ICON_SVG$3, L.title);
7114
7114
  const urlLabel = createElement("label", { class: "an-label" });
7115
7115
  urlLabel.textContent = L.url;
7116
7116
  const urlInput = createElement("input", {
@@ -7213,7 +7213,7 @@
7213
7213
  * ImageDialog.js - Dialog for inserting images (by URL or file upload)
7214
7214
  * Inspired by Summernote's ImageDialog — rewritten without jQuery
7215
7215
  */
7216
- var ICON_SVG$1 = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" 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="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>`;
7216
+ var ICON_SVG$2 = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" 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="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>`;
7217
7217
  var ImageDialog = class extends BaseDialog {
7218
7218
  show() {
7219
7219
  this._saveRange();
@@ -7224,7 +7224,7 @@
7224
7224
  }
7225
7225
  _buildDialog() {
7226
7226
  const L = this.context.locale.imageDialog;
7227
- const { overlay, box } = this._buildDialogShell(L.ariaLabel, ICON_SVG$1, L.title);
7227
+ const { overlay, box } = this._buildDialogShell(L.ariaLabel, ICON_SVG$2, L.title);
7228
7228
  const urlLabel = createElement("label", { class: "an-label" });
7229
7229
  urlLabel.textContent = L.imageUrl;
7230
7230
  const urlInput = createElement("input", {
@@ -7378,7 +7378,7 @@
7378
7378
  * • Vimeo URLs → <iframe> embed
7379
7379
  * • Direct video URLs → <video> element (.mp4 / .webm / .ogg)
7380
7380
  */
7381
- var ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2"/></svg>`;
7381
+ var ICON_SVG$1 = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2"/></svg>`;
7382
7382
  var VideoDialog = class extends BaseDialog {
7383
7383
  show() {
7384
7384
  this._saveRange();
@@ -7389,7 +7389,7 @@
7389
7389
  }
7390
7390
  _buildDialog() {
7391
7391
  const L = this.context.locale.videoDialog;
7392
- const { overlay, box } = this._buildDialogShell(L.ariaLabel, ICON_SVG, L.title);
7392
+ const { overlay, box } = this._buildDialogShell(L.ariaLabel, ICON_SVG$1, L.title);
7393
7393
  const urlLabel = createElement("label", { class: "an-label" });
7394
7394
  urlLabel.textContent = L.videoUrl;
7395
7395
  const urlInput = createElement("input", {
@@ -12352,35 +12352,17 @@
12352
12352
  "symbols"
12353
12353
  ]
12354
12354
  ];
12355
- var EmojiDialog = class {
12356
- /**
12357
- * @param {import('../Context.js').Context} context
12358
- */
12359
- constructor(context) {
12360
- this.context = context;
12361
- /** @type {HTMLElement|null} */
12362
- this._dialog = null;
12363
- this._disposers = [];
12364
- this._savedRange = null;
12365
- this._activeCat = "all";
12366
- }
12355
+ var EmojiDialog = class extends BaseDialog {
12356
+ _activeCat = "all";
12367
12357
  initialize() {
12368
12358
  return this;
12369
12359
  }
12370
- destroy() {
12371
- this._disposers.forEach((d) => d());
12372
- this._disposers = [];
12373
- if (this._dialog && this._dialog.parentNode) this._dialog.remove();
12374
- this._dialog = null;
12375
- }
12376
12360
  show() {
12377
12361
  if (!this._dialog) {
12378
12362
  this._dialog = this._buildDialog();
12379
12363
  document.body.appendChild(this._dialog);
12380
12364
  }
12381
- withSavedRange((range) => {
12382
- this._savedRange = range;
12383
- });
12365
+ this._saveRange();
12384
12366
  this._activeCat = "all";
12385
12367
  this._searchInput.value = "";
12386
12368
  this._updateCatTabs();
@@ -12449,6 +12431,7 @@
12449
12431
  grid.appendChild(cell);
12450
12432
  });
12451
12433
  this._grid = grid;
12434
+ this._firstInput = searchInput;
12452
12435
  const btnRow = createElement("div", { class: "an-dialog-actions" });
12453
12436
  const cancelBtn = createElement("button", {
12454
12437
  type: "button",
@@ -12538,21 +12521,6 @@
12538
12521
  editable.focus();
12539
12522
  this.context.invoke("editor.afterCommand");
12540
12523
  }
12541
- _open() {
12542
- if (this._dialog) {
12543
- this._dialog.style.display = "flex";
12544
- this._removeTrap = trapFocus(this._dialog, () => this._close());
12545
- setTimeout(() => this._searchInput?.focus(), 50);
12546
- }
12547
- }
12548
- _close() {
12549
- if (this._dialog) this._dialog.style.display = "none";
12550
- if (this._removeTrap) {
12551
- this._removeTrap();
12552
- this._removeTrap = null;
12553
- }
12554
- this._savedRange = null;
12555
- }
12556
12524
  };
12557
12525
  //#endregion
12558
12526
  //#region src/js/module/IconDialog.js
@@ -12810,19 +12778,9 @@
12810
12778
  ["gift", "objects"],
12811
12779
  ["puzzle-piece", "objects"]
12812
12780
  ];
12813
- var IconDialog = class {
12814
- /**
12815
- * @param {import('../Context.js').Context} context
12816
- */
12817
- constructor(context) {
12818
- this.context = context;
12819
- /** @type {HTMLElement|null} */
12820
- this._dialog = null;
12821
- this._disposers = [];
12822
- this._savedRange = null;
12823
- this._selectedIcon = null;
12824
- this._activeCat = "all";
12825
- }
12781
+ var IconDialog = class extends BaseDialog {
12782
+ _selectedIcon = null;
12783
+ _activeCat = "all";
12826
12784
  initialize() {
12827
12785
  this._ensureFontAwesome();
12828
12786
  return this;
@@ -12846,20 +12804,12 @@
12846
12804
  link.referrerPolicy = "no-referrer";
12847
12805
  document.head.appendChild(link);
12848
12806
  }
12849
- destroy() {
12850
- this._disposers.forEach((d) => d());
12851
- this._disposers = [];
12852
- this._dialog?.remove();
12853
- this._dialog = null;
12854
- }
12855
12807
  show() {
12856
12808
  if (!this._dialog) {
12857
12809
  this._dialog = this._buildDialog();
12858
12810
  document.body.appendChild(this._dialog);
12859
12811
  }
12860
- withSavedRange((range) => {
12861
- this._savedRange = range;
12862
- });
12812
+ this._saveRange();
12863
12813
  this._selectedIcon = null;
12864
12814
  this._activeCat = "all";
12865
12815
  this._searchInput.value = "";
@@ -12900,6 +12850,7 @@
12900
12850
  autocomplete: "off"
12901
12851
  });
12902
12852
  this._searchInput = searchInput;
12853
+ this._firstInput = searchInput;
12903
12854
  const catBar = createElement("div", { class: "an-icon-cats" });
12904
12855
  const allTab = createElement("button", {
12905
12856
  type: "button",
@@ -13138,21 +13089,9 @@
13138
13089
  }
13139
13090
  this.context.invoke("editor.afterCommand");
13140
13091
  }
13141
- _open() {
13142
- if (this._dialog) {
13143
- this._dialog.style.display = "flex";
13144
- this._removeTrap = trapFocus(this._dialog, () => this._close());
13145
- setTimeout(() => this._searchInput?.focus(), 50);
13146
- }
13147
- }
13148
13092
  _close() {
13149
- if (this._dialog) this._dialog.style.display = "none";
13150
- if (this._removeTrap) {
13151
- this._removeTrap();
13152
- this._removeTrap = null;
13153
- }
13154
- this._savedRange = null;
13155
13093
  this._selectedIcon = null;
13094
+ super._close();
13156
13095
  }
13157
13096
  };
13158
13097
  //#endregion
@@ -13893,59 +13832,25 @@
13893
13832
  }]
13894
13833
  }
13895
13834
  ];
13896
- var ShortcutsDialog = class {
13897
- /** @param {import('../Context.js').Context} context */
13898
- constructor(context) {
13899
- this.context = context;
13900
- this._dialog = null;
13901
- this._closeBtn = null;
13902
- this._disposers = [];
13903
- }
13904
- initialize() {
13905
- this._dialog = this._buildDialog();
13906
- document.body.appendChild(this._dialog);
13907
- return this;
13908
- }
13909
- destroy() {
13910
- this._disposers.forEach((d) => d());
13911
- this._disposers = [];
13912
- this._dialog?.remove();
13913
- this._dialog = null;
13914
- }
13835
+ var ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="7" width="20" height="14" rx="2"/><path d="M6 11h.01M10 11h.01M14 11h.01M18 11h.01M6 15h.01M18 15h.01M10 15h4"/><path d="M7 3l5 4 5-4"/></svg>`;
13836
+ var ShortcutsDialog = class extends BaseDialog {
13915
13837
  show() {
13916
- if (this._dialog) {
13917
- this._dialog.style.display = "flex";
13918
- this._removeTrap = trapFocus(this._dialog, () => this._close());
13919
- setTimeout(() => this._closeBtn?.focus(), 50);
13920
- }
13921
- }
13922
- _close() {
13923
- if (this._dialog) this._dialog.style.display = "none";
13924
- if (this._removeTrap) {
13925
- this._removeTrap();
13926
- this._removeTrap = null;
13927
- }
13838
+ this._open();
13928
13839
  }
13929
13840
  _buildDialog() {
13930
- const overlay = createElement("div", {
13931
- class: "an-dialog-overlay",
13932
- role: "dialog",
13933
- "aria-modal": "true",
13934
- "aria-label": this.context.locale.shortcutsDialog.ariaLabel
13935
- });
13936
- const box = createElement("div", { class: "an-dialog-box an-shortcuts-box" });
13937
- const titleRow = createElement("div", { class: "an-icon-title-row" });
13938
- const title = createElement("h3", { class: "an-dialog-title" });
13939
- title.textContent = this.context.locale.shortcutsDialog.title;
13841
+ const L = this.context.locale.shortcutsDialog;
13842
+ const { overlay, box } = this._buildDialogShell(L.ariaLabel, ICON_SVG, L.title);
13843
+ box.classList.add("an-shortcuts-box");
13940
13844
  const closeBtn = createElement("button", {
13941
13845
  type: "button",
13942
13846
  class: "an-icon-close",
13943
- "aria-label": this.context.locale.shortcutsDialog.close
13847
+ "aria-label": L.close,
13848
+ style: "margin-left:auto"
13944
13849
  });
13945
13850
  closeBtn.textContent = "×";
13946
13851
  this._closeBtn = closeBtn;
13947
- titleRow.append(title, closeBtn);
13948
- box.appendChild(titleRow);
13852
+ this._firstInput = closeBtn;
13853
+ box.querySelector(".an-dialog-header").appendChild(closeBtn);
13949
13854
  (this.context.locale.shortcutsDialog.shortcuts || SHORTCUTS).forEach(({ category, items }) => {
13950
13855
  const catEl = createElement("div", { class: "an-shortcuts-cat" });
13951
13856
  catEl.textContent = category;
@@ -13962,12 +13867,8 @@
13962
13867
  });
13963
13868
  box.appendChild(table);
13964
13869
  });
13965
- overlay.appendChild(box);
13966
13870
  const d1 = on(closeBtn, "click", () => this._close());
13967
- const d2 = on(overlay, "click", (e) => {
13968
- if (e.target === overlay) this._close();
13969
- });
13970
- this._disposers.push(d1, d2);
13871
+ this._disposers.push(d1);
13971
13872
  return overlay;
13972
13873
  }
13973
13874
  };
@@ -13981,12 +13882,10 @@
13981
13882
  * for highlighting. Supports case-sensitive search, Prev/Next navigation and
13982
13883
  * single / replace-all replacement.
13983
13884
  */
13984
- var FindReplace = class {
13885
+ var FindReplace = class extends BaseDialog {
13985
13886
  /** @param {import('../Context.js').Context} context */
13986
13887
  constructor(context) {
13987
- this.context = context;
13988
- /** @type {HTMLElement|null} */
13989
- this._dialog = null;
13888
+ super(context);
13990
13889
  /** @type {HTMLInputElement|null} */
13991
13890
  this._findInput = null;
13992
13891
  /** @type {HTMLInputElement|null} */
@@ -14007,23 +13906,13 @@
14007
13906
  this._queryRegex = null;
14008
13907
  this._lastQuery = null;
14009
13908
  this._lastCaseSensitive = null;
14010
- this._disposers = [];
14011
- this._removeTrap = null;
14012
13909
  this._focusTimer = null;
14013
13910
  }
14014
- initialize() {
14015
- this._dialog = this._buildDialog();
14016
- document.body.appendChild(this._dialog);
14017
- return this;
14018
- }
14019
13911
  destroy() {
14020
13912
  clearTimeout(this._focusTimer);
14021
13913
  this._focusTimer = null;
14022
13914
  this._clearHighlights();
14023
- this._disposers.forEach((d) => d());
14024
- this._disposers = [];
14025
- if (this._dialog && this._dialog.parentNode) this._dialog.remove();
14026
- this._dialog = null;
13915
+ super.destroy();
14027
13916
  }
14028
13917
  /**
14029
13918
  * Opens the dialog in 'find' or 'replace' mode.
@@ -16388,7 +16277,7 @@
16388
16277
  return this;
16389
16278
  },
16390
16279
  /** Library version */
16391
- version: "1.6.2"
16280
+ version: "1.6.3"
16392
16281
  };
16393
16282
  /**
16394
16283
  * @param {string|Element|NodeList|Element[]} selector