mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 04:11:12 +00:00
Fixing
This commit is contained in:
parent
caeb27af08
commit
1ffa514dcc
8 changed files with 24 additions and 22 deletions
|
@ -50,7 +50,7 @@ export async function createSsrHtml(
|
|||
.toBuffer()
|
||||
.then(buf => buf.toString("base64"))}`
|
||||
: favIconPngUrl;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
console.log(
|
||||
"Could not fetch site logo for apple touch icon. Using default icon.",
|
||||
);
|
||||
|
|
|
@ -42,7 +42,7 @@ export default async function (site: Site) {
|
|||
} else {
|
||||
icons = generateDefaultIcons();
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
console.log(
|
||||
`Failed to fetch site logo for manifest icon. Using default icon`,
|
||||
);
|
||||
|
|
|
@ -13,8 +13,10 @@ interface EmojiPickerState {
|
|||
showPicker: boolean;
|
||||
}
|
||||
|
||||
function closeEmojiMartOnEsc(i, event): void {
|
||||
event.key === "Escape" && i.setState({ showPicker: false });
|
||||
function closeEmojiMartOnEsc(i: EmojiPicker, event: KeyboardEvent): void {
|
||||
if (event.key === "Escape") {
|
||||
i.setState({ showPicker: false });
|
||||
}
|
||||
}
|
||||
|
||||
@tippyMixin
|
||||
|
@ -72,9 +74,11 @@ export class EmojiPicker extends Component<EmojiPickerProps, EmojiPickerState> {
|
|||
e.preventDefault();
|
||||
i.setState({ showPicker: !i.state.showPicker });
|
||||
|
||||
i.state.showPicker
|
||||
? document.addEventListener("keyup", e => closeEmojiMartOnEsc(i, e))
|
||||
: document.removeEventListener("keyup", e => closeEmojiMartOnEsc(i, e));
|
||||
if (i.state.showPicker) {
|
||||
document.addEventListener("keyup", e => closeEmojiMartOnEsc(i, e));
|
||||
} else {
|
||||
document.removeEventListener("keyup", e => closeEmojiMartOnEsc(i, e));
|
||||
}
|
||||
}
|
||||
|
||||
handleEmojiClick(e: any) {
|
||||
|
|
|
@ -451,7 +451,7 @@ export class MarkdownTextArea extends Component<
|
|||
}));
|
||||
}),
|
||||
);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
errorOccurred = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,11 +57,13 @@ async function handleLoginSuccess(i: Login, loginRes: LoginResponse) {
|
|||
|
||||
const { prev } = i.props;
|
||||
|
||||
prev
|
||||
? i.props.history.replace(prev)
|
||||
: i.props.history.action === "PUSH"
|
||||
? i.props.history.back()
|
||||
: i.props.history.replace("/");
|
||||
if (prev) {
|
||||
i.props.history.replace(prev);
|
||||
} else if (i.props.history.action === "PUSH") {
|
||||
i.props.history.back();
|
||||
} else {
|
||||
i.props.history.replace("/");
|
||||
}
|
||||
|
||||
UnreadCounterService.Instance.updateAll();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { communitySearch, personSearch } from "@utils/app";
|
||||
import { isBrowser } from "@utils/browser";
|
||||
import { debounce, groupBy } from "@utils/helpers";
|
||||
import { CommunityTribute, PersonTribute } from "@utils/types";
|
||||
import { Picker } from "emoji-mart";
|
||||
|
@ -18,8 +17,7 @@ import markdown_it_highlightjs from "markdown-it-highlightjs/core";
|
|||
import { Renderer, Token } from "markdown-it";
|
||||
import { instanceLinkRegex, relTags } from "./config";
|
||||
import { lazyHighlightjs } from "./lazy-highlightjs";
|
||||
|
||||
export let Tribute: any;
|
||||
import Tribute from "tributejs";
|
||||
|
||||
export let md: MarkdownIt = new MarkdownIt();
|
||||
|
||||
|
@ -40,10 +38,6 @@ export let customEmojisLookup: Map<string, CustomEmojiView> = new Map<
|
|||
CustomEmojiView
|
||||
>();
|
||||
|
||||
if (isBrowser()) {
|
||||
Tribute = require("tributejs");
|
||||
}
|
||||
|
||||
export function mdToHtml(text: string, rerender: () => void) {
|
||||
return { __html: lazyHighlightjs.render(md, text, rerender) };
|
||||
}
|
||||
|
|
|
@ -37,7 +37,9 @@ export class UserService {
|
|||
showToast?: boolean;
|
||||
}) {
|
||||
if (isBrowser() && res.jwt) {
|
||||
showToast && toast(I18NextService.i18n.t("logged_in"));
|
||||
if (showToast) {
|
||||
toast(I18NextService.i18n.t("logged_in"));
|
||||
}
|
||||
setAuthCookie(res.jwt);
|
||||
this.#setAuthInfo();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ export default function (dateString?: string) {
|
|||
return formatDistanceStrict(parsed, new Date(), {
|
||||
addSuffix: true,
|
||||
});
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return "indeterminate";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue