docs: update content
This commit is contained in:
@@ -51,24 +51,26 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
/* Basic editor styles */
|
::v-deep {
|
||||||
.ProseMirror {
|
/* Basic editor styles */
|
||||||
> * + * {
|
.ProseMirror {
|
||||||
margin-top: 0.75em;
|
> * + * {
|
||||||
|
margin-top: 0.75em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.checkbox {
|
.checkbox {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
|
|
||||||
input[type="checkbox"] {
|
input[type="checkbox"] {
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
[contenteditable=false] {
|
[contenteditable=false] {
|
||||||
color: #999;
|
color: #999;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ new Editor({
|
|||||||
editorProps: {
|
editorProps: {
|
||||||
attributes: {
|
attributes: {
|
||||||
class: 'prose prose-sm sm:prose lg:prose-lg xl:prose-2xl mx-auto focus:outline-none',
|
class: 'prose prose-sm sm:prose lg:prose-lg xl:prose-2xl mx-auto focus:outline-none',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ import { RocksDB } from '@hocuspocus/extension-rocksdb'
|
|||||||
const server = Server.configure({
|
const server = Server.configure({
|
||||||
port: 1234,
|
port: 1234,
|
||||||
extensions: [
|
extensions: [
|
||||||
new RocksDB({ path: './database' })
|
new RocksDB({ path: './database' }),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -308,10 +308,10 @@ your views.
|
|||||||
This example is **not intended** to be a primary storage as serializing to and deserializing from JSON will not store the collaboration history steps but only the resulting document. Make sure to always use the RocksDB extension as primary storage.
|
This example is **not intended** to be a primary storage as serializing to and deserializing from JSON will not store the collaboration history steps but only the resulting document. Make sure to always use the RocksDB extension as primary storage.
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import {debounce} from 'debounce'
|
import { debounce } from 'debounce'
|
||||||
import {Server} from '@hocuspocus/server'
|
import { Server } from '@hocuspocus/server'
|
||||||
import {TiptapTransformer} from '@hocuspocus/transformer'
|
import { TiptapTransformer } from '@hocuspocus/transformer'
|
||||||
import {writeFile} from 'fs'
|
import { writeFile } from 'fs'
|
||||||
|
|
||||||
let debounced
|
let debounced
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ import Heading from '@tiptap/extension-heading'
|
|||||||
|
|
||||||
const CustomHeading = Heading.extend({
|
const CustomHeading = Heading.extend({
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
|
...Heading.options,
|
||||||
levels: [1, 2, 3],
|
levels: [1, 2, 3],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -230,6 +231,10 @@ renderHTML({ HTMLAttributes }) {
|
|||||||
If you want to add some specific attributes there, import the `mergeAttributes` helper from `@tiptap/core`:
|
If you want to add some specific attributes there, import the `mergeAttributes` helper from `@tiptap/core`:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
import { mergeAttributes } from '@tiptap/core'
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
renderHTML({ HTMLAttributes }) {
|
renderHTML({ HTMLAttributes }) {
|
||||||
return ['a', mergeAttributes(HTMLAttributes, { rel: this.options.rel }), 0]
|
return ['a', mergeAttributes(HTMLAttributes, { rel: this.options.rel }), 0]
|
||||||
},
|
},
|
||||||
@@ -262,7 +267,7 @@ parseHTML() {
|
|||||||
tag: 'b',
|
tag: 'b',
|
||||||
getAttrs: node => node.style.fontWeight !== 'normal' && null,
|
getAttrs: node => node.style.fontWeight !== 'normal' && null,
|
||||||
},
|
},
|
||||||
// <span style="font-weight: bold">
|
// <span style="font-weight: bold"> and <span style="font-weight: 700">
|
||||||
{
|
{
|
||||||
style: 'font-weight',
|
style: 'font-weight',
|
||||||
getAttrs: value => /^(bold(er)?|[5-9]\d{2,})$/.test(value as string) && null,
|
getAttrs: value => /^(bold(er)?|[5-9]\d{2,})$/.test(value as string) && null,
|
||||||
@@ -406,7 +411,7 @@ const CustomLink = Link.extend({
|
|||||||
return () => {
|
return () => {
|
||||||
const container = document.createElement('div')
|
const container = document.createElement('div')
|
||||||
|
|
||||||
container.addEventListener('change', event => {
|
container.addEventListener('click', event => {
|
||||||
alert('clicked on the container')
|
alert('clicked on the container')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ And yes, all of that is reactive, too. A pretty seemless communication, isn’t
|
|||||||
## Adding a content editable
|
## Adding a content editable
|
||||||
There is another component called `NodeViewContent` which helps you adding editable content to your node view. Here is an example:
|
There is another component called `NodeViewContent` which helps you adding editable content to your node view. Here is an example:
|
||||||
|
|
||||||
```js
|
```jsx
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { NodeViewWrapper, NodeViewContent } from '@tiptap/react'
|
import { NodeViewWrapper, NodeViewContent } from '@tiptap/react'
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ new Editor({
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
Text,
|
Text,
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ new Editor({
|
|||||||
editorProps: {
|
editorProps: {
|
||||||
attributes: {
|
attributes: {
|
||||||
class: 'prose prose-sm sm:prose lg:prose-lg xl:prose-2xl mx-auto focus:outline-none',
|
class: 'prose prose-sm sm:prose lg:prose-lg xl:prose-2xl mx-auto focus:outline-none',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user