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

Improve introducing examples in the documentation #4334

Merged
merged 2 commits into from
Aug 18, 2023
Merged
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 docs/api/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ editor.first(({ commands }) => [
])
```

Inside of commands you can do the same thing like that:
Inside of commands you can do the same thing:

```js
export default () => ({ commands }) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/api/editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ new Editor({
})
```

You can even initiate your editor before mounting it to an element. This is useful when your DOM is not yet available. Just leave out the `element`, we’ll create one for you. Append it to your container at a later date like that:
You can even initiate your editor before mounting it to an element. This is useful when your DOM is not yet available. Just leave out the `element`, we’ll create one for you. Append it to your container at a later date:

```js
yourContainerElement.append(editor.options.element)
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/custom-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ You’ll learn how you start from scratch at the end, but you’ll need the same
## Extend existing extensions
Every extension has an `extend()` method, which takes an object with everything you want to change or add to it.

Let’s say, you’d like to change the keyboard shortcut for the bullet list. You should start with looking at the source code of the extension, in that case [the `BulletList` node](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-bullet-list/src/bullet-list.ts). For the bespoken example to overwrite the keyboard shortcut, your code could look like that:
Let’s say, you’d like to change the keyboard shortcut for the bullet list. You should start with looking at the source code of the extension, in that case [the `BulletList` node](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-bullet-list/src/bullet-list.ts). For the bespoken example to overwrite the keyboard shortcut, your code could look like this:

```js
// 1. Import the extension
Expand Down Expand Up @@ -65,7 +65,7 @@ The order in which extensions are loaded influences two things:
The [`Link`](/api/marks/link) mark for example has a higher priority, which means it will be rendered as `<a href="…"><strong>Example</strong></a>` instead of `<strong><a href="…">Example</a></strong>`.

### Settings
All settings can be configured through the extension anyway, but if you want to change the default settings, for example to provide a library on top of Tiptap for other developers, you can do it like that:
All settings can be configured through the extension anyway, but if you want to change the default settings, for example to provide a library on top of Tiptap for other developers, you can do it like this:

```js
import Heading from '@tiptap/extension-heading'
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/menus.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Which commands are available depends on what extensions you have registered with
You have already seen the `focus()` command in the above example. When you click on the button, the browser focuses that DOM element and the editor loses focus. It’s likely you want to add `focus()` to all your menu buttons, so the writing flow of your users isn’t interrupted.

### The active state
The editor provides an `isActive()` method to check if something is applied to the selected text already. In Vue.js you can toggle a CSS class with help of that function like that:
The editor provides an `isActive()` method to check if something is applied to the selected text already. In Vue.js you can toggle a CSS class with help of that function:

```html
<button :class="{ 'is-active': editor.isActive('bold') }" @click="editor.chain().focus().toggleBold().run()">
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/node-views/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export default {
</script>
```

If you just want to have all (and TypeScript support) you can import all props like that:
If you just want to have all (and TypeScript support) you can import all props:

```js
// Vue 3
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ JSON is probably easier to loop through, for example to look for a mention and i
const json = editor.getJSON()
```

You can store that in your database (or send it to an API) and restore the document initially like that:
You can store that in your database (or send it to an API) and restore the document initially:

```js
new Editor({
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/styling.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ new Editor({
})
```

The rendered HTML will look like that:
The rendered HTML will look like this:

```html
<h1 class="my-custom-heading">Example Text</h1>
Expand All @@ -62,7 +62,7 @@ The rendered HTML will look like that:
If there are already classes defined by the extensions, your classes will be added.

### Editor
You can even pass classes to the element which contains the editor like that:
You can even pass classes to the element which contains the editor:

```js
new Editor({
Expand Down