New

docx-editor 1.x has shipped. Vue support, i18n, agents. Read the migration guide →

API Referencev1.0.2

@eigenpal/docx-editor-core/utils/comments

Framework-agnostic comment + tracked-change helpers shared by the React and Vue adapters. The data shapes and string-formatting rules here are part of the visible UI (avatar colors, date strings) so keep this file as the single source of truth — both adapters import from here. CSS-property factories live in adapter-specific files (sidebar/cardUtils.ts in React, sidebar/sidebarUtils.ts in Vue).

Functions(5)

declare function formatDate(dateStr?: string): string;
declare function getAvatarColor(name: string): string;

Extract plain text from a Comment's paragraph content.

declare function getCommentText(paragraphs?: Paragraph[]): string;
declare function getInitials(name: string): string;
declare function truncateText(text: string, maxLength?: number): string;

Interfaces(1)

interface TrackedChangeEntry
MemberTypeSummary
authorstring
date?string
deletedText?stringFor replacements: the deleted text that was replaced
fromnumber
insertionRevisionId?numberFor replacements: the insertion part's revisionId (different from the deletion's)
revisionIdnumber
textstring
tonumber
type'insertion' | 'deletion' | 'replacement'