docs: move content example to the guide

This commit is contained in:
Hans Pagel
2020-11-30 14:56:18 +01:00
parent 3ff8303ebd
commit 0cd31d05aa
4 changed files with 5 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
context('/examples/export-html-or-json', () => {
context('/guide/store-content', () => {
before(() => {
cy.visit('/examples/export-html-or-json')
cy.visit('/guide/store-content')
})
beforeEach(() => {

View File

@@ -1,3 +0,0 @@
# Export HTML or JSON
<demo name="Examples/ExportHtmlOrJson" highlight="52-60"/>

View File

@@ -3,9 +3,10 @@
## toc
## Introduction
You can store your content as a JSON object or as a good old HTML string. Both work fine. And of course, you can pass both formats to the editor to restore your content.
You can store your content as a JSON object or as a good old HTML string. Both work fine. And of course, you can pass both formats to the editor to restore your content. Here is an interactive example, that exports the content as HTML and JSON when the document is changed:
You can store your content as JSON and restore the content from HTML, or the other way around. I dont know why you would do that, but tiptap wouldnt care.
## Example
<demo name="Guide/StoreContent" highlight="52-60"/>
## Option 1: JSON
JSON is probably easier to loop through, for example to look for a mention and its more like what tiptap uses under the hood. Anyway, if you want to use JSON to store the content we provide a method to retrieve the content as JSON: