@ebl-vue/editor-full 1.0.12 → 1.0.13

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.
Files changed (46) hide show
  1. package/dist/index.d.ts +5 -0
  2. package/dist/index.mjs +733 -440
  3. package/dist/index.mjs.map +1 -1
  4. package/package.json +3 -1
  5. package/src/components/Editor/Editor.vue +34 -10
  6. package/src/i18n/zh-cn.ts +6 -1
  7. package/src/icons/index.ts +15 -0
  8. package/src/installer.ts +4 -3
  9. package/src/plugins/alert/index.ts +19 -27
  10. package/src/plugins/block-alignment/index.ts +4 -3
  11. package/src/plugins/code/index.ts +3 -2
  12. package/src/plugins/color-picker/index.ts +3 -11
  13. package/src/plugins/delimiter/index.ts +5 -6
  14. package/src/plugins/header/H1.ts +1 -1
  15. package/src/plugins/header/H2.ts +1 -1
  16. package/src/plugins/header/H3.ts +1 -1
  17. package/src/plugins/header/H4.ts +1 -2
  18. package/src/plugins/header/H5.ts +1 -3
  19. package/src/plugins/header/H6.ts +1 -3
  20. package/src/plugins/imageTool/index.css +145 -0
  21. package/src/plugins/imageTool/index.ts +519 -0
  22. package/src/plugins/imageTool/types/codexteam__ajax.d.ts +89 -0
  23. package/src/plugins/imageTool/types/types.ts +234 -0
  24. package/src/plugins/imageTool/ui.ts +312 -0
  25. package/src/plugins/imageTool/uploader.ts +234 -0
  26. package/src/plugins/imageTool/utils/dom.ts +24 -0
  27. package/src/plugins/imageTool/utils/isPromise.ts +10 -0
  28. package/src/plugins/indent/index.ts +5 -7
  29. package/src/plugins/inline-code/index.ts +2 -5
  30. package/src/plugins/list/ListRenderer/ChecklistRenderer.ts +1 -4
  31. package/src/plugins/list/index.ts +20 -37
  32. package/src/plugins/list/types/OlCounterType.ts +1 -1
  33. package/src/plugins/marker/index.ts +28 -16
  34. package/src/plugins/paragraph/index.ts +3 -2
  35. package/src/plugins/quote/index.ts +1 -4
  36. package/src/plugins/table/plugin.ts +1 -1
  37. package/src/plugins/table/table.ts +40 -38
  38. package/src/plugins/table/toolbox.ts +5 -4
  39. package/src/plugins/table/utils/dom.ts +15 -14
  40. package/src/plugins/table/utils/popover.ts +28 -15
  41. package/src/plugins/underline/index.ts +2 -4
  42. package/src/plugins/undo/index.ts +48 -33
  43. package/src/plugins/undo/observer.ts +3 -3
  44. package/types/index.d.ts +5 -0
  45. package/vite.config.ts +3 -1
  46. package/src/plugins/list/styles/icons/index.ts +0 -10
@@ -8,7 +8,7 @@ import {
8
8
  IconDirectionUpRight,
9
9
  IconDirectionDownRight,
10
10
  IconCross,
11
- IconPlus
11
+
12
12
  } from '../../icons';
13
13
  type TableData = {
14
14
  /**
@@ -76,12 +76,12 @@ export default class Table {
76
76
  private selectedColumn: any;
77
77
  private tunes: any;
78
78
  private focusedCell: any;
79
- private numberOfColumns: number;
79
+
80
80
  private hoveredCell: any;
81
81
  private isDragging: boolean;
82
- private draggingRow: number;
82
+ //private draggingRow: number;
83
83
  private draggingColumn: number;
84
- private draggingColArr: any[];
84
+ //private draggingColArr: any[];
85
85
  private startWidth: number;
86
86
  private mouseStartX: number;
87
87
  private colWidthArr:any[];
@@ -110,8 +110,8 @@ export default class Table {
110
110
  this.hoveredCell = null;
111
111
 
112
112
  this.isDragging = false;
113
- this.draggingColArr = [];
114
- this.draggingRow = 0;
113
+ //this.draggingColArr = [];
114
+ //this.draggingRow = 0;
115
115
  this.draggingColumn = 0;
116
116
  this.startWidth = 0;
117
117
  this.mouseStartX = 0;
@@ -176,17 +176,18 @@ export default class Table {
176
176
  /**
177
177
  * Global click listener allows to delegate clicks on some elements
178
178
  */
179
- this.documentClicked = (event:MouseEvent) => {
180
- const clickedInsideTable = event.target.closest(`.${CSS.table}`) !== null;
181
- const outsideTableClicked = event.target.closest(`.${CSS.wrapper}`) === null;
179
+ this.documentClicked = (event: MouseEvent) => {
180
+ let target = event.target as HTMLElement;
181
+ const clickedInsideTable = target.closest(`.${CSS.table}`) !== null;
182
+ const outsideTableClicked = target.closest(`.${CSS.wrapper}`) === null;
182
183
  const clickedOutsideToolboxes = clickedInsideTable || outsideTableClicked;
183
184
 
184
185
  if (clickedOutsideToolboxes) {
185
186
  this.hideToolboxes();
186
187
  }
187
188
 
188
- const clickedOnAddRowButton = event.target.closest(`.${CSS.addRow}`);
189
- const clickedOnAddColumnButton = event.target.closest(`.${CSS.addColumn}`);
189
+ const clickedOnAddRowButton = target.closest(`.${CSS.addRow}`);
190
+ const clickedOnAddColumnButton = target.closest(`.${CSS.addColumn}`);
190
191
 
191
192
  /**
192
193
  * Also, check if clicked in current table, not other (because documentClicked bound to the whole document)
@@ -247,9 +248,9 @@ handleDocumentMousedown = (e:MouseEvent) => {
247
248
  this.table.classList.add("table-resizing"); //为整个表格添加光标样式
248
249
  document.addEventListener("mousemove", this.handleDocumentMousemove);
249
250
  document.addEventListener("mouseup", this.handleDocumentMouseup);
250
- this.draggingRow = this.hoveredRow;
251
+ //this.draggingRow = this.hoveredRow;
251
252
  this.draggingColumn = this.hoveredColumn;
252
- this.draggingColArr = this.getCellInCol(this.draggingColumn);
253
+ //this.draggingColArr = this.getCellInCol(this.draggingColumn);
253
254
  this.startWidth = this.colWidthArr[this.draggingColumn - 1]; //获取初始宽度
254
255
  this.mouseStartX = e.clientX;
255
256
  }
@@ -268,7 +269,7 @@ handleDocumentMousedown = (e:MouseEvent) => {
268
269
  return cells;
269
270
  }
270
271
  // mousemove事件
271
- handleDocumentMousemove = (e) => {
272
+ handleDocumentMousemove = (e:MouseEvent) => {
272
273
  if (!this.isDragging) return;
273
274
  const currentMouseX = e.clientX;
274
275
  const deltaX = currentMouseX - this.mouseStartX;
@@ -278,7 +279,7 @@ handleDocumentMousedown = (e:MouseEvent) => {
278
279
  this.updateColWidth();
279
280
  };
280
281
  // mouseup事件
281
- handleDocumentMouseup = (e) => {
282
+ handleDocumentMouseup = () => {
282
283
  //this.showToolbox(); // 拖拽结束时重新显示工具栏
283
284
  //this.updateToolboxPosition();
284
285
  this.updateToolboxesPosition();
@@ -445,7 +446,7 @@ handleDocumentMousedown = (e:MouseEvent) => {
445
446
  * @param {HTMLElement} cell - cell element
446
447
  * @returns {HTMLElement}
447
448
  */
448
- getRowByCell(cell:Element) {
449
+ getRowByCell(cell:HTMLElement) {
449
450
  return cell.parentElement;
450
451
  }
451
452
 
@@ -549,7 +550,7 @@ handleDocumentMousedown = (e:MouseEvent) => {
549
550
  * Check if the number of rows has reached the maximum allowed rows specified in the configuration,
550
551
  * and if so, exit the function to prevent adding more columns beyond the limit.
551
552
  */
552
- if (this.config && this.config.maxrows && this.numberOfRows >= this.config.maxrows && addRowButton) {
553
+ if (this.config && this.config.maxrows && this.numberOfRows >= this.config.maxrows ) {
553
554
  return;
554
555
  }
555
556
 
@@ -570,7 +571,7 @@ handleDocumentMousedown = (e:MouseEvent) => {
570
571
  const insertedRowFirstCell = this.getRowFirstCell(insertedRow);
571
572
 
572
573
  if (insertedRowFirstCell && setFocus) {
573
- $.focus(insertedRowFirstCell);
574
+ $.focus(insertedRowFirstCell as HTMLElement);
574
575
  }
575
576
 
576
577
  const addRowButton = this.wrapper.querySelector(`.${CSS.addRow}`);
@@ -607,7 +608,7 @@ handleDocumentMousedown = (e:MouseEvent) => {
607
608
  *
608
609
  * @param {number} index
609
610
  */
610
- deleteRow(index) {
611
+ deleteRow(index: number) {
611
612
  this.getRow(index).remove();
612
613
  const addRowButton = this.wrapper.querySelector(`.${CSS.addRow}`);
613
614
  if (addRowButton) {
@@ -731,10 +732,10 @@ handleDocumentMousedown = (e:MouseEvent) => {
731
732
  * Fills a row with cells
732
733
  *
733
734
  * @param {HTMLElement} row - row to fill
734
- * @param {number} numberOfColumns - how many cells should be in a row
735
+ * @param {number} numOfColumns - how many cells should be in a row
735
736
  */
736
- fillRow(row, numberOfColumns) {
737
- for (let i = 1; i <= numberOfColumns; i++) {
737
+ fillRow(row:HTMLElement, numOfColumns:number) {
738
+ for (let i = 1; i <= numOfColumns; i++) {
738
739
  const newCell = this.createCell();
739
740
 
740
741
  row.appendChild(newCell);
@@ -793,8 +794,8 @@ handleDocumentMousedown = (e:MouseEvent) => {
793
794
  *
794
795
  * @param {Event} event - mouse move event
795
796
  */
796
- onMouseMoveInTable(event) {
797
- const { row, column, deltaXCell, deltaYCell } = this.getHoveredCell(event);
797
+ onMouseMoveInTable(event:MouseEvent) {
798
+ const { row, column, deltaXCell } = this.getHoveredCell(event);
798
799
 
799
800
  this.hoveredColumn = column;
800
801
  this.hoveredRow = row;
@@ -825,7 +826,7 @@ handleDocumentMousedown = (e:MouseEvent) => {
825
826
  *
826
827
  * @param {KeyboardEvent} event - keypress event
827
828
  */
828
- onKeyPressListener(event) {
829
+ onKeyPressListener(event: KeyboardEvent) {
829
830
  if (event.key === 'Enter') {
830
831
  if (event.shiftKey) {
831
832
  return true;
@@ -843,7 +844,7 @@ handleDocumentMousedown = (e:MouseEvent) => {
843
844
  *
844
845
  * @param {KeyboardEvent} event - keydown event
845
846
  */
846
- onKeyDownListener(event) {
847
+ onKeyDownListener(event: KeyboardEvent) {
847
848
  if (event.key === 'Tab') {
848
849
  event.stopPropagation();
849
850
  }
@@ -854,9 +855,10 @@ handleDocumentMousedown = (e:MouseEvent) => {
854
855
  *
855
856
  * @param {FocusEvent} event - focusin event
856
857
  */
857
- focusInTableListener(event) {
858
- const cell = event.target;
858
+ focusInTableListener(event: FocusEvent) {
859
+ const cell = event.target as HTMLElement;
859
860
  const row = this.getRowByCell(cell);
861
+ if(!row) return;
860
862
 
861
863
  this.focusedCell = {
862
864
  row: Array.from(this.table.querySelectorAll(`.${CSS.row}`)).indexOf(row) + 1,
@@ -954,7 +956,7 @@ handleDocumentMousedown = (e:MouseEvent) => {
954
956
  *
955
957
  * @param {boolean} withHeadings - use headings row or not
956
958
  */
957
- setHeadingsSetting(withHeadings) {
959
+ setHeadingsSetting(withHeadings: boolean) {
958
960
  this.tunes.withHeadings = withHeadings;
959
961
 
960
962
  if (withHeadings) {
@@ -997,7 +999,7 @@ handleDocumentMousedown = (e:MouseEvent) => {
997
999
  *
998
1000
  * @param {number} index
999
1001
  */
1000
- selectRow(index) {
1002
+ selectRow(index: number) {
1001
1003
  const row = this.getRow(index);
1002
1004
 
1003
1005
  if (row) {
@@ -1028,7 +1030,7 @@ handleDocumentMousedown = (e:MouseEvent) => {
1028
1030
  *
1029
1031
  * @param {number} index
1030
1032
  */
1031
- selectColumn(index) {
1033
+ selectColumn(index: number) {
1032
1034
  for (let i = 1; i <= this.numberOfRows; i++) {
1033
1035
  const cell = this.getCell(i, index);
1034
1036
 
@@ -1048,9 +1050,9 @@ handleDocumentMousedown = (e:MouseEvent) => {
1048
1050
  return;
1049
1051
  }
1050
1052
 
1051
- let cells = this.table.querySelectorAll(`.${CSS.cellSelected}`);
1053
+ let cells = this.table.querySelectorAll(`.${CSS.cellSelected}`) as HTMLElement[];
1052
1054
 
1053
- Array.from(cells).forEach(column => {
1055
+ Array.from(cells).forEach((column: HTMLElement) => {
1054
1056
  column.classList.remove(CSS.cellSelected);
1055
1057
  });
1056
1058
 
@@ -1077,7 +1079,7 @@ handleDocumentMousedown = (e:MouseEvent) => {
1077
1079
  const afterTheRightBorder1 = ({ fromRightBorder }: { fromRightBorder: number }) => x > (width - fromRightBorder);
1078
1080
  hoveredColumn = this.binSearch(
1079
1081
  this.numberOfColumns,
1080
- (mid) => this.getCell(1, mid),
1082
+ (mid: number) => this.getCell(1, mid),
1081
1083
  beforeTheLeftBorder1,
1082
1084
  afterTheRightBorder1
1083
1085
  );
@@ -1089,7 +1091,7 @@ handleDocumentMousedown = (e:MouseEvent) => {
1089
1091
  const afterTheRightBorder2 = ({ fromBottomBorder }: { fromBottomBorder: number }) => y > (height - fromBottomBorder);
1090
1092
  hoveredRow = this.binSearch(
1091
1093
  this.numberOfRows,
1092
- (mid) => this.getCell(mid, 1),
1094
+ (mid: number) => this.getCell(mid, 1),
1093
1095
  beforeTheLeftBorder2,
1094
1096
  afterTheRightBorder2
1095
1097
  );
@@ -1134,7 +1136,7 @@ handleDocumentMousedown = (e:MouseEvent) => {
1134
1136
  * @param {function} afterTheRightBorder - determines the cursor position, to the right of the cell or not
1135
1137
  * @returns {number}
1136
1138
  */
1137
- binSearch(numberOfCells, getCell, beforeTheLeftBorder, afterTheRightBorder) {
1139
+ binSearch(numberOfCells: number, getCell: Function, beforeTheLeftBorder: Function, afterTheRightBorder: Function) {
1138
1140
  let leftBorder = 0;
1139
1141
  let rightBorder = numberOfCells + 1;
1140
1142
  let totalIterations = 0;
@@ -1171,13 +1173,13 @@ handleDocumentMousedown = (e:MouseEvent) => {
1171
1173
  for (let i = 1; i <= this.numberOfRows; i++) {
1172
1174
  const row = this.table.querySelector(`.${CSS.row}:nth-child(${i})`);
1173
1175
  const cells = Array.from(row.querySelectorAll(`.${CSS.cell}`));
1174
- const isEmptyRow = cells.every(cell => !cell.textContent.trim());
1176
+ const isEmptyRow = cells.every((cell:any)=>!cell.textContent.trim());
1175
1177
 
1176
1178
  if (isEmptyRow) {
1177
1179
  continue;
1178
1180
  }
1179
1181
 
1180
- data.push(cells.map(cell => cell.innerHTML));
1182
+ data.push(cells.map((cell:any) => cell.innerHTML));
1181
1183
  }
1182
1184
 
1183
1185
  return data;
@@ -21,7 +21,7 @@ import { IconMenuSmall } from "../../icons";
21
21
  * <toolbox>
22
22
  */
23
23
  export default class Toolbox {
24
- private api: any;
24
+
25
25
  private items: any;
26
26
  private onOpen: any;
27
27
  private onClose: any;
@@ -38,8 +38,8 @@ export default class Toolbox {
38
38
  * @param {function} config.onClose - callback fired when the Popover is closing
39
39
  * @param {string} config.cssModifier - the modifier for the Toolbox. Allows to add some specific styles.
40
40
  */
41
- constructor({ api, items, onOpen, onClose, cssModifier = "" }: any) {
42
- this.api = api;
41
+ constructor({ items, onOpen, onClose, cssModifier = "" }: any) {
42
+
43
43
 
44
44
  this.items = items;
45
45
  this.onOpen = onOpen;
@@ -147,7 +147,8 @@ export default class Toolbox {
147
147
  * Set 'top' or 'left' style
148
148
  */
149
149
  Object.entries(position).forEach(([prop, value]) => {
150
- this.wrapper.style[prop] = value;
150
+ //this.wrapper.style[prop] = value;
151
+ this.wrapper.style.setProperty(prop, value as string);
151
152
  });
152
153
 
153
154
  this.wrapper.classList.add(Toolbox.CSS.toolboxShowed);
@@ -7,9 +7,9 @@
7
7
  * @returns {Element}
8
8
  */
9
9
  export function make(
10
- tagName,
11
- classNames,
12
- attributes = {}
10
+ tagName: string,
11
+ classNames: string | string[],
12
+ attributes:Record<string, any> = {}
13
13
  ) {
14
14
  const el = document.createElement(tagName);
15
15
 
@@ -24,7 +24,8 @@ export function make(
24
24
  continue;
25
25
  }
26
26
 
27
- el[attrName] = attributes[attrName];
27
+ //el[attrName] = attributes[attrName];
28
+ el.setAttribute(attrName, attributes[attrName]);
28
29
  }
29
30
 
30
31
  return el;
@@ -36,7 +37,7 @@ export function make(
36
37
  * @param {HTMLElement} elem - item
37
38
  * @returns {{x1: number, y1: number, x2: number, y2: number}} coordinates of the upper left (x1,y1) and lower right(x2,y2) corners
38
39
  */
39
- export function getCoords(elem) {
40
+ export function getCoords(elem: HTMLElement) {
40
41
  const rect = elem.getBoundingClientRect();
41
42
 
42
43
  return {
@@ -54,7 +55,7 @@ export function getCoords(elem) {
54
55
  * @param {HTMLElement} secondElem - inner element, if its borders go beyond the first, then the paddings will be considered negative
55
56
  * @returns {{fromTopBorder: number, fromLeftBorder: number, fromRightBorder: number, fromBottomBorder: number}}
56
57
  */
57
- export function getRelativeCoordsOfTwoElems(firstElem, secondElem) {
58
+ export function getRelativeCoordsOfTwoElems(firstElem: HTMLElement, secondElem: HTMLElement) {
58
59
  const firstCoords = getCoords(firstElem);
59
60
  const secondCoords = getCoords(secondElem);
60
61
 
@@ -72,7 +73,7 @@ export function getRelativeCoordsOfTwoElems(firstElem, secondElem) {
72
73
  * @param {HTMLElement} elem - element relative to which the coordinates will be calculated
73
74
  * @param {Event} event - mouse event
74
75
  */
75
- export function getCursorPositionRelativeToElement(elem, event) {
76
+ export function getCursorPositionRelativeToElement(elem: HTMLElement, event: MouseEvent) {
76
77
  const rect = elem.getBoundingClientRect();
77
78
  const { width, height, x, y } = rect;
78
79
  const { clientX, clientY } = event;
@@ -92,8 +93,8 @@ export function getCursorPositionRelativeToElement(elem, event) {
92
93
  * @param {HTMLElement} referenceNode
93
94
  * @returns {HTMLElement}
94
95
  */
95
- export function insertAfter(newNode, referenceNode) {
96
- return referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
96
+ export function insertAfter(newNode: HTMLElement, referenceNode: HTMLElement) {
97
+ return referenceNode?.parentNode?.insertBefore(newNode, referenceNode.nextSibling);
97
98
  }
98
99
 
99
100
  /**
@@ -103,8 +104,8 @@ export function insertAfter(newNode, referenceNode) {
103
104
  * @param {HTMLElement} referenceNode
104
105
  * @returns {HTMLElement}
105
106
  */
106
- export function insertBefore(newNode, referenceNode) {
107
- return referenceNode.parentNode.insertBefore(newNode, referenceNode);
107
+ export function insertBefore(newNode: HTMLElement, referenceNode: HTMLElement) {
108
+ return referenceNode?.parentNode?.insertBefore(newNode, referenceNode);
108
109
  }
109
110
 
110
111
 
@@ -116,13 +117,13 @@ export function insertBefore(newNode, referenceNode) {
116
117
  *
117
118
  * @returns {void}
118
119
  */
119
- export function focus(element, atStart = true) {
120
+ export function focus(element: HTMLElement, atStart = true) {
120
121
  const range = document.createRange();
121
122
  const selection = window.getSelection();
122
123
 
123
124
  range.selectNodeContents(element);
124
125
  range.collapse(atStart);
125
126
 
126
- selection.removeAllRanges();
127
- selection.addRange(range);
127
+ selection?.removeAllRanges();
128
+ selection?.addRange(range);
128
129
  }
@@ -8,16 +8,25 @@ import * as $ from './dom';
8
8
  * @property {function} hideIf - if provided, item will be hid, if this method returns true
9
9
  * @property {function} onClick - click callback
10
10
  */
11
-
11
+ interface IPopoverItem {
12
+ label: string;
13
+ icon?: string;
14
+ confirmationRequired?: boolean;
15
+ hideIf?: () => boolean;
16
+ onClick: () => void;
17
+ }
12
18
  /**
13
19
  * This cass provides a popover rendering
14
20
  */
15
21
  export default class Popover {
22
+ private wrapper: HTMLElement|null|undefined;
23
+ private items: IPopoverItem[];
24
+ private itemEls: HTMLElement[];
16
25
  /**
17
26
  * @param {object} options - constructor options
18
27
  * @param {PopoverItem[]} options.items - constructor options
19
28
  */
20
- constructor({items}) {
29
+ constructor({items}: {items: any}) {
21
30
  this.items = items;
22
31
  this.wrapper = undefined;
23
32
  this.itemEls = [];
@@ -48,7 +57,7 @@ export default class Popover {
48
57
  render() {
49
58
  this.wrapper = $.make('div', Popover.CSS.popover);
50
59
 
51
- this.items.forEach((item, index) => {
60
+ this.items.forEach((item:IPopoverItem, index:number) => {
52
61
  const itemEl = $.make('div', Popover.CSS.item);
53
62
  const icon = $.make('div', Popover.CSS.itemIcon, {
54
63
  innerHTML: item.icon
@@ -57,12 +66,13 @@ export default class Popover {
57
66
  textContent: item.label
58
67
  });
59
68
 
60
- itemEl.dataset.index = index;
69
+ itemEl.dataset.index = index + '';
70
+
61
71
 
62
72
  itemEl.appendChild(icon);
63
73
  itemEl.appendChild(label);
64
74
 
65
- this.wrapper.appendChild(itemEl);
75
+ this.wrapper?.appendChild(itemEl);
66
76
  this.itemEls.push(itemEl);
67
77
  });
68
78
 
@@ -82,8 +92,9 @@ export default class Popover {
82
92
  *
83
93
  * @returns {void}
84
94
  */
85
- popoverClicked(event) {
86
- const clickedItem = event.target.closest(`.${Popover.CSS.item}`);
95
+ popoverClicked(event: MouseEvent) {
96
+ const target = event.target as HTMLElement;
97
+ const clickedItem = target.closest(`.${Popover.CSS.item}`) as HTMLElement;
87
98
 
88
99
  /**
89
100
  * Clicks outside or between item
@@ -92,8 +103,10 @@ export default class Popover {
92
103
  return;
93
104
  }
94
105
 
95
- const clickedItemIndex = clickedItem.dataset.index;
96
- const item = this.items[clickedItemIndex];
106
+ const clickedItemIndex:string|undefined = clickedItem.dataset.index;
107
+ if(!clickedItemIndex) return;
108
+
109
+ const item = this.items[parseInt(clickedItemIndex)];
97
110
 
98
111
  if (item.confirmationRequired && !this.hasConfirmationState(clickedItem)) {
99
112
  this.setConfirmationState(clickedItem);
@@ -109,7 +122,7 @@ export default class Popover {
109
122
  *
110
123
  * @returns {void}
111
124
  */
112
- setConfirmationState(itemEl) {
125
+ setConfirmationState(itemEl: HTMLElement) {
113
126
  itemEl.classList.add(Popover.CSS.itemConfirmState);
114
127
  }
115
128
 
@@ -118,7 +131,7 @@ export default class Popover {
118
131
  *
119
132
  * @returns {void}
120
133
  */
121
- clearConfirmationState(itemEl) {
134
+ clearConfirmationState(itemEl: HTMLElement) {
122
135
  itemEl.classList.remove(Popover.CSS.itemConfirmState);
123
136
  }
124
137
 
@@ -127,7 +140,7 @@ export default class Popover {
127
140
  *
128
141
  * @returns {boolean}
129
142
  */
130
- hasConfirmationState(itemEl) {
143
+ hasConfirmationState(itemEl: HTMLElement) {
131
144
  return itemEl.classList.contains(Popover.CSS.itemConfirmState);
132
145
  }
133
146
 
@@ -137,7 +150,7 @@ export default class Popover {
137
150
  * @returns {boolean}
138
151
  */
139
152
  get opened() {
140
- return this.wrapper.classList.contains(Popover.CSS.popoverOpened);
153
+ return this.wrapper?.classList.contains(Popover.CSS.popoverOpened) || false;
141
154
  }
142
155
 
143
156
  /**
@@ -155,7 +168,7 @@ export default class Popover {
155
168
  }
156
169
  });
157
170
 
158
- this.wrapper.classList.add(Popover.CSS.popoverOpened);
171
+ this.wrapper?.classList.add(Popover.CSS.popoverOpened);
159
172
  }
160
173
 
161
174
  /**
@@ -164,7 +177,7 @@ export default class Popover {
164
177
  * @returns {void}
165
178
  */
166
179
  close() {
167
- this.wrapper.classList.remove(Popover.CSS.popoverOpened);
180
+ this.wrapper?.classList.remove(Popover.CSS.popoverOpened);
168
181
  this.itemEls.forEach(el => {
169
182
  this.clearConfirmationState(el);
170
183
  });
@@ -2,10 +2,8 @@
2
2
  * Build styles
3
3
  */
4
4
  import './index.css';
5
- const IconUnderline = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
6
- <path d="M9 7.5V11.5C9 12.2956 9.31607 13.0587 9.87868 13.6213C10.4413 14.1839 11.2044 14.5 12 14.5C12.7956 14.5 13.5587 14.1839 14.1213 13.6213C14.6839 13.0587 15 12.2956 15 11.5V7.5" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
7
- <path d="M7.71429 18H16.2857" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
8
- </svg>`;
5
+ import { IconUnderline } from '../../icons';
6
+
9
7
  import {type API, type InlineTool, type SanitizerConfig} from "@ebl-vue/editorjs";
10
8
  import {type InlineToolConstructorOptions} from "@ebl-vue/editorjs/types/tools/inline-tool";
11
9