مرحبًا، أيها الجميع
أريد تغيير هذه الأيقونات
لقد فعلت ذلك بهذه الطريقة
وكتبتها في الرأس
لكن الأيقونة لم تتغير
إنها تعمل مع أيقونات أخرى
من فضلك ساعدني في حل هذه المشكلة
Don
11 أغسطس 2021، 1:36م
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
11 أغسطس 2021، 2:35م
5
يمكنك تحديده بسهولة باستخدام فحص العناصر.
على سبيل المثال: إشعار أيقونة الشهادة
ابحث عن اسم الأيقونة باستخدام فحص العناصر
ابحث عن نفس الأيقونة في مكتبة الأيقونات (icon-library) في ملف JavaScript
"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');