حسناً، هذا الحل مثير للإعجاب، ولكن يمكنك فعل ذلك يا @Don:
api
.modifySelectKit("category-drop")
.replaceContent((component, content) => {
let newContent = [];
content.forEach((item) => {
if (
component.category?.slug === "general" &&
item.id === "all-categories"
) {
item.name = "jojo";
}
newContent.push(item);
});
return newContent;
});
https://github.com/discourse/discourse/blob/main/app/assets/javascripts/select-kit/addon/mixins/plugin-api.js يسرد جميع الإجراءات التي يمكنك القيام بها:
- appendContent
- prependContent
- replaceContent
- onChange
أخبرني إذا واجهت صعوبة في استخدام هذا. يجب أن يكون موثقاً بشكل أفضل، ولكني هنا إذا كانت لديك أي أسئلة.
