0.6.6 • Published 3 months ago

@univerjs/sheets-thread-comment-ui v0.6.6

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 months ago

@univerjs/sheets-thread-comment-ui

Package Overview

Package NameUMD NamespaceVersionLicenseDownloadsContains CSSContains i18n locales
@univerjs/sheets-thread-comment-uiUniverSheetsThreadComment⭕️⭕️

Introduction

@univerjs/sheets-thread-comment-ui provides the comment/annotation function of Univer Sheets.

Usage

Installation

# Use npm
npm install @univerjs/sheets-thread-comment-ui

# Use pnpm
pnpm add @univerjs/sheets-thread-comment-ui

Register the plugin

import { UniverSheetsThreadCommentPlugin, IThreadCommentMentionDataService} from '@univerjs/sheets-thread-comment-ui';

const mockUser = {
    userID: 'mockId',
    name: 'MockUser',
    avatar: 'icon-url',
    anonymous: false,
    canBindAnonymous: false,
};

class CustomMentionDataService implements IThreadCommentMentionDataService {
    trigger: string = '@';

     // Get the common interface implementation of the mentioned user
    async getMentions(search: string) {
        return [
            {
                id: mockUser.userID,
                label: mockUser.name,
                type: 'user',
                icon: mockUser.avatar,
            },
            {
                id: '2',
                label: 'User2',
                type: 'user',
                icon: mockUser.avatar,
            },
        ];
    }
}

univer.registerPlugin(UniverSheetsThreadCommentPlugin);

API

import {
    AddCommentCommand,
    DeleteCommentCommand,
    UpdateCommentCommand,
    ResolveCommentCommand,
    DeleteCommentTreeCommand,
} from '@univerjs/sheets-thread-comment-ui';
import type {
    IAddCommentCommandParams,
    IDeleteCommentCommandParams,
    IResolveCommentCommandParams,
    IUpdateCommentCommandParams,
    IDeleteCommentTreeCommandParams,
} from '@univerjs/sheets-thread-comment-ui';

// Add comment by command
const commandService = univer.__getInjector().get(ICommandService);

commandService.executeCommand(AddCommentCommand.id, {
    unitId: 'unitId',
    subUnitId: 'subUnitId',
    comment: {
        // comment content
    },
} as IAddCommentCommandParams);
0.6.6

3 months ago

0.6.5

3 months ago

0.6.3

4 months ago

0.6.4

3 months ago

0.6.2

4 months ago

0.6.1

4 months ago

0.6.0

4 months ago

0.6.0-alpha.0

5 months ago

0.5.5

5 months ago

0.5.4

5 months ago

0.5.3

6 months ago

0.5.2

6 months ago

0.5.1

7 months ago

0.5.0

7 months ago

0.5.0-beta.1

7 months ago

0.5.0-beta.0

7 months ago

0.5.0-alpha.0

7 months ago