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