mirror of
https://github.com/docmost/docmost.git
synced 2025-11-26 15:23:39 +10:00
preserve confluence table bg color
This commit is contained in:
Submodule apps/server/src/ee updated: ea6b8990a1...4a454317bf
@@ -2,33 +2,39 @@ import { TableCell as TiptapTableCell } from "@tiptap/extension-table-cell";
|
|||||||
|
|
||||||
export const TableCell = TiptapTableCell.extend({
|
export const TableCell = TiptapTableCell.extend({
|
||||||
name: "tableCell",
|
name: "tableCell",
|
||||||
content: "(paragraph | heading | bulletList | orderedList | taskList | blockquote | callout | image | video | attachment | mathBlock | details | codeBlock)+",
|
content:
|
||||||
|
"(paragraph | heading | bulletList | orderedList | taskList | blockquote | callout | image | video | attachment | mathBlock | details | codeBlock)+",
|
||||||
|
|
||||||
addAttributes() {
|
addAttributes() {
|
||||||
return {
|
return {
|
||||||
...this.parent?.(),
|
...this.parent?.(),
|
||||||
backgroundColor: {
|
backgroundColor: {
|
||||||
default: null,
|
default: null,
|
||||||
parseHTML: (element) => element.style.backgroundColor || null,
|
parseHTML: (element) =>
|
||||||
|
element.style.backgroundColor ||
|
||||||
|
element.getAttribute("data-background-color") ||
|
||||||
|
null,
|
||||||
renderHTML: (attributes) => {
|
renderHTML: (attributes) => {
|
||||||
if (!attributes.backgroundColor) {
|
if (!attributes.backgroundColor) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
style: `background-color: ${attributes.backgroundColor}`,
|
style: `background-color: ${attributes.backgroundColor}`,
|
||||||
'data-background-color': attributes.backgroundColor,
|
"data-background-color": attributes.backgroundColor,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
backgroundColorName: {
|
backgroundColorName: {
|
||||||
default: null,
|
default: null,
|
||||||
parseHTML: (element) => element.getAttribute('data-background-color-name') || null,
|
parseHTML: (element) =>
|
||||||
|
element.getAttribute("data-background-color-name") || null,
|
||||||
renderHTML: (attributes) => {
|
renderHTML: (attributes) => {
|
||||||
if (!attributes.backgroundColorName) {
|
if (!attributes.backgroundColorName) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
'data-background-color-name': attributes.backgroundColorName.toLowerCase(),
|
"data-background-color-name":
|
||||||
|
attributes.backgroundColorName.toLowerCase(),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,33 +2,39 @@ import { TableHeader as TiptapTableHeader } from "@tiptap/extension-table-header
|
|||||||
|
|
||||||
export const TableHeader = TiptapTableHeader.extend({
|
export const TableHeader = TiptapTableHeader.extend({
|
||||||
name: "tableHeader",
|
name: "tableHeader",
|
||||||
content: "(paragraph | heading | bulletList | orderedList | taskList | blockquote | callout | image | video | attachment | mathBlock | details | codeBlock)+",
|
content:
|
||||||
|
"(paragraph | heading | bulletList | orderedList | taskList | blockquote | callout | image | video | attachment | mathBlock | details | codeBlock)+",
|
||||||
|
|
||||||
addAttributes() {
|
addAttributes() {
|
||||||
return {
|
return {
|
||||||
...this.parent?.(),
|
...this.parent?.(),
|
||||||
backgroundColor: {
|
backgroundColor: {
|
||||||
default: null,
|
default: null,
|
||||||
parseHTML: (element) => element.style.backgroundColor || null,
|
parseHTML: (element) =>
|
||||||
|
element.style.backgroundColor ||
|
||||||
|
element.getAttribute("data-background-color") ||
|
||||||
|
null,
|
||||||
renderHTML: (attributes) => {
|
renderHTML: (attributes) => {
|
||||||
if (!attributes.backgroundColor) {
|
if (!attributes.backgroundColor) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
style: `background-color: ${attributes.backgroundColor}`,
|
style: `background-color: ${attributes.backgroundColor}`,
|
||||||
'data-background-color': attributes.backgroundColor,
|
"data-background-color": attributes.backgroundColor,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
backgroundColorName: {
|
backgroundColorName: {
|
||||||
default: null,
|
default: null,
|
||||||
parseHTML: (element) => element.getAttribute('data-background-color-name') || null,
|
parseHTML: (element) =>
|
||||||
|
element.getAttribute("data-background-color-name") || null,
|
||||||
renderHTML: (attributes) => {
|
renderHTML: (attributes) => {
|
||||||
if (!attributes.backgroundColorName) {
|
if (!attributes.backgroundColorName) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
'data-background-color-name': attributes.backgroundColorName.toLowerCase(),
|
"data-background-color-name":
|
||||||
|
attributes.backgroundColorName.toLowerCase(),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user