rename schema names

This commit is contained in:
Philipp Kühn 2020-11-03 20:57:09 +01:00
parent 50d1d6372e
commit 4ed01c41cb
12 changed files with 31 additions and 31 deletions

View File

@ -40,10 +40,10 @@
<button @click="editor.chain().focus().heading({ level: 6 }).run()" :class="{ 'is-active': editor.isActive('heading', { level: 6 }) }">
h6
</button>
<button @click="editor.chain().focus().bulletList().run()" :class="{ 'is-active': editor.isActive('bullet_list') }">
<button @click="editor.chain().focus().bulletList().run()" :class="{ 'is-active': editor.isActive('bulletList') }">
bullet list
</button>
<button @click="editor.chain().focus().orderedList().run()" :class="{ 'is-active': editor.isActive('ordered_list') }">
<button @click="editor.chain().focus().orderedList().run()" :class="{ 'is-active': editor.isActive('orderedList') }">
ordered list
</button>
<button @click="editor.chain().focus().codeBlock().run()" :class="{ 'is-active': editor.isActive('codeBlock') }">

View File

@ -1,6 +1,6 @@
<template>
<div v-if="editor">
<button @click="editor.chain().focus().bulletList().run()" :class="{ 'is-active': editor.isActive('bullet_list') }">
<button @click="editor.chain().focus().bulletList().run()" :class="{ 'is-active': editor.isActive('bulletList') }">
bullet list
</button>

View File

@ -1,9 +1,9 @@
<template>
<div v-if="editor">
<button @click="editor.chain().focus().bulletList().run()" :class="{ 'is-active': editor.isActive('bullet_list') }">
<button @click="editor.chain().focus().bulletList().run()" :class="{ 'is-active': editor.isActive('bulletList') }">
bullet list
</button>
<button @click="editor.chain().focus().orderedList().run()" :class="{ 'is-active': editor.isActive('ordered_list') }">
<button @click="editor.chain().focus().orderedList().run()" :class="{ 'is-active': editor.isActive('orderedList') }">
ordered list
</button>

View File

@ -1,6 +1,6 @@
<template>
<div v-if="editor">
<button @click="editor.chain().focus().orderedList().run()" :class="{ 'is-active': editor.isActive('ordered_list') }">
<button @click="editor.chain().focus().orderedList().run()" :class="{ 'is-active': editor.isActive('orderedList') }">
ordered list
</button>

View File

@ -12,15 +12,15 @@ context('/api/nodes/task-list', () => {
it('should parse unordered lists correctly', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.setContent('<ul data-type="task_list"><li data-checked="true" data-type="task_item"><p>Example Text</p></li></ul>')
expect(editor.getHTML()).to.eq('<ul data-type="task_list"><li data-checked="true" data-type="task_item"><p>Example Text</p></li></ul>')
editor.setContent('<ul data-type="task_list"><li data-checked="true" data-type="taskItem"><p>Example Text</p></li></ul>')
expect(editor.getHTML()).to.eq('<ul data-type="task_list"><li data-checked="true" data-type="taskItem"><p>Example Text</p></li></ul>')
})
})
it('should parse unordered lists without paragraphs correctly', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.setContent('<ul data-type="task_list"><li data-checked="false" data-type="task_item">Example Text</li></ul>')
expect(editor.getHTML()).to.eq('<ul data-type="task_list"><li data-checked="false" data-type="task_item"><p>Example Text</p></li></ul>')
editor.setContent('<ul data-type="task_list"><li data-checked="false" data-type="taskItem">Example Text</li></ul>')
expect(editor.getHTML()).to.eq('<ul data-type="task_list"><li data-checked="false" data-type="taskItem"><p>Example Text</p></li></ul>')
})
})

View File

@ -39,8 +39,8 @@ export default {
],
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>
<li data-type="taskItem" data-checked="true">A list item</li>
<li data-type="taskItem" data-checked="false">And another one</li>
</ul>
`,
})

View File

@ -24,7 +24,7 @@ yarn add @tiptap/extension-bullet-list @tiptap/extension-list-item
## Commands
| Command | Parameters | Description |
| ----------- | ---------- | --------------------- |
| bullet_list | — | Toggle a bullet list. |
| bulletList | — | Toggle a bullet list. |
## Keyboard shortcuts
* `Control`&nbsp;`Shift`&nbsp;`8`

View File

@ -4,11 +4,11 @@ import { wrappingInputRule } from 'prosemirror-inputrules'
export const inputRegex = /^\s*([-+*])\s$/
const BulletList = createNode({
name: 'bullet_list',
name: 'bulletList',
group: 'block list',
content: 'list_item+',
content: 'listItem+',
parseHTML() {
return [
@ -23,7 +23,7 @@ const BulletList = createNode({
addCommands() {
return {
bulletList: (): Command => ({ commands }) => {
return commands.toggleList('bullet_list', 'list_item')
return commands.toggleList('bulletList', 'listItem')
},
}
},

View File

@ -1,7 +1,7 @@
import { createNode } from '@tiptap/core'
const ListItem = createNode({
name: 'list_item',
name: 'listItem',
content: '(paragraph|list?)+',
@ -21,9 +21,9 @@ const ListItem = createNode({
addKeyboardShortcuts() {
return {
Enter: () => this.editor.splitListItem('list_item'),
Tab: () => this.editor.sinkListItem('list_item'),
'Shift-Tab': () => this.editor.liftListItem('list_item'),
Enter: () => this.editor.splitListItem('listItem'),
Tab: () => this.editor.sinkListItem('listItem'),
'Shift-Tab': () => this.editor.liftListItem('listItem'),
}
},
})

View File

@ -4,11 +4,11 @@ import { wrappingInputRule } from 'prosemirror-inputrules'
export const inputRegex = /^(\d+)\.\s$/
const OrderedList = createNode({
name: 'ordered_list',
name: 'orderedList',
group: 'block list',
content: 'list_item+',
content: 'listItem+',
addAttributes() {
return {
@ -42,7 +42,7 @@ const OrderedList = createNode({
addCommands() {
return {
orderedList: (): Command => ({ commands }) => {
return commands.toggleList('ordered_list', 'list_item')
return commands.toggleList('orderedList', 'listItem')
},
}
},

View File

@ -8,7 +8,7 @@ export interface TaskItemOptions {
}
const TaskItem = createNode({
name: 'task_item',
name: 'taskItem',
content() {
return this.options.nested ? '(paragraph|task_list)+' : 'paragraph+'
@ -37,20 +37,20 @@ const TaskItem = createNode({
parseHTML() {
return [
{
tag: 'li[data-type="task_item"]',
tag: 'li[data-type="taskItem"]',
priority: 51,
},
]
},
renderHTML({ attributes }) {
return ['li', mergeAttributes(attributes, { 'data-type': 'task_item' }), 0]
return ['li', mergeAttributes(attributes, { 'data-type': 'taskItem' }), 0]
},
addKeyboardShortcuts() {
const shortcuts = {
Enter: () => this.editor.splitListItem('task_item'),
'Shift-Tab': () => this.editor.liftListItem('task_item'),
Enter: () => this.editor.splitListItem('taskItem'),
'Shift-Tab': () => this.editor.liftListItem('taskItem'),
}
if (!this.options.nested) {
@ -59,7 +59,7 @@ const TaskItem = createNode({
return {
...shortcuts,
Tab: () => this.editor.sinkListItem('task_item'),
Tab: () => this.editor.sinkListItem('taskItem'),
}
},

View File

@ -5,7 +5,7 @@ const TaskList = createNode({
group: 'block list',
content: 'task_item+',
content: 'taskItem+',
parseHTML() {
return [
@ -23,7 +23,7 @@ const TaskList = createNode({
addCommands() {
return {
taskList: (): Command => ({ commands }) => {
return commands.toggleList('task_list', 'task_item')
return commands.toggleList('task_list', 'taskItem')
},
}
},