From 0cd31d05aa40e9ebc8bd66579b1f39fc0246645d Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Mon, 30 Nov 2020 14:56:18 +0100 Subject: [PATCH] docs: move content example to the guide --- .../ExportHtmlOrJson => Guide/StoreContent}/index.spec.js | 4 ++-- .../ExportHtmlOrJson => Guide/StoreContent}/index.vue | 0 docs/src/docPages/examples/export-html-or-json.md | 3 --- docs/src/docPages/guide/store-content.md | 5 +++-- 4 files changed, 5 insertions(+), 7 deletions(-) rename docs/src/demos/{Examples/ExportHtmlOrJson => Guide/StoreContent}/index.spec.js (89%) rename docs/src/demos/{Examples/ExportHtmlOrJson => Guide/StoreContent}/index.vue (100%) delete mode 100644 docs/src/docPages/examples/export-html-or-json.md diff --git a/docs/src/demos/Examples/ExportHtmlOrJson/index.spec.js b/docs/src/demos/Guide/StoreContent/index.spec.js similarity index 89% rename from docs/src/demos/Examples/ExportHtmlOrJson/index.spec.js rename to docs/src/demos/Guide/StoreContent/index.spec.js index 4e96f2a4..188020e7 100644 --- a/docs/src/demos/Examples/ExportHtmlOrJson/index.spec.js +++ b/docs/src/demos/Guide/StoreContent/index.spec.js @@ -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(() => { diff --git a/docs/src/demos/Examples/ExportHtmlOrJson/index.vue b/docs/src/demos/Guide/StoreContent/index.vue similarity index 100% rename from docs/src/demos/Examples/ExportHtmlOrJson/index.vue rename to docs/src/demos/Guide/StoreContent/index.vue diff --git a/docs/src/docPages/examples/export-html-or-json.md b/docs/src/docPages/examples/export-html-or-json.md deleted file mode 100644 index 6a32ec1b..00000000 --- a/docs/src/docPages/examples/export-html-or-json.md +++ /dev/null @@ -1,3 +0,0 @@ -# Export HTML or JSON - - diff --git a/docs/src/docPages/guide/store-content.md b/docs/src/docPages/guide/store-content.md index 8d62fbbf..161b3017 100644 --- a/docs/src/docPages/guide/store-content.md +++ b/docs/src/docPages/guide/store-content.md @@ -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 don’t know why you would do that, but tiptap wouldn’t care. +## Example + ## Option 1: JSON JSON is probably easier to loop through, for example to look for a mention and it’s 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: