mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-30 02:19:52 +02:00
update walkthroughs, docs and changelog
This commit is contained in:
@@ -50,7 +50,7 @@ class App extends React.Component {
|
||||
}
|
||||
|
||||
// Define a new handler which prints the key that was pressed.
|
||||
onKeyDown = (event, data, change) => {
|
||||
onKeyDown = (event, change) => {
|
||||
console.log(event.key)
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ class App extends React.Component {
|
||||
this.setState({ state })
|
||||
}
|
||||
|
||||
onKeyDown = (event, data, change) => {
|
||||
onKeyDown = (event, change) => {
|
||||
// Return with no changes if it's not the "&" key.
|
||||
if (event.key != '&') return
|
||||
|
||||
|
@@ -27,7 +27,7 @@ class App extends React.Component {
|
||||
this.setState({ state })
|
||||
}
|
||||
|
||||
onKeyDown = (event, data, change) => {
|
||||
onKeyDown = (event, change) => {
|
||||
if (event.key != '`' || !event.metaKey) return
|
||||
event.preventDefault()
|
||||
const isCode = change.state.blocks.some(block => block.type == 'code')
|
||||
@@ -68,7 +68,7 @@ class App extends React.Component {
|
||||
this.setState({ state })
|
||||
}
|
||||
|
||||
onKeyDown = (event, data, change) => {
|
||||
onKeyDown = (event, change) => {
|
||||
if (!event.metaKey) return
|
||||
|
||||
// Decide what to do based on the key code...
|
||||
@@ -144,7 +144,7 @@ class App extends React.Component {
|
||||
this.setState({ state })
|
||||
}
|
||||
|
||||
onKeyDown = (event, data, change) => {
|
||||
onKeyDown = (event, change) => {
|
||||
if (!event.metaKey) return
|
||||
|
||||
switch (event.key) {
|
||||
|
@@ -22,7 +22,7 @@ class App extends React.Component {
|
||||
this.setState({ state })
|
||||
}
|
||||
|
||||
onKeyDown = (event, data, change) => {
|
||||
onKeyDown = (event, change) => {
|
||||
if (event.key != '&') return
|
||||
event.preventDefault()
|
||||
change.insertText('and');
|
||||
@@ -84,7 +84,7 @@ class App extends React.Component {
|
||||
this.setState({ state })
|
||||
}
|
||||
|
||||
onKeyDown = (event, data, change) => {
|
||||
onKeyDown = (event, change) => {
|
||||
if (event.key != '&') return
|
||||
event.preventDefault()
|
||||
change.insertText('and')
|
||||
@@ -128,7 +128,7 @@ class App extends React.Component {
|
||||
this.setState({ state })
|
||||
}
|
||||
|
||||
onKeyDown = (event, data, change) => {
|
||||
onKeyDown = (event, change) => {
|
||||
// Return with no changes if it's not the "`" key with cmd/ctrl pressed.
|
||||
if (event.key != '`' || !event.metaKey) return
|
||||
|
||||
@@ -178,7 +178,7 @@ class App extends React.Component {
|
||||
this.setState({ state })
|
||||
}
|
||||
|
||||
onKeyDown = (event, data, change) => {
|
||||
onKeyDown = (event, change) => {
|
||||
if (event.key != '`' || !event.metaKey) return
|
||||
|
||||
event.preventDefault()
|
||||
|
@@ -29,7 +29,7 @@ class App extends React.Component {
|
||||
this.setState({ state })
|
||||
}
|
||||
|
||||
onKeyDown = (event, data, change) => {
|
||||
onKeyDown = (event, change) => {
|
||||
if (event.key != 'b' || !event.metaKey) return
|
||||
event.preventDefault()
|
||||
change.toggleMark('bold')
|
||||
@@ -71,7 +71,7 @@ function MarkHotkey(options) {
|
||||
|
||||
// Return our "plugin" object, containing the `onKeyDown` handler.
|
||||
return {
|
||||
onKeyDown(event, data, change) {
|
||||
onKeyDown(event, change) {
|
||||
// Check that the key pressed matches our `key` option.
|
||||
if (!event.metaKey || event.key != key) return
|
||||
|
||||
|
Reference in New Issue
Block a user