mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-18 23:07:02 +08:00
fix(editor): extra line breaks and spaces when parsing table from html (#10190)
close: BS-2562, BS-2569
This commit is contained in:
@@ -41,7 +41,7 @@ export const tableBlockHtmlAdapterMatcher: BlockHtmlAdapterMatcher = {
|
||||
},
|
||||
'children'
|
||||
);
|
||||
walkerContext.skipChildren();
|
||||
walkerContext.skipAllChildren();
|
||||
}
|
||||
},
|
||||
leave: (o, context) => {
|
||||
|
||||
@@ -35,7 +35,7 @@ export const tableBlockMarkdownAdapterMatcher: BlockMarkdownAdapterMatcher = {
|
||||
},
|
||||
'children'
|
||||
);
|
||||
walkerContext.skipChildren();
|
||||
walkerContext.skipAllChildren();
|
||||
}
|
||||
},
|
||||
leave: (o, context) => {
|
||||
|
||||
@@ -91,7 +91,7 @@ export const processTable = (
|
||||
};
|
||||
const getTextFromElement = (element: ElementContent): string => {
|
||||
if (element.type === 'text') {
|
||||
return element.value;
|
||||
return element.value.trim();
|
||||
}
|
||||
if (element.type === 'element') {
|
||||
return element.children.map(child => getTextFromElement(child)).join('');
|
||||
|
||||
Reference in New Issue
Block a user