mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-06 03:49:56 +08:00
fix(editor): footnote popup style and position issues (#11771)
Close [BS-3049](https://linear.app/affine-design/issue/BS-3049/chat引用的样式坏了) [BS-3024](https://linear.app/affine-design/issue/BS-3024/footnote-在容器边缘时,hover-抽搐)
This commit is contained in:
@@ -29,13 +29,23 @@ export const markdownFootnoteReferenceToDeltaMatcher =
|
||||
const footnoteReference = FootNoteReferenceParamsSchema.parse(
|
||||
footnoteDefinitionJson
|
||||
);
|
||||
|
||||
// If the footnote reference is an attachment, and the file type is not set,
|
||||
// Try to infer the file type from the file name.
|
||||
const { type: referenceType, fileName, fileType } = footnoteReference;
|
||||
if (referenceType === 'attachment' && fileName && !fileType) {
|
||||
const ext = fileName.split('.').pop()?.toLowerCase();
|
||||
if (ext) {
|
||||
footnoteReference.fileType = ext;
|
||||
}
|
||||
}
|
||||
|
||||
const footnote = {
|
||||
label: ast.identifier,
|
||||
reference: footnoteReference,
|
||||
};
|
||||
return [{ insert: ' ', attributes: { footnote } }];
|
||||
} catch (error) {
|
||||
console.warn('Error parsing footnote reference', error);
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user