lexical-remark
Version:
This package contains Markdown helpers and functionality for Lexical using remark-parse.
20 lines (17 loc) • 472 B
text/typescript
import { AttachmentNode } from '../../extensions/attachments/node.js';
import { Attachment } from '../../types.js';
import { Handler } from './index.js';
export const attachment: Handler<AttachmentNode> = (node) => {
const remarkNode: Attachment = {
children: [
{
type: 'text',
value: `📎 ${node.getFilename()}`,
},
],
filename: node.getFilename(),
type: 'attachment',
url: node.getURL(),
};
return remarkNode;
};