docs: update content

This commit is contained in:
Hans Pagel 2020-12-04 13:41:05 +01:00
parent 037658e701
commit 70c2590c72
2 changed files with 11 additions and 4 deletions

View File

@ -200,11 +200,18 @@ Yes, its magic. As already mentioned, that is all based on the fantastic Y.js
Our collaborative editing backend is ready to handle advanced use cases, like authorization, persistence and scaling. Lets go through a few common use cases here!
:::pro Backend as a Service (Paid)
Dont want to wrap your head around the backend part? No worries, we offer a managed backend. For less than 1.000 documents, its $49/month (VAT may apply) and probably saves you a ton of time.
Send us an email to [humans@tiptap.dev](mailto:humans@tiptap.dev) for further details.
Dont want to wrap your head around the backend part? No worries, we offer a managed backend. For less than 1.000 documents, its $49/month (VAT may apply) and probably saves you a ton of time. Send us an email to [humans@tiptap.dev](mailto:humans@tiptap.dev) for further details.
:::
### The document name
The document name is `'example-document'` in all examples here, but it could be any string. In a real-world app youd probably add the name of your entity, the ID of the entity and in some cases even the field (if you have multiple fields that you want to make collaborative). Here is how that could look like for a CMS:
```js
const documentName = 'page.140.content'
```
In the backend, you can split the string to know the user is typing on a page with the ID 140 in the `content` field and manage authorization and such accordingly. New documents are created on the fly, no need to tell the backend about them, besides passing a string to the provider.
### Authentication
With the `onConnect` hook you can write a custom Promise to check if a client is authenticated. That can be a request to an API, to a microservice, a database query, or whatever is needed, as long as its executing `resolve()` at some point. You can also pass contextual data to the `resolve()` method which will be accessible in other hooks.

View File

@ -28,7 +28,7 @@ editor.chain().toggleBold().focus().run()
In other words: This will be the typical **Bold** button for your text editor.
Which commands are available depends on what extensions youve registered with editor. Most of the extensions come with a `set…()`, `unset…()` and `toggle…()` command. Read the extension documentation to see whats actually available or just surf through your code editors autocomplete.
Which commands are available depends on what extensions youve registered with the editor. Most of the extensions come with a `set…()`, `unset…()` and `toggle…()` command. Read the extension documentation to see whats actually available or just surf through your code editors autocomplete.
## Keep the focus
Youve seen the `focus()` command in the above example already. When you click on the button, the browser focuses that DOM element and the editor loses focus. Its likely you want to add `focus()` to all your toolbar buttons, so the writing flow of your users isnt interrupted.