docs: improve getting started guides, add v-model demo
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
# Use v-model
|
||||
|
||||
<demo name="Examples/VModel" />
|
||||
@@ -22,7 +22,7 @@ npm init nuxt-app tiptap-example
|
||||
cd tiptap-example
|
||||
```
|
||||
|
||||
## 3. Install the dependencies
|
||||
## 2. Install the dependencies
|
||||
Okay, enough of the boring boilerplate work. Let’s finally install tiptap! For the following example you’ll need `@tiptap/core` (the actual editor) and the `@tiptap/vue-starter-kit` which has everything to get started quickly, for example a few default extensions and a basic Vue component.
|
||||
|
||||
```bash
|
||||
@@ -35,7 +35,7 @@ yarn add @tiptap/core @tiptap/vue-starter-kit
|
||||
|
||||
If you followed step 1 and 2, you can now start your project with `npm run serve` or `yarn serve`, and open [http://localhost:8080/](http://localhost:8080/) in your favorite browser. This might be different, if you’re working with an existing project.
|
||||
|
||||
## 4. Create a new component
|
||||
## 3. Create a new component
|
||||
To actually start using tiptap, you’ll need to add a new component to your app. Let’s call it `Tiptap` and put the following example code in `src/components/Tiptap.vue`.
|
||||
|
||||
This is the fastest way to get tiptap up and running with Vue. It will give you a very basic version of tiptap, without any buttons. No worries, you will be able to add more functionality soon.
|
||||
@@ -73,8 +73,8 @@ export default {
|
||||
</script>
|
||||
```
|
||||
|
||||
## 5. Add it to your app
|
||||
Now, let’s replace the content of `src/App.vue` with the following example code to use our new `Tiptap` component in our app.
|
||||
## 4. Add it to your app
|
||||
Now, let’s replace the content of `pages/index.vue` with the following example code to use our new `Tiptap` component in our app.
|
||||
|
||||
```html
|
||||
<template>
|
||||
@@ -82,20 +82,11 @@ Now, let’s replace the content of `src/App.vue` with the following example cod
|
||||
<tiptap />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Tiptap from './components/Tiptap.vue'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
Tiptap
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
::: warning Nuxt.js
|
||||
If you use Nuxt.js, note that tiptap needs to run in the client, not on the server. It’s required to wrap the editor in a `<client-only>` tag.
|
||||
:::
|
||||
|
||||
You should now see tiptap in your browser. You’ve successfully set up tiptap! Time to give yourself a pat on the back. Let’s start to configure your editor in the next step.
|
||||
|
||||
## 5. Use v-model (optional)
|
||||
You’re probably used to bind your data with `v-model` in forms, that’s also possible with tiptap. Here is a working example component, that you can integrate in your project:
|
||||
|
||||
<demo name="Guide/GettingStarted/VModel" />
|
||||
|
||||
@@ -89,7 +89,7 @@ export default {
|
||||
```
|
||||
|
||||
## 5. Add it to your app
|
||||
Now, let’s replace the content of `pages/index.vue` with the following example code to use our new `Tiptap` component in our app.
|
||||
Now, let’s replace the content of `src/App.vue` with the following example code to use our new `Tiptap` component in our app.
|
||||
|
||||
```html
|
||||
<template>
|
||||
@@ -97,6 +97,22 @@ Now, let’s replace the content of `pages/index.vue` with the following example
|
||||
<tiptap />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Tiptap from './components/Tiptap.vue'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
Tiptap
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
You should now see tiptap in your browser. You’ve successfully set up tiptap! Time to give yourself a pat on the back. Let’s start to configure your editor in the next step.
|
||||
|
||||
## 6. Use v-model (optional)
|
||||
You’re probably used to bind your data with `v-model` in forms, that’s also possible with tiptap. Here is a working example component, that you can integrate in your project:
|
||||
|
||||
<demo name="Guide/GettingStarted/VModel" />
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
link: /examples/book
|
||||
- title: For minimalists
|
||||
link: /examples/minimalist
|
||||
# - title: Use with v-model
|
||||
# link: /examples/v-model
|
||||
|
||||
- title: Guide
|
||||
items:
|
||||
|
||||
Reference in New Issue
Block a user