docs: update content
This commit is contained in:
@@ -52,12 +52,12 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Placeholder (on every new line) */
|
/* Placeholder (on every new line) */
|
||||||
// .ProseMirror p.is-empty::before {
|
/*.ProseMirror p.is-empty::before {
|
||||||
// content: attr(data-placeholder);
|
content: attr(data-placeholder);
|
||||||
// float: left;
|
float: left;
|
||||||
// color: #ced4da;
|
color: #ced4da;
|
||||||
// pointer-events: none;
|
pointer-events: none;
|
||||||
// height: 0;
|
height: 0;
|
||||||
// }
|
}*/
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
58
docs/src/demos/Nodes/Emoji/index.spec.js
Normal file
58
docs/src/demos/Nodes/Emoji/index.spec.js
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
context('/demos/Nodes/Paragraph', () => {
|
||||||
|
before(() => {
|
||||||
|
cy.visit('/demos/Nodes/Paragraph')
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||||
|
editor.commands.clearContent()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should parse paragraphs correctly', () => {
|
||||||
|
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||||
|
editor.commands.setContent('<p>Example Text</p>')
|
||||||
|
expect(editor.getHTML()).to.eq('<p>Example Text</p>')
|
||||||
|
|
||||||
|
editor.commands.setContent('<p><x-unknown>Example Text</x-unknown></p>')
|
||||||
|
expect(editor.getHTML()).to.eq('<p>Example Text</p>')
|
||||||
|
|
||||||
|
editor.commands.setContent('<p style="display: block;">Example Text</p>')
|
||||||
|
expect(editor.getHTML()).to.eq('<p>Example Text</p>')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('text should be wrapped in a paragraph by default', () => {
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.type('Example Text')
|
||||||
|
.find('p')
|
||||||
|
.should('contain', 'Example Text')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('enter should make a new paragraph', () => {
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.type('First Paragraph{enter}Second Paragraph')
|
||||||
|
.find('p')
|
||||||
|
.should('have.length', 2)
|
||||||
|
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.find('p:first')
|
||||||
|
.should('contain', 'First Paragraph')
|
||||||
|
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.find('p:nth-child(2)')
|
||||||
|
.should('contain', 'Second Paragraph')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('backspace should remove the second paragraph', () => {
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.type('{enter}')
|
||||||
|
.find('p')
|
||||||
|
.should('have.length', 2)
|
||||||
|
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.type('{backspace}')
|
||||||
|
.find('p')
|
||||||
|
.should('have.length', 1)
|
||||||
|
})
|
||||||
|
})
|
||||||
75
docs/src/demos/Nodes/Emoji/index.vue
Normal file
75
docs/src/demos/Nodes/Emoji/index.vue
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<template>
|
||||||
|
<div v-if="editor">
|
||||||
|
<button @click="editor.chain().focus(). insertText('✨').run()">
|
||||||
|
✨
|
||||||
|
</button>
|
||||||
|
<button @click="editor.chain().focus(). insertText('😅').run()">
|
||||||
|
😅
|
||||||
|
</button>
|
||||||
|
<button @click="editor.chain().focus(). insertText('🎉').run()">
|
||||||
|
🎉
|
||||||
|
</button>
|
||||||
|
<button @click="editor.chain().focus(). insertText('💖').run()">
|
||||||
|
💖
|
||||||
|
</button>
|
||||||
|
<button @click="editor.chain().focus(). insertText('👀').run()">
|
||||||
|
👀
|
||||||
|
</button>
|
||||||
|
<button @click="editor.chain().focus(). insertText('👍️').run()">
|
||||||
|
👍️
|
||||||
|
</button>
|
||||||
|
<editor-content :editor="editor" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { Editor, EditorContent } from '@tiptap/vue-2'
|
||||||
|
import Document from '@tiptap/extension-document'
|
||||||
|
import Paragraph from '@tiptap/extension-paragraph'
|
||||||
|
import Text from '@tiptap/extension-text'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
EditorContent,
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
editor: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.editor = new Editor({
|
||||||
|
extensions: [
|
||||||
|
Document,
|
||||||
|
Paragraph,
|
||||||
|
Text,
|
||||||
|
],
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeDestroy() {
|
||||||
|
this.editor.destroy()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
/* Basic editor styles */
|
||||||
|
.ProseMirror {
|
||||||
|
> * + * {
|
||||||
|
margin-top: 0.75em;
|
||||||
|
}
|
||||||
|
|
||||||
|
font-size: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
margin: 0.125rem;
|
||||||
|
width: 2rem;
|
||||||
|
height: 2rem;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 2rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -18,6 +18,7 @@ There are also some extensions with more capabilities. We call them [nodes](/api
|
|||||||
| [FontFamily](/api/extensions/font-family) | – | [GitHub](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-font-family/) |
|
| [FontFamily](/api/extensions/font-family) | – | [GitHub](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-font-family/) |
|
||||||
| [Gapcursor](/api/extensions/gapcursor) | Yes | [GitHub](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-gapcursor/) |
|
| [Gapcursor](/api/extensions/gapcursor) | Yes | [GitHub](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-gapcursor/) |
|
||||||
| [History](/api/extensions/history) | Yes | [GitHub](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-history/) |
|
| [History](/api/extensions/history) | Yes | [GitHub](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-history/) |
|
||||||
|
| [Placeholder](/api/extensions/placeholder) | – | [GitHub](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-placeholder/) |
|
||||||
| [TextAlign](/api/extensions/text-align) | – | [GitHub](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-text-align/) |
|
| [TextAlign](/api/extensions/text-align) | – | [GitHub](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-text-align/) |
|
||||||
| [Typography](/api/extensions/typography) | – | [GitHub](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-typography/) |
|
| [Typography](/api/extensions/typography) | – | [GitHub](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-typography/) |
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
[](https://www.npmjs.com/package/@tiptap/extension-placeholder)
|
[](https://www.npmjs.com/package/@tiptap/extension-placeholder)
|
||||||
[](https://npmcharts.com/compare/@tiptap/extension-placeholder?minimal=true)
|
[](https://npmcharts.com/compare/@tiptap/extension-placeholder?minimal=true)
|
||||||
|
|
||||||
This extension provides placeholder support.
|
This extension provides placeholder support. Give your users an idea what they should write with a tiny hint. There is a handful of things to customize, if you feel like it.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -1,7 +1,19 @@
|
|||||||
# Emoji
|
# Emoji
|
||||||
|
|
||||||
|
## Support for emojis
|
||||||
|
There is no extension or example yet, but it’s definitely on our list to build a dedicated extension to add emoji support.
|
||||||
|
|
||||||
|
If you want to give it a shot yourself, you could start altering the [`Mention`](/api/nodes/mention) node. This uses the [`Suggestion`](/utilities/suggestion) utility, which should help with an autocomplete and such things.
|
||||||
|
|
||||||
:::pro Fund the development ♥
|
:::pro Fund the development ♥
|
||||||
We need your support to maintain, update, support and develop tiptap 2. If you’re waiting for this extension, [become a sponsor and fund open-source](/sponsor).
|
We need your support to maintain, update, support and develop tiptap 2. If you’re waiting for this extension, [become a sponsor and fund open-source](/sponsor).
|
||||||
:::
|
:::
|
||||||
|
|
||||||
TODO
|
## Bring your own emoji picker
|
||||||
|
You can use any emoji picker, or build your own. Just use [commands](/api/commands) to insert the picked emojis.
|
||||||
|
|
||||||
|
```js
|
||||||
|
this.editor.chain().focus().insertText('✨').run()
|
||||||
|
```
|
||||||
|
|
||||||
|
<demo name="Nodes/Emoji" />
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
# Placeholder
|
|
||||||
|
|
||||||
⚠️ Experiment
|
|
||||||
|
|
||||||
<demo name="Experiments/Placeholder" />
|
|
||||||
@@ -215,6 +215,7 @@
|
|||||||
link: /api/extensions/history
|
link: /api/extensions/history
|
||||||
- title: Placeholder
|
- title: Placeholder
|
||||||
link: /api/extensions/placeholder
|
link: /api/extensions/placeholder
|
||||||
|
type: new
|
||||||
- title: TextAlign
|
- title: TextAlign
|
||||||
link: /api/extensions/text-align
|
link: /api/extensions/text-align
|
||||||
- title: Typography
|
- title: Typography
|
||||||
|
|||||||
Reference in New Issue
Block a user