1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-31 19:01:54 +02:00

Upgrade next.js to 12 and related packages (#5042)

* Upgrade next.js and source-map-loader

* Add changeset

* Upgrade eslint and typescript

* improve reliability of iframe test

* fix lint
This commit is contained in:
Bryan Haakman
2022-07-15 15:14:18 +02:00
committed by GitHub
parent f96b659755
commit 11a93e65de
31 changed files with 817 additions and 1396 deletions

View File

@@ -21,7 +21,7 @@
"lodash": "^4.17.21",
"slate": "^0.81.0",
"slate-hyperscript": "^0.77.0",
"source-map-loader": "^0.2.4"
"source-map-loader": "^4.0.0"
},
"peerDependencies": {
"slate": ">=0.65.3"

View File

@@ -19,6 +19,7 @@ export interface HistoryEditor extends BaseEditor {
redo: () => void
}
// eslint-disable-next-line no-redeclare
export const HistoryEditor = {
/**
* Check if a value is a `HistoryEditor` object.

View File

@@ -11,6 +11,7 @@ export interface History {
undos: Operation[][]
}
// eslint-disable-next-line no-redeclare
export const History = {
/**
* Check if a value is a `History` object.

View File

@@ -19,7 +19,7 @@
"devDependencies": {
"@babel/runtime": "^7.7.4",
"slate": "^0.81.0",
"source-map-loader": "^0.2.4"
"source-map-loader": "^4.0.0"
},
"peerDependencies": {
"slate": ">=0.65.3"

View File

@@ -35,7 +35,7 @@
"react-test-renderer": ">=16.8.0",
"slate": "^0.81.0",
"slate-hyperscript": "^0.77.0",
"source-map-loader": "^0.2.4"
"source-map-loader": "^4.0.0"
},
"peerDependencies": {
"react": ">=16.8.0",

View File

@@ -1479,6 +1479,7 @@ const defaultScrollSelectionIntoView = (
scrollIntoView(leafEl, {
scrollMode: 'if-needed',
})
// @ts-expect-error an unorthodox delete D:
delete leafEl.getBoundingClientRect
}
}

View File

@@ -51,6 +51,7 @@ export interface ReactEditor extends BaseEditor {
hasRange: (editor: ReactEditor, range: Range) => boolean
}
// eslint-disable-next-line no-redeclare
export const ReactEditor = {
/**
* Check if the user is currently composing inside the editor.

View File

@@ -22,7 +22,7 @@
"@babel/runtime": "^7.7.4",
"lodash": "^4.17.21",
"slate-hyperscript": "^0.77.0",
"source-map-loader": "^0.2.4"
"source-map-loader": "^4.0.0"
},
"keywords": [
"canvas",

View File

@@ -326,6 +326,7 @@ export interface EditorInterface {
const IS_EDITOR_CACHE = new WeakMap<object, boolean>()
// eslint-disable-next-line no-redeclare
export const Editor: EditorInterface = {
/**
* Get the ancestor above a location in the document.

View File

@@ -37,6 +37,7 @@ const isElement = (value: any): value is Element => {
)
}
// eslint-disable-next-line no-redeclare
export const Element: ElementInterface = {
/**
* Check if a value implements the 'Ancestor' interface.

View File

@@ -15,6 +15,7 @@ export interface LocationInterface {
isLocation: (value: any) => value is Location
}
// eslint-disable-next-line no-redeclare
export const Location: LocationInterface = {
/**
* Check if a value implements the `Location` interface.
@@ -36,6 +37,7 @@ export interface SpanInterface {
isSpan: (value: any) => value is Span
}
// eslint-disable-next-line no-redeclare
export const Span: SpanInterface = {
/**
* Check if a value implements the `Span` interface.

View File

@@ -102,6 +102,7 @@ export interface NodeInterface {
const IS_NODE_LIST_CACHE = new WeakMap<any[], boolean>()
// eslint-disable-next-line no-redeclare
export const Node: NodeInterface = {
/**
* Get the node at a specific path, asserting that it's an ancestor node.

View File

@@ -147,6 +147,7 @@ export interface OperationInterface {
inverse: (op: Operation) => Operation
}
// eslint-disable-next-line no-redeclare
export const Operation: OperationInterface = {
/**
* Check of a value is a `NodeOperation` object.

View File

@@ -16,6 +16,7 @@ export interface PathRefInterface {
transform: (ref: PathRef, op: Operation) => void
}
// eslint-disable-next-line no-redeclare
export const PathRef: PathRefInterface = {
/**
* Transform the path ref's current value by an operation.

View File

@@ -53,6 +53,7 @@ export interface PathInterface {
) => Path | null
}
// eslint-disable-next-line no-redeclare
export const Path: PathInterface = {
/**
* Get a list of ancestor paths for a given path.

View File

@@ -17,6 +17,7 @@ export interface PointRefInterface {
transform: (ref: PointRef, op: Operation) => void
}
// eslint-disable-next-line no-redeclare
export const PointRef: PointRefInterface = {
/**
* Transform the point ref's current value by an operation.

View File

@@ -34,6 +34,7 @@ export interface PointInterface {
) => Point | null
}
// eslint-disable-next-line no-redeclare
export const Point: PointInterface = {
/**
* Compare a point to another, returning an integer indicating whether the

View File

@@ -16,6 +16,7 @@ export interface RangeRefInterface {
transform: (ref: RangeRef, op: Operation) => void
}
// eslint-disable-next-line no-redeclare
export const RangeRef: RangeRefInterface = {
/**
* Transform the range ref's current value by an operation.

View File

@@ -44,6 +44,7 @@ export interface RangeInterface {
) => Range | null
}
// eslint-disable-next-line no-redeclare
export const Range: RangeInterface = {
/**
* Get the start and end points of a range, in the order in which they appear

View File

@@ -22,6 +22,7 @@ let _scrubber: Scrubber | undefined = undefined
* });
*
*/
// eslint-disable-next-line no-redeclare
export const Scrubber: ScrubberInterface = {
setScrubber(scrubber: Scrubber | undefined): void {
_scrubber = scrubber

View File

@@ -28,6 +28,7 @@ export interface TextInterface {
decorations: (node: Text, decorations: Range[]) => Text[]
}
// eslint-disable-next-line no-redeclare
export const Text: TextInterface = {
/**
* Check if two text nodes are equal.

View File

@@ -313,6 +313,7 @@ const applyToDraft = (editor: Editor, selection: Selection, op: Operation) => {
return selection
}
// eslint-disable-next-line no-redeclare
export const GeneralTransforms: GeneralTransforms = {
/**
* Transform the editor by an operation.

View File

@@ -127,6 +127,7 @@ export interface NodeTransforms {
) => void
}
// eslint-disable-next-line no-redeclare
export const NodeTransforms: NodeTransforms = {
/**
* Insert nodes at a specific location in the Editor.

View File

@@ -29,6 +29,7 @@ export interface SelectionTransforms {
setSelection: (editor: Editor, props: Partial<Range>) => void
}
// eslint-disable-next-line no-redeclare
export const SelectionTransforms: SelectionTransforms = {
/**
* Collapse the selection.

View File

@@ -46,6 +46,7 @@ export interface TextTransforms {
) => void
}
// eslint-disable-next-line no-redeclare
export const TextTransforms: TextTransforms = {
/**
* Delete content in the editor.