@lexical/table 0.1.19 → 0.1.20

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.
@@ -931,7 +931,7 @@ function $updateDOMForSelection(grid, gridSelection) {
931
931
 
932
932
  if (lexicalNode && selectedCellNodes.has(lexicalNode)) {
933
933
  cell.highlighted = true;
934
- elemStyle.setProperty('background-color', 'rgb(163, 187, 255)');
934
+ elemStyle.setProperty('background-color', 'rgb(172, 206, 247)');
935
935
  elemStyle.setProperty('caret-color', 'transparent');
936
936
  highlightedCells.push(cell);
937
937
  } else {
@@ -18,7 +18,7 @@ this.currentX&&h===this.currentY)return;this.currentX=f;this.currentY=h;this.isH
18
18
  "element"),f.formatText(a))});g.$setSelection(b);this.editor.dispatchCommand(g.SELECTION_CHANGE_COMMAND)})}clearText(){this.editor.update(()=>{const a=g.$getNodeByKey(this.tableNodeKey);if(!C(a))throw Error("Expected TableNode.");var b=g.$getSelection();g.$isGridSelection(b)||x(79);b=b.getNodes().filter(w);b.length===this.grid.columns*this.grid.rows?(a.selectPrevious(),a.remove(),this.clearHighlight()):(b.forEach(f=>{if(g.$isElementNode(f)){const h=g.$createParagraphNode(),c=g.$createTextNode();h.append(c);
19
19
  f.append(h);f.getChildren().forEach(k=>{k!==h&&k.remove()})}}),D(this.grid,null),g.$setSelection(null),this.editor.dispatchCommand(g.SELECTION_CHANGE_COMMAND))})}}function E(a){for(;null!=a;){const b=a.nodeName;if("TD"===b||"TH"===b){a=a._cell;if(void 0===a)break;return a}a=a.parentNode}return null}
20
20
  function B(a){const b=[],f={cells:b,columns:0,rows:0};var h=a.firstChild;let c=a=0;for(b.length=0;null!=h;){var k=h.nodeName;if("TD"===k||"TH"===k)k={elem:h,highlighted:!1,x:a,y:c},h._cell=k,void 0===b[c]&&(b[c]=[]),b[c][a]=k;else if(k=h.firstChild,null!=k){h=k;continue}k=h.nextSibling;if(null!=k)a++,h=k;else if(k=h.parentNode,null!=k){h=k.nextSibling;if(null==h)break;c++;a=0}}f.columns=a+1;f.rows=c+1;return f}
21
- function D(a,b){const f=[];({cells:a}=a);b=new Set(b?b.getNodes():[]);for(let h=0;h<a.length;h++){const c=a[h];for(let k=0;k<c.length;k++){const p=c[k],d=p.elem.style,e=g.$getNearestNodeFromDOMNode(p.elem);e&&b.has(e)?(p.highlighted=!0,d.setProperty("background-color","rgb(163, 187, 255)"),d.setProperty("caret-color","transparent"),f.push(p)):(p.highlighted=!1,d.removeProperty("background-color"),d.removeProperty("caret-color"),p.elem.getAttribute("style")||p.elem.removeAttribute("style"))}}return f}
21
+ function D(a,b){const f=[];({cells:a}=a);b=new Set(b?b.getNodes():[]);for(let h=0;h<a.length;h++){const c=a[h];for(let k=0;k<c.length;k++){const p=c[k],d=p.elem.style,e=g.$getNearestNodeFromDOMNode(p.elem);e&&b.has(e)?(p.highlighted=!0,d.setProperty("background-color","rgb(172, 206, 247)"),d.setProperty("caret-color","transparent"),f.push(p)):(p.highlighted=!1,d.removeProperty("background-color"),d.removeProperty("caret-color"),p.elem.getAttribute("style")||p.elem.removeAttribute("style"))}}return f}
22
22
  const G=(a,b,f,h,c)=>{switch(c){case "backward":case "forward":return c="forward"===c,f!==(c?a.grid.columns-1:0)?F(b.getCellNodeFromCordsOrThrow(f+(c?1:-1),h,a.grid)):h!==(c?a.grid.rows-1:0)?F(b.getCellNodeFromCordsOrThrow(c?0:a.grid.columns-1,h+(c?1:-1),a.grid)):c?b.selectNext():b.selectPrevious(),!0;case "up":return 0!==h?F(b.getCellNodeFromCordsOrThrow(f,h-1,a.grid)):b.selectPrevious(),!0;case "down":return h!==a.grid.rows-1?F(b.getCellNodeFromCordsOrThrow(f,h+1,a.grid)):b.selectNext(),!0}return!1},
23
23
  H=(a,b,f,h,c)=>{switch(c){case "backward":case "forward":return c="forward"===c,f!==(c?a.grid.columns-1:0)&&a.adjustFocusCellForSelection(b.getCellFromCordsOrThrow(f+(c?1:-1),h,a.grid)),!0;case "up":if(0!==h)return a.adjustFocusCellForSelection(b.getCellFromCordsOrThrow(f,h-1,a.grid)),!0;break;case "down":if(h!==a.grid.rows-1)return a.adjustFocusCellForSelection(b.getCellFromCordsOrThrow(f,h+1,a.grid)),!0}return!1};
24
24
  function F(a){const b=a.getChildren().find(f=>g.$isParagraphNode(f));g.$isParagraphNode(b)?b.selectEnd():a.selectEnd()}
package/package.json CHANGED
@@ -8,13 +8,13 @@
8
8
  "table"
9
9
  ],
10
10
  "license": "MIT",
11
- "version": "0.1.19",
11
+ "version": "0.1.20",
12
12
  "main": "LexicalTable.js",
13
13
  "peerDependencies": {
14
- "lexical": "0.1.19"
14
+ "lexical": "0.1.20"
15
15
  },
16
16
  "dependencies": {
17
- "@lexical/utils": "0.1.19"
17
+ "@lexical/utils": "0.1.20"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",