This commit is contained in:
1 parent
71c59837eb
commit
3c628e404d
2 files changed
+10
-4
No files matched your search
+1
-1
@@ -672,7 +672,7 @@ body.single-col .post-list {
|
||||
.article-content th,
|
||||
.article-content td {
|
||||
border: 1px solid var(--border-color);
|
||||
padding: 0.6rem 1rem;
|
||||
padding: 0.3rem 0.8rem;
|
||||
}
|
||||
|
||||
.article-content th {
|
||||
|
||||
@@ -223,7 +223,7 @@ class TablePreviewWidget extends WidgetType {
|
||||
// Basic markdown parsing for links and strong could be done here, but textContent is safer
|
||||
td.textContent = col;
|
||||
td.style.border = '1px solid var(--border-color, #e5e7eb)';
|
||||
td.style.padding = '0.6rem 1rem';
|
||||
td.style.padding = '0.3rem 0.8rem';
|
||||
td.style.textAlign = alignments[colIndex] || 'left';
|
||||
if (isHeader) {
|
||||
td.style.backgroundColor = 'rgba(0, 0, 0, 0.03)';
|
||||
@@ -266,14 +266,20 @@ function getTableDecorations(state: EditorState) {
|
||||
node.to === currentTableRange.to;
|
||||
|
||||
if (!isCurrent) {
|
||||
const tableStr = state.doc.sliceString(node.from, node.to);
|
||||
// Ensure block replace decorations cover entire lines
|
||||
const startLine = state.doc.lineAt(node.from);
|
||||
const endLine = state.doc.lineAt(node.to);
|
||||
const from = startLine.from;
|
||||
const to = endLine.to;
|
||||
|
||||
const tableStr = state.doc.sliceString(from, to);
|
||||
// Skip malformed tables or empty ones
|
||||
if (tableStr.trim().length > 0) {
|
||||
const deco = Decoration.replace({
|
||||
widget: new TablePreviewWidget(tableStr),
|
||||
block: true
|
||||
});
|
||||
widgets.push(deco.range(node.from, node.to));
|
||||
widgets.push(deco.range(from, to));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user