Novelty Polygonal Mathematics
    Have ideas to improve npm?Join in the discussion! »

    visualne-comment-plugin
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.4 • Public • Published

    Visualne comment plugin

    Visualne plugin

    • Add inline comment: Shift + C (by default)
    • Add frame comment: select nodes, Shift + F (by default)
    • Delete comment: Select comment and press Delete (by default)
    • Edit comment: Call context menu
    import { Plugin } from 'visualne';
    import { CommentPlugin } from 'visualne-comment-plugin';
    
    editor.use<Plugin, CommentPluginParams>(CommentPlugin, { 
        margin: 20 // indent for new frame comments by default 30 (px)
    })
    
    editor.trigger('addcomment', ({ type: 'frame', text, nodes }))
    editor.trigger('addcomment', ({ type: 'inline', text, position }))
    
    editor.trigger('removecomment', { comment })
    editor.trigger('removecomment', { type })

    Edit comment using custom modal (instead of prompt)

    editor.use(CommentPlugin, { disableBuiltInEdit: true });
    
    editor.on('editcomment', async (comment) => {
        comment.text = await openEditModal(comment.text);
        comment.update();
    });

    Add custom key bindings

    editor.use(CommentPlugin, {
        frameCommentKeys: { code: 'KeyF', shiftKey: true, ctrlKey: false, altKey: false },
        inlineCommentKeys: { code: 'KeyC', shiftKey: true, ctrlKey: false, altKey: false },
        deleteCommentKeys: { code: 'Delete', shiftKey: false, ctrlKey: false, altKey: false }
    })

    Install

    npm i visualne-comment-plugin

    DownloadsWeekly Downloads

    5

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    90.3 kB

    Total Files

    20

    Last publish

    Collaborators

    • avatar