Improve patch regex

This commit is contained in:
TheGreenPig 2024-09-15 00:25:48 +02:00
parent 5750a9cc48
commit ecbd6ceb1d

View file

@ -66,7 +66,7 @@ function FilePreview({ attachment }: { attachment: Attachment; }) {
if (!previewBlobUrl) return null; if (!previewBlobUrl) return null;
return previewBlobUrl && <div className={"file-viewer container"} id={`file-viewer-${stripLink(attachment.url)}`}><embed src={previewBlobUrl} className="file-viewer preview" title={attachment.filename} /></div>; return <div className={"file-viewer container"} id={`file-viewer-${stripLink(attachment.url)}`}><embed src={previewBlobUrl} className="file-viewer preview" title={attachment.filename} /></div>;
} }
async function buildCss() { async function buildCss() {
@ -151,8 +151,8 @@ export default definePlugin({
{ {
find: "Messages.IMG_ALT_ATTACHMENT_FILE_TYPE.format", find: "Messages.IMG_ALT_ATTACHMENT_FILE_TYPE.format",
replacement: { replacement: {
match: /function\((.+?)\)(.+Fragment.{0,500}newMosaicStyle.{0,500}?children:\[)(.+?\])/, match: /newMosaicStyle,\i\),children:\[(?<=}=(\i);.+?)/,
replace: "function($1)$2$self.renderPreviewButton($1),$3" replace: "$&$self.renderPreviewButton($1),"
} }
} }
], ],