mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-08-06 13:38:49 +08:00
docs: update content
This commit is contained in:
parent
f1dac9aaef
commit
0e6c79a761
@ -3,7 +3,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// Option 1: Browser + server-side
|
||||
import { generateHTML } from '@tiptap/html'
|
||||
// Option 2: Browser-only (lightweight)
|
||||
// import { generateHTML } from '@tiptap/core'
|
||||
import Document from '@tiptap/extension-document'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Text from '@tiptap/extension-text'
|
||||
@ -45,6 +48,7 @@ export default {
|
||||
Paragraph,
|
||||
Text,
|
||||
Bold,
|
||||
// other extensions …
|
||||
])
|
||||
},
|
||||
}
|
||||
|
@ -110,18 +110,14 @@ const editor = new Editor({
|
||||
### Option 1: Read-only instance of tiptap
|
||||
To render the saved content, set the editor to read-only. That’s how you can achieve the exact same rendering as it’s in the editor, without duplicating your CSS and other code.
|
||||
|
||||
<demo name="Guide/Content/ReadOnly" highlight="3-6,22,28,41-47" />
|
||||
<demo name="Guide/Content/ReadOnly" highlight="3-6,22,28,42-46" />
|
||||
|
||||
### Option 2: Generate HTML from ProseMirror JSON
|
||||
If you need to render the content on the server side, for example to generate the HTML for a blog post which has been written in tiptap, you’ll probably want to do just that without an actual editor instance.
|
||||
|
||||
That’s what the `generateHTML()` is for. It’s a helper function which renders HTML without an actual editor instance.
|
||||
|
||||
:::info Browser-only rendering
|
||||
Import a lightweight implementation of `generateHTML()` from `@tiptap/core` if you’re using the function in a browser context only.
|
||||
:::
|
||||
|
||||
<demo name="Guide/Content/GenerateHTML" highlight="6,43-48"/>
|
||||
<demo name="Guide/Content/GenerateHTML" highlight="6-7,46-52"/>
|
||||
|
||||
## Migration
|
||||
If you’re migrating existing content to tiptap we would recommend to get your existing output to HTML. That’s probably the best format to get your initial content into tiptap, because ProseMirror ensures there is nothing wrong with it. Even if there are some tags or attributes that aren’t allowed (based on your configuration), tiptap just throws them away quietly.
|
||||
@ -131,7 +127,4 @@ We’re about to go through a few cases to help with that, for example we provid
|
||||
[Share your experiences with us!](mailto:humans@tiptap.dev) We’d like to add more information here.
|
||||
|
||||
## Security
|
||||
There’s no reason to use on or the other because of security concerns.
|
||||
|
||||
### Validation
|
||||
Always validate user input sent to an API. Attackers don’t need to use tiptap to send malicious HTML or JSON to an API endpoint.
|
||||
There’s no reason to use on or the other because of security concerns. If someone wants to send malicious content to your server, it doesn’t matter if it’s JSON or HTML. You should always validate user input.
|
||||
|
Loading…
Reference in New Issue
Block a user