docs: update content

This commit is contained in:
Hans Pagel
2021-02-07 16:12:27 +01:00
parent 5571e1dd27
commit 7d15e5afb9
9 changed files with 23 additions and 20 deletions

View File

@@ -7,7 +7,7 @@ import { Editor, EditorContent } from '@tiptap/vue-starter-kit'
import Document from '@tiptap/extension-document' import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph' import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text' import Text from '@tiptap/extension-text'
import Heading from '@tiptap/extension-heading' import Code from '@tiptap/extension-code'
import Typography from '@tiptap/extension-typography' import Typography from '@tiptap/extension-typography'
import { ColorHighlighter } from './ColorHighlighter' import { ColorHighlighter } from './ColorHighlighter'
@@ -28,23 +28,21 @@ export default {
Document, Document,
Paragraph, Paragraph,
Text, Text,
Heading.configure({ Code,
levels: [1, 2],
}),
Typography, Typography,
ColorHighlighter, ColorHighlighter,
], ],
content: ` content: `
<h2>
Whats a savvy text editor?
</h2>
<p> <p>
Maybe an editor which detects hex colors like #FFF, #0D0D0D, #616161, #A975FF, #FB5151, #FD9170, #FFCB6B, #68CEF8, #80cbc4, or #9DEF8F and adds a color swatch to them while you type. → With the Typography extension, tiptap understands »what you mean« and adds correct characters to your text — its like a “typography nerd” on your side.
</p> </p>
<p> <p>
→ Or an editor, which knows »what you mean« and adds the correct characters to your text — like a “typography nerd” on your side. That should be the 1×1, right? Try it out and type (c), ->, >>, 1/2, !=, -- here: Try it out and type <code>(c)</code>, <code>-></code>, <code>>></code>, <code>1/2</code>, <code>!=</code>, <code>--</code> or <code>1x1</code> here:
</p> </p>
<p></p> <p></p>
<p>
Also, you can teach the editor new things. For example to recognize hex colors and add a color swatch on the fly: #FFF, #0D0D0D, #616161, #A975FF, #FB5151, #FD9170, #FFCB6B, #68CEF8, #80cbc4, #9DEF8F
</p>
`, `,
}) })
}, },
@@ -70,6 +68,11 @@ export default {
h6 { h6 {
line-height: 1.1; line-height: 1.1;
} }
code {
background-color: rgba(#616161, 0.1);
color: #616161;
}
} }
/* Color swatches */ /* Color swatches */

View File

@@ -1,3 +1,3 @@
# Savvy # Savvy editor
<demo name="Examples/Savvy" /> <demo name="Examples/Savvy" />

View File

@@ -8,6 +8,7 @@ Congratulations! Youve found our playground with a list of experiments. Be aw
* [Color](/experiments/color) * [Color](/experiments/color)
* [Commands](/experiments/commands) * [Commands](/experiments/commands)
* [Embeds](/experiments/embeds) * [Embeds](/experiments/embeds)
* [Multiple editors](/experiments/multiple-editors)
## Waiting for approval ## Waiting for approval
* [@tiptap/extension-placeholder](/experiments/placeholder) * [@tiptap/extension-placeholder](/experiments/placeholder)

View File

@@ -2,4 +2,4 @@
The following example has three different instances of tiptap. The first is configured to have a single paragraph of text, the second to have a task list and the third to have text. All of them are stored in a single Y.js document, which can be synced in real-time with other users. The following example has three different instances of tiptap. The first is configured to have a single paragraph of text, the second to have a task list and the third to have text. All of them are stored in a single Y.js document, which can be synced in real-time with other users.
<demo name="Examples/MultipleEditors" /> <demo name="Experiments/MultipleEditors" />

View File

@@ -26,7 +26,7 @@ p {
## Option 2: Add custom classes ## Option 2: Add custom classes
Most extensions have a `class` option, which you can use to add a custom CSS class to the HTML tag. You can control the whole rendering, including adding classes to everything.
### Extensions ### Extensions
Most extensions allow you to add attributes to the rendered HTML through the `HTMLAttributes` option. You can use that to add a custom class (or any other attribute). Thats also very helpful, when you work with [Tailwind CSS](https://tailwindcss.com/). Most extensions allow you to add attributes to the rendered HTML through the `HTMLAttributes` option. You can use that to add a custom class (or any other attribute). Thats also very helpful, when you work with [Tailwind CSS](https://tailwindcss.com/).
@@ -73,7 +73,7 @@ new Editor({
``` ```
### With Tailwind CSS ### With Tailwind CSS
The editor works fine with Tailwind CSS, too. Find an example thats styled with the `@tailwindcss/typography` plugin. The editor works fine with Tailwind CSS, too. Find an example thats styled with the `@tailwindcss/typography` plugin below.
<iframe <iframe
src="https://codesandbox.io/embed/tiptap-demo-tailwind-iqjz0?fontsize=14&hidenavigation=1&module=%2Fsrc%2Findex.js&theme=dark&view=preview" src="https://codesandbox.io/embed/tiptap-demo-tailwind-iqjz0?fontsize=14&hidenavigation=1&module=%2Fsrc%2Findex.js&theme=dark&view=preview"
@@ -84,7 +84,7 @@ The editor works fine with Tailwind CSS, too. Find an example thats styled wi
></iframe> ></iframe>
## Option 3: Customize the HTML ## Option 3: Customize the HTML
You can even customize the markup for every extension. This will make a custom bold extension that doesnt render a `<strong>` tag, but a `<b>` tag: Or you can customize the markup for extensions. The following example will make a custom bold extension that doesnt render a `<strong>` tag, but a `<b>` tag:
```js ```js
import Bold from '@tiptap/extension-bold' import Bold from '@tiptap/extension-bold'
@@ -105,4 +105,5 @@ new Editor({
}) })
``` ```
You should put your custom extensions in separate files though, but I think you got the idea. You should put your custom extensions in separate files, but I think you got the idea.

View File

@@ -22,8 +22,8 @@ editor.chain().toggleBold().focus().run()
1. `editor` should be a tiptap instance, 1. `editor` should be a tiptap instance,
2. `chain()` is used to tell the editor you want to execute multiple commands, 2. `chain()` is used to tell the editor you want to execute multiple commands,
3. `toggleBold()` marks selected text bold, or removes the bold mark from the text selection if its already applied, 3. `focus()` sets the focus back to the editor,
4. `focus()` sets the focus back to the editor and 4. `toggleBold()` marks the selected text bold, or removes the bold mark from the text selection if its already applied and
5. `run()` will execute the chain. 5. `run()` will execute the chain.
In other words: This will be the typical **Bold** button for your text editor. In other words: This will be the typical **Bold** button for your text editor.

View File

@@ -38,9 +38,7 @@
link: /examples/community link: /examples/community
- title: Minimal setup - title: Minimal setup
link: /examples/minimal link: /examples/minimal
- title: Multiple editors - title: Savvy editor
link: /examples/multiple-editors
- title: Savvy
link: /examples/savvy link: /examples/savvy
type: draft type: draft