Merge branch 'main' of github.com:ueberdosis/tiptap-next into main
This commit is contained in:
@@ -53,7 +53,7 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
ul[data-type="task_list"] {
|
ul[data-type="taskList"] {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ import Text from '@tiptap/extension-text'
|
|||||||
|
|
||||||
new Editor({
|
new Editor({
|
||||||
extensions: [
|
extensions: [
|
||||||
Document(),
|
Document(),
|
||||||
Paragraph(),
|
Paragraph(),
|
||||||
Text(),
|
Text(),
|
||||||
// all your other extensions
|
// all your other extensions
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export default (attributeNames: string[] = []): Command => ({ tr, state, dispatc
|
|||||||
|
|
||||||
if (attribute && defaultValue !== undefined && dispatch) {
|
if (attribute && defaultValue !== undefined && dispatch) {
|
||||||
tr.setNodeMarkup(pos, undefined, {
|
tr.setNodeMarkup(pos, undefined, {
|
||||||
|
...node.attrs,
|
||||||
[name]: defaultValue,
|
[name]: defaultValue,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ export default (attributes: {}): Command => ({ tr, state, dispatch }) => {
|
|||||||
|
|
||||||
state.doc.nodesBetween(from, to, (node, pos) => {
|
state.doc.nodesBetween(from, to, (node, pos) => {
|
||||||
if (!node.type.isText && dispatch) {
|
if (!node.type.isText && dispatch) {
|
||||||
tr.setNodeMarkup(pos, undefined, attributes)
|
tr.setNodeMarkup(pos, undefined, {
|
||||||
|
...node.attrs,
|
||||||
|
...attributes,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const TaskItem = createNode({
|
|||||||
name: 'taskItem',
|
name: 'taskItem',
|
||||||
|
|
||||||
content() {
|
content() {
|
||||||
return this.options.nested ? '(paragraph|task_list)+' : 'paragraph+'
|
return this.options.nested ? '(paragraph|taskList)+' : 'paragraph+'
|
||||||
},
|
},
|
||||||
|
|
||||||
defining: true,
|
defining: true,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Command, createNode, mergeAttributes } from '@tiptap/core'
|
import { Command, createNode, mergeAttributes } from '@tiptap/core'
|
||||||
|
|
||||||
const TaskList = createNode({
|
const TaskList = createNode({
|
||||||
name: 'task_list',
|
name: 'taskList',
|
||||||
|
|
||||||
group: 'block list',
|
group: 'block list',
|
||||||
|
|
||||||
@@ -10,20 +10,20 @@ const TaskList = createNode({
|
|||||||
parseHTML() {
|
parseHTML() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
tag: 'ul[data-type="task_list"]',
|
tag: 'ul[data-type="taskList"]',
|
||||||
priority: 51,
|
priority: 51,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
renderHTML({ attributes }) {
|
renderHTML({ attributes }) {
|
||||||
return ['ul', mergeAttributes(attributes, { 'data-type': 'task_list' }), 0]
|
return ['ul', mergeAttributes(attributes, { 'data-type': 'taskList' }), 0]
|
||||||
},
|
},
|
||||||
|
|
||||||
addCommands() {
|
addCommands() {
|
||||||
return {
|
return {
|
||||||
taskList: (): Command => ({ commands }) => {
|
taskList: (): Command => ({ commands }) => {
|
||||||
return commands.toggleList('task_list', 'taskItem')
|
return commands.toggleList('taskList', 'taskItem')
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user