add more content

This commit is contained in:
Hans Pagel
2020-11-05 22:16:18 +01:00
parent f946954e91
commit e90934aa96
8 changed files with 163 additions and 46 deletions

View File

@@ -0,0 +1,5 @@
context('/examples/todo-app', () => {
before(() => {
cy.visit('/examples/todo-app')
})
})

View File

@@ -0,0 +1,70 @@
<template>
<div v-if="editor">
<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'
const CustomDocument = Document.extend({
content: 'taskList',
})
export default {
components: {
EditorContent,
},
data() {
return {
editor: null,
}
},
mounted() {
this.editor = new Editor({
extensions: [
CustomDocument(),
Paragraph(),
Text(),
TaskList(),
TaskItem(),
],
content: `
<ul data-type="task_list">
<li data-type="taskItem" data-checked="true">A list item</li>
<li data-type="taskItem" data-checked="false">And another one</li>
</ul>
`,
})
},
beforeDestroy() {
this.editor.destroy()
},
}
</script>
<style lang="scss">
ul[data-type="taskList"] {
list-style: none;
padding: 0;
li {
display: flex;
align-items: center;
> input {
flex: 0 0 auto;
margin-right: 0.5rem;
}
}
}
</style>

View File

@@ -0,0 +1,5 @@
context('/api/nodes/task-item', () => {
before(() => {
cy.visit('/api/nodes/task-item')
})
})

View File

@@ -0,0 +1,66 @@
<template>
<div v-if="editor">
<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="taskItem" data-checked="true">A list item</li>
<li data-type="taskItem" data-checked="false">And another one</li>
</ul>
`,
})
},
beforeDestroy() {
this.editor.destroy()
},
}
</script>
<style lang="scss">
ul[data-type="taskList"] {
list-style: none;
padding: 0;
li {
display: flex;
align-items: center;
> input {
flex: 0 0 auto;
margin-right: 0.5rem;
}
}
}
</style>

View File

@@ -5,11 +5,16 @@
## Introduction ## Introduction
tiptap comes with sensible keyboard shortcut defaults. Depending on what you want to use it for, youll probably want to change those keyboard shortcuts to your liking. Lets have a look at what we defined for you, and show you how to change it then! tiptap comes with sensible keyboard shortcut defaults. Depending on what you want to use it for, youll probably want to change those keyboard shortcuts to your liking. Lets have a look at what we defined for you, and show you how to change it then!
Funfact: A while ago, we built a [keyboard shortcut learning app](https://mouseless.app), to which we manually added exercises for thousands of keyboard shortcuts for a bunch of tools. Funfact: We built a [keyboard shortcut learning app](https://mouseless.app), to which we manually added exercises for thousands of keyboard shortcuts for a bunch of tools.
## Predefined keyboard shortcuts ## Predefined keyboard shortcuts
Most of the core extensions register their own keyboard shortcuts. Depending on what set of extension you use, not all of the below listed keyboard shortcuts work for your editor. Most of the core extensions register their own keyboard shortcuts. Depending on what set of extension you use, not all of the below listed keyboard shortcuts work for your editor.
### Ideas
* Task List ⌥⌘L (iaWriter)
* Mark Task Complete ⌘. (iaWriter)
* Text Highlight ⌘E (Paper)
### Essentials ### Essentials
❌ = untested ❌ = untested

View File

@@ -1,4 +1,7 @@
# TaskItem # TaskItem
This extension renders a task item list element, which is a `<li>` tag with a `data-type` attribute set to `taskItem`. It also renders a checkbox inside the list element, which updates a `checked` attribute.
This extension doesnt require any JavaScript framework, its based on plain JavaScript.
## Installation ## Installation
::: warning Use with TaskList ::: warning Use with TaskList
@@ -18,8 +21,8 @@ yarn add @tiptap/extension-task-list @tiptap/extension-task-item
| ------ | ------ | ------- | -------------------------------------------- | | ------ | ------ | ------- | -------------------------------------------- |
| class | string | | Add a custom class to the rendered HTML tag. | | class | string | | Add a custom class to the rendered HTML tag. |
## Commands ## Keyboard shortcuts
*None* * New list item: `Enter`
## Source code ## Source code
[packages/extension-task-item/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-task-item/) [packages/extension-task-item/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-task-item/)

View File

@@ -0,0 +1,3 @@
# Todo App
<demo name="Examples/TodoApp" highlight="" />

View File

@@ -18,59 +18,20 @@
link: /examples/collaborative-editing link: /examples/collaborative-editing
- title: Markdown shortcuts - title: Markdown shortcuts
link: /examples/markdown-shortcuts link: /examples/markdown-shortcuts
# - title: Menu Bubble
# link: /examples/menu-bubble
# draft: true
# - title: Floating Menu
# link: /examples/floating-menu
# draft: true
- title: Formatting - title: Formatting
link: /examples/formatting link: /examples/formatting
- title: Links - title: Links
link: /examples/links link: /examples/links
draft: true draft: true
# - title: Images - title: Todo App
# link: /examples/images link: /examples/todo-app
# draft: true draft: true
# - title: Hiding Menu Bar
# link: /examples/hiding-menu-bar
# draft: true
# - title: Todo List
# link: /examples/todo-list
# draft: true
# - title: Tables
# link: /examples/tables
# draft: true
# - title: Search and Replace
# link: /examples/search-and-replace
# draft: true
# - title: Suggestions
# link: /examples/suggestions
# draft: true
# - title: Code Highlighting
# link: /examples/code-highlighting
# draft: true
- title: History - title: History
link: /examples/history link: /examples/history
- title: Read-only - title: Read-only
link: /examples/read-only link: /examples/read-only
# - title: Embeds
# link: /examples/embeds
# draft: true
# - title: Placeholder
# link: /examples/placeholder
# draft: true
- title: Focus - title: Focus
link: /examples/focus link: /examples/focus
# - title: Title
# link: /examples/title
# draft: true
# - title: Trailing Paragraph
# link: /examples/trailing-paragraph
# draft: true
# - title: Drag Handle
# link: /examples/drag-handle
# draft: true
- title: Minimalist - title: Minimalist
link: /examples/minimalist link: /examples/minimalist
- title: Export HTML or JSON - title: Export HTML or JSON
@@ -136,7 +97,6 @@
link: /api/nodes/task-list link: /api/nodes/task-list
- title: TaskItem - title: TaskItem
link: /api/nodes/task-item link: /api/nodes/task-item
draft: true
- title: Text - title: Text
link: /api/nodes/text link: /api/nodes/text
- title: Marks - title: Marks