From 2c5a82df47c71282e8cb2d8bb223d42e3a2be5c7 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Tue, 6 Apr 2021 23:57:20 +0200 Subject: [PATCH 1/2] docs: update content, add new commands pages --- docs/src/docPages/api/commands.md | 8 +++---- .../docPages/api/commands/clear-content.md | 12 +++++++++++ docs/src/docPages/api/commands/insert-html.md | 13 ++++++++++++ docs/src/docPages/api/commands/insert-node.md | 13 ++++++++++++ docs/src/docPages/api/commands/insert-text.md | 12 +++++++++++ docs/src/docPages/api/commands/set-content.md | 21 +++++++++++++++++-- docs/src/links.yaml | 13 +++++++++++- 7 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 docs/src/docPages/api/commands/clear-content.md create mode 100644 docs/src/docPages/api/commands/insert-html.md create mode 100644 docs/src/docPages/api/commands/insert-node.md create mode 100644 docs/src/docPages/api/commands/insert-text.md diff --git a/docs/src/docPages/api/commands.md b/docs/src/docPages/api/commands.md index 7e3f086a..836e91ac 100644 --- a/docs/src/docPages/api/commands.md +++ b/docs/src/docPages/api/commands.md @@ -151,10 +151,10 @@ Have a look at all of the core commands listed below. They should give you a goo | Command | Description | Links | | --------------- | ------------------------------------------------ | ----------------------------------- | | .clearContent() | Clear the whole document. | [More](/api/commands/clear-content) | -| .insertHTML() | Insert a string of HTML at the current position. | | -| .insertNode() | Insert a node at the current position. | | -| .insertText() | Insert a string of text at the current position. | | -| .setContent() | Replace the whole document with new content. | | +| .insertHTML() | Insert a string of HTML at the current position. | [More](/api/commands/insert-html) | +| .insertNode() | Insert a node at the current position. | [More](/api/commands/insert-node) | +| .insertText() | Insert a string of text at the current position. | [More](/api/commands/insert-text) | +| .setContent() | Replace the whole document with new content. | [More](/api/commands/set-content) | ### Nodes & Marks | Command | Description | diff --git a/docs/src/docPages/api/commands/clear-content.md b/docs/src/docPages/api/commands/clear-content.md new file mode 100644 index 00000000..0a824543 --- /dev/null +++ b/docs/src/docPages/api/commands/clear-content.md @@ -0,0 +1,12 @@ +# clearContent + +See also: [setContent](/api/commands/set-content) + +## Parameters + +## Usage + +```js +this.editor.commands.clearContent() +``` + diff --git a/docs/src/docPages/api/commands/insert-html.md b/docs/src/docPages/api/commands/insert-html.md new file mode 100644 index 00000000..638288de --- /dev/null +++ b/docs/src/docPages/api/commands/insert-html.md @@ -0,0 +1,13 @@ +# insertHTML + + +See also: [insertText](/api/commands/insert-text), [insertNode](/api/commands/insert-node) + +## Parameters + +## Usage + +```js +this.editor.commands.insertHTML('

Example text

') +``` + diff --git a/docs/src/docPages/api/commands/insert-node.md b/docs/src/docPages/api/commands/insert-node.md new file mode 100644 index 00000000..60ebeb0f --- /dev/null +++ b/docs/src/docPages/api/commands/insert-node.md @@ -0,0 +1,13 @@ +# insertNode + + +See also: [insertHTML](/api/commands/insert-html), [insertText](/api/commands/insert-text) + +## Parameters + +## Usage + +```js +this.editor.commands.insertNode('paragraph') +``` + diff --git a/docs/src/docPages/api/commands/insert-text.md b/docs/src/docPages/api/commands/insert-text.md new file mode 100644 index 00000000..4e0294b3 --- /dev/null +++ b/docs/src/docPages/api/commands/insert-text.md @@ -0,0 +1,12 @@ +# insertText + +See also: [insertHTML](/api/commands/insert-html), [insertNode](/api/commands/insert-node) + +## Parameters + +## Usage + +```js +this.editor.commands.insertText('Example text') +``` + diff --git a/docs/src/docPages/api/commands/set-content.md b/docs/src/docPages/api/commands/set-content.md index a0761018..38c74224 100644 --- a/docs/src/docPages/api/commands/set-content.md +++ b/docs/src/docPages/api/commands/set-content.md @@ -1,7 +1,7 @@ # setContent The `setContent` command replaces the document with a new one. You can pass JSON or HTML, both work fine. It’s basically the same as setting the `content` on initialization. -See also: [clearContent()](#) +See also: [clearContent](/api/commands/clear-content) ## Parameters @@ -20,6 +20,23 @@ Options to configure the parsing can be passed during initialization and/or with ## Usage ```js -this.editor.commands.setContent('

Example Content

') +// HTML +this.editor.commands.setContent('

Example Text

') + +// JSON +this.editor.commands.setContent({ + "type": "doc", + "content": [ + { + "type": "paragraph", + "content": [ + { + "type": "text", + "text": "Example Text" + } + ] + } + ] +}) ``` diff --git a/docs/src/links.yaml b/docs/src/links.yaml index 712aefbe..848e47ab 100644 --- a/docs/src/links.yaml +++ b/docs/src/links.yaml @@ -133,9 +133,20 @@ - title: Commands link: /api/commands items: + - title: clearContent + link: /api/commands/clear-content + type: draft + - title: insertHTML + link: /api/commands/insert-html + type: draft + - title: insertNode + link: /api/commands/insert-node + type: draft + - title: insertText + link: /api/commands/insert-text + type: draft - title: setContent link: /api/commands/set-content - type: draft - title: Nodes link: /api/nodes items: From c063cc99f4e96841b337546ad0cdf521916cb6fb Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Wed, 7 Apr 2021 00:08:50 +0200 Subject: [PATCH 2/2] docs: add better titles to the integration guides --- docs/src/docPages/installation/alpine.md | 4 ++++ docs/src/docPages/installation/livewire.md | 4 ++++ docs/src/docPages/installation/next.md | 10 ---------- docs/src/docPages/installation/nuxt.md | 4 ++++ docs/src/docPages/installation/react.md | 4 ++++ docs/src/docPages/installation/svelte.md | 4 ++++ docs/src/docPages/installation/vue2.md | 4 ++++ docs/src/docPages/installation/vue3.md | 4 ++++ 8 files changed, 28 insertions(+), 10 deletions(-) delete mode 100644 docs/src/docPages/installation/next.md diff --git a/docs/src/docPages/installation/alpine.md b/docs/src/docPages/installation/alpine.md index 6dca23ac..bf6ed83b 100644 --- a/docs/src/docPages/installation/alpine.md +++ b/docs/src/docPages/installation/alpine.md @@ -1,3 +1,7 @@ +--- +title: Alpine WYSIWYG +--- + # Alpine.js ## toc diff --git a/docs/src/docPages/installation/livewire.md b/docs/src/docPages/installation/livewire.md index d8a61b21..d09b2a3a 100644 --- a/docs/src/docPages/installation/livewire.md +++ b/docs/src/docPages/installation/livewire.md @@ -1,3 +1,7 @@ +--- +title: Livewire WYSIWYG +--- + # Livewire ## toc diff --git a/docs/src/docPages/installation/next.md b/docs/src/docPages/installation/next.md deleted file mode 100644 index a71e9336..00000000 --- a/docs/src/docPages/installation/next.md +++ /dev/null @@ -1,10 +0,0 @@ -# Next.js - -## toc - -## Introduction -The following guide describes how to integrate tiptap with your [Next.js](https://nextjs.org/) project. - -TODO - - diff --git a/docs/src/docPages/installation/nuxt.md b/docs/src/docPages/installation/nuxt.md index 7ccaa0e1..7b08e475 100644 --- a/docs/src/docPages/installation/nuxt.md +++ b/docs/src/docPages/installation/nuxt.md @@ -1,3 +1,7 @@ +--- +title: Nuxt.js WYSIWYG +--- + # Nuxt.js ## toc diff --git a/docs/src/docPages/installation/react.md b/docs/src/docPages/installation/react.md index 7d25d9d5..0d777181 100644 --- a/docs/src/docPages/installation/react.md +++ b/docs/src/docPages/installation/react.md @@ -1,3 +1,7 @@ +--- +title: React WYSIWYG +--- + # React ## toc diff --git a/docs/src/docPages/installation/svelte.md b/docs/src/docPages/installation/svelte.md index 78d41686..55c2195e 100644 --- a/docs/src/docPages/installation/svelte.md +++ b/docs/src/docPages/installation/svelte.md @@ -1,3 +1,7 @@ +--- +title: Svelte WYSIWYG +--- + # Svelte ## toc diff --git a/docs/src/docPages/installation/vue2.md b/docs/src/docPages/installation/vue2.md index 47c4aa57..9809f6cb 100644 --- a/docs/src/docPages/installation/vue2.md +++ b/docs/src/docPages/installation/vue2.md @@ -1,3 +1,7 @@ +--- +title: Vue.js 2 WYSIWYG +--- + # Vue.js 2 ## toc diff --git a/docs/src/docPages/installation/vue3.md b/docs/src/docPages/installation/vue3.md index d142d437..86ff170f 100644 --- a/docs/src/docPages/installation/vue3.md +++ b/docs/src/docPages/installation/vue3.md @@ -1,3 +1,7 @@ +--- +title: Vue.js 3 WYSIWYG +--- + # Vue.js 3 ## toc