Skip to content

Commit

Permalink
Merge branch 'main' into refactor/plate-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
zbeyens committed Dec 27, 2023
2 parents adc0d6d + a0d5765 commit c1d8ce5
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 45 deletions.
6 changes: 0 additions & 6 deletions .changeset/mean-taxis-tie.md

This file was deleted.

24 changes: 12 additions & 12 deletions apps/www/public/registry/themes.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
--accent: 240 4.8% 95.9%;
--accent-foreground: 240 5.9% 10%;

--destructive: 0 84.2% 60.2%;
--destructive: 0 72.22% 50.59%;
--destructive-foreground: 0 0% 98%;

--ring: 240 5.9% 10%;
Expand Down Expand Up @@ -88,7 +88,7 @@
--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;

--destructive: 0 84.2% 60.2%;
--destructive: 0 72.22% 50.59%;
--destructive-foreground: 210 40% 98%;

--ring: 215 20.2% 65.1%;
Expand Down Expand Up @@ -152,7 +152,7 @@
--accent: 60 4.8% 95.9%;
--accent-foreground: 24 9.8% 10%;

--destructive: 0 84.2% 60.2%;
--destructive: 0 72.22% 50.59%;
--destructive-foreground: 60 9.1% 97.8%;

--ring: 20 14.3% 4.1%;
Expand Down Expand Up @@ -216,7 +216,7 @@
--accent: 220 14.3% 95.9%;
--accent-foreground: 220.9 39.3% 11%;

--destructive: 0 84.2% 60.2%;
--destructive: 0 72.22% 50.59%;
--destructive-foreground: 210 20% 98%;

--ring: 224 71.4% 4.1%;
Expand Down Expand Up @@ -280,7 +280,7 @@
--accent: 0 0% 96.1%;
--accent-foreground: 0 0% 9%;

--destructive: 0 84.2% 60.2%;
--destructive: 0 72.22% 50.59%;
--destructive-foreground: 0 0% 98%;

--ring: 0 0% 3.9%;
Expand Down Expand Up @@ -344,7 +344,7 @@
--accent: 0 0% 96.1%;
--accent-foreground: 0 0% 9%;

--destructive: 0 84.2% 60.2%;
--destructive: 0 72.22% 50.59%;
--destructive-foreground: 0 0% 98%;

--ring: 0 72.2% 50.6%;
Expand Down Expand Up @@ -408,7 +408,7 @@
--accent: 240 4.8% 95.9%;
--accent-foreground: 240 5.9% 10%;

--destructive: 0 84.2% 60.2%;
--destructive: 0 72.22% 50.59%;
--destructive-foreground: 0 0% 98%;

--ring: 346.8 77.2% 49.8%;
Expand Down Expand Up @@ -472,7 +472,7 @@
--accent: 60 4.8% 95.9%;
--accent-foreground: 24 9.8% 10%;

--destructive: 0 84.2% 60.2%;
--destructive: 0 72.22% 50.59%;
--destructive-foreground: 60 9.1% 97.8%;

--ring: 24.6 95% 53.1%;
Expand Down Expand Up @@ -536,7 +536,7 @@
--accent: 240 4.8% 95.9%;
--accent-foreground: 240 5.9% 10%;

--destructive: 0 84.2% 60.2%;
--destructive: 0 72.22% 50.59%;
--destructive-foreground: 0 0% 98%;

--ring: 142.1 76.2% 36.3%;
Expand Down Expand Up @@ -600,7 +600,7 @@
--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;

--destructive: 0 84.2% 60.2%;
--destructive: 0 72.22% 50.59%;
--destructive-foreground: 210 40% 98%;

--ring: 221.2 83.2% 53.3%;
Expand Down Expand Up @@ -664,7 +664,7 @@
--accent: 60 4.8% 95.9%;
--accent-foreground: 24 9.8% 10%;

--destructive: 0 84.2% 60.2%;
--destructive: 0 72.22% 50.59%;
--destructive-foreground: 60 9.1% 97.8%;

--ring: 20 14.3% 4.1%;
Expand Down Expand Up @@ -728,7 +728,7 @@
--accent: 220 14.3% 95.9%;
--accent-foreground: 220.9 39.3% 11%;

--destructive: 0 84.2% 60.2%;
--destructive: 0 72.22% 50.59%;
--destructive-foreground: 210 20% 98%;

--ring: 262.1 83.3% 57.8%;
Expand Down
8 changes: 8 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @udecode/plate-ui

## 28.1.0

### Minor Changes

- [#2824](https://github.com/udecode/plate/pull/2824) by [@zbeyens](https://github.com/zbeyens)
- add support for custom tailwind prefix
- minify build

## 24.1.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@udecode/plate-ui",
"version": "24.1.1",
"version": "28.1.0",
"description": "Add Plate components to your apps.",
"license": "MIT",
"homepage": "https://platejs.org",
Expand Down
6 changes: 4 additions & 2 deletions packages/plate/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @udecode/plate

## 28.1.1

## 28.0.0

## 27.0.4
Expand Down Expand Up @@ -276,9 +278,9 @@
- due to esm issues, dnd plugin is not part of plate package anymore. To use it, install `@udecode/plate-ui-dnd`
```ts
// before
import { createDndPlugin } from '@udecode/plate';
import { createDndPlugin } from "@udecode/plate";
// after
import { createDndPlugin } from '@udecode/plate-ui-dnd';
import { createDndPlugin } from "@udecode/plate-ui-dnd";
```
- upgrade peerDeps:
```json
Expand Down
8 changes: 4 additions & 4 deletions packages/plate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@udecode/plate",
"version": "28.0.0",
"version": "28.1.1",
"description": "Plate – a plugin system for slate",
"license": "MIT",
"homepage": "https://platejs.org",
Expand Down Expand Up @@ -72,13 +72,13 @@
"@udecode/plate-reset-node": "28.0.0",
"@udecode/plate-resizable": "28.0.0",
"@udecode/plate-select": "28.0.0",
"@udecode/plate-serializer-csv": "28.0.0",
"@udecode/plate-serializer-docx": "28.0.0",
"@udecode/plate-serializer-csv": "28.1.1",
"@udecode/plate-serializer-docx": "28.1.1",
"@udecode/plate-serializer-html": "28.0.0",
"@udecode/plate-serializer-md": "28.0.0",
"@udecode/plate-suggestion": "28.0.0",
"@udecode/plate-tabbable": "28.0.0",
"@udecode/plate-table": "28.0.0",
"@udecode/plate-table": "28.1.1",
"@udecode/plate-trailing-block": "28.0.0"
},
"peerDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions packages/serializer-csv/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @udecode/plate-serializer-csv

## 28.1.1

## 28.0.0

## 27.0.3
Expand Down
4 changes: 2 additions & 2 deletions packages/serializer-csv/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@udecode/plate-serializer-csv",
"version": "28.0.0",
"version": "28.1.1",
"description": "CSV serializer plugin for Plate",
"license": "MIT",
"homepage": "https://platejs.org",
Expand Down Expand Up @@ -40,7 +40,7 @@
},
"dependencies": {
"@udecode/plate-common": "28.0.0",
"@udecode/plate-table": "28.0.0",
"@udecode/plate-table": "28.1.1",
"papaparse": "^5.4.1"
},
"peerDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions packages/serializer-docx/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @udecode/plate-docx-serializer

## 28.1.1

## 28.0.0

## 27.0.3
Expand Down
4 changes: 2 additions & 2 deletions packages/serializer-docx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@udecode/plate-serializer-docx",
"version": "28.0.0",
"version": "28.1.1",
"description": "Docx serializer plugin for Plate",
"license": "MIT",
"homepage": "https://platejs.org",
Expand Down Expand Up @@ -45,7 +45,7 @@
"@udecode/plate-indent-list": "28.0.0",
"@udecode/plate-media": "28.0.0",
"@udecode/plate-paragraph": "28.0.0",
"@udecode/plate-table": "28.0.0",
"@udecode/plate-table": "28.1.1",
"validator": "^13.9.0"
},
"peerDependencies": {
Expand Down
8 changes: 8 additions & 0 deletions packages/table/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @udecode/plate-table

## 28.1.1

### Patch Changes

- [#2832](https://github.com/udecode/plate/pull/2832) by [@dimaanj](https://github.com/dimaanj)
- Fix: merge of header cells in table
- Fix: #2831

## 28.0.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/table/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@udecode/plate-table",
"version": "28.0.0",
"version": "28.1.1",
"description": "Table plugin for Plate",
"license": "MIT",
"homepage": "https://platejs.org",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const useTableCellElementState = ({
const rowIndex = getTableRowIndex(editor, cellElement);

const rowSize =
rowSizeOverrides.get(rowIndex) ?? rowElement?.size ?? undefined;
rowSizeOverrides.get?.(rowIndex) ?? rowElement?.size ?? undefined;

const isFirstCell = colIndex === 0;
const isFirstRow = tableElement.children?.[0] === rowElement;
Expand Down Expand Up @@ -115,7 +115,7 @@ export const useTableCellElementState = ({
const endingColIndex = colIndex + colSpan - 1;

const rowSize =
rowSizeOverrides.get(endingRowIndex) ?? rowElement?.size ?? undefined;
rowSizeOverrides.get?.(endingRowIndex) ?? rowElement?.size ?? undefined;

const isFirstCell = colIndex === 0;
const isFirstRow = tableElement.children?.[0] === rowElement;
Expand Down
13 changes: 4 additions & 9 deletions packages/table/src/merge/mergeTableCells.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
collapseSelection,
getBlockAbove,
getPluginOptions,
getPluginType,
Expand All @@ -10,7 +11,7 @@ import {
} from '@udecode/plate-common';
import { cloneDeep } from 'lodash';

import { ELEMENT_TABLE } from '../createTablePlugin';
import { ELEMENT_TABLE, ELEMENT_TH } from '../createTablePlugin';
import { getTableGridAbove } from '../queries';
import { getColSpan } from '../queries/getColSpan';
import { getRowSpan } from '../queries/getRowSpan';
Expand Down Expand Up @@ -78,14 +79,7 @@ export const mergeTableCells = <V extends Value = Value>(
// and values are an array of all paths with that column
const cols: { [key: string]: number[][] } = {};

// A boolean to keep track if we have a header cell among the cells we are merging
let hasHeaderCell = false;

cellEntries.forEach(([entry, path]) => {
if (!hasHeaderCell && entry.type === 'table_header_cell') {
hasHeaderCell = true;
}

const rowIndex = path.at(-2)!;

if (cols[rowIndex]) {
Expand All @@ -107,7 +101,7 @@ export const mergeTableCells = <V extends Value = Value>(
// calculated colSpan and rowSpan attributes and combined content
const mergedCell = {
...getEmptyCellNode(editor, {
header: cellEntries[0][0].type === 'th',
header: cellEntries[0][0].type === getPluginType(editor, ELEMENT_TH),
newCellChildren: contents,
}),
colSpan,
Expand All @@ -116,5 +110,6 @@ export const mergeTableCells = <V extends Value = Value>(

// insert the new merged cell in place of the first cell in the selection
insertElements(editor, mergedCell, { at: cellEntries[0][1] });
collapseSelection(editor);
});
};
4 changes: 2 additions & 2 deletions packages/table/src/merge/unmergeTableCells.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
withoutNormalizing,
} from '@udecode/plate-common';

import { ELEMENT_TABLE, ELEMENT_TR } from '../createTablePlugin';
import { ELEMENT_TABLE, ELEMENT_TH, ELEMENT_TR } from '../createTablePlugin';
import { getTableGridAbove } from '../queries';
import { getColSpan } from '../queries/getColSpan';
import { getRowSpan } from '../queries/getRowSpan';
Expand All @@ -34,7 +34,7 @@ export const unmergeTableCells = <V extends Value = Value>(
const createEmptyCell = (children?: TDescendant[]) => {
return {
...getEmptyCellNode(editor, {
header: cellElem.type === 'th',
header: cellElem.type === getPluginType(editor, ELEMENT_TH),
newCellChildren: children,
}),
colSpan: 1,
Expand Down
2 changes: 1 addition & 1 deletion packages/table/src/queries/getTableOverriddenColSizes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const getTableOverriddenColSizes = (
tableNode.colSizes
? [...tableNode.colSizes]
: (Array.from({ length: colCount }).fill(0) as number[])
).map((size, index) => colSizeOverrides?.get(index) ?? size);
).map((size, index) => colSizeOverrides?.get?.(index) ?? size);

return colSizes;
};
2 changes: 1 addition & 1 deletion packages/table/src/transforms/insertTableRow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const insertTableRow = <V extends Value>(
const isHeaderColumn =
!hasSingleRow &&
(tableEntry[0].children as TElement[]).every(
(n) => n.children[i].type === ELEMENT_TH
(n) => n.children[i].type === getPluginType(editor, ELEMENT_TH)
);
return getEmptyCellNode(editor, {
header: header ?? isHeaderColumn,
Expand Down

0 comments on commit c1d8ce5

Please sign in to comment.