Merge branch 'main' of github.com:ueberdosis/tiptap-next into main
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
export default function (Vue, options, context) {
|
||||
|
||||
Vue.mixin({
|
||||
data() {
|
||||
return {
|
||||
cwd: options.cwd,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
context.router.afterEach(to => {
|
||||
if (to.hash) {
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -52,6 +52,10 @@ const globby = require('globby')
|
||||
|
||||
module.exports = function (api) {
|
||||
|
||||
api.setClientOptions({
|
||||
cwd: process.cwd(),
|
||||
})
|
||||
|
||||
api.loadSource(({ addCollection }) => {
|
||||
const appCollection = addCollection({ typeName: 'Package' })
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -101,7 +101,7 @@ export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style lang="scss">
|
||||
.export {
|
||||
padding: 1rem 0 0;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -52,7 +52,7 @@ export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style lang="scss">
|
||||
.checkbox {
|
||||
margin-bottom: 1rem;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 it’s very likely you want to use it. It’s needed to write paragraphs of text. 🤓</p>
|
||||
<p>The Paragraph extension is not required, but it’s very likely you want to use it. It’s needed to write paragraphs of text. 🤓</p>
|
||||
`,
|
||||
})
|
||||
},
|
||||
|
||||
70
docs/src/demos/Extensions/TaskList/index.vue
Normal file
70
docs/src/demos/Extensions/TaskList/index.vue
Normal 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>
|
||||
@@ -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" />
|
||||
|
||||
31
docs/src/docPages/api/extensions/task-list.md
Normal file
31
docs/src/docPages/api/extensions/task-list.md
Normal 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 you’ll 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" />
|
||||
@@ -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`
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -95,6 +95,10 @@
|
||||
> table a,
|
||||
> .remark-container a {
|
||||
text-decoration: underline;
|
||||
|
||||
code {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
#toc {
|
||||
|
||||
Reference in New Issue
Block a user