diff --git a/demos/src/Examples/Community/React/index.jsx b/demos/src/Examples/Community/React/index.jsx
index fdb6bf26..51bd1e33 100644
--- a/demos/src/Examples/Community/React/index.jsx
+++ b/demos/src/Examples/Community/React/index.jsx
@@ -28,7 +28,7 @@ export default () => {
],
content: `
- What do you all think about the new movie?
+ What do you all think about the new movie?
`,
})
diff --git a/demos/src/Examples/Community/Vue/index.vue b/demos/src/Examples/Community/Vue/index.vue
index 7c2647de..95d60eb8 100644
--- a/demos/src/Examples/Community/Vue/index.vue
+++ b/demos/src/Examples/Community/Vue/index.vue
@@ -79,7 +79,7 @@ export default {
],
content: `
- What do you all think about the new movie?
+ What do you all think about the new movie?
`,
})
diff --git a/demos/src/Nodes/Mention/React/index.jsx b/demos/src/Nodes/Mention/React/index.jsx
index 38c2bef9..adbd62a9 100644
--- a/demos/src/Nodes/Mention/React/index.jsx
+++ b/demos/src/Nodes/Mention/React/index.jsx
@@ -22,9 +22,9 @@ export default () => {
],
content: `
Hi everyone! Don’t forget the daily stand up at 8 AM.
- Would you mind to share what you’ve been working on lately? We fear not much happened since Dirty Dancing.
-
Let’s go through your most important points quickly.
- I have a meeting with and don’t want to come late.
+ Would you mind to share what you’ve been working on lately? We fear not much happened since Dirty Dancing.
+
Let’s go through your most important points quickly.
+ I have a meeting with and don’t want to come late.
– Thanks, your big boss
`,
})
diff --git a/demos/src/Nodes/Mention/Vue/index.vue b/demos/src/Nodes/Mention/Vue/index.vue
index f14a03de..2862e517 100644
--- a/demos/src/Nodes/Mention/Vue/index.vue
+++ b/demos/src/Nodes/Mention/Vue/index.vue
@@ -38,9 +38,9 @@ export default {
],
content: `
Hi everyone! Don’t forget the daily stand up at 8 AM.
- Would you mind to share what you’ve been working on lately? We fear not much happened since Dirty Dancing.
-
Let’s go through your most important points quickly.
- I have a meeting with and don’t want to come late.
+ Would you mind to share what you’ve been working on lately? We fear not much happened since Dirty Dancing.
+
Let’s go through your most important points quickly.
+ I have a meeting with and don’t want to come late.
– Thanks, your big boss
`,
})
diff --git a/packages/extension-blockquote/src/blockquote.ts b/packages/extension-blockquote/src/blockquote.ts
index 554ec1d4..734ab881 100644
--- a/packages/extension-blockquote/src/blockquote.ts
+++ b/packages/extension-blockquote/src/blockquote.ts
@@ -54,13 +54,13 @@ export const Blockquote = Node.create({
addCommands() {
return {
setBlockquote: () => ({ commands }) => {
- return commands.wrapIn('blockquote')
+ return commands.wrapIn(this.name)
},
toggleBlockquote: () => ({ commands }) => {
- return commands.toggleWrap('blockquote')
+ return commands.toggleWrap(this.name)
},
unsetBlockquote: () => ({ commands }) => {
- return commands.lift('blockquote')
+ return commands.lift(this.name)
},
}
},
diff --git a/packages/extension-bold/src/bold.ts b/packages/extension-bold/src/bold.ts
index 71c26e17..2593ad1f 100644
--- a/packages/extension-bold/src/bold.ts
+++ b/packages/extension-bold/src/bold.ts
@@ -65,13 +65,13 @@ export const Bold = Mark.create({
addCommands() {
return {
setBold: () => ({ commands }) => {
- return commands.setMark('bold')
+ return commands.setMark(this.name)
},
toggleBold: () => ({ commands }) => {
- return commands.toggleMark('bold')
+ return commands.toggleMark(this.name)
},
unsetBold: () => ({ commands }) => {
- return commands.unsetMark('bold')
+ return commands.unsetMark(this.name)
},
}
},
diff --git a/packages/extension-bullet-list/src/bullet-list.ts b/packages/extension-bullet-list/src/bullet-list.ts
index 08b05b66..4679cebb 100644
--- a/packages/extension-bullet-list/src/bullet-list.ts
+++ b/packages/extension-bullet-list/src/bullet-list.ts
@@ -43,7 +43,7 @@ export const BulletList = Node.create({
addCommands() {
return {
toggleBulletList: () => ({ commands }) => {
- return commands.toggleList('bulletList', 'listItem')
+ return commands.toggleList(this.name, 'listItem')
},
}
},
diff --git a/packages/extension-code-block/src/code-block.ts b/packages/extension-code-block/src/code-block.ts
index b19085a5..bf4568f6 100644
--- a/packages/extension-code-block/src/code-block.ts
+++ b/packages/extension-code-block/src/code-block.ts
@@ -91,10 +91,10 @@ export const CodeBlock = Node.create({
addCommands() {
return {
setCodeBlock: attributes => ({ commands }) => {
- return commands.setNode('codeBlock', attributes)
+ return commands.setNode(this.name, attributes)
},
toggleCodeBlock: attributes => ({ commands }) => {
- return commands.toggleNode('codeBlock', 'paragraph', attributes)
+ return commands.toggleNode(this.name, 'paragraph', attributes)
},
}
},
diff --git a/packages/extension-code/src/code.ts b/packages/extension-code/src/code.ts
index ea99ca67..a8b78b8e 100644
--- a/packages/extension-code/src/code.ts
+++ b/packages/extension-code/src/code.ts
@@ -57,13 +57,13 @@ export const Code = Mark.create({
addCommands() {
return {
setCode: () => ({ commands }) => {
- return commands.setMark('code')
+ return commands.setMark(this.name)
},
toggleCode: () => ({ commands }) => {
- return commands.toggleMark('code')
+ return commands.toggleMark(this.name)
},
unsetCode: () => ({ commands }) => {
- return commands.unsetMark('code')
+ return commands.unsetMark(this.name)
},
}
},
diff --git a/packages/extension-heading/src/heading.ts b/packages/extension-heading/src/heading.ts
index 346bcb9f..53625d58 100644
--- a/packages/extension-heading/src/heading.ts
+++ b/packages/extension-heading/src/heading.ts
@@ -71,14 +71,14 @@ export const Heading = Node.create({
return false
}
- return commands.setNode('heading', attributes)
+ return commands.setNode(this.name, attributes)
},
toggleHeading: attributes => ({ commands }) => {
if (!this.options.levels.includes(attributes.level)) {
return false
}
- return commands.toggleNode('heading', 'paragraph', attributes)
+ return commands.toggleNode(this.name, 'paragraph', attributes)
},
}
},
diff --git a/packages/extension-highlight/src/highlight.ts b/packages/extension-highlight/src/highlight.ts
index 8f8a8374..3d3b8af7 100644
--- a/packages/extension-highlight/src/highlight.ts
+++ b/packages/extension-highlight/src/highlight.ts
@@ -80,13 +80,13 @@ export const Highlight = Mark.create({
addCommands() {
return {
setHighlight: attributes => ({ commands }) => {
- return commands.setMark('highlight', attributes)
+ return commands.setMark(this.name, attributes)
},
toggleHighlight: attributes => ({ commands }) => {
- return commands.toggleMark('highlight', attributes)
+ return commands.toggleMark(this.name, attributes)
},
unsetHighlight: () => ({ commands }) => {
- return commands.unsetMark('highlight')
+ return commands.unsetMark(this.name)
},
}
},
diff --git a/packages/extension-italic/src/italic.ts b/packages/extension-italic/src/italic.ts
index 705f5b19..5aeae3a0 100644
--- a/packages/extension-italic/src/italic.ts
+++ b/packages/extension-italic/src/italic.ts
@@ -64,13 +64,13 @@ export const Italic = Mark.create({
addCommands() {
return {
setItalic: () => ({ commands }) => {
- return commands.setMark('italic')
+ return commands.setMark(this.name)
},
toggleItalic: () => ({ commands }) => {
- return commands.toggleMark('italic')
+ return commands.toggleMark(this.name)
},
unsetItalic: () => ({ commands }) => {
- return commands.unsetMark('italic')
+ return commands.unsetMark(this.name)
},
}
},
diff --git a/packages/extension-link/src/link.ts b/packages/extension-link/src/link.ts
index 108806c9..9caa9943 100644
--- a/packages/extension-link/src/link.ts
+++ b/packages/extension-link/src/link.ts
@@ -82,13 +82,13 @@ export const Link = Mark.create({
addCommands() {
return {
setLink: attributes => ({ commands }) => {
- return commands.setMark('link', attributes)
+ return commands.setMark(this.name, attributes)
},
toggleLink: attributes => ({ commands }) => {
- return commands.toggleMark('link', attributes, { extendEmptyMarkRange: true })
+ return commands.toggleMark(this.name, attributes, { extendEmptyMarkRange: true })
},
unsetLink: () => ({ commands }) => {
- return commands.unsetMark('link', { extendEmptyMarkRange: true })
+ return commands.unsetMark(this.name, { extendEmptyMarkRange: true })
},
}
},
@@ -120,7 +120,7 @@ export const Link = Mark.create({
key: new PluginKey('handleClickLink'),
props: {
handleClick: (view, pos, event) => {
- const attrs = this.editor.getAttributes('link')
+ const attrs = this.editor.getAttributes(this.name)
const link = (event.target as HTMLElement)?.closest('a')
if (link && attrs.href) {
diff --git a/packages/extension-list-item/src/list-item.ts b/packages/extension-list-item/src/list-item.ts
index 4845a623..cf3ea451 100644
--- a/packages/extension-list-item/src/list-item.ts
+++ b/packages/extension-list-item/src/list-item.ts
@@ -31,9 +31,9 @@ export const ListItem = Node.create({
addKeyboardShortcuts() {
return {
- Enter: () => this.editor.commands.splitListItem('listItem'),
- Tab: () => this.editor.commands.sinkListItem('listItem'),
- 'Shift-Tab': () => this.editor.commands.liftListItem('listItem'),
+ Enter: () => this.editor.commands.splitListItem(this.name),
+ Tab: () => this.editor.commands.sinkListItem(this.name),
+ 'Shift-Tab': () => this.editor.commands.liftListItem(this.name),
}
},
})
diff --git a/packages/extension-mention/src/mention.ts b/packages/extension-mention/src/mention.ts
index a50249cb..69ed1011 100644
--- a/packages/extension-mention/src/mention.ts
+++ b/packages/extension-mention/src/mention.ts
@@ -105,7 +105,7 @@ export const Mention = Node.create({
parseHTML() {
return [
{
- tag: 'span[data-mention]',
+ tag: `span[data-type="${this.name}"]`,
},
]
},
@@ -113,7 +113,7 @@ export const Mention = Node.create({
renderHTML({ node, HTMLAttributes }) {
return [
'span',
- mergeAttributes({ 'data-mention': '' }, this.options.HTMLAttributes, HTMLAttributes),
+ mergeAttributes({ 'data-type': this.name }, this.options.HTMLAttributes, HTMLAttributes),
this.options.renderLabel({
options: this.options,
node,
diff --git a/packages/extension-ordered-list/src/ordered-list.ts b/packages/extension-ordered-list/src/ordered-list.ts
index a57dae69..b6f64cb8 100644
--- a/packages/extension-ordered-list/src/ordered-list.ts
+++ b/packages/extension-ordered-list/src/ordered-list.ts
@@ -62,7 +62,7 @@ export const OrderedList = Node.create({
addCommands() {
return {
toggleOrderedList: () => ({ commands }) => {
- return commands.toggleList('orderedList', 'listItem')
+ return commands.toggleList(this.name, 'listItem')
},
}
},
diff --git a/packages/extension-paragraph/src/paragraph.ts b/packages/extension-paragraph/src/paragraph.ts
index bf146932..d442fd53 100644
--- a/packages/extension-paragraph/src/paragraph.ts
+++ b/packages/extension-paragraph/src/paragraph.ts
@@ -43,7 +43,7 @@ export const Paragraph = Node.create({
addCommands() {
return {
setParagraph: () => ({ commands }) => {
- return commands.setNode('paragraph')
+ return commands.setNode(this.name)
},
}
},
diff --git a/packages/extension-strike/src/strike.ts b/packages/extension-strike/src/strike.ts
index 5d8711b2..a232a39d 100644
--- a/packages/extension-strike/src/strike.ts
+++ b/packages/extension-strike/src/strike.ts
@@ -66,13 +66,13 @@ export const Strike = Mark.create({
addCommands() {
return {
setStrike: () => ({ commands }) => {
- return commands.setMark('strike')
+ return commands.setMark(this.name)
},
toggleStrike: () => ({ commands }) => {
- return commands.toggleMark('strike')
+ return commands.toggleMark(this.name)
},
unsetStrike: () => ({ commands }) => {
- return commands.unsetMark('strike')
+ return commands.unsetMark(this.name)
},
}
},
diff --git a/packages/extension-subscript/src/subscript.ts b/packages/extension-subscript/src/subscript.ts
index e99ff222..2861eeb6 100644
--- a/packages/extension-subscript/src/subscript.ts
+++ b/packages/extension-subscript/src/subscript.ts
@@ -58,13 +58,13 @@ export const Subscript = Mark.create({
addCommands() {
return {
setSubscript: () => ({ commands }) => {
- return commands.setMark('subscript')
+ return commands.setMark(this.name)
},
toggleSubscript: () => ({ commands }) => {
- return commands.toggleMark('subscript')
+ return commands.toggleMark(this.name)
},
unsetSubscript: () => ({ commands }) => {
- return commands.unsetMark('subscript')
+ return commands.unsetMark(this.name)
},
}
},
diff --git a/packages/extension-superscript/src/superscript.ts b/packages/extension-superscript/src/superscript.ts
index 6d3a1cba..f0b888e7 100644
--- a/packages/extension-superscript/src/superscript.ts
+++ b/packages/extension-superscript/src/superscript.ts
@@ -58,13 +58,13 @@ export const Superscript = Mark.create({
addCommands() {
return {
setSuperscript: () => ({ commands }) => {
- return commands.setMark('superscript')
+ return commands.setMark(this.name)
},
toggleSuperscript: () => ({ commands }) => {
- return commands.toggleMark('superscript')
+ return commands.toggleMark(this.name)
},
unsetSuperscript: () => ({ commands }) => {
- return commands.unsetMark('superscript')
+ return commands.unsetMark(this.name)
},
}
},
diff --git a/packages/extension-task-item/src/task-item.ts b/packages/extension-task-item/src/task-item.ts
index c11dc1e7..f0b309cb 100644
--- a/packages/extension-task-item/src/task-item.ts
+++ b/packages/extension-task-item/src/task-item.ts
@@ -39,7 +39,7 @@ export const TaskItem = Node.create({
parseHTML() {
return [
{
- tag: 'li[data-type="taskItem"]',
+ tag: `li[data-type="${this.name}"]`,
priority: 51,
},
]
@@ -51,7 +51,7 @@ export const TaskItem = Node.create({
mergeAttributes(
this.options.HTMLAttributes,
HTMLAttributes,
- { 'data-type': 'taskItem' },
+ { 'data-type': this.name },
),
[
'label',
@@ -75,8 +75,8 @@ export const TaskItem = Node.create({
addKeyboardShortcuts() {
const shortcuts = {
- Enter: () => this.editor.commands.splitListItem('taskItem'),
- 'Shift-Tab': () => this.editor.commands.liftListItem('taskItem'),
+ Enter: () => this.editor.commands.splitListItem(this.name),
+ 'Shift-Tab': () => this.editor.commands.liftListItem(this.name),
}
if (!this.options.nested) {
@@ -85,7 +85,7 @@ export const TaskItem = Node.create({
return {
...shortcuts,
- Tab: () => this.editor.commands.sinkListItem('taskItem'),
+ Tab: () => this.editor.commands.sinkListItem(this.name),
}
},
diff --git a/packages/extension-task-list/src/task-list.ts b/packages/extension-task-list/src/task-list.ts
index 2dfc0521..b317d76a 100644
--- a/packages/extension-task-list/src/task-list.ts
+++ b/packages/extension-task-list/src/task-list.ts
@@ -31,20 +31,20 @@ export const TaskList = Node.create({
parseHTML() {
return [
{
- tag: 'ul[data-type="taskList"]',
+ tag: `ul[data-type="${this.name}"]`,
priority: 51,
},
]
},
renderHTML({ HTMLAttributes }) {
- return ['ul', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { 'data-type': 'taskList' }), 0]
+ return ['ul', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { 'data-type': this.name }), 0]
},
addCommands() {
return {
toggleTaskList: () => ({ commands }) => {
- return commands.toggleList('taskList', 'taskItem')
+ return commands.toggleList(this.name, 'taskItem')
},
}
},
diff --git a/packages/extension-text-align/src/text-align.ts b/packages/extension-text-align/src/text-align.ts
index ce3109d9..40d52ae0 100644
--- a/packages/extension-text-align/src/text-align.ts
+++ b/packages/extension-text-align/src/text-align.ts
@@ -62,6 +62,7 @@ export const TextAlign = Extension.create({
return this.options.types.every(type => commands.updateAttributes(type, { textAlign: alignment }))
},
+
unsetTextAlign: () => ({ commands }) => {
return this.options.types.every(type => commands.resetAttributes(type, 'textAlign'))
},
diff --git a/packages/extension-text-style/src/text-style.ts b/packages/extension-text-style/src/text-style.ts
index 0fc9daf3..dc9454a2 100644
--- a/packages/extension-text-style/src/text-style.ts
+++ b/packages/extension-text-style/src/text-style.ts
@@ -59,7 +59,7 @@ export const TextStyle = Mark.create({
return true
}
- return commands.unsetMark('textStyle')
+ return commands.unsetMark(this.name)
},
}
},
diff --git a/packages/extension-underline/src/underline.ts b/packages/extension-underline/src/underline.ts
index 05344ac3..5403eb01 100644
--- a/packages/extension-underline/src/underline.ts
+++ b/packages/extension-underline/src/underline.ts
@@ -52,13 +52,13 @@ export const Underline = Mark.create({
addCommands() {
return {
setUnderline: () => ({ commands }) => {
- return commands.setMark('underline')
+ return commands.setMark(this.name)
},
toggleUnderline: () => ({ commands }) => {
- return commands.toggleMark('underline')
+ return commands.toggleMark(this.name)
},
unsetUnderline: () => ({ commands }) => {
- return commands.unsetMark('underline')
+ return commands.unsetMark(this.name)
},
}
},