docs: update content, add og image
This commit is contained in:
@@ -9,7 +9,7 @@ The editor provides a ton of commands to programmtically add or change content o
|
||||
All available commands are accessible through an editor instance. Let’s say you want to make text bold when a user clicks on a button. That’s how that would look like:
|
||||
|
||||
```js
|
||||
editor.commands.toggleBold()
|
||||
editor.commands.addBold()
|
||||
```
|
||||
|
||||
While that’s perfectly fine and does make the selected bold, you’d likely want to change multiple commands in one run. Let’s have a look at how that works.
|
||||
@@ -70,12 +70,12 @@ editor
|
||||
Both calls would return `true` if it’s possible to apply the commands, and `false` in case it’s not.
|
||||
|
||||
### Try commands
|
||||
If you want to run a list of commands, but want only the first successful command to be applied, you can do this with the `.try()` method. This method runs one command after the other and stops at the first which returns `true`.
|
||||
If you want to run a list of commands, but want only the first successful command to be applied, you can do this with the `.first()` method. This method runs one command after the other and stops at the first which returns `true`.
|
||||
|
||||
For example, the backspace key tries to undo an input rule first. If that was successful, it stops there. If no input rule has been applied and thus can’t be reverted, it runs the next command and deletes the selection, if there is one. Here is the simplified example:
|
||||
|
||||
```js
|
||||
editor.try(({ commands }) => [
|
||||
editor.first(({ commands }) => [
|
||||
() => commands.undoInputRule(),
|
||||
() => commands.deleteSelection(),
|
||||
// …
|
||||
@@ -85,7 +85,7 @@ editor.try(({ commands }) => [
|
||||
Inside of commands you can do the same thing like that:
|
||||
|
||||
```js
|
||||
commands.try([
|
||||
commands.first([
|
||||
() => commands.undoInputRule(),
|
||||
() => commands.deleteSelection(),
|
||||
// …
|
||||
|
||||
@@ -29,11 +29,23 @@ export default {
|
||||
property: 'og:title',
|
||||
content: this.$page?.docPage?.title,
|
||||
},
|
||||
{
|
||||
property: 'og:image',
|
||||
content: 'https://next.tiptap.dev/og-image.png',
|
||||
},
|
||||
/* Twitter */
|
||||
{
|
||||
name: 'twitter:title',
|
||||
content: this.$page?.docPage?.title,
|
||||
},
|
||||
{
|
||||
name: 'twitter:card',
|
||||
content: 'summary_large_image',
|
||||
},
|
||||
{
|
||||
name: 'twitter:image',
|
||||
content: 'https://next.tiptap.dev/og-image.png',
|
||||
},
|
||||
{
|
||||
name: 'twitter:site',
|
||||
content: '@_ueberdosis',
|
||||
|
||||
BIN
docs/static/og-image.png
vendored
Normal file
BIN
docs/static/og-image.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
Reference in New Issue
Block a user