@lexical/table 0.7.6 → 0.7.7
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/LexicalTable.dev.js +0 -25
- package/LexicalTable.prod.js +0 -1
- package/package.json +3 -3
package/LexicalTable.dev.js
CHANGED
@@ -308,31 +308,6 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
|
|
308
308
|
|
309
309
|
const getDOMSelection = targetWindow => CAN_USE_DOM ? (targetWindow || window).getSelection() : null;
|
310
310
|
|
311
|
-
if (CAN_USE_DOM) {
|
312
|
-
const disableNativeSelectionUi = document.createElement('style');
|
313
|
-
disableNativeSelectionUi.innerHTML = `
|
314
|
-
table.disable-selection {
|
315
|
-
-webkit-touch-callout: none;
|
316
|
-
-webkit-user-select: none;
|
317
|
-
-khtml-user-select: none;
|
318
|
-
-moz-user-select: none;
|
319
|
-
-ms-user-select: none;
|
320
|
-
user-select: none;
|
321
|
-
}
|
322
|
-
|
323
|
-
.disable-selection span::selection{
|
324
|
-
background-color: transparent;
|
325
|
-
}
|
326
|
-
.disable-selection br::selection{
|
327
|
-
background-color: transparent;
|
328
|
-
}
|
329
|
-
`;
|
330
|
-
|
331
|
-
if (document.body) {
|
332
|
-
document.body.append(disableNativeSelectionUi);
|
333
|
-
}
|
334
|
-
}
|
335
|
-
|
336
311
|
class TableSelection {
|
337
312
|
constructor(editor, tableNodeKey) {
|
338
313
|
this.isHighlightingCells = false;
|
package/LexicalTable.prod.js
CHANGED
@@ -13,7 +13,6 @@ function x(a){a=a.nodeName.toLowerCase();return{forChild:(b,e)=>{if(B(e)&&!d.$is
|
|
13
13
|
class C extends d.DEPRECATED_GridRowNode{static getType(){return"tablerow"}static clone(a){return new C(a.__height,a.__key)}static importDOM(){return{tr:()=>({conversion:D,priority:0})}}static importJSON(a){return E(a.height)}constructor(a,b){super(b);this.__height=a}exportJSON(){return{...super.exportJSON(),type:"tablerow",version:1}}createDOM(a){let b=document.createElement("tr");this.__height&&(b.style.height=`${this.__height}px`);n.addClassNamesToElement(b,a.theme.tableRow);return b}isShadowRoot(){return!0}setHeight(a){this.getWritable().__height=
|
14
14
|
a;return this.__height}getHeight(){return this.getLatest().__height}updateDOM(a){return a.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function D(){return{node:E()}}function E(a){return d.$applyNodeReplacement(new C(a))}function F(a){return a instanceof C}function G(a){throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?code=${a} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
|
15
15
|
let H="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement;
|
16
|
-
if(H){let a=document.createElement("style");a.innerHTML="\n table.disable-selection {\n -webkit-touch-callout: none;\n -webkit-user-select: none; \n -khtml-user-select: none; \n -moz-user-select: none; \n -ms-user-select: none; \n user-select: none;\n }\n \n .disable-selection span::selection{\n background-color: transparent;\n }\n .disable-selection br::selection{\n background-color: transparent;\n }\n ";document.body&&document.body.append(a)}
|
17
16
|
class I{constructor(a,b){this.isHighlightingCells=!1;this.focusY=this.focusX=this.anchorY=this.anchorX=-1;this.listenersToRemove=new Set;this.tableNodeKey=b;this.editor=a;this.grid={cells:[],columns:0,rows:0};this.focusCell=this.anchorCell=this.focusCellNodeKey=this.anchorCellNodeKey=this.gridSelection=null;this.hasHijackedSelectionStyles=!1;this.trackTableGrid()}getGrid(){return this.grid}removeListeners(){Array.from(this.listenersToRemove).forEach(a=>a())}trackTableGrid(){let a=new MutationObserver(b=>
|
18
17
|
{this.editor.update(()=>{var e=!1;for(let h=0;h<b.length;h++){const c=b[h].target.nodeName;if("TABLE"===c||"TR"===c){e=!0;break}}if(e){e=this.editor.getElementByKey(this.tableNodeKey);if(!e)throw Error("Expected to find TableElement in DOM");this.grid=J(e)}})});this.editor.update(()=>{let b=this.editor.getElementByKey(this.tableNodeKey);if(!b)throw Error("Expected to find TableElement in DOM");this.grid=J(b);a.observe(b,{childList:!0,subtree:!0})})}clearHighlight(){this.isHighlightingCells=!1;this.focusY=
|
19
18
|
this.focusX=this.anchorY=this.anchorX=-1;this.focusCell=this.anchorCell=this.focusCellNodeKey=this.anchorCellNodeKey=this.gridSelection=null;this.hasHijackedSelectionStyles=!1;this.enableHighlightStyle();this.editor.update(()=>{var a=d.$getNodeByKey(this.tableNodeKey);if(!K(a))throw Error("Expected TableNode.");a=this.editor.getElementByKey(this.tableNodeKey);if(!a)throw Error("Expected to find TableElement in DOM");a=J(a);L(a,null);d.$setSelection(null);this.editor.dispatchCommand(d.SELECTION_CHANGE_COMMAND,
|
package/package.json
CHANGED
@@ -8,13 +8,13 @@
|
|
8
8
|
"table"
|
9
9
|
],
|
10
10
|
"license": "MIT",
|
11
|
-
"version": "0.7.
|
11
|
+
"version": "0.7.7",
|
12
12
|
"main": "LexicalTable.js",
|
13
13
|
"peerDependencies": {
|
14
|
-
"lexical": "0.7.
|
14
|
+
"lexical": "0.7.7"
|
15
15
|
},
|
16
16
|
"dependencies": {
|
17
|
-
"@lexical/utils": "0.7.
|
17
|
+
"@lexical/utils": "0.7.7"
|
18
18
|
},
|
19
19
|
"repository": {
|
20
20
|
"type": "git",
|