docs: improve getting started guides, add v-model demo

This commit is contained in:
Hans Pagel
2020-12-01 15:50:02 +01:00
parent be464d100f
commit d3e0de4e2e
7 changed files with 26 additions and 24 deletions

View File

@@ -1,3 +0,0 @@
# Use v-model
<demo name="Examples/VModel" />

View File

@@ -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. Lets finally install tiptap! For the following example youll 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 youre working with an existing project.
## 4. Create a new component
## 3. Create a new component
To actually start using tiptap, youll need to add a new component to your app. Lets 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, lets 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, lets 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, lets 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. Its required to wrap the editor in a `<client-only>` tag.
:::
You should now see tiptap in your browser. Youve successfully set up tiptap! Time to give yourself a pat on the back. Lets start to configure your editor in the next step.
## 5. Use v-model (optional)
Youre probably used to bind your data with `v-model` in forms, thats also possible with tiptap. Here is a working example component, that you can integrate in your project:
<demo name="Guide/GettingStarted/VModel" />

View File

@@ -89,7 +89,7 @@ export default {
```
## 5. Add it to your app
Now, lets replace the content of `pages/index.vue` with the following example code to use our new `Tiptap` component in our app.
Now, lets 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, lets 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. Youve successfully set up tiptap! Time to give yourself a pat on the back. Lets start to configure your editor in the next step.
## 6. Use v-model (optional)
Youre probably used to bind your data with `v-model` in forms, thats also possible with tiptap. Here is a working example component, that you can integrate in your project:
<demo name="Guide/GettingStarted/VModel" />

View File

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