Merge branch 'main' of github.com:ueberdosis/tiptap-next into main

This commit is contained in:
Hans Pagel
2021-03-25 09:48:56 +01:00
46 changed files with 455 additions and 525 deletions

View File

@@ -0,0 +1,29 @@
# Placeholder
[![Version](https://img.shields.io/npm/v/@tiptap/extension-placeholder.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-placeholder)
[![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-placeholder.svg)](https://npmcharts.com/compare/@tiptap/extension-placeholder?minimal=true)
This extension provides placeholder support.
## Installation
```bash
# with npm
npm install @tiptap/extension-placeholder
# with Yarn
yarn add @tiptap/extension-placeholder
```
## Settings
| Option | Type | Default | Description |
| -------------------- | ------------------- | --------------------- | ----------------------------------------------------------- |
| emptyEditorClass | `String` | `'is-editor-empty'` | The added CSS class if the editor is empty. |
| emptyNodeClass | `String` | `'is-empty'` | The added CSS class if the node is empty. |
| placeholder | `String | Function` | `'Write something …'` | The placeholder text added as `data-placeholder` attribute. |
| showOnlyWhenEditable | `Boolean` | `true` | Show decorations only when editor is editable. |
| showOnlyCurrent | `Boolean` | `true` | Show decorations only in currently selected node. |
## Source code
[packages/extension-placeholder/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-placeholder/)
## Usage
<demo name="Extensions/Placeholder" />

View File

@@ -8,6 +8,3 @@ Congratulations! Youve found our playground with a list of experiments. Be aw
* [@tiptap/extension-iframe?](/experiments/embeds)
* [@tiptap/extension-toggle-list?](/experiments/details)
* [@tiptap/extension-collaboration-annotation](/experiments/collaboration-annotation)
## Waiting for approval
* [@tiptap/extension-placeholder](/experiments/placeholder)

View File

@@ -105,6 +105,7 @@ export default {
NodeViewContent,
},
}
</script>
```
You dont need to add those `class` attributes, feel free to remove them or pass other class names. Try it out in the following example:

View File

@@ -173,10 +173,9 @@ export default {
this.editor = new Editor({
content: this.modelValue,
extensions: defaultExtensions(),
})
this.editor.on('update', () => {
this.$emit('update:modelValue', this.editor.getHTML())
onUpdate: () => {
this.$emit('update:modelValue', this.editor.getHTML())
},
})
},