음, 이 솔루션은 인상적이지만 @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
이것을 사용하는 데 문제가 있으면 알려주세요. 문서화가 더 잘 되어야 할 것 같은데, 궁금한 점이 있으면 언제든지 도와드릴게요.
