@udecode/plate-table
Advanced tools
Comparing version 2.0.0 to 2.0.1
# @udecode/plate-table | ||
## 2.0.1 | ||
### Patch Changes | ||
- [#948](https://github.com/udecode/plate/pull/948) [`099a86fa`](https://github.com/udecode/plate/commit/099a86faede3b3acf7da6842a78e4fab76815073) Thanks [@dylans](https://github.com/dylans)! - some table cell calls were missing th check | ||
## 2.0.0 | ||
@@ -4,0 +10,0 @@ |
@@ -122,4 +122,4 @@ import { getPlatePluginOptions, getPlatePluginType, isElement, getRenderElement } from '@udecode/plate-core'; | ||
/** | ||
* If at (default = selection) is in table>tr>td, return table, tr, and td | ||
* node entries. | ||
* If at (default = selection) is in table>tr>td or table>tr>th, | ||
* return table, tr, and td or th node entries. | ||
*/ | ||
@@ -133,3 +133,3 @@ | ||
match: { | ||
type: getPlatePluginType(editor, ELEMENT_TD) | ||
type: [getPlatePluginType(editor, ELEMENT_TD), getPlatePluginType(editor, ELEMENT_TH)] | ||
} | ||
@@ -143,3 +143,3 @@ })) { | ||
match: { | ||
type: getPlatePluginType(editor, ELEMENT_TD) | ||
type: [getPlatePluginType(editor, ELEMENT_TD), getPlatePluginType(editor, ELEMENT_TH)] | ||
} | ||
@@ -149,3 +149,3 @@ }) || getParent(editor, paragraphPath); | ||
const [tableCellNode, tableCellPath] = tableCell; | ||
if (tableCellNode.type !== getPlatePluginType(editor, ELEMENT_TD)) return; | ||
if (tableCellNode.type !== (getPlatePluginType(editor, ELEMENT_TD) || getPlatePluginType(editor, ELEMENT_TH))) return; | ||
const tableRow = getParent(editor, tableCellPath); | ||
@@ -216,3 +216,3 @@ if (!tableRow) return; | ||
const matchCells = node => { | ||
return isElement(node) && (node.type === getPlatePluginType(editor, ELEMENT_TD) || node.type === getPlatePluginType(editor, ELEMENT_TD)); | ||
return isElement(node) && (node.type === getPlatePluginType(editor, ELEMENT_TD) || node.type === getPlatePluginType(editor, ELEMENT_TH)); | ||
}; | ||
@@ -350,3 +350,3 @@ | ||
return { | ||
type: header ? getPlatePluginType(editor, ELEMENT_TD) : getPlatePluginType(editor, ELEMENT_TD), | ||
type: header ? getPlatePluginType(editor, ELEMENT_TD) : getPlatePluginType(editor, ELEMENT_TH), | ||
children: [{ | ||
@@ -371,3 +371,3 @@ type: getPlatePluginType(editor, ELEMENT_DEFAULT), | ||
match: { | ||
type: [getPlatePluginType(editor, ELEMENT_TD), getPlatePluginType(editor, ELEMENT_TD)] | ||
type: [getPlatePluginType(editor, ELEMENT_TD), getPlatePluginType(editor, ELEMENT_TH)] | ||
} | ||
@@ -374,0 +374,0 @@ }); |
@@ -126,4 +126,4 @@ 'use strict'; | ||
/** | ||
* If at (default = selection) is in table>tr>td, return table, tr, and td | ||
* node entries. | ||
* If at (default = selection) is in table>tr>td or table>tr>th, | ||
* return table, tr, and td or th node entries. | ||
*/ | ||
@@ -137,3 +137,3 @@ | ||
match: { | ||
type: plateCore.getPlatePluginType(editor, ELEMENT_TD) | ||
type: [plateCore.getPlatePluginType(editor, ELEMENT_TD), plateCore.getPlatePluginType(editor, ELEMENT_TH)] | ||
} | ||
@@ -147,3 +147,3 @@ })) { | ||
match: { | ||
type: plateCore.getPlatePluginType(editor, ELEMENT_TD) | ||
type: [plateCore.getPlatePluginType(editor, ELEMENT_TD), plateCore.getPlatePluginType(editor, ELEMENT_TH)] | ||
} | ||
@@ -153,3 +153,3 @@ }) || plateCommon.getParent(editor, paragraphPath); | ||
const [tableCellNode, tableCellPath] = tableCell; | ||
if (tableCellNode.type !== plateCore.getPlatePluginType(editor, ELEMENT_TD)) return; | ||
if (tableCellNode.type !== (plateCore.getPlatePluginType(editor, ELEMENT_TD) || plateCore.getPlatePluginType(editor, ELEMENT_TH))) return; | ||
const tableRow = plateCommon.getParent(editor, tableCellPath); | ||
@@ -220,3 +220,3 @@ if (!tableRow) return; | ||
const matchCells = node => { | ||
return plateCore.isElement(node) && (node.type === plateCore.getPlatePluginType(editor, ELEMENT_TD) || node.type === plateCore.getPlatePluginType(editor, ELEMENT_TD)); | ||
return plateCore.isElement(node) && (node.type === plateCore.getPlatePluginType(editor, ELEMENT_TD) || node.type === plateCore.getPlatePluginType(editor, ELEMENT_TH)); | ||
}; | ||
@@ -354,3 +354,3 @@ | ||
return { | ||
type: header ? plateCore.getPlatePluginType(editor, ELEMENT_TD) : plateCore.getPlatePluginType(editor, ELEMENT_TD), | ||
type: header ? plateCore.getPlatePluginType(editor, ELEMENT_TD) : plateCore.getPlatePluginType(editor, ELEMENT_TH), | ||
children: [{ | ||
@@ -375,3 +375,3 @@ type: plateCore.getPlatePluginType(editor, plateCommon.ELEMENT_DEFAULT), | ||
match: { | ||
type: [plateCore.getPlatePluginType(editor, ELEMENT_TD), plateCore.getPlatePluginType(editor, ELEMENT_TD)] | ||
type: [plateCore.getPlatePluginType(editor, ELEMENT_TD), plateCore.getPlatePluginType(editor, ELEMENT_TH)] | ||
} | ||
@@ -378,0 +378,0 @@ }); |
import { SPEditor } from '@udecode/plate-core'; | ||
import { Location } from 'slate'; | ||
/** | ||
* If at (default = selection) is in table>tr>td, return table, tr, and td | ||
* node entries. | ||
* If at (default = selection) is in table>tr>td or table>tr>th, | ||
* return table, tr, and td or th node entries. | ||
*/ | ||
@@ -7,0 +7,0 @@ export declare const getTableCellEntry: (editor: SPEditor, { at }?: { |
{ | ||
"name": "@udecode/plate-table", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Table plugin for Plate", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
129773