如何在 quick-access-profile 中添加一个新按钮?

你好!

是否可以在此部分添加新链接:

它将位于“偏好设置”和“通知”之间。可以通过编辑我的主题或添加新插件来实现。

谢谢!

你好!欢迎回来。 :slight_smile:

您有一个 API 函数 addQuickAccessProfileItem,它可以在注销按钮之前插入一个项目。

https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/lib/plugin-api.gjs#L1893-L1907

例如:

<script type="text/discourse-plugin" version="0.8">
api.addQuickAccessProfileItem({
  icon: "pencil-alt",
  href: "/somewhere",
  content: "Test"
})
</script>

然后您可以使用 CSS 来重新排序项目(这并非理想解决方案,但别无选择)

.user-menu {
    .summary { order: 1 }
    .activity { order: 2 }
    .invites { order: 3 }
    .drafts { order: 4 }
    .preferences { order: 5 }

    /* 您的项目 */
    .test { order: 6 }

    .do-not-disturb { order: 7 }
    .logout { order: 8 }
}

希望这对您有帮助。 :+1:

9 个赞

非常感谢!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.