Skip to content

Commit

Permalink
Merge branch 'main' into improve-ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldziher authored Dec 25, 2024
2 parents 6fd4e93 + 5081e88 commit 0d99c7a
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 20 deletions.
5 changes: 1 addition & 4 deletions apps/www/src/registry/default/plate-ui/draggable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,7 @@ export const Draggable = withRef<'div', PlateRenderElementProps>(
className={cn(
'relative',
isDragging && 'opacity-50',
STRUCTURAL_TYPES.includes(element.type)
? 'group/structural'
: 'group',
className
STRUCTURAL_TYPES.includes(element.type) ? 'group/structural' : 'group'
)}
>
<Gutter>
Expand Down
2 changes: 2 additions & 0 deletions packages/ai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @udecode/plate-ai

## 41.0.8

## 41.0.6

## 41.0.1
Expand Down
4 changes: 2 additions & 2 deletions packages/ai/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@udecode/plate-ai",
"version": "41.0.6",
"version": "41.0.8",
"description": "Text AI plugin for Plate",
"keywords": [
"plate",
Expand Down Expand Up @@ -51,7 +51,7 @@
},
"dependencies": {
"@udecode/plate-markdown": "41.0.0",
"@udecode/plate-selection": "41.0.6",
"@udecode/plate-selection": "41.0.8",
"lodash": "^4.17.21"
},
"devDependencies": {
Expand Down
4 changes: 4 additions & 0 deletions packages/csv/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @udecode/plate-serializer-csv

## 41.0.9

## 41.0.7

## 41.0.0

## 40.0.0
Expand Down
4 changes: 2 additions & 2 deletions packages/csv/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@udecode/plate-csv",
"version": "41.0.0",
"version": "41.0.9",
"description": "CSV serializer plugin for Plate",
"keywords": [
"csv",
Expand Down Expand Up @@ -46,7 +46,7 @@
"typecheck": "yarn p:typecheck"
},
"dependencies": {
"@udecode/plate-table": "41.0.0",
"@udecode/plate-table": "41.0.9",
"papaparse": "^5.4.1"
},
"devDependencies": {
Expand Down
4 changes: 4 additions & 0 deletions packages/docx/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @udecode/plate-docx-serializer

## 41.0.9

## 41.0.7

## 41.0.0

## 40.2.7
Expand Down
4 changes: 2 additions & 2 deletions packages/docx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@udecode/plate-docx",
"version": "41.0.0",
"version": "41.0.9",
"description": "Docx serializer plugin for Plate",
"keywords": [
"docx",
Expand Down Expand Up @@ -50,7 +50,7 @@
"@udecode/plate-indent": "41.0.0",
"@udecode/plate-indent-list": "41.0.0",
"@udecode/plate-media": "41.0.0",
"@udecode/plate-table": "41.0.0",
"@udecode/plate-table": "41.0.9",
"validator": "^13.12.0"
},
"devDependencies": {
Expand Down
6 changes: 6 additions & 0 deletions packages/plate/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @udecode/plate

## 41.0.9

## 41.0.8

## 41.0.7

## 41.0.6

## 41.0.5
Expand Down
10 changes: 5 additions & 5 deletions packages/plate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@udecode/plate",
"version": "41.0.6",
"version": "41.0.9",
"description": "Plate – a plugin system for slate",
"keywords": [
"contentEditable",
Expand Down Expand Up @@ -66,9 +66,9 @@
"@udecode/plate-combobox": "41.0.0",
"@udecode/plate-comments": "41.0.0",
"@udecode/plate-common": "41.0.5",
"@udecode/plate-csv": "41.0.0",
"@udecode/plate-csv": "41.0.9",
"@udecode/plate-diff": "41.0.0",
"@udecode/plate-docx": "41.0.0",
"@udecode/plate-docx": "41.0.9",
"@udecode/plate-find-replace": "41.0.0",
"@udecode/plate-floating": "41.0.0",
"@udecode/plate-font": "41.0.0",
Expand All @@ -90,11 +90,11 @@
"@udecode/plate-reset-node": "41.0.0",
"@udecode/plate-resizable": "41.0.0",
"@udecode/plate-select": "41.0.0",
"@udecode/plate-selection": "41.0.6",
"@udecode/plate-selection": "41.0.8",
"@udecode/plate-slash-command": "41.0.0",
"@udecode/plate-suggestion": "41.0.0",
"@udecode/plate-tabbable": "41.0.0",
"@udecode/plate-table": "41.0.0",
"@udecode/plate-table": "41.0.9",
"@udecode/plate-toggle": "41.0.0",
"@udecode/plate-trailing-block": "41.0.0"
},
Expand Down
6 changes: 6 additions & 0 deletions packages/selection/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @udecode/plate-selection

## 41.0.8

### Patch Changes

- [#3912](https://github.com/udecode/plate/pull/3912) by [@felixfeng33](https://github.com/felixfeng33) – Fix `selectedIds` has `undifinded`

## 41.0.6

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/selection/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@udecode/plate-selection",
"version": "41.0.6",
"version": "41.0.8",
"description": "Plate selection plugins",
"keywords": [
"plate",
Expand Down
6 changes: 4 additions & 2 deletions packages/selection/src/react/BlockSelectionPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,12 @@ export const BlockSelectionPlugin = createTPlatePlugin<BlockSelectionConfig>({
const next = new Set(prev);

if (added) {
extractSelectableIds(added).forEach((id) => next.add(id));
extractSelectableIds(added).forEach((id) => id && next.add(id));
}
if (removed) {
extractSelectableIds(removed).forEach((id) => next.delete(id));
extractSelectableIds(removed).forEach(
(id) => id && next.delete(id)
);
}

setOption('selectedIds', next);
Expand Down
12 changes: 12 additions & 0 deletions packages/table/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @udecode/plate-table

## 41.0.9

### Patch Changes

- [#3909](https://github.com/udecode/plate/pull/3909) by [@Croc-ye](https://github.com/Croc-ye) – fix: copying form mulitple cells does not retain font attributes

## 41.0.7

### Patch Changes

- [#3908](https://github.com/udecode/plate/pull/3908) by [@Croc-ye](https://github.com/Croc-ye) – fix: exception of inputting Chinese when selecting multiple cells

## 41.0.0

### Major 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": "41.0.0",
"version": "41.0.9",
"description": "Table plugin for Plate",
"keywords": [
"plate",
Expand Down
2 changes: 1 addition & 1 deletion packages/table/src/lib/withSetFragmentDataTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export const withSetFragmentDataTable: ExtendEditor<TableConfig> = ({
data.setData('text/html', divElement.innerHTML);

// set slate fragment
const selectedFragmentStr = JSON.stringify(tableNode);
const selectedFragmentStr = JSON.stringify([tableNode]);
const encodedFragment = window.btoa(
encodeURIComponent(selectedFragmentStr)
);
Expand Down
29 changes: 29 additions & 0 deletions packages/table/src/react/onKeyDownTable.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import {
type TElement,
collapseSelection,
getAboveNode,
getNodeEntries,
isExpanded,
isHotkey,
select,
} from '@udecode/plate-common';
Expand All @@ -9,6 +12,7 @@ import { type KeyboardHandler, Hotkeys } from '@udecode/plate-common/react';
import {
type TableConfig,
KEY_SHIFT_EDGES,
getCellTypes,
getNextTableCell,
getPreviousTableCell,
getTableEntries,
Expand All @@ -22,6 +26,31 @@ export const onKeyDownTable: KeyboardHandler<TableConfig> = ({
}) => {
if (event.defaultPrevented) return;

const compositeKeyCode = 229;

if (
// This exception only occurs when IME composition is triggered, and can be identified by this keycode
event.which === compositeKeyCode &&
editor.selection &&
isExpanded(editor.selection)
) {
// fix the exception of inputting Chinese when selecting multiple cells
const tdEntries = Array.from(
getNodeEntries(editor, {
at: editor.selection,
match: { type: getCellTypes(editor) },
})
);

if (tdEntries.length > 1) {
collapseSelection(editor, {
edge: 'end',
});

return;
}
}

const isKeyDown: any = {
'shift+down': isHotkey('shift+down', event),
'shift+left': isHotkey('shift+left', event),
Expand Down

0 comments on commit 0d99c7a

Please sign in to comment.