feat: parseHTML for attributes should return the value instead of an object now, fix #1863

This commit is contained in:
Philipp Kühn
2021-09-08 23:53:44 +02:00
parent d3285e9308
commit 8a3b47a529
17 changed files with 38 additions and 92 deletions

View File

@@ -16,11 +16,7 @@ const CustomTableCell = TableCell.extend({
// and add a new one …
backgroundColor: {
default: null,
parseHTML: element => {
return {
backgroundColor: element.getAttribute('data-background-color'),
}
},
parseHTML: element => element.getAttribute('data-background-color'),
renderHTML: attributes => {
return {
'data-background-color': attributes.backgroundColor,
@@ -36,7 +32,7 @@ export const tableHTML = `
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>

View File

@@ -76,11 +76,7 @@ const CustomTableCell = TableCell.extend({
// and add a new one …
backgroundColor: {
default: null,
parseHTML: element => {
return {
backgroundColor: element.getAttribute('data-background-color'),
}
},
parseHTML: element => element.getAttribute('data-background-color'),
renderHTML: attributes => {
return {
'data-background-color': attributes.backgroundColor,

View File

@@ -42,11 +42,7 @@ export default Node.create({
},
allowfullscreen: {
default: this.options.allowFullscreen,
parseHTML: () => {
return {
allowfullscreen: this.options.allowFullscreen,
}
},
parseHTML: () => this.options.allowFullscreen,
},
}
},

View File

@@ -57,29 +57,17 @@ export const Figure = Node.create<FigureOptions>({
return {
src: {
default: null,
parseHTML: element => {
return {
src: element.querySelector('img')?.getAttribute('src'),
}
},
parseHTML: element => element.querySelector('img')?.getAttribute('src'),
},
alt: {
default: null,
parseHTML: element => {
return {
alt: element.querySelector('img')?.getAttribute('alt'),
}
},
parseHTML: element => element.querySelector('img')?.getAttribute('alt'),
},
title: {
default: null,
parseHTML: element => {
return {
title: element.querySelector('img')?.getAttribute('title'),
}
},
parseHTML: element => element.querySelector('img')?.getAttribute('title'),
},
}
},