Merge branch 'main' into report-fix

This commit is contained in:
SleeplessOne1917 2023-08-30 23:57:24 +00:00 committed by GitHub
commit 168e35c743
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 10 deletions

View file

@ -142,8 +142,8 @@
<symbol id="icon-book-open" viewBox="0 0 24 24"> <symbol id="icon-book-open" viewBox="0 0 24 24">
<path d="M21 4v13h-6c-0.728 0-1.412 0.195-2 0.535v-10.535c0-0.829 0.335-1.577 0.879-2.121s1.292-0.879 2.121-0.879zM11 17.535c-0.588-0.34-1.272-0.535-2-0.535h-6v-13h5c0.829 0 1.577 0.335 2.121 0.879s0.879 1.292 0.879 2.121zM22 2h-6c-1.38 0-2.632 0.561-3.536 1.464-0.167 0.167-0.322 0.346-0.464 0.536-0.142-0.19-0.297-0.369-0.464-0.536-0.904-0.903-2.156-1.464-3.536-1.464h-6c-0.552 0-1 0.448-1 1v15c0 0.552 0.448 1 1 1h7c0.553 0 1.051 0.223 1.414 0.586s0.586 0.861 0.586 1.414c0 0.552 0.448 1 1 1s1-0.448 1-1c0-0.553 0.223-1.051 0.586-1.414s0.861-0.586 1.414-0.586h7c0.552 0 1-0.448 1-1v-15c0-0.552-0.448-1-1-1z"></path> <path d="M21 4v13h-6c-0.728 0-1.412 0.195-2 0.535v-10.535c0-0.829 0.335-1.577 0.879-2.121s1.292-0.879 2.121-0.879zM11 17.535c-0.588-0.34-1.272-0.535-2-0.535h-6v-13h5c0.829 0 1.577 0.335 2.121 0.879s0.879 1.292 0.879 2.121zM22 2h-6c-1.38 0-2.632 0.561-3.536 1.464-0.167 0.167-0.322 0.346-0.464 0.536-0.142-0.19-0.297-0.369-0.464-0.536-0.904-0.903-2.156-1.464-3.536-1.464h-6c-0.552 0-1 0.448-1 1v15c0 0.552 0.448 1 1 1h7c0.553 0 1.051 0.223 1.414 0.586s0.586 0.861 0.586 1.414c0 0.552 0.448 1 1 1s1-0.448 1-1c0-0.553 0.223-1.051 0.586-1.414s0.861-0.586 1.414-0.586h7c0.552 0 1-0.448 1-1v-15c0-0.552-0.448-1-1-1z"></path>
</symbol> </symbol>
<symbol id="icon-alert-triangle" viewBox="0 0 24 24"> <symbol id="icon-alert-triangle" viewBox="0 -960 960 960">
<path d="M11.148 4.374c0.073-0.123 0.185-0.242 0.334-0.332 0.236-0.143 0.506-0.178 0.756-0.116s0.474 0.216 0.614 0.448l8.466 14.133c0.070 0.12 0.119 0.268 0.128 0.434-0.015 0.368-0.119 0.591-0.283 0.759-0.18 0.184-0.427 0.298-0.693 0.301l-16.937-0.001c-0.152-0.001-0.321-0.041-0.481-0.134-0.239-0.138-0.399-0.359-0.466-0.607s-0.038-0.519 0.092-0.745zM9.432 3.346l-8.47 14.14c-0.422 0.731-0.506 1.55-0.308 2.29s0.68 1.408 1.398 1.822c0.464 0.268 0.976 0.4 1.475 0.402h16.943c0.839-0.009 1.587-0.354 2.123-0.902s0.864-1.303 0.855-2.131c-0.006-0.536-0.153-1.044-0.406-1.474l-8.474-14.147c-0.432-0.713-1.11-1.181-1.854-1.363s-1.561-0.081-2.269 0.349c-0.429 0.26-0.775 0.615-1.012 1.014zM11 9v4c0 0.552 0.448 1 1 1s1-0.448 1-1v-4c0-0.552-0.448-1-1-1s-1 0.448-1 1zM12 18c0.552 0 1-0.448 1-1s-0.448-1-1-1-1 0.448-1 1 0.448 1 1 1z"></path> <path d="M480-79q-16 0-30.5-6T423-102L102-423q-11-12-17-26.5T79-480q0-16 6-31t17-26l321-321q12-12 26.5-17.5T480-881q16 0 31 5.5t26 17.5l321 321q12 11 17.5 26t5.5 31q0 16-5.5 30.5T858-423L537-102q-11 11-26 17t-31 6Zm0-80 321-321-321-321-321 321 321 321Zm-40-281h80v-240h-80v240Zm40 120q17 0 28.5-11.5T520-360q0-17-11.5-28.5T480-400q-17 0-28.5 11.5T440-360q0 17 11.5 28.5T480-320Zm0-160Z"></path>
</symbol> </symbol>
<symbol id="icon-zap" viewBox="0 0 24 24"> <symbol id="icon-zap" viewBox="0 0 24 24">
<path d="M11.585 5.26l-0.577 4.616c0.033 0.716 0.465 1.124 0.992 1.124h6.865l-6.45 7.74 0.577-4.616c-0.033-0.716-0.465-1.124-0.992-1.124h-6.865zM12.232 1.36l-10 12c-0.354 0.424-0.296 1.055 0.128 1.408 0.187 0.157 0.415 0.233 0.64 0.232h7.867l-0.859 6.876c-0.069 0.548 0.32 1.048 0.868 1.116 0.349 0.044 0.678-0.098 0.892-0.352l10-12c0.354-0.424 0.296-1.055-0.128-1.408-0.187-0.157-0.415-0.233-0.64-0.232h-7.867l0.859-6.876c0.069-0.548-0.32-1.048-0.868-1.116-0.349-0.044-0.678 0.098-0.892 0.352z"></path> <path d="M11.585 5.26l-0.577 4.616c0.033 0.716 0.465 1.124 0.992 1.124h6.865l-6.45 7.74 0.577-4.616c-0.033-0.716-0.465-1.124-0.992-1.124h-6.865zM12.232 1.36l-10 12c-0.354 0.424-0.296 1.055 0.128 1.408 0.187 0.157 0.415 0.233 0.64 0.232h7.867l-0.859 6.876c-0.069 0.548 0.32 1.048 0.868 1.116 0.349 0.044 0.678-0.098 0.892-0.352l10-12c0.354-0.424 0.296-1.055-0.128-1.408-0.187-0.157-0.415-0.233-0.64-0.232h-7.867l0.859-6.876c0.069-0.548-0.32-1.048-0.868-1.116-0.349-0.044-0.678 0.098-0.892 0.352z"></path>

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View file

@ -21,20 +21,19 @@ export class CommunityLink extends Component<CommunityLinkProps, any> {
render() { render() {
const community = this.props.community; const community = this.props.community;
let name_: string, title: string, link: string; let title: string, link: string;
const local = community.local === null ? true : community.local; const local = community.local === null ? true : community.local;
const domain = hostname(community.actor_id);
if (local) { if (local) {
name_ = community.name;
title = community.title; title = community.title;
link = `/c/${community.name}`; link = `/c/${community.name}`;
} else { } else {
const domain = hostname(community.actor_id); const name_ = `${community.name}@${domain}`;
name_ = `${community.name}@${domain}`;
title = `${community.title}@${domain}`; title = `${community.title}@${domain}`;
link = !this.props.realLink ? `/c/${name_}` : community.actor_id; link = !this.props.realLink ? `/c/${name_}` : community.actor_id;
} }
const apubName = `!${name_}`; const apubName = `!${community.name}@${domain}`;
const displayName = this.props.useApubName ? apubName : title; const displayName = this.props.useApubName ? apubName : title;
return !this.props.realLink ? ( return !this.props.realLink ? (
<Link <Link

View file

@ -15,7 +15,7 @@ import markdown_it_sub from "markdown-it-sub";
import markdown_it_sup from "markdown-it-sup"; import markdown_it_sup from "markdown-it-sup";
import Renderer from "markdown-it/lib/renderer"; import Renderer from "markdown-it/lib/renderer";
import Token from "markdown-it/lib/token"; import Token from "markdown-it/lib/token";
import { instanceLinkRegex } from "./config"; import { instanceLinkRegex, relTags } from "./config";
export let Tribute: any; export let Tribute: any;
@ -185,7 +185,7 @@ export function setupMarkdown() {
// defs: emojiDefs, // defs: emojiDefs,
// }) // })
.disable("image"); .disable("image");
const defaultRenderer = md.renderer.rules.image; const defaultImageRenderer = md.renderer.rules.image;
md.renderer.rules.image = function ( md.renderer.rules.image = function (
tokens: Token[], tokens: Token[],
idx: number, idx: number,
@ -205,7 +205,7 @@ export function setupMarkdown() {
const isLocalEmoji = customEmoji !== undefined; const isLocalEmoji = customEmoji !== undefined;
if (!isLocalEmoji) { if (!isLocalEmoji) {
const imgElement = const imgElement =
defaultRenderer?.(tokens, idx, options, env, self) ?? ""; defaultImageRenderer?.(tokens, idx, options, env, self) ?? "";
if (imgElement) { if (imgElement) {
return `<span class='${ return `<span class='${
isEmoji ? "icon icon-emoji" : "" isEmoji ? "icon icon-emoji" : ""
@ -221,6 +221,21 @@ export function setupMarkdown() {
md.renderer.rules.table_open = function () { md.renderer.rules.table_open = function () {
return '<table class="table">'; return '<table class="table">';
}; };
const defaultLinkRenderer =
md.renderer.rules.link_open ||
function (tokens, idx, options, _env, self) {
return self.renderToken(tokens, idx, options);
};
md.renderer.rules.link_open = function (
tokens: Token[],
idx: number,
options: MarkdownIt.Options,
env: any,
self: Renderer,
) {
tokens[idx].attrPush(["rel", relTags]);
return defaultLinkRenderer(tokens, idx, options, env, self);
};
} }
export function setupEmojiDataModel(custom_emoji_views: CustomEmojiView[]) { export function setupEmojiDataModel(custom_emoji_views: CustomEmojiView[]) {