Assign replacements
This commit is contained in:
parent
e29d9db2e7
commit
c74d6c6fff
3 changed files with 41 additions and 5 deletions
|
@ -36,6 +36,7 @@ import { ExportTypes } from "./exportUtils";
|
|||
import { IExportOptions } from "./exportUtils";
|
||||
import MatrixClientContext from "../../contexts/MatrixClientContext";
|
||||
import getExportCSS from "./exportCSS";
|
||||
import { textForEvent } from "../../TextForEvent";
|
||||
|
||||
export default class HTMLExporter extends Exporter {
|
||||
protected avatars: Map<string, boolean>;
|
||||
|
@ -346,13 +347,16 @@ export default class HTMLExporter extends Exporter {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
eventTile = await this.getEventTileMarkup(this.createModifiedEvent(this.mediaOmitText, mxEv), joined);
|
||||
eventTile = await this.getEventTileMarkup(
|
||||
this.createModifiedEvent(this.mediaOmitText, mxEv),
|
||||
joined,
|
||||
);
|
||||
}
|
||||
} else eventTile = await this.getEventTileMarkup(mxEv, joined);
|
||||
} catch (e) {
|
||||
// TODO: Handle callEvent errors
|
||||
console.error(e);
|
||||
eventTile = await this.getEventTileMarkup(this.createModifiedEvent("Error parsing HTML", mxEv), joined);
|
||||
eventTile = await this.getEventTileMarkup(this.createModifiedEvent(textForEvent(mxEv), mxEv), joined);
|
||||
}
|
||||
|
||||
return eventTile;
|
||||
|
|
|
@ -20,6 +20,7 @@ import ThemeWatcher from "../../settings/watchers/ThemeWatcher";
|
|||
|
||||
const getExportCSS = async (): Promise<string> => {
|
||||
const theme = new ThemeWatcher().getEffectiveTheme();
|
||||
// eslint-disable-next-line camelcase
|
||||
const hash = __webpack_hash__;
|
||||
const bundle = await fetch(`bundles/${hash}/bundle.css`);
|
||||
const bundleCSS = await bundle.text();
|
||||
|
@ -32,13 +33,14 @@ const getExportCSS = async (): Promise<string> => {
|
|||
themeCSS = await res.text();
|
||||
}
|
||||
const fontFaceRegex = /@font-face {.*?}/sg;
|
||||
themeCSS.replace(fontFaceRegex, '');
|
||||
themeCSS.replace(
|
||||
|
||||
themeCSS = themeCSS.replace(fontFaceRegex, '');
|
||||
themeCSS = themeCSS.replace(
|
||||
/font-family: Inter/g,
|
||||
`font-family: -apple-system, BlinkMacSystemFont, avenir next,
|
||||
avenir, segoe ui, helvetica neue, helvetica, Ubuntu, roboto, noto, arial, sans-serif`,
|
||||
);
|
||||
themeCSS.replace(
|
||||
themeCSS = themeCSS.replace(
|
||||
/font-family: Inconsolata/g,
|
||||
"font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace",
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue