chore(editor): add track for mention (#11594)

This commit is contained in:
Flrande
2025-04-10 16:33:11 +08:00
committed by GitHub
parent 44d2f301de
commit cc257f4fbe
2 changed files with 34 additions and 2 deletions

View File

@@ -376,6 +376,10 @@ export class AtMenuConfigService extends Service {
close(); close();
track.doc.editor.atMenu.mentionMember({
type: 'member',
});
const inlineRange = inlineEditor.getInlineRange(); const inlineRange = inlineEditor.getInlineRange();
if (!inlineRange || inlineRange.length !== 0) return; if (!inlineRange || inlineRange.length !== 0) return;
@@ -440,6 +444,8 @@ export class AtMenuConfigService extends Service {
const err = UserFriendlyError.fromAny(error); const err = UserFriendlyError.fromAny(error);
if (err.is(ErrorNames.MENTION_USER_DOC_ACCESS_DENIED)) { if (err.is(ErrorNames.MENTION_USER_DOC_ACCESS_DENIED)) {
track.doc.editor.atMenu.noAccessPrompted();
const canUserManage = this.guardService.can$( const canUserManage = this.guardService.can$(
'Doc_Users_Manage', 'Doc_Users_Manage',
docId docId
@@ -456,6 +462,11 @@ export class AtMenuConfigService extends Service {
action: { action: {
label: 'Invite', label: 'Invite',
onClick: async () => { onClick: async () => {
track.$.sharePanel.$.inviteUserDocRole({
control: 'member list',
role: 'reader',
});
try { try {
await this.docGrantedUsersService.updateUserRole( await this.docGrantedUsersService.updateUserRole(
id, id,
@@ -517,6 +528,11 @@ export class AtMenuConfigService extends Service {
icon: UserIcon(), icon: UserIcon(),
action: () => { action: () => {
close(); close();
track.doc.editor.atMenu.mentionMember({
type: 'invite',
});
this.dialogService.open('setting', { this.dialogService.open('setting', {
activeTab: 'workspace:members', activeTab: 'workspace:members',
}); });

View File

@@ -177,6 +177,10 @@ type MeetingEvents =
| 'activeMenubarAppItem'; | 'activeMenubarAppItem';
// END SECTION // END SECTION
// SECTION: mention
type MentionEvents = 'mentionMember' | 'noAccessPrompted';
// END SECTION
type UserEvents = type UserEvents =
| GeneralEvents | GeneralEvents
| AppEvents | AppEvents
@@ -198,7 +202,9 @@ type UserEvents =
| TemplateEvents | TemplateEvents
| NotificationEvents | NotificationEvents
| IntegrationEvents | IntegrationEvents
| MeetingEvents; | MeetingEvents
| MentionEvents;
interface PageDivision { interface PageDivision {
[page: string]: { [page: string]: {
[segment: string]: { [segment: string]: {
@@ -405,7 +411,13 @@ const PageEvents = {
doc: { doc: {
editor: { editor: {
slashMenu: ['linkDoc', 'createDoc', 'bookmark'], slashMenu: ['linkDoc', 'createDoc', 'bookmark'],
atMenu: ['linkDoc', 'import', 'createDoc'], atMenu: [
'linkDoc',
'import',
'createDoc',
'mentionMember',
'noAccessPrompted',
],
quickSearch: ['createDoc'], quickSearch: ['createDoc'],
formatToolbar: ['bold'], formatToolbar: ['bold'],
pageRef: ['navigate'], pageRef: ['navigate'],
@@ -698,6 +710,10 @@ export type EventArgs = {
| 'Meeting Settings' | 'Meeting Settings'
| 'Quit AFFiNE Completely'; | 'Quit AFFiNE Completely';
}; };
mentionMember: {
type: 'member' | 'invite' | 'more';
};
noAccessPrompted: {};
}; };
// for type checking // for type checking