Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alex selection fix #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "2.7.1",
"version": "0.59.0",
"version": "0.59.1-alpha.0",
"npmClient": "yarn",
"useWorkspaces": true
}
6 changes: 3 additions & 3 deletions packages/slate-history/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "slate-history",
"description": "An operation-based history implementation for Slate editors.",
"version": "0.59.0",
"version": "0.59.1-alpha.0",
"license": "MIT",
"repository": "git://github.com/ianstormtaylor/slate.git",
"main": "dist/index.js",
Expand All @@ -18,8 +18,8 @@
"is-plain-object": "^3.0.0"
},
"devDependencies": {
"slate": "^0.59.0",
"slate-hyperscript": "^0.59.0"
"slate": "^0.59.1-alpha.0",
"slate-hyperscript": "^0.59.1-alpha.0"
},
"peerDependencies": {
"slate": ">=0.55.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/slate-hyperscript/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "slate-hyperscript",
"description": "A hyperscript helper for creating Slate documents.",
"version": "0.59.0",
"version": "0.59.1-alpha.0",
"license": "MIT",
"repository": "git://github.com/ianstormtaylor/slate.git",
"main": "dist/index.js",
Expand All @@ -17,7 +17,7 @@
"is-plain-object": "^3.0.0"
},
"devDependencies": {
"slate": "^0.59.0"
"slate": "^0.59.1-alpha.0"
},
"peerDependencies": {
"slate": ">=0.55.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/slate-react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "slate-react",
"description": "Tools for building completely customizable richtext editors with React.",
"version": "0.59.0",
"version": "0.59.1-alpha.0",
"license": "MIT",
"repository": "git://github.com/ianstormtaylor/slate.git",
"main": "dist/index.js",
Expand All @@ -23,8 +23,8 @@
"scroll-into-view-if-needed": "^2.2.20"
},
"devDependencies": {
"slate": "^0.59.0",
"slate-hyperscript": "^0.59.0"
"slate": "^0.59.1-alpha.0",
"slate-hyperscript": "^0.59.1-alpha.0"
},
"peerDependencies": {
"react": ">=16.8.0",
Expand Down
8 changes: 7 additions & 1 deletion packages/slate-react/src/components/editable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,13 @@ export const Editable = (props: EditableProps) => {
const el = ReactEditor.toDOMNode(editor, editor)
state.isUpdatingSelection = true

const newDomRange = selection && ReactEditor.toDOMRange(editor, selection)
let newDomRange: DOMRange | null = null

try {
newDomRange = selection && ReactEditor.toDOMRange(editor, selection)
} catch (err) {
// Invalid selection
}

if (newDomRange) {
if (Range.isBackward(selection!)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/slate/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "slate",
"description": "A completely customizable framework for building rich text editors.",
"version": "0.59.0",
"version": "0.59.1-alpha.0",
"license": "MIT",
"repository": "git://github.com/ianstormtaylor/slate.git",
"main": "dist/index.js",
Expand Down