add bold commands

This commit is contained in:
Philipp Kühn
2020-11-17 21:47:39 +01:00
parent 0354f02842
commit 3349ebf081
13 changed files with 30 additions and 18 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.bold()
editor.commands.toggleBold()
```
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.
@@ -21,7 +21,7 @@ Most commands can be combined to one call. Thats shorter than separate functi
editor
.chain()
.focus()
.bold()
.toggleBold()
.run()
```
@@ -53,7 +53,7 @@ Sometimes, you dont want to actually run the commands, but only know if it wo
```js
editor
.can()
.bold()
.toggleBold()
```
And you can use it together with `.chain()`, too. Here is an example which checks if its possible to apply all the commands:
@@ -62,7 +62,7 @@ And you can use it together with `.chain()`, too. Here is an example which check
editor
.can()
.chain()
.bold()
.toggleBold()
.italic()
.run()
```