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

This commit is contained in:
Hans Pagel
2020-10-30 20:11:28 +01:00
36 changed files with 563 additions and 149 deletions

View File

@@ -161,7 +161,7 @@ export default {
}
</script>
<style lang="scss" scoped>
<style lang="scss">
/* A list of all available users */
.collaboration-users {
margin-top: 0.5rem;

View File

@@ -101,7 +101,7 @@ export default {
}
</script>
<style lang="scss" scoped>
<style lang="scss">
.export {
padding: 1rem 0 0;

View File

@@ -58,7 +58,7 @@ export default {
}
</script>
<style lang="scss" scoped>
<style lang="scss">
.has-focus {
border-radius: 3px;
box-shadow: 0 0 0 3px #3ea4ffe6;

View File

@@ -52,7 +52,7 @@ export default {
}
</script>
<style lang="scss" scoped>
<style lang="scss">
.checkbox {
margin-bottom: 1rem;

View File

@@ -61,7 +61,7 @@ export default {
}
</script>
<style lang="scss" scoped>
<style lang="scss">
/* Give a remote user a caret */
.collaboration-cursor__caret {
position: relative;

View File

@@ -11,26 +11,6 @@ import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
const CustomParagraph = Paragraph.extend({
addAttributes() {
return {
color: {
default: null,
parseHTML: element => {
return {
color: element.getAttribute('data-color'),
}
},
renderHTML: attributes => {
return {
style: `color: ${attributes.color}`,
}
},
},
}
},
})
export default {
components: {
EditorContent,
@@ -46,11 +26,11 @@ export default {
this.editor = new Editor({
extensions: [
Document(),
CustomParagraph(),
Paragraph(),
Text(),
],
content: `
<p data-color="blue">The Paragraph extension is not required, but its very likely you want to use it. Its needed to write paragraphs of text. 🤓</p>
<p>The Paragraph extension is not required, but its very likely you want to use it. Its needed to write paragraphs of text. 🤓</p>
`,
})
},

View File

@@ -0,0 +1,70 @@
<template>
<div v-if="editor">
<button @click="editor.chain().focus().taskList().run()" :class="{ 'is-active': editor.isActive('task_list') }">
task list
</button>
<editor-content :editor="editor" />
</div>
</template>
<script>
import { Editor } from '@tiptap/core'
import { EditorContent } from '@tiptap/vue'
import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
import TaskList from '@tiptap/extension-task-list'
import TaskItem from '@tiptap/extension-task-item'
export default {
components: {
EditorContent,
},
data() {
return {
editor: null,
}
},
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
TaskList(),
TaskItem(),
],
content: `
<ul data-type="task_list">
<li data-type="task_item" data-checked="true">A list item</li>
<li data-type="task_item" data-checked="false">And another one</li>
</ul>
`,
})
},
beforeDestroy() {
this.editor.destroy()
},
}
</script>
<style lang="scss">
ul[data-type="task_list"] {
list-style: none;
padding: 0;
li {
display: flex;
align-items: center;
> input {
flex: 0 0 auto;
margin-right: 0.5rem;
}
}
}
</style>

View File

@@ -9,8 +9,13 @@ npm install @tiptap/extension-image
yarn add @tiptap/extension-image
```
## Settings
| Option | Type | Default | Description |
| ------ | ------- | ------- | ------------------------ |
| inline | boolean | false | Renders the node inline. |
## Source code
[packages/extension-image/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-image/)
## Usage
<demo name="Extensions/Image" highlight="12,30" />
<demo name="Extensions/Image" />

View File

@@ -0,0 +1,31 @@
# TaskList
This extension enables you to use task lists in the editor. They are rendered as `<ul>` HTML tags.
## Installation
::: warning Use with TaskItem
The `TaskList` extension is intended to be used with the [`TaskItem`](/api/extensions/task-item) extension. Make sure to import that one too, otherwise youll get a SyntaxError.
:::
```bash
# With npm
npm install @tiptap/extension-task-list @tiptap/extension-task-item
# Or: With Yarn
yarn add @tiptap/extension-task-list @tiptap/extension-task-item
```
## Settings
| Option | Type | Default | Description |
| ------ | ------ | ------- | -------------------------------------------- |
| class | string | | Add a custom class to the rendered HTML tag. |
## Commands
| Command | Options | Description |
| -------- | ------- | ------------------- |
| taskList | — | Toggle a task list. |
## Source code
[packages/extension-task-list/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-task-list/)
## Usage
<demo name="Extensions/TaskList" />

View File

@@ -214,6 +214,10 @@ export default {
const { currentPath } = this
const filePath = currentPath === '' ? '/introduction' : currentPath
if (process.env.NODE_ENV === 'development') {
return `vscode://file${this.cwd}/src/docPages${filePath}.md`
}
return `https://github.com/ueberdosis/tiptap-next/blob/main/docs/src/docPages${filePath}.md`
},
},

View File

@@ -158,6 +158,9 @@
# draft: true
- title: Strike
link: /api/extensions/strike
- title: TaskList
link: /api/extensions/task-list
draft: true
# - title: TableCell
# link: /api/extensions/table-cell
# draft: true

View File

@@ -95,6 +95,10 @@
> table a,
> .remark-container a {
text-decoration: underline;
code {
text-decoration: underline;
}
}
#toc {