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.
@@ -7401,7 +7401,7 @@ var BaseDialog = class {
7401
7401
  * LinkDialog.js - Dialog for inserting / editing hyperlinks
7402
7402
  * Inspired by Summernote's LinkDialog — rewritten without jQuery
7403
7403
  */
7404
- 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>`;
7404
+ 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>`;
7405
7405
  var LinkDialog = class extends BaseDialog {
7406
7406
  /**
7407
7407
  * Opens the link dialog.
@@ -7414,7 +7414,7 @@ var LinkDialog = class extends BaseDialog {
7414
7414
  }
7415
7415
  _buildDialog() {
7416
7416
  const L = this.context.locale.linkDialog;
7417
- const { overlay, box } = this._buildDialogShell(L.ariaLabel, ICON_SVG$2, L.title);
7417
+ const { overlay, box } = this._buildDialogShell(L.ariaLabel, ICON_SVG$3, L.title);
7418
7418
  const urlLabel = createElement("label", { class: "an-label" });
7419
7419
  urlLabel.textContent = L.url;
7420
7420
  const urlInput = createElement("input", {
@@ -7517,7 +7517,7 @@ var LinkDialog = class extends BaseDialog {
7517
7517
  * ImageDialog.js - Dialog for inserting images (by URL or file upload)
7518
7518
  * Inspired by Summernote's ImageDialog — rewritten without jQuery
7519
7519
  */
7520
- 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>`;
7520
+ 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>`;
7521
7521
  var ImageDialog = class extends BaseDialog {
7522
7522
  show() {
7523
7523
  this._saveRange();
@@ -7528,7 +7528,7 @@ var ImageDialog = class extends BaseDialog {
7528
7528
  }
7529
7529
  _buildDialog() {
7530
7530
  const L = this.context.locale.imageDialog;
7531
- const { overlay, box } = this._buildDialogShell(L.ariaLabel, ICON_SVG$1, L.title);
7531
+ const { overlay, box } = this._buildDialogShell(L.ariaLabel, ICON_SVG$2, L.title);
7532
7532
  const urlLabel = createElement("label", { class: "an-label" });
7533
7533
  urlLabel.textContent = L.imageUrl;
7534
7534
  const urlInput = createElement("input", {
@@ -7682,7 +7682,7 @@ var ImageDialog = class extends BaseDialog {
7682
7682
  * • Vimeo URLs → <iframe> embed
7683
7683
  * • Direct video URLs → <video> element (.mp4 / .webm / .ogg)
7684
7684
  */
7685
- 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>`;
7685
+ 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>`;
7686
7686
  var VideoDialog = class extends BaseDialog {
7687
7687
  show() {
7688
7688
  this._saveRange();
@@ -7693,7 +7693,7 @@ var VideoDialog = class extends BaseDialog {
7693
7693
  }
7694
7694
  _buildDialog() {
7695
7695
  const L = this.context.locale.videoDialog;
7696
- const { overlay, box } = this._buildDialogShell(L.ariaLabel, ICON_SVG, L.title);
7696
+ const { overlay, box } = this._buildDialogShell(L.ariaLabel, ICON_SVG$1, L.title);
7697
7697
  const urlLabel = createElement("label", { class: "an-label" });
7698
7698
  urlLabel.textContent = L.videoUrl;
7699
7699
  const urlInput = createElement("input", {
@@ -12656,35 +12656,17 @@ var EMOJI_LIST = [
12656
12656
  "symbols"
12657
12657
  ]
12658
12658
  ];
12659
- var EmojiDialog = class {
12660
- /**
12661
- * @param {import('../Context.js').Context} context
12662
- */
12663
- constructor(context) {
12664
- this.context = context;
12665
- /** @type {HTMLElement|null} */
12666
- this._dialog = null;
12667
- this._disposers = [];
12668
- this._savedRange = null;
12669
- this._activeCat = "all";
12670
- }
12659
+ var EmojiDialog = class extends BaseDialog {
12660
+ _activeCat = "all";
12671
12661
  initialize() {
12672
12662
  return this;
12673
12663
  }
12674
- destroy() {
12675
- this._disposers.forEach((d) => d());
12676
- this._disposers = [];
12677
- if (this._dialog && this._dialog.parentNode) this._dialog.remove();
12678
- this._dialog = null;
12679
- }
12680
12664
  show() {
12681
12665
  if (!this._dialog) {
12682
12666
  this._dialog = this._buildDialog();
12683
12667
  document.body.appendChild(this._dialog);
12684
12668
  }
12685
- withSavedRange((range) => {
12686
- this._savedRange = range;
12687
- });
12669
+ this._saveRange();
12688
12670
  this._activeCat = "all";
12689
12671
  this._searchInput.value = "";
12690
12672
  this._updateCatTabs();
@@ -12753,6 +12735,7 @@ var EmojiDialog = class {
12753
12735
  grid.appendChild(cell);
12754
12736
  });
12755
12737
  this._grid = grid;
12738
+ this._firstInput = searchInput;
12756
12739
  const btnRow = createElement("div", { class: "an-dialog-actions" });
12757
12740
  const cancelBtn = createElement("button", {
12758
12741
  type: "button",
@@ -12842,21 +12825,6 @@ var EmojiDialog = class {
12842
12825
  editable.focus();
12843
12826
  this.context.invoke("editor.afterCommand");
12844
12827
  }
12845
- _open() {
12846
- if (this._dialog) {
12847
- this._dialog.style.display = "flex";
12848
- this._removeTrap = trapFocus(this._dialog, () => this._close());
12849
- setTimeout(() => this._searchInput?.focus(), 50);
12850
- }
12851
- }
12852
- _close() {
12853
- if (this._dialog) this._dialog.style.display = "none";
12854
- if (this._removeTrap) {
12855
- this._removeTrap();
12856
- this._removeTrap = null;
12857
- }
12858
- this._savedRange = null;
12859
- }
12860
12828
  };
12861
12829
  //#endregion
12862
12830
  //#region src/js/module/IconDialog.js
@@ -13114,19 +13082,9 @@ var ICON_LIST = [
13114
13082
  ["gift", "objects"],
13115
13083
  ["puzzle-piece", "objects"]
13116
13084
  ];
13117
- var IconDialog = class {
13118
- /**
13119
- * @param {import('../Context.js').Context} context
13120
- */
13121
- constructor(context) {
13122
- this.context = context;
13123
- /** @type {HTMLElement|null} */
13124
- this._dialog = null;
13125
- this._disposers = [];
13126
- this._savedRange = null;
13127
- this._selectedIcon = null;
13128
- this._activeCat = "all";
13129
- }
13085
+ var IconDialog = class extends BaseDialog {
13086
+ _selectedIcon = null;
13087
+ _activeCat = "all";
13130
13088
  initialize() {
13131
13089
  this._ensureFontAwesome();
13132
13090
  return this;
@@ -13150,20 +13108,12 @@ var IconDialog = class {
13150
13108
  link.referrerPolicy = "no-referrer";
13151
13109
  document.head.appendChild(link);
13152
13110
  }
13153
- destroy() {
13154
- this._disposers.forEach((d) => d());
13155
- this._disposers = [];
13156
- this._dialog?.remove();
13157
- this._dialog = null;
13158
- }
13159
13111
  show() {
13160
13112
  if (!this._dialog) {
13161
13113
  this._dialog = this._buildDialog();
13162
13114
  document.body.appendChild(this._dialog);
13163
13115
  }
13164
- withSavedRange((range) => {
13165
- this._savedRange = range;
13166
- });
13116
+ this._saveRange();
13167
13117
  this._selectedIcon = null;
13168
13118
  this._activeCat = "all";
13169
13119
  this._searchInput.value = "";
@@ -13204,6 +13154,7 @@ var IconDialog = class {
13204
13154
  autocomplete: "off"
13205
13155
  });
13206
13156
  this._searchInput = searchInput;
13157
+ this._firstInput = searchInput;
13207
13158
  const catBar = createElement("div", { class: "an-icon-cats" });
13208
13159
  const allTab = createElement("button", {
13209
13160
  type: "button",
@@ -13442,21 +13393,9 @@ var IconDialog = class {
13442
13393
  }
13443
13394
  this.context.invoke("editor.afterCommand");
13444
13395
  }
13445
- _open() {
13446
- if (this._dialog) {
13447
- this._dialog.style.display = "flex";
13448
- this._removeTrap = trapFocus(this._dialog, () => this._close());
13449
- setTimeout(() => this._searchInput?.focus(), 50);
13450
- }
13451
- }
13452
13396
  _close() {
13453
- if (this._dialog) this._dialog.style.display = "none";
13454
- if (this._removeTrap) {
13455
- this._removeTrap();
13456
- this._removeTrap = null;
13457
- }
13458
- this._savedRange = null;
13459
13397
  this._selectedIcon = null;
13398
+ super._close();
13460
13399
  }
13461
13400
  };
13462
13401
  //#endregion
@@ -14197,59 +14136,25 @@ var SHORTCUTS = [
14197
14136
  }]
14198
14137
  }
14199
14138
  ];
14200
- var ShortcutsDialog = class {
14201
- /** @param {import('../Context.js').Context} context */
14202
- constructor(context) {
14203
- this.context = context;
14204
- this._dialog = null;
14205
- this._closeBtn = null;
14206
- this._disposers = [];
14207
- }
14208
- initialize() {
14209
- this._dialog = this._buildDialog();
14210
- document.body.appendChild(this._dialog);
14211
- return this;
14212
- }
14213
- destroy() {
14214
- this._disposers.forEach((d) => d());
14215
- this._disposers = [];
14216
- this._dialog?.remove();
14217
- this._dialog = null;
14218
- }
14139
+ 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>`;
14140
+ var ShortcutsDialog = class extends BaseDialog {
14219
14141
  show() {
14220
- if (this._dialog) {
14221
- this._dialog.style.display = "flex";
14222
- this._removeTrap = trapFocus(this._dialog, () => this._close());
14223
- setTimeout(() => this._closeBtn?.focus(), 50);
14224
- }
14225
- }
14226
- _close() {
14227
- if (this._dialog) this._dialog.style.display = "none";
14228
- if (this._removeTrap) {
14229
- this._removeTrap();
14230
- this._removeTrap = null;
14231
- }
14142
+ this._open();
14232
14143
  }
14233
14144
  _buildDialog() {
14234
- const overlay = createElement("div", {
14235
- class: "an-dialog-overlay",
14236
- role: "dialog",
14237
- "aria-modal": "true",
14238
- "aria-label": this.context.locale.shortcutsDialog.ariaLabel
14239
- });
14240
- const box = createElement("div", { class: "an-dialog-box an-shortcuts-box" });
14241
- const titleRow = createElement("div", { class: "an-icon-title-row" });
14242
- const title = createElement("h3", { class: "an-dialog-title" });
14243
- title.textContent = this.context.locale.shortcutsDialog.title;
14145
+ const L = this.context.locale.shortcutsDialog;
14146
+ const { overlay, box } = this._buildDialogShell(L.ariaLabel, ICON_SVG, L.title);
14147
+ box.classList.add("an-shortcuts-box");
14244
14148
  const closeBtn = createElement("button", {
14245
14149
  type: "button",
14246
14150
  class: "an-icon-close",
14247
- "aria-label": this.context.locale.shortcutsDialog.close
14151
+ "aria-label": L.close,
14152
+ style: "margin-left:auto"
14248
14153
  });
14249
14154
  closeBtn.textContent = "×";
14250
14155
  this._closeBtn = closeBtn;
14251
- titleRow.append(title, closeBtn);
14252
- box.appendChild(titleRow);
14156
+ this._firstInput = closeBtn;
14157
+ box.querySelector(".an-dialog-header").appendChild(closeBtn);
14253
14158
  (this.context.locale.shortcutsDialog.shortcuts || SHORTCUTS).forEach(({ category, items }) => {
14254
14159
  const catEl = createElement("div", { class: "an-shortcuts-cat" });
14255
14160
  catEl.textContent = category;
@@ -14266,12 +14171,8 @@ var ShortcutsDialog = class {
14266
14171
  });
14267
14172
  box.appendChild(table);
14268
14173
  });
14269
- overlay.appendChild(box);
14270
14174
  const d1 = on(closeBtn, "click", () => this._close());
14271
- const d2 = on(overlay, "click", (e) => {
14272
- if (e.target === overlay) this._close();
14273
- });
14274
- this._disposers.push(d1, d2);
14175
+ this._disposers.push(d1);
14275
14176
  return overlay;
14276
14177
  }
14277
14178
  };
@@ -14285,12 +14186,10 @@ var ShortcutsDialog = class {
14285
14186
  * for highlighting. Supports case-sensitive search, Prev/Next navigation and
14286
14187
  * single / replace-all replacement.
14287
14188
  */
14288
- var FindReplace = class {
14189
+ var FindReplace = class extends BaseDialog {
14289
14190
  /** @param {import('../Context.js').Context} context */
14290
14191
  constructor(context) {
14291
- this.context = context;
14292
- /** @type {HTMLElement|null} */
14293
- this._dialog = null;
14192
+ super(context);
14294
14193
  /** @type {HTMLInputElement|null} */
14295
14194
  this._findInput = null;
14296
14195
  /** @type {HTMLInputElement|null} */
@@ -14311,23 +14210,13 @@ var FindReplace = class {
14311
14210
  this._queryRegex = null;
14312
14211
  this._lastQuery = null;
14313
14212
  this._lastCaseSensitive = null;
14314
- this._disposers = [];
14315
- this._removeTrap = null;
14316
14213
  this._focusTimer = null;
14317
14214
  }
14318
- initialize() {
14319
- this._dialog = this._buildDialog();
14320
- document.body.appendChild(this._dialog);
14321
- return this;
14322
- }
14323
14215
  destroy() {
14324
14216
  clearTimeout(this._focusTimer);
14325
14217
  this._focusTimer = null;
14326
14218
  this._clearHighlights();
14327
- this._disposers.forEach((d) => d());
14328
- this._disposers = [];
14329
- if (this._dialog && this._dialog.parentNode) this._dialog.remove();
14330
- this._dialog = null;
14219
+ super.destroy();
14331
14220
  }
14332
14221
  /**
14333
14222
  * Opens the dialog in 'find' or 'replace' mode.
@@ -16818,7 +16707,7 @@ var AutumnNote = {
16818
16707
  return this;
16819
16708
  },
16820
16709
  /** Library version */
16821
- version: "1.6.2"
16710
+ version: "1.6.3"
16822
16711
  };
16823
16712
  /**
16824
16713
  * @param {string|Element|NodeList|Element[]} selector