overtype 2.3.6 → 2.3.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # OverType
2
2
 
3
- A lightweight markdown editor library with perfect WYSIWYG alignment using an invisible textarea overlay technique. Includes optional toolbar. ~117KB minified with all features.
3
+ A lightweight markdown editor library with perfect WYSIWYG alignment using an invisible textarea overlay technique. Includes optional toolbar. ~110KB minified with all features.
4
4
 
5
5
  ## Live Examples
6
6
 
@@ -19,7 +19,7 @@ A lightweight markdown editor library with perfect WYSIWYG alignment using an in
19
19
  - ⌨️ **Keyboard shortcuts** - Common markdown shortcuts (Cmd/Ctrl+B for bold, etc.)
20
20
  - 📱 **Mobile optimized** - Responsive design with mobile-specific styles
21
21
  - 🔄 **DOM persistence aware** - Recovers from existing DOM (perfect for HyperClay and similar platforms)
22
- - 🚀 **Lightweight** - ~117KB minified
22
+ - 🚀 **Lightweight** - ~110KB minified
23
23
  - 🎯 **Optional toolbar** - Clean, minimal toolbar with all essential formatting
24
24
  - ✨ **Smart shortcuts** - Keyboard shortcuts with selection preservation
25
25
  - 📝 **Smart list continuation** - GitHub-style automatic list continuation on Enter
@@ -35,7 +35,7 @@ We overlap an invisible textarea on top of styled output, giving the illusion of
35
35
 
36
36
  | Feature | OverType | HyperMD | Milkdown | TUI Editor | EasyMDE |
37
37
  |---------|----------|---------|----------|------------|---------|
38
- | **Size** | ~117KB | 364.02 KB | 344.51 KB | 560.99 KB | 323.69 KB |
38
+ | **Size** | ~110KB | 364.02 KB | 344.51 KB | 560.99 KB | 323.69 KB |
39
39
  | **Dependencies** | Bundled | CodeMirror | ProseMirror + plugins | Multiple libs | CodeMirror |
40
40
  | **Setup** | Single file | Complex config | Build step required | Complex config | Moderate |
41
41
  | **Approach** | Invisible textarea | ContentEditable | ContentEditable | ContentEditable | CodeMirror |
@@ -775,14 +775,20 @@ Special thanks to:
775
775
  - [Kristián Kostecký](https://github.com/kristiankostecky) - Fixed toolbar option being ignored in reinit() ([#62](https://github.com/panphora/overtype/pull/62))
776
776
  - [Lyric Wai](https://github.com/lyricat) - Fixed double-escaping of links ([#64](https://github.com/panphora/overtype/pull/64)), shared code block alignment fix ([#65](https://github.com/panphora/overtype/issues/65))
777
777
  - [kozi](https://github.com/kozi) - Reported Firefox link tooltip bug ([#68](https://github.com/panphora/overtype/issues/68)), toolbar positioning ([#69](https://github.com/panphora/overtype/issues/69)), theme CSS variable issues ([#70](https://github.com/panphora/overtype/issues/70), [#71](https://github.com/panphora/overtype/issues/71))
778
- - [1951FDG](https://github.com/1951FDG) - Reported unordered list rendering bug ([#74](https://github.com/panphora/overtype/issues/74)), suggested showStats() API improvement ([#77](https://github.com/panphora/overtype/issues/77))
779
- - [nodesocket](https://github.com/nodesocket) - Reported toolbarButtons export issues ([#73](https://github.com/panphora/overtype/issues/73), [#78](https://github.com/panphora/overtype/issues/78)), suggested image toolbar button ([#89](https://github.com/panphora/overtype/issues/89))
778
+ - [1951FDG](https://github.com/1951FDG) - Reported unordered list rendering bug ([#74](https://github.com/panphora/overtype/issues/74)), suggested showStats() API improvement ([#77](https://github.com/panphora/overtype/issues/77)), reported placeholder CSS regression ([#102](https://github.com/panphora/overtype/issues/102))
779
+ - [nodesocket](https://github.com/nodesocket) - Reported toolbarButtons export issues ([#73](https://github.com/panphora/overtype/issues/73), [#78](https://github.com/panphora/overtype/issues/78)), suggested image toolbar button ([#89](https://github.com/panphora/overtype/issues/89)), reported custom theme stats bar styling ([#101](https://github.com/panphora/overtype/issues/101))
780
780
  - [Travis Bell](https://github.com/travisbell) - Reported keyboard shortcuts bug in ESM build ([#80](https://github.com/panphora/overtype/issues/80))
781
781
  - [fab2713](https://github.com/fab2713) - Reported italic rendering in lists ([#81](https://github.com/panphora/overtype/issues/81)), reinit maxHeight ([#82](https://github.com/panphora/overtype/issues/82)), placeholder visibility ([#83](https://github.com/panphora/overtype/issues/83)), suggested auto theme ([#84](https://github.com/panphora/overtype/issues/84)), relative URL prefix ([#85](https://github.com/panphora/overtype/issues/85)), minification improvements ([#94](https://github.com/panphora/overtype/issues/94))
782
782
  - [oooo-ps](https://github.com/oooo-ps) - Reported remote script loading issue ([#86](https://github.com/panphora/overtype/issues/86))
783
783
  - [ddarfantasy](https://github.com/ddarfantasy), [ThaUnknown](https://github.com/ThaUnknown) - Reported and debugged text misalignment caused by CSS framework font resets ([#91](https://github.com/panphora/overtype/issues/91))
784
784
  - [milen-yordanov](https://github.com/milen-yordanov) - Reported code block colors ignoring theme in preview mode ([#97](https://github.com/panphora/overtype/issues/97))
785
785
  - [asalimian](https://github.com/asalimian) - Reported spellcheck being disabled ([#98](https://github.com/panphora/overtype/issues/98))
786
+ - [be5invis](https://github.com/be5invis) - Reported reinit() not propagating fontSize changes ([#108](https://github.com/panphora/overtype/issues/108)), suggested focus/blur callbacks ([#107](https://github.com/panphora/overtype/issues/107))
787
+ - [Danny Vink](https://github.com/dannyvink) - Fixed task list overlay alignment with spaced checkbox markers ([#109](https://github.com/panphora/overtype/pull/109))
788
+ - [yurivish](https://github.com/yurivish) - Reported fontFamily option not being applied ([#110](https://github.com/panphora/overtype/issues/110))
789
+ - [phinnaeus](https://github.com/phinnaeus) - Diagnosed missing fontFamily wiring ([#110](https://github.com/panphora/overtype/issues/110))
790
+ - [Tan Nhu](https://github.com/tnhu) - Fixed onChange feedback loop with async syntax highlighters ([#111](https://github.com/panphora/overtype/pull/111))
791
+ - [pscanf](https://github.com/pscanf) - Re-exported markdown-actions for custom toolbar implementations ([#105](https://github.com/panphora/overtype/issues/105), [#106](https://github.com/panphora/overtype/pull/106))
786
792
 
787
793
  ### TypeScript & Framework Support
788
794
  - [merlinz01](https://github.com/merlinz01) - Contributed TypeScript declaration file ([#20](https://github.com/panphora/overtype/pull/20))
@@ -1,5 +1,5 @@
1
1
  /**
2
- * OverType v2.3.6
2
+ * OverType v2.3.8
3
3
  * A lightweight markdown editor library with perfect WYSIWYG alignment
4
4
  * @license MIT
5
5
  * @author David Miranda
@@ -7,6 +7,10 @@
7
7
  */
8
8
  var __defProp = Object.defineProperty;
9
9
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
10
14
  var __publicField = (obj, key, value) => {
11
15
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
12
16
  return value;
@@ -122,13 +126,13 @@ var MarkdownParser = class {
122
126
  * @returns {string} Parsed task list item
123
127
  */
124
128
  static parseTaskList(html, isPreviewMode = false) {
125
- return html.replace(/^((?: )*)-\s+\[([ xX])\]\s+(.+)$/, (match, indent, checked, content) => {
129
+ return html.replace(/^((?: )*)-(\s+)\[([ xX])\](\s*)(.*)$/, (match, indent, spacingBeforeBox, checked, spacingAfterBox, content) => {
126
130
  content = this.parseInlineElements(content);
127
131
  if (isPreviewMode) {
128
132
  const isChecked = checked.toLowerCase() === "x";
129
133
  return `${indent}<li class="task-list"><input type="checkbox" ${isChecked ? "checked" : ""}> ${content}</li>`;
130
134
  } else {
131
- return `${indent}<li class="task-list"><span class="syntax-marker">- [${checked}] </span>${content}</li>`;
135
+ return `${indent}<li class="task-list"><span class="syntax-marker">-${spacingBeforeBox}[${checked}]${spacingAfterBox}</span>${content}</li>`;
132
136
  }
133
137
  });
134
138
  }
@@ -1887,6 +1891,30 @@ function generateStyles(options = {}) {
1887
1891
  }
1888
1892
 
1889
1893
  // node_modules/markdown-actions/dist/markdown-actions.esm.js
1894
+ var markdown_actions_esm_exports = {};
1895
+ __export(markdown_actions_esm_exports, {
1896
+ applyCustomFormat: () => applyCustomFormat,
1897
+ default: () => src_default,
1898
+ expandSelection: () => expandSelection2,
1899
+ getActiveFormats: () => getActiveFormats2,
1900
+ getDebugMode: () => getDebugMode,
1901
+ hasFormat: () => hasFormat2,
1902
+ insertHeader: () => insertHeader,
1903
+ insertLink: () => insertLink,
1904
+ preserveSelection: () => preserveSelection,
1905
+ setDebugMode: () => setDebugMode,
1906
+ setUndoMethod: () => setUndoMethod,
1907
+ toggleBold: () => toggleBold,
1908
+ toggleBulletList: () => toggleBulletList,
1909
+ toggleCode: () => toggleCode,
1910
+ toggleH1: () => toggleH1,
1911
+ toggleH2: () => toggleH2,
1912
+ toggleH3: () => toggleH3,
1913
+ toggleItalic: () => toggleItalic,
1914
+ toggleNumberedList: () => toggleNumberedList,
1915
+ toggleQuote: () => toggleQuote,
1916
+ toggleTaskList: () => toggleTaskList
1917
+ });
1890
1918
  var __defProp2 = Object.defineProperty;
1891
1919
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
1892
1920
  var __hasOwnProp = Object.prototype.hasOwnProperty;
@@ -1973,6 +2001,9 @@ function mergeWithDefaults(format) {
1973
2001
  return __spreadValues(__spreadValues({}, getDefaultStyle()), format);
1974
2002
  }
1975
2003
  var debugMode = false;
2004
+ function setDebugMode(enabled) {
2005
+ debugMode = enabled;
2006
+ }
1976
2007
  function getDebugMode() {
1977
2008
  return debugMode;
1978
2009
  }
@@ -2093,6 +2124,19 @@ function insertText(textarea, { text, selectionStart, selectionEnd }) {
2093
2124
  console.groupEnd();
2094
2125
  }
2095
2126
  }
2127
+ function setUndoMethod(method) {
2128
+ switch (method) {
2129
+ case "native":
2130
+ canInsertText = true;
2131
+ break;
2132
+ case "manual":
2133
+ canInsertText = false;
2134
+ break;
2135
+ case "auto":
2136
+ canInsertText = null;
2137
+ break;
2138
+ }
2139
+ }
2096
2140
  function isMultipleLines(string) {
2097
2141
  return string.trim().split("\n").length > 1;
2098
2142
  }
@@ -2162,6 +2206,15 @@ function newlinesToSurroundSelectedText(textarea) {
2162
2206
  }
2163
2207
  return { newlinesToAppend, newlinesToPrepend };
2164
2208
  }
2209
+ function preserveSelection(textarea, callback) {
2210
+ const start = textarea.selectionStart;
2211
+ const end = textarea.selectionEnd;
2212
+ const scrollTop = textarea.scrollTop;
2213
+ callback();
2214
+ textarea.selectionStart = start;
2215
+ textarea.selectionEnd = end;
2216
+ textarea.scrollTop = scrollTop;
2217
+ }
2165
2218
  function applyLineOperation(textarea, operation, options = {}) {
2166
2219
  const originalStart = textarea.selectionStart;
2167
2220
  const originalEnd = textarea.selectionEnd;
@@ -2535,6 +2588,43 @@ function getActiveFormats(textarea) {
2535
2588
  }
2536
2589
  return formats;
2537
2590
  }
2591
+ function hasFormat(textarea, format) {
2592
+ const activeFormats = getActiveFormats(textarea);
2593
+ return activeFormats.includes(format);
2594
+ }
2595
+ function expandSelection(textarea, options = {}) {
2596
+ if (!textarea)
2597
+ return;
2598
+ const { toWord, toLine, toFormat } = options;
2599
+ const { selectionStart, selectionEnd, value } = textarea;
2600
+ if (toLine) {
2601
+ const lines = value.split("\n");
2602
+ let lineStart = 0;
2603
+ let lineEnd = 0;
2604
+ let currentPos = 0;
2605
+ for (const line of lines) {
2606
+ if (selectionStart >= currentPos && selectionStart <= currentPos + line.length) {
2607
+ lineStart = currentPos;
2608
+ lineEnd = currentPos + line.length;
2609
+ break;
2610
+ }
2611
+ currentPos += line.length + 1;
2612
+ }
2613
+ textarea.selectionStart = lineStart;
2614
+ textarea.selectionEnd = lineEnd;
2615
+ } else if (toWord && selectionStart === selectionEnd) {
2616
+ let start = selectionStart;
2617
+ let end = selectionEnd;
2618
+ while (start > 0 && !/\s/.test(value[start - 1])) {
2619
+ start--;
2620
+ }
2621
+ while (end < value.length && !/\s/.test(value[end])) {
2622
+ end++;
2623
+ }
2624
+ textarea.selectionStart = start;
2625
+ textarea.selectionEnd = end;
2626
+ }
2627
+ }
2538
2628
  function toggleBold(textarea) {
2539
2629
  if (!textarea || textarea.disabled || textarea.readOnly)
2540
2630
  return;
@@ -2728,6 +2818,51 @@ function toggleH3(textarea) {
2728
2818
  function getActiveFormats2(textarea) {
2729
2819
  return getActiveFormats(textarea);
2730
2820
  }
2821
+ function hasFormat2(textarea, format) {
2822
+ return hasFormat(textarea, format);
2823
+ }
2824
+ function expandSelection2(textarea, options = {}) {
2825
+ expandSelection(textarea, options);
2826
+ }
2827
+ function applyCustomFormat(textarea, format) {
2828
+ if (!textarea || textarea.disabled || textarea.readOnly)
2829
+ return;
2830
+ const style = mergeWithDefaults(format);
2831
+ let result;
2832
+ if (style.multiline) {
2833
+ const selectedText = textarea.value.slice(textarea.selectionStart, textarea.selectionEnd);
2834
+ if (isMultipleLines(selectedText)) {
2835
+ result = multilineStyle(textarea, style);
2836
+ } else {
2837
+ result = blockStyle(textarea, style);
2838
+ }
2839
+ } else {
2840
+ result = blockStyle(textarea, style);
2841
+ }
2842
+ insertText(textarea, result);
2843
+ }
2844
+ var src_default = {
2845
+ toggleBold,
2846
+ toggleItalic,
2847
+ toggleCode,
2848
+ insertLink,
2849
+ toggleBulletList,
2850
+ toggleNumberedList,
2851
+ toggleQuote,
2852
+ toggleTaskList,
2853
+ insertHeader,
2854
+ toggleH1,
2855
+ toggleH2,
2856
+ toggleH3,
2857
+ getActiveFormats: getActiveFormats2,
2858
+ hasFormat: hasFormat2,
2859
+ expandSelection: expandSelection2,
2860
+ applyCustomFormat,
2861
+ preserveSelection,
2862
+ setUndoMethod,
2863
+ setDebugMode,
2864
+ getDebugMode
2865
+ };
2731
2866
 
2732
2867
  // src/toolbar.js
2733
2868
  var Toolbar = class {
@@ -4653,21 +4788,9 @@ var _OverType = class _OverType {
4653
4788
  * @returns {Array} Array of OverType instances
4654
4789
  */
4655
4790
  constructor(target, options = {}) {
4656
- let elements;
4657
- if (typeof target === "string") {
4658
- elements = document.querySelectorAll(target);
4659
- if (elements.length === 0) {
4660
- throw new Error(`No elements found for selector: ${target}`);
4661
- }
4662
- elements = Array.from(elements);
4663
- } else if (target instanceof Element) {
4664
- elements = [target];
4665
- } else if (target instanceof NodeList) {
4666
- elements = Array.from(target);
4667
- } else if (Array.isArray(target)) {
4668
- elements = target;
4669
- } else {
4670
- throw new Error("Invalid target: must be selector string, Element, NodeList, or Array");
4791
+ const elements = _OverType._resolveTargets(target);
4792
+ if (typeof target === "string" && elements.length === 0) {
4793
+ throw new Error(`No elements found for selector: ${target}`);
4671
4794
  }
4672
4795
  const instances = elements.map((element) => {
4673
4796
  if (element.overTypeInstance) {
@@ -4715,7 +4838,7 @@ var _OverType = class _OverType {
4715
4838
  });
4716
4839
  this.initialized = true;
4717
4840
  if (this.options.onChange) {
4718
- this.options.onChange(this.getValue(), this);
4841
+ this._notifyChange();
4719
4842
  }
4720
4843
  }
4721
4844
  /**
@@ -4753,6 +4876,8 @@ var _OverType = class _OverType {
4753
4876
  onChange: null,
4754
4877
  onKeydown: null,
4755
4878
  onRender: null,
4879
+ onFocus: null,
4880
+ onBlur: null,
4756
4881
  // Features
4757
4882
  showActiveLineRaw: false,
4758
4883
  showStats: false,
@@ -5155,13 +5280,19 @@ var _OverType = class _OverType {
5155
5280
  if (this.options.showStats && this.statsBar) {
5156
5281
  this._updateStats();
5157
5282
  }
5158
- if (this.options.onChange && this.initialized) {
5159
- this.options.onChange(text, this);
5160
- }
5161
5283
  if (this.options.onRender) {
5162
5284
  this.options.onRender(this.preview, isPreviewMode ? "preview" : "normal", this);
5163
5285
  }
5164
5286
  }
5287
+ /**
5288
+ * Notify listeners that the editor value changed
5289
+ * @private
5290
+ */
5291
+ _notifyChange() {
5292
+ if (!this.options.onChange || !this.initialized)
5293
+ return;
5294
+ this.options.onChange(this.textarea.value, this);
5295
+ }
5165
5296
  /**
5166
5297
  * Apply background styling to code blocks
5167
5298
  * @private
@@ -5195,6 +5326,25 @@ var _OverType = class _OverType {
5195
5326
  */
5196
5327
  handleInput(event) {
5197
5328
  this.updatePreview();
5329
+ this._notifyChange();
5330
+ }
5331
+ /**
5332
+ * Handle focus events
5333
+ * @private
5334
+ */
5335
+ handleFocus(event) {
5336
+ if (this.options.onFocus) {
5337
+ this.options.onFocus(event, this);
5338
+ }
5339
+ }
5340
+ /**
5341
+ * Handle blur events
5342
+ * @private
5343
+ */
5344
+ handleBlur(event) {
5345
+ if (this.options.onBlur) {
5346
+ this.options.onBlur(event, this);
5347
+ }
5198
5348
  }
5199
5349
  /**
5200
5350
  * Handle keydown events
@@ -5375,11 +5525,15 @@ var _OverType = class _OverType {
5375
5525
  * @param {string} value - Markdown content to set
5376
5526
  */
5377
5527
  setValue(value) {
5528
+ const didChange = this.textarea.value !== value;
5378
5529
  this.textarea.value = value;
5379
5530
  this.updatePreview();
5380
5531
  if (this.options.autoResize) {
5381
5532
  this._updateAutoHeight();
5382
5533
  }
5534
+ if (didChange) {
5535
+ this._notifyChange();
5536
+ }
5383
5537
  }
5384
5538
  /**
5385
5539
  * Execute an action by ID
@@ -5736,9 +5890,9 @@ var _OverType = class _OverType {
5736
5890
  * // HTML: <div class="editor" data-ot-toolbar="true" data-ot-theme="cave"></div>
5737
5891
  * OverType.initFromData('.editor', { fontSize: '14px' });
5738
5892
  */
5739
- static initFromData(selector, defaults = {}) {
5740
- const elements = document.querySelectorAll(selector);
5741
- return Array.from(elements).map((el) => {
5893
+ static initFromData(target, defaults = {}) {
5894
+ const elements = _OverType._resolveTargets(target);
5895
+ return elements.map((el) => {
5742
5896
  const options = { ...defaults };
5743
5897
  for (const attr of el.attributes) {
5744
5898
  if (attr.name.startsWith("data-ot-")) {
@@ -5750,6 +5904,33 @@ var _OverType = class _OverType {
5750
5904
  return new _OverType(el, options)[0];
5751
5905
  });
5752
5906
  }
5907
+ /**
5908
+ * Normalize various target shapes to an array of Elements
5909
+ * @private
5910
+ * @param {string|Element|NodeList|Element[]} target
5911
+ * @returns {Element[]}
5912
+ */
5913
+ static _resolveTargets(target) {
5914
+ if (target == null) {
5915
+ throw new Error("Invalid target: must be selector string, Element, NodeList, or Array");
5916
+ }
5917
+ if (typeof target === "string") {
5918
+ return Array.from(document.querySelectorAll(target));
5919
+ }
5920
+ if (target instanceof Element) {
5921
+ return [target];
5922
+ }
5923
+ if (target instanceof NodeList) {
5924
+ return Array.from(target);
5925
+ }
5926
+ if (Array.isArray(target)) {
5927
+ return target;
5928
+ }
5929
+ if (typeof target.length === "number") {
5930
+ return Array.from(target);
5931
+ }
5932
+ throw new Error("Invalid target: must be selector string, Element, NodeList, or Array");
5933
+ }
5753
5934
  /**
5754
5935
  * Parse a data attribute value to the appropriate type
5755
5936
  * @private
@@ -5766,11 +5947,22 @@ var _OverType = class _OverType {
5766
5947
  return value;
5767
5948
  }
5768
5949
  /**
5769
- * Get instance from element
5770
- * @param {Element} element - DOM element
5771
- * @returns {OverType|null} OverType instance or null
5950
+ * Get instance from a target. Accepts the same shapes as the constructor;
5951
+ * for multi-element targets, returns the instance for the first matching
5952
+ * element, or null if none.
5953
+ * @param {string|Element|NodeList|Element[]} target
5954
+ * @returns {OverType|null}
5772
5955
  */
5773
- static getInstance(element) {
5956
+ static getInstance(target) {
5957
+ let element;
5958
+ if (target instanceof Element) {
5959
+ element = target;
5960
+ } else {
5961
+ const elements = _OverType._resolveTargets(target);
5962
+ element = elements[0];
5963
+ }
5964
+ if (!element)
5965
+ return null;
5774
5966
  return element.overTypeInstance || _OverType.instances.get(element) || null;
5775
5967
  }
5776
5968
  /**
@@ -5948,6 +6140,22 @@ var _OverType = class _OverType {
5948
6140
  instance.handleKeydown(e);
5949
6141
  }
5950
6142
  });
6143
+ document.addEventListener("focus", (e) => {
6144
+ if (e.target && e.target.classList && e.target.classList.contains("overtype-input")) {
6145
+ const wrapper = e.target.closest(".overtype-wrapper");
6146
+ const instance = wrapper == null ? void 0 : wrapper._instance;
6147
+ if (instance)
6148
+ instance.handleFocus(e);
6149
+ }
6150
+ }, true);
6151
+ document.addEventListener("blur", (e) => {
6152
+ if (e.target && e.target.classList && e.target.classList.contains("overtype-input")) {
6153
+ const wrapper = e.target.closest(".overtype-wrapper");
6154
+ const instance = wrapper == null ? void 0 : wrapper._instance;
6155
+ if (instance)
6156
+ instance.handleBlur(e);
6157
+ }
6158
+ }, true);
5951
6159
  document.addEventListener("scroll", (e) => {
5952
6160
  if (e.target && e.target.classList && e.target.classList.contains("overtype-input")) {
5953
6161
  const wrapper = e.target.closest(".overtype-wrapper");