1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-11 17:53:59 +02:00

Enable Extending Editor types in TypeScript (#4133)

* Change HistoryEditor from type to interface

* v0.60.8

* v0.60.9

* Have ReactEditor and HistoryEditor extend BaseEditor instead of Editor

* v0.60.10
This commit is contained in:
Sunny Hirai
2021-03-20 13:47:33 -07:00
committed by GitHub
parent 1940317d6a
commit 5be428a0b3
7 changed files with 15 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
{ {
"lerna": "2.7.1", "lerna": "2.7.1",
"version": "0.60.7", "version": "0.60.10",
"npmClient": "yarn", "npmClient": "yarn",
"useWorkspaces": true "useWorkspaces": true
} }

View File

@@ -1,7 +1,7 @@
{ {
"name": "slate-history", "name": "slate-history",
"description": "An operation-based history implementation for Slate editors.", "description": "An operation-based history implementation for Slate editors.",
"version": "0.60.7", "version": "0.60.10",
"license": "MIT", "license": "MIT",
"repository": "git://github.com/ianstormtaylor/slate.git", "repository": "git://github.com/ianstormtaylor/slate.git",
"main": "dist/index.js", "main": "dist/index.js",
@@ -18,8 +18,8 @@
"is-plain-object": "^3.0.0" "is-plain-object": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"slate": "^0.60.7", "slate": "^0.60.9",
"slate-hyperscript": "^0.60.7" "slate-hyperscript": "^0.60.9"
}, },
"peerDependencies": { "peerDependencies": {
"slate": ">=0.55.0" "slate": ">=0.55.0"

View File

@@ -1,4 +1,4 @@
import { Editor } from 'slate' import { BaseEditor, Editor } from 'slate'
import { History } from './history' import { History } from './history'
/** /**
@@ -13,7 +13,7 @@ export const MERGING = new WeakMap<Editor, boolean | undefined>()
* `HistoryEditor` contains helpers for history-enabled editors. * `HistoryEditor` contains helpers for history-enabled editors.
*/ */
export type HistoryEditor = Editor & { export interface HistoryEditor extends BaseEditor {
history: History history: History
undo: () => void undo: () => void
redo: () => void redo: () => void

View File

@@ -1,7 +1,7 @@
{ {
"name": "slate-hyperscript", "name": "slate-hyperscript",
"description": "A hyperscript helper for creating Slate documents.", "description": "A hyperscript helper for creating Slate documents.",
"version": "0.60.7", "version": "0.60.9",
"license": "MIT", "license": "MIT",
"repository": "git://github.com/ianstormtaylor/slate.git", "repository": "git://github.com/ianstormtaylor/slate.git",
"main": "dist/index.js", "main": "dist/index.js",
@@ -17,7 +17,7 @@
"is-plain-object": "^3.0.0" "is-plain-object": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"slate": "^0.60.7" "slate": "^0.60.9"
}, },
"peerDependencies": { "peerDependencies": {
"slate": ">=0.55.0" "slate": ">=0.55.0"

View File

@@ -1,7 +1,7 @@
{ {
"name": "slate-react", "name": "slate-react",
"description": "Tools for building completely customizable richtext editors with React.", "description": "Tools for building completely customizable richtext editors with React.",
"version": "0.60.7", "version": "0.60.10",
"license": "MIT", "license": "MIT",
"repository": "git://github.com/ianstormtaylor/slate.git", "repository": "git://github.com/ianstormtaylor/slate.git",
"main": "dist/index.js", "main": "dist/index.js",
@@ -23,9 +23,9 @@
"scroll-into-view-if-needed": "^2.2.20" "scroll-into-view-if-needed": "^2.2.20"
}, },
"devDependencies": { "devDependencies": {
"slate": "^0.60.7", "slate": "^0.60.9",
"slate-history": "^0.60.7", "slate-history": "^0.60.10",
"slate-hyperscript": "^0.60.7" "slate-hyperscript": "^0.60.9"
}, },
"peerDependencies": { "peerDependencies": {
"react": ">=16.8.0", "react": ">=16.8.0",

View File

@@ -1,4 +1,4 @@
import { Editor, Node, Path, Point, Range, Transforms, Descendant } from 'slate' import { Editor, Node, Path, Point, Range, Transforms, BaseEditor } from 'slate'
import { Key } from '../utils/key' import { Key } from '../utils/key'
import { import {
@@ -28,7 +28,7 @@ import {
* A React and DOM-specific version of the `Editor` interface. * A React and DOM-specific version of the `Editor` interface.
*/ */
export interface ReactEditor extends Editor { export interface ReactEditor extends BaseEditor {
insertData: (data: DataTransfer) => void insertData: (data: DataTransfer) => void
setFragmentData: (data: DataTransfer) => void setFragmentData: (data: DataTransfer) => void
} }

View File

@@ -1,7 +1,7 @@
{ {
"name": "slate", "name": "slate",
"description": "A completely customizable framework for building rich text editors.", "description": "A completely customizable framework for building rich text editors.",
"version": "0.60.7", "version": "0.60.9",
"license": "MIT", "license": "MIT",
"repository": "git://github.com/ianstormtaylor/slate.git", "repository": "git://github.com/ianstormtaylor/slate.git",
"main": "dist/index.js", "main": "dist/index.js",