Всем привет!
Я хочу изменить эти иконки
Я сделал это так:
И прописал это в заголовке:
Но иконка не изменилась.
С другими иконками всё работает.
Пожалуйста, помогите решить эту проблему.
Don
11.Август.2021 13:36:38
2
Привет, Михаил,
Попробуй, пожалуйста, этот вариант
<script type="text/discourse-plugin" version="0.8">
api.replaceIcon('notification.granted_badge', 'oo-medal-badges');
</script>
Эти замены можно найти здесь
import { h } from "virtual-dom";
import { isDevelopment } from "discourse-common/config/environment";
import escape from "discourse-common/lib/escape";
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
let _renderers = [];
let warnMissingIcons = true;
let _iconList;
const REPLACEMENTS = {
"d-tracking": "bell",
"d-muted": "discourse-bell-slash",
"d-regular": "far-bell",
"d-watching": "discourse-bell-exclamation",
"d-watching-first": "discourse-bell-one",
"d-drop-expanded": "caret-down",
"d-drop-collapsed": "caret-right",
"d-unliked": "far-heart",
"d-liked": "heart",
"notification.mentioned": "at",
Да, всё сработало. Большое спасибо!
И где я могу посмотреть, как они выглядят?
Don:
const REPLACEMENTS = {
"d-tracking": "bell",
"d-muted": "discourse-bell-slash",
"d-regular": "far-bell",
"d-watching": "discourse-bell-exclamation",
"d-watching-first": "discourse-bell-one",
"d-drop-expanded": "caret-down",
"d-drop-collapsed": "caret-right",
"d-unliked": "far-heart",
"d-liked": "heart",
"notification.mentioned": "at",
Don
11.Август.2021 14:35:07
5
Вы можете легко найти его, используя инструмент «Исследовать элементы».
Например: уведомление с иконкой сертификата .
Найдите имя иконки с помощью инструмента «Исследовать элементы».
Найдите ту же иконку в файле icon-library.js.
"notification.liked": "heart",
"notification.liked_2": "heart",
"notification.liked_many": "heart",
"notification.liked_consolidated": "heart",
"notification.private_message": "far-envelope",
"notification.invited_to_private_message": "far-envelope",
"notification.invited_to_topic": "hand-point-right",
"notification.invitee_accepted": "user",
"notification.moved_post": "sign-out-alt",
"notification.linked": "link",
"notification.granted_badge": "certificate",
"notification.topic_reminder": "far-clock",
"notification.watching_first_post": "discourse-bell-one",
"notification.group_message_summary": "users",
"notification.post_approved": "check",
"notification.membership_request_accepted": "user-plus",
"notification.membership_request_consolidated": "users",
"notification.reaction": "bell",
"notification.votes_released": "plus",
};
Затем вы можете заменить иконку на любую другую, какую захотите.
Спасибо за ваш ответ.
Я разобрался. Я думал, что существует какой-то список со стандартными иконками Discourse.
Разрешите добавить это для будущей справки. Я следовал инструкциям на Replace Discourse's default SVG icons with custom icons in a theme - #19 , но сначала не понял, что один и тот же значок может упоминаться по-разному. В самом приложении, в разделе «/styleguide/atoms/icons», есть список всех значков и способы их обращения. Поэтому в моём файле header.html теперь есть 5 ссылок на значок конверта:
api.replaceIcon('envelope', 'fgx-air-mail');
api.replaceIcon('far-envelope', 'fgx-air-mail');
api.replaceIcon('notification.private_message', 'fgx-air-mail');
api.replaceIcon('notification.read_private_message', 'fgx-air-mail');
api.replaceIcon('notification.invited_to_private_message', 'fgx-air-mail');