oasis-editor 0.0.203 → 0.0.205

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,6 +31,12 @@ export interface EssentialsFormattingCapability {
31
31
  hasRevisionsInSelection: () => boolean;
32
32
  hasNavigableRevisions: () => boolean;
33
33
  hasNavigableComments: () => boolean;
34
+ canCreateComment: () => boolean;
35
+ canReplyToComment: () => boolean;
36
+ newComment: () => boolean;
37
+ replyComment: () => boolean;
38
+ editComment: () => boolean;
39
+ canEditComment: () => boolean;
34
40
  navigateRevisionNext: () => boolean;
35
41
  navigateRevisionPrevious: () => boolean;
36
42
  navigateCommentNext: () => boolean;
@@ -22,6 +22,8 @@ export interface OasisEditorEditorLayoutProps {
22
22
  export interface OasisEditorEditorOverlayProps {
23
23
  selectionBoxes: Accessor<SelectionBox[]>;
24
24
  commentHighlights: Accessor<CommentHighlightBox[]>;
25
+ onReplyToComment?: (commentId: string) => void;
26
+ onEditComment?: (commentId: string) => void;
25
27
  selectedImageBox: Accessor<SelectedImageBox | null>;
26
28
  selectedTextBoxBox: Accessor<SelectedTextBoxBox | null>;
27
29
  selectedTableBox: Accessor<SelectedTableBox | null>;
@@ -1,4 +1,5 @@
1
1
  import { ComponentProps, JSX } from 'solid-js';
2
+ import { EditorCommentComposer } from './createEditorCommentComposer.js';
2
3
  import { FontDialog } from '../components/Dialogs/FontDialog.js';
3
4
  import { ParagraphDialog } from '../components/Dialogs/ParagraphDialog.js';
4
5
  import { TablePropertiesDialog } from '../components/Dialogs/TablePropertiesDialog.js';
@@ -9,6 +10,7 @@ import { createEditorDialogs } from './useEditorDialogs.js';
9
10
  type EditorDialogsState = ReturnType<typeof createEditorDialogs>;
10
11
  export interface EditorDialogsLayerProps {
11
12
  dialogs: EditorDialogsState;
13
+ commentComposer: EditorCommentComposer;
12
14
  findReplace: ComponentProps<typeof FindReplaceDialog>["fr"];
13
15
  fontFamilyOptions: () => string[];
14
16
  fontSizeOptions: () => number[];
@@ -25,6 +25,8 @@ export interface EditorViewLayoutInput {
25
25
  export interface EditorViewOverlayInput {
26
26
  selectionBoxes: Accessor<SelectionBox[]>;
27
27
  commentHighlights: Accessor<CommentHighlightBox[]>;
28
+ onReplyToComment?: (commentId: string) => void;
29
+ onEditComment?: (commentId: string) => void;
28
30
  selectedImageBox: Accessor<SelectedImageBox | null>;
29
31
  selectedTextBoxBox: Accessor<SelectedTextBoxBox | null>;
30
32
  selectedTableBox: Accessor<SelectedTableBox | null>;
@@ -5,6 +5,7 @@ import { OasisEditorClientController, OasisEditorUiState } from '../../app/clien
5
5
  import { TranslateFn } from '../../i18n/index.js';
6
6
  import { createEditorDocumentRuntime } from './createEditorDocumentRuntime.js';
7
7
  import { createEditorInteractionRuntime } from './createEditorInteractionRuntime.js';
8
+ import { EditorCommentComposer } from './createEditorCommentComposer.js';
8
9
  import { OasisEditorAppDocumentProps, OasisEditorAppRuntimeProps } from '../OasisEditorAppProps.js';
9
10
  type DocumentRuntime = ReturnType<typeof createEditorDocumentRuntime>;
10
11
  type InteractionRuntime = ReturnType<typeof createEditorInteractionRuntime>;
@@ -17,6 +18,7 @@ interface LinkDialogSetter {
17
18
  export interface EditorCommandRuntimeDeps {
18
19
  document: DocumentRuntime;
19
20
  interaction: InteractionRuntime;
21
+ commentComposer: EditorCommentComposer;
20
22
  state: EditorState;
21
23
  logger: EditorLogger;
22
24
  isReadOnly: () => boolean;
@@ -0,0 +1,34 @@
1
+ import { EditorState } from '../../core/model.js';
2
+ export interface CommentComposerDraft {
3
+ mode: "new" | "reply" | "edit";
4
+ /** Snapshot captured before modal focus steals the editor selection. */
5
+ snapshot: EditorState;
6
+ parentId?: string;
7
+ parentAuthor?: string;
8
+ parentText?: string;
9
+ commentId?: string;
10
+ commentAuthor?: string;
11
+ commentText?: string;
12
+ }
13
+ export interface CommentComposerDeps {
14
+ state: () => EditorState;
15
+ isReadOnly: () => boolean;
16
+ applyTransactionalState: (change: (current: EditorState) => EditorState) => void;
17
+ focusInput: () => void;
18
+ }
19
+ /** One instance per editor; never a global author, dialog, or comment state. */
20
+ export declare function createEditorCommentComposer(deps: CommentComposerDeps): {
21
+ draft: import('solid-js').Accessor<CommentComposerDraft | null>;
22
+ lastAuthor: import('solid-js').Accessor<string>;
23
+ canCreate: () => boolean;
24
+ canReply: () => boolean;
25
+ canEdit: () => boolean;
26
+ openNew: () => boolean;
27
+ openReply: () => boolean;
28
+ openReplyToId: (parentId: string) => boolean;
29
+ openEdit: () => boolean;
30
+ openEditToId: (commentId: string) => boolean;
31
+ close: () => void;
32
+ submit: (author: string, text: string) => boolean;
33
+ };
34
+ export type EditorCommentComposer = ReturnType<typeof createEditorCommentComposer>;
@@ -5,6 +5,7 @@ import { createEditorCommandsController } from '../../../app/controllers/EditorC
5
5
  import { createEditorHistoryActions } from '../../../app/controllers/useEditorHistoryActions.js';
6
6
  import { createEditorStyleController } from '../../../app/controllers/useEditorStyle.js';
7
7
  import { EditorFormatPainter } from '../createEditorFormatPainter.js';
8
+ import { EditorCommentComposer } from '../createEditorCommentComposer.js';
8
9
  import { createEditorTableOperations } from '../../../app/controllers/useEditorTableOperations.js';
9
10
  import { EssentialsDesignCapability } from '../../../plugins/internal/essentialsCapabilities.js';
10
11
  export interface CreateEditorEssentialsPluginOptions {
@@ -24,6 +25,7 @@ export interface CreateEditorEssentialsPluginOptions {
24
25
  historyActions: ReturnType<typeof createEditorHistoryActions>;
25
26
  styleController: ReturnType<typeof createEditorStyleController>;
26
27
  formatPainter: EditorFormatPainter;
28
+ commentComposer: EditorCommentComposer;
27
29
  tableOps: ReturnType<typeof createEditorTableOperations>;
28
30
  docIO: {
29
31
  handleExportDocx: () => Promise<Blob>;
@@ -5,6 +5,9 @@ export interface CommentHighlightOverlayProps {
5
5
  boxes: Accessor<CommentHighlightBox[]>;
6
6
  /** Comment bodies keyed by their editor-local id, for the hover popup. */
7
7
  commentsById: Accessor<Record<string, EditorComment>>;
8
+ onReplyToComment?: (commentId: string) => void;
9
+ onEditComment?: (commentId: string) => void;
10
+ readOnly?: boolean;
8
11
  }
9
12
  /**
10
13
  * Renders the highlight rectangles over commented text and, on hover/click of a
@@ -0,0 +1,7 @@
1
+ import { JSX } from 'solid-js';
2
+ import { EditorCommentComposer } from '../../app/createEditorCommentComposer.js';
3
+ export interface CommentComposerDialogProps {
4
+ composer: EditorCommentComposer;
5
+ }
6
+ /** Dialog state is local to the mounted editor. */
7
+ export declare function CommentComposerDialog(props: CommentComposerDialogProps): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis-editor",
3
- "version": "0.0.203",
3
+ "version": "0.0.205",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {