Skip to content

Commit

Permalink
merge convert
Browse files Browse the repository at this point in the history
  • Loading branch information
bdbch committed Jul 15, 2024
2 parents 0ae8207 + bed2af0 commit ae59c41
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/content/collaboration/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const sidebarConfig: SidebarConfig = {
{
title: 'Convert API',
href: '/collaboration/documents/convert-api',
tags: ['Beta'],
},
],
},
Expand Down
7 changes: 4 additions & 3 deletions src/content/editor/extensions/functionality/export.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ extension:
icon: Download
isPro: true
isNew: true
isBeta: true
isCloud: true
---

import { Callout } from '@/components/ui/Callout'
import { CodeDemo } from '@/components/CodeDemo'

Export documents from various formats like docx, odt, and markdown and convert them from Tiptap's JSON format.

<Callout title="Pro Extension" variant="warning">

This extension requires a valid subscription in an eligible plan and [access to our private registry](/guides/pro-extensions), set this up first.
Expand All @@ -26,8 +29,6 @@ import { CodeDemo } from '@/components/CodeDemo'

</Callout>

With Tiptap Convert, you can easily export documents to various formats like docx, odt, and markdown. This feature allows you to convert documents from Tiptap's JSON format, enabling seamless integration with your collaborative editor.

## Example

<CodeDemo isPro path="/Extensions/ImportExport" />
Expand Down Expand Up @@ -107,7 +108,7 @@ const editor = new Editor({
})
```

## Exporting a document
## Export a document

```js
// Do a simple export to docx
Expand Down
35 changes: 21 additions & 14 deletions src/content/editor/extensions/functionality/import.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,44 @@ extension:
icon: Upload
isPro: true
isNew: true
isBeta: true
isCloud: true
---

import { Callout } from '@/components/ui/Callout'
import { CodeDemo } from '@/components/CodeDemo'

<Callout title="Pro Extension" variant="warning">

This extension requires a valid subscription in an eligible plan and [access to our private registry](/guides/pro-extensions), set this up first.

**You need to be a business customer, to use the advanced extension.**
Import documents from various formats like docx, odt, and markdown and convert them to Tiptap's JSON format.

<Callout title="Beta release" variant="hint">
This extension is accessible to anyone with a Tiptap account. To install the extension you need
access to our [private registry](/guides/pro-extensions), set this up first.
</Callout>

With Tiptap Convert, you can easily import documents from various formats like docx, odt, and markdown. This feature allows you to convert documents to Tiptap's JSON format, enabling seamless integration with your collaborative editor.

## Example

<CodeDemo isPro path="/Extensions/ImportExport" />

## Setup JWT authentication on your server
## Authenticate on your server

JWT, or JSON Web Token, is a compact, URL-safe means of representing claims to be transferred between two parties. The information in a JWT is digitally signed using a cryptographic algorithm to ensure that the claims cannot be altered after the token is issued. This digital signature makes the JWT a reliable vehicle for secure information exchange in web applications, providing a method to authenticate and exchange information.
JWT, or JSON Web Token, is a compact, URL-safe means of representing claims to be transferred between two parties. The information in a JWT is digitally signed using a cryptographic algorithm to ensure that the claims cannot be altered after the token is issued.

<Callout title="Authentication" variant="hint">
Make sure to use the Auth key from the [Convert
settings](https://cloud.tiptap.dev/convert-settings) page. Other Tiptap feature authentications
cannot be used.
</Callout>

### Create a static JWT for testing

For testing purposes, you might not want to set up a complete backend system to generate JWTs. In such cases, using online tools like http://jwtbuilder.jamiekurtz.com/ can be a quick workaround. These tools allow you to create a JWT by inputting the necessary payload and signing it with a secret key.

When using these tools, ensure that the "Key" field is replaced with the secret key from your [Collaboration settings](https://collab.tiptap.dev/apps/settings) page. You don’t need to change any other information.
When using these tools, ensure that the "Key" field is replaced with the secret key from your [Convert settings](https://cloud.tiptap.dev/convert-settings) page. You don’t need to change any other information.

**Remember, this approach is only recommended for testing due to security risks associated with exposing your secret key.**
<Callout title="Only for testing" variant="warning">
Remember, this approach is only recommended for testing due to security risks associated with
exposing your secret key.
</Callout>

### Generate JWTs server side

Expand Down Expand Up @@ -74,11 +81,11 @@ This setup not only increases security but also provides a scalable solution for

Ensure the secret key is stored as an environment variable on the server, or define it directly in the server code. Avoid sending it from the client side.

## Setting up the client-side
## Set up the client-side

Before we can start import & exporting documents, we need to set up the extension. The extension will handle all requests and responses to the convert API & will handle content insertions and downloads.

### Installing the extension
### Install the extension

To use the convert extension, you need to install the `@tiptap-pro/extension-import` package:

Expand Down Expand Up @@ -107,7 +114,7 @@ const editor = new Editor({
})
```

## Importing your first document
## Import your first document

```js
// The most simple way to import a file
Expand Down
4 changes: 2 additions & 2 deletions src/content/editor/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export const sidebarConfig: SidebarConfig = {
{
href: '/editor/extensions/functionality/export',
title: 'Export',
tags: ['Pro', 'Cloud'],
tags: ['Beta', 'Pro'],
},
{
href: '/editor/extensions/functionality/filehandler',
Expand Down Expand Up @@ -322,7 +322,7 @@ export const sidebarConfig: SidebarConfig = {
{
href: '/editor/extensions/functionality/import',
title: 'Import',
tags: ['Pro', 'Cloud'],
tags: ['Beta', 'Pro'],
},
{
href: '/editor/extensions/functionality/mathematics',
Expand Down

0 comments on commit ae59c41

Please sign in to comment.