Skip to content

Commit

Permalink
Use @udecode/plate-common as peer dependency, replace imports to use …
Browse files Browse the repository at this point in the history
…plate-common package
  • Loading branch information
kudlajz committed Nov 20, 2024
1 parent 8ea8c42 commit 8fa7b82
Show file tree
Hide file tree
Showing 23 changed files with 28 additions and 70 deletions.
47 changes: 0 additions & 47 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,53 +39,6 @@
"dependencies": {
"@types/react": "^18.3.0",
"@types/react-dom": "^18.3.0",
"@udecode/plate-ai": "40.0.0",
"@udecode/plate-alignment": "^40.0.0",
"@udecode/plate-autoformat": "^40.0.0",
"@udecode/plate-basic-elements": "^40.0.0",
"@udecode/plate-basic-marks": "^40.0.0",
"@udecode/plate-block-quote": "^40.0.0",
"@udecode/plate-break": "^40.0.0",
"@udecode/plate-callout": "^40.0.0",
"@udecode/plate-caption": "^40.0.0",
"@udecode/plate-code-block": "^40.0.0",
"@udecode/plate-combobox": "^40.0.0",
"@udecode/plate-comments": "^40.0.0",
"@udecode/plate-common": "^40.0.0",
"@udecode/plate-cursor": "^40.0.0",
"@udecode/plate-date": "^40.0.0",
"@udecode/plate-dnd": "40.0.0",
"@udecode/plate-docx": "40.0.0",
"@udecode/plate-emoji": "^40.0.0",
"@udecode/plate-excalidraw": "^40.0.0",
"@udecode/plate-floating": "^40.0.0",
"@udecode/plate-font": "^40.0.0",
"@udecode/plate-heading": "^40.0.0",
"@udecode/plate-highlight": "^40.0.0",
"@udecode/plate-horizontal-rule": "^40.0.0",
"@udecode/plate-indent": "^40.0.0",
"@udecode/plate-indent-list": "^40.0.0",
"@udecode/plate-juice": "^40.0.0",
"@udecode/plate-kbd": "^40.0.0",
"@udecode/plate-layout": "^40.0.0",
"@udecode/plate-line-height": "^40.0.0",
"@udecode/plate-link": "^40.0.0",
"@udecode/plate-markdown": "^40.0.0",
"@udecode/plate-math": "^40.0.0",
"@udecode/plate-media": "40.0.0",
"@udecode/plate-mention": "40.0.0",
"@udecode/plate-node-id": "^40.0.0",
"@udecode/plate-reset-node": "^40.0.0",
"@udecode/plate-resizable": "^40.0.0",
"@udecode/plate-select": "^40.0.0",
"@udecode/plate-selection": "^40.0.0",
"@udecode/plate-slash-command": "^40.0.0",
"@udecode/plate-tabbable": "^40.0.0",
"@udecode/plate-table": "^40.0.0",
"@udecode/plate-toggle": "^40.0.0",
"@udecode/plate-trailing-block": "^40.0.0",
"@udecode/slate": "^39.2.1",
"@udecode/slate-react": "^40.0.0",
"react": "^18.3.0",
"react-dom": "^18.3.0",
"slate": "^0.110.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-commons/src/commands/blur.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { SlateEditor } from '@udecode/plate-common';
import { deselectEditor } from '@udecode/slate-react';
import { deselectEditor } from '@udecode/plate-common/react';

export function blur(editor: SlateEditor): void {
deselectEditor(editor);
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-commons/src/commands/focus.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { SlateEditor } from '@udecode/plate-common';
import { focusEditor } from '@udecode/slate-react';
import { focusEditor } from '@udecode/plate-common/react';

import { moveCursorToEndOfDocument } from './moveCursorToEndOfDocument';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { SlateEditor } from '@udecode/plate-common';
import { toDOMRange } from '@udecode/slate-react';
import { toDOMRange } from '@udecode/plate-common/react';
import type { Range, Point } from 'slate';

export type ContainerEdge = 'top' | 'bottom';
Expand Down
3 changes: 1 addition & 2 deletions packages/slate-commons/src/commands/isVoid.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { SlateEditor } from '@udecode/plate-common';
import { isElement } from '@udecode/slate';
import { isElement, type SlateEditor } from '@udecode/plate-common';
import type { Node } from 'slate';

export function isVoid(editor: SlateEditor, node: Node): boolean {
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-commons/src/commands/toDomNode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { SlateEditor } from '@udecode/plate-common';
import { toDOMNode } from '@udecode/slate-react';
import { toDOMNode } from '@udecode/plate-common/react';
import type { Node } from 'slate';

export function toDomNode(editor: SlateEditor, node: Node): HTMLElement | null {
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-commons/src/commands/toDomRange.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { SlateEditor } from '@udecode/plate-common';
import { toDOMRange } from '@udecode/slate-react';
import { toDOMRange } from '@udecode/plate-common/react';
import type { Range } from 'slate';

export function toDomRange(editor: SlateEditor, range: Range): globalThis.Range | null {
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-commons/src/lib/useSavedSelection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { SlateEditor } from '@udecode/plate-common';
import { focusEditor } from '@udecode/slate-react';
import { focusEditor } from '@udecode/plate-common/react';
import { useState } from 'react';

import { saveSelection } from '../commands';
Expand Down
3 changes: 2 additions & 1 deletion packages/slate-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@prezly/events": "^2.0.3",
"@prezly/linear-partition": "^1.0.3",
"@prezly/progress-promise": "^2.0.1",
"@prezly/sdk": "^22.1.0",
"@prezly/sdk": "^23.0.0",
"@prezly/slate-commons": "workspace:*",
"@prezly/slate-lists": "workspace:*",
"@prezly/slate-tables": "workspace:*",
Expand Down Expand Up @@ -91,6 +91,7 @@
"validator": "^13.11.0"
},
"peerDependencies": {
"@udecode/plate-common": "^40.0.0",
"react": "^18.3.0",
"react-dom": "^18.3.0",
"slate": "^0.110.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { castArray } from '@technically/lodash';
import { removeMark, type SlateEditor } from '@udecode/plate-common';
import { getEditorString, HistoryEditor } from '@udecode/slate';
import {
getEditorString,
HistoryEditor,
removeMark,
type SlateEditor,
} from '@udecode/plate-common';
import type { Point, Range } from 'slate';

import type { AutoformatMarkRule } from '../types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { SlateEditor } from '@udecode/plate-common';
import { blurEditor } from '@udecode/slate-react';
import { blurEditor } from '@udecode/plate-common/react';
import { isHotkey } from 'is-hotkey';
import type { KeyboardEvent } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion packages/slate-editor/src/extensions/image/withImages.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EditorCommands } from '@prezly/slate-commons';
import { isImageNode } from '@prezly/slate-types';
import type { SlateEditor } from '@udecode/plate-common';
import { toDOMRange } from '@udecode/slate-react';
import { toDOMRange } from '@udecode/plate-common/react';
import { Range } from 'slate';

import { convertToHtml, encodeSlateFragment } from '#lib';
Expand Down
3 changes: 1 addition & 2 deletions packages/slate-editor/src/modules/editor/lib/createOnCut.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { EditorCommands } from '@prezly/slate-commons';
import type { SlateEditor } from '@udecode/plate-common';
import { setFragmentData } from '@udecode/slate-react';
import { Range } from 'slate';

export function createOnCut(editor: SlateEditor) {
return function (event: React.ClipboardEvent<HTMLDivElement>): void {
event.preventDefault();

setFragmentData(editor, event.clipboardData);
editor.setFragmentData(event.clipboardData);

const { selection } = editor;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { EditorCommands } from '@prezly/slate-commons';
import type { LinkNode } from '@prezly/slate-types';
import type { SlateEditor } from '@udecode/plate-common';
import { getNode } from '@udecode/slate';
import { getNode, type SlateEditor } from '@udecode/plate-common';
import { Node, Path } from 'slate';

import { createPlaceholder, PlaceholderNode, PlaceholdersManager } from '#extensions/placeholders';
Expand Down
1 change: 1 addition & 0 deletions packages/slate-lists/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"clean:build": "rimraf build/ *.tsbuildinfo"
},
"peerDependencies": {
"@udecode/plate-common": "^40.0.0",
"react": "^18.3.0",
"react-dom": "^18.3.0",
"slate": "^0.110.2",
Expand Down
1 change: 1 addition & 0 deletions packages/slate-tables/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"clean:build": "rimraf build/ *.tsbuildinfo"
},
"peerDependencies": {
"@udecode/plate-common": "^40.0.0",
"react": "^18.3.0",
"react-dom": "^18.3.0",
"slate": "^0.110.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-tables/src/commands/insertColumn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { focusEditor } from '@udecode/slate-react';
import { focusEditor } from '@udecode/plate-common/react';
import { type Location, Path } from 'slate';

import { Traverse } from '../core';
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-tables/src/commands/insertRow.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { focusEditor } from '@udecode/slate-react';
import { focusEditor } from '@udecode/plate-common/react';
import { type Location, Path, Node } from 'slate';

import { Traverse } from '../core';
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-tables/src/commands/insertTable.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { focusEditor } from '@udecode/slate-react';
import { focusEditor } from '@udecode/plate-common/react';
import { type Location } from 'slate';

import { TableNode } from '../nodes';
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-tables/src/commands/removeColumn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { focusEditor } from '@udecode/slate-react';
import { focusEditor } from '@udecode/plate-common/react';
import { type Location } from 'slate';

import { Traverse } from '../core';
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-tables/src/commands/removeRow.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { focusEditor } from '@udecode/slate-react';
import { focusEditor } from '@udecode/plate-common/react';
import { type Location } from 'slate';

import { Traverse } from '../core';
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-tables/src/commands/removeTable.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { focusEditor } from '@udecode/slate-react';
import { focusEditor } from '@udecode/plate-common/react';
import { type Location } from 'slate';

import { Traverse } from '../core';
Expand Down
1 change: 1 addition & 0 deletions packages/slate-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"clean:build": "rimraf build/ *.tsbuildinfo"
},
"peerDependencies": {
"@udecode/plate-common": "^40.0.0",
"slate": "^0.110.2"
},
"dependencies": {
Expand Down

0 comments on commit 8fa7b82

Please sign in to comment.