docs: update content, add og image

This commit is contained in:
Hans Pagel
2020-11-18 16:28:45 +01:00
parent 4f753bc596
commit ef52156dbb
4 changed files with 16 additions and 4 deletions

View File

@@ -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. Lets say you want to make text bold when a user clicks on a button. Thats how that would look like:
```js
editor.commands.toggleBold()
editor.commands.addBold()
```
While thats perfectly fine and does make the selected bold, youd likely want to change multiple commands in one run. Lets have a look at how that works.
@@ -70,12 +70,12 @@ editor
Both calls would return `true` if its possible to apply the commands, and `false` in case its 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 cant 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(),
// …

View File

@@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB