@box/threaded-annotations 4.9.8 → 4.10.1

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.
@@ -1 +1 @@
1
- import{CustomMention}from"./custom-mention/custom-mention.js";import{CustomParagraph}from"./custom-paragraph.js";import{DismissBarOnEscape}from"./dismiss-bar-on-escape.js";import{NormalizeEmptyNodeSelection}from"./normalize-empty-node-selection.js";import Document from"@tiptap/extension-document";import Text from"@tiptap/extension-text";import Bold from"@tiptap/extension-bold";import Italic from"@tiptap/extension-italic";import{BulletList,ListItem,OrderedList}from"@tiptap/extension-list";import Underline from"@tiptap/extension-underline";import{Placeholder,UndoRedo}from"@tiptap/extensions";var createMessageEditorExtensions=({isRichTextEnabled,mentionSuggestion,placeholder})=>{let baseExtensions=[Document,CustomParagraph,Placeholder.configure({placeholder,showOnlyWhenEditable:!1}),Text,CustomMention.configure({suggestion:mentionSuggestion})];return isRichTextEnabled?[...baseExtensions,UndoRedo,Bold,Italic,Underline,BulletList.configure({keepMarks:!0}),OrderedList.configure({keepMarks:!0}),ListItem,NormalizeEmptyNodeSelection,DismissBarOnEscape]:baseExtensions};export{createMessageEditorExtensions};
1
+ import{CustomMention}from"./custom-mention/custom-mention.js";import{CustomParagraph}from"./custom-paragraph.js";import{DismissBarOnEscape}from"./dismiss-bar-on-escape.js";import{NormalizeEmptyNodeSelection}from"./normalize-empty-node-selection.js";import{StripMentionMarks}from"./strip-mention-marks.js";import Document from"@tiptap/extension-document";import Text from"@tiptap/extension-text";import Bold from"@tiptap/extension-bold";import Italic from"@tiptap/extension-italic";import{BulletList,ListItem,OrderedList}from"@tiptap/extension-list";import Underline from"@tiptap/extension-underline";import{Placeholder,UndoRedo}from"@tiptap/extensions";var createMessageEditorExtensions=({isRichTextEnabled,mentionSuggestion,placeholder})=>{let baseExtensions=[Document,CustomParagraph,Placeholder.configure({placeholder,showOnlyWhenEditable:!1}),Text,CustomMention.configure({suggestion:mentionSuggestion})];return isRichTextEnabled?[...baseExtensions,UndoRedo,Bold,Italic,Underline,BulletList.configure({keepMarks:!0}),OrderedList.configure({keepMarks:!0}),ListItem,NormalizeEmptyNodeSelection,DismissBarOnEscape,StripMentionMarks]:baseExtensions};export{createMessageEditorExtensions};
@@ -1 +1 @@
1
- import{t as MentionComponent}from"../../../../../../../chunks/mention-component.js";import{jsx}from"react/jsx-runtime";import{NodeViewWrapper,ReactNodeViewRenderer}from"@tiptap/react";import{mergeAttributes}from"@tiptap/core";import Mention from"@tiptap/extension-mention";var MentionNodeView=({node})=>{let{mentionedUserName,mentionedUserId,mentionedUserEmail,mentionId}=node.attrs;return jsx(NodeViewWrapper,{as:`span`,children:jsx(MentionComponent,{mentionedUserEmail,mentionedUserId,mentionedUserName,mentionId})})},CustomMention=Mention.extend({addAttributes(){return{mentionedUserId:{default:null,parseHTML:element=>element.getAttribute(`data-mentioned-user-id`),renderHTML:attributes=>attributes.mentionedUserId?{"data-mentioned-user-id":attributes.mentionedUserId}:{}},mentionedUserName:{default:null,parseHTML:element=>element.getAttribute(`data-mentioned-user-name`),renderHTML:attributes=>attributes.mentionedUserName?{"data-mentioned-user-name":attributes.mentionedUserName}:{}},mentionedUserEmail:{default:null,parseHTML:element=>element.getAttribute(`data-mentioned-user-email`),renderHTML:attributes=>attributes.mentionedUserEmail?{"data-mentioned-user-email":attributes.mentionedUserEmail}:{}},mentionId:{default:null,parseHTML:element=>element.getAttribute(`data-mention-id`),renderHTML:attributes=>({"data-mention-id":attributes.mentionId})}}},addNodeView(){return ReactNodeViewRenderer(MentionNodeView)},renderHTML({HTMLAttributes,node}){return[`span`,mergeAttributes(this.options.HTMLAttributes,HTMLAttributes,{"data-component-type":`mention`,"data-mentioned-user-id":node.attrs.mentionedUserId,"data-mentioned-user-name":node.attrs.mentionedUserName,"data-mentioned-user-email":node.attrs.mentionedUserEmail,"data-mention-id":node.attrs.mentionId}),`@${node.attrs.mentionedUserName}`]}});export{CustomMention};
1
+ import{t as MentionComponent}from"../../../../../../../chunks/mention-component.js";import{jsx}from"react/jsx-runtime";import{NodeViewWrapper,ReactNodeViewRenderer}from"@tiptap/react";import{mergeAttributes}from"@tiptap/core";import Mention from"@tiptap/extension-mention";var MentionNodeView=({node})=>{let{mentionedUserName,mentionedUserId,mentionedUserEmail,mentionId}=node.attrs;return jsx(NodeViewWrapper,{as:`span`,children:jsx(MentionComponent,{mentionedUserEmail,mentionedUserId,mentionedUserName,mentionId})})},CustomMention=Mention.extend({marks:``,addAttributes(){return{mentionedUserId:{default:null,parseHTML:element=>element.getAttribute(`data-mentioned-user-id`),renderHTML:attributes=>attributes.mentionedUserId?{"data-mentioned-user-id":attributes.mentionedUserId}:{}},mentionedUserName:{default:null,parseHTML:element=>element.getAttribute(`data-mentioned-user-name`),renderHTML:attributes=>attributes.mentionedUserName?{"data-mentioned-user-name":attributes.mentionedUserName}:{}},mentionedUserEmail:{default:null,parseHTML:element=>element.getAttribute(`data-mentioned-user-email`),renderHTML:attributes=>attributes.mentionedUserEmail?{"data-mentioned-user-email":attributes.mentionedUserEmail}:{}},mentionId:{default:null,parseHTML:element=>element.getAttribute(`data-mention-id`),renderHTML:attributes=>({"data-mention-id":attributes.mentionId})}}},addNodeView(){return ReactNodeViewRenderer(MentionNodeView)},renderHTML({HTMLAttributes,node}){return[`span`,mergeAttributes(this.options.HTMLAttributes,HTMLAttributes,{"data-component-type":`mention`,"data-mentioned-user-id":node.attrs.mentionedUserId,"data-mentioned-user-name":node.attrs.mentionedUserName,"data-mentioned-user-email":node.attrs.mentionedUserEmail,"data-mention-id":node.attrs.mentionId}),`@${node.attrs.mentionedUserName}`]}});export{CustomMention};
@@ -0,0 +1 @@
1
+ import{Extension}from"@tiptap/core";import{Plugin,PluginKey}from"@tiptap/pm/state";var StripMentionMarks=Extension.create({name:`stripMentionMarks`,addProseMirrorPlugins(){return[new Plugin({key:new PluginKey(`stripMentionMarks`),appendTransaction:(transactions,_oldState,newState)=>{if(!transactions.some(transaction=>transaction.docChanged))return null;let mentionType=newState.schema.nodes.mention,transaction=newState.tr,stripped=!1;return newState.doc.descendants((node,pos)=>{node.type!==mentionType||node.marks.length===0||(transaction=transaction.removeMark(pos,pos+node.nodeSize),stripped=!0)}),stripped?transaction:null}})]}});export{StripMentionMarks};
@@ -1,52 +1,4 @@
1
- // THIS IS A GENERATED FILE. DO NOT EDIT MANUALLY OR YOUR CHANGES WILL BE OVERWRITTEN
2
- export default {
3
- "boxui.threadedAnnotations.threadedAnnotationsAriaLabel": "Threaded annotation",
4
- "groupSharedFeatures.threadedAnnotations.annotationMessageAriaLabel": "Annotation message",
5
- "groupSharedFeatures.threadedAnnotations.annotationPage": "Page {number}",
6
- "groupSharedFeatures.threadedAnnotations.cancelDeleteButtonAriaLabel": "Cancel delete button",
7
- "groupSharedFeatures.threadedAnnotations.copyLink": "Copy link",
8
- "groupSharedFeatures.threadedAnnotations.delete": "Delete",
9
- "groupSharedFeatures.threadedAnnotations.deleteButtonAriaLabel": "Delete button",
10
- "groupSharedFeatures.threadedAnnotations.deleteCancel": "Cancel",
11
- "groupSharedFeatures.threadedAnnotations.deleteCommentQuestion": "Do you want to delete this comment?",
12
- "groupSharedFeatures.threadedAnnotations.deleteConfirmation": "Delete confirmation",
13
- "groupSharedFeatures.threadedAnnotations.deleteQuestion": "Delete this {type, select, annotation {annotation} other {comment}}{hasReplies, select, true { and replies} other {}}? This action can't be undone.",
14
- "groupSharedFeatures.threadedAnnotations.edit": "Edit",
15
- "groupSharedFeatures.threadedAnnotations.edited": "(Edited)",
16
- "groupSharedFeatures.threadedAnnotations.editedTooltip": "Edited {time}",
17
- "groupSharedFeatures.threadedAnnotations.hideReplies": "Hide replies",
18
- "groupSharedFeatures.threadedAnnotations.markedAsResolved": "marked as resolved",
19
- "groupSharedFeatures.threadedAnnotations.messageEditor.cancel": "Cancel",
20
- "groupSharedFeatures.threadedAnnotations.messageEditor.cancelButtonAriaLabel": "Cancel button",
21
- "groupSharedFeatures.threadedAnnotations.messageEditor.characterCount": "{count}/{maxCount}",
22
- "groupSharedFeatures.threadedAnnotations.messageEditor.characterLimitExceeded": "Your comment is {excess, plural, one {# character} other {# characters}} too long",
23
- "groupSharedFeatures.threadedAnnotations.messageEditor.editorContentAriaLabel": "Message editor",
24
- "groupSharedFeatures.threadedAnnotations.messageEditor.placeholderAddComment": "Add a comment, @ to mention",
25
- "groupSharedFeatures.threadedAnnotations.messageEditor.placeholderAriaLabel": "Message input placeholder",
26
- "groupSharedFeatures.threadedAnnotations.messageEditor.placeholderPrefix": "Write a comment or",
27
- "groupSharedFeatures.threadedAnnotations.messageEditor.placeholderPrefixReply": "Write a reply or",
28
- "groupSharedFeatures.threadedAnnotations.messageEditor.placeholderReply": "Reply, @ to mention",
29
- "groupSharedFeatures.threadedAnnotations.messageEditor.placeholderSuffix": "to mention",
30
- "groupSharedFeatures.threadedAnnotations.messageEditor.post": "Post",
31
- "groupSharedFeatures.threadedAnnotations.messageEditor.postButtonAriaLabel": "Post button",
32
- "groupSharedFeatures.threadedAnnotations.messageEditor.postLoading": "Loading...",
33
- "groupSharedFeatures.threadedAnnotations.messageEditor.save": "Save",
34
- "groupSharedFeatures.threadedAnnotations.messageEditor.saveLoading": "Saving...",
35
- "groupSharedFeatures.threadedAnnotations.messageEditor.scrollContainerAriaLabel": "Message editor scroll container",
36
- "groupSharedFeatures.threadedAnnotations.messageEditor.timestampToggleLabel": "Comment with timestamp",
37
- "groupSharedFeatures.threadedAnnotations.moreOptionsAriaLabel": "More options button",
38
- "groupSharedFeatures.threadedAnnotations.originalContentDeleted": "Original content was deleted",
39
- "groupSharedFeatures.threadedAnnotations.reply": "Reply",
40
- "groupSharedFeatures.threadedAnnotations.replyButtonAriaLabel": "Reply button",
41
- "groupSharedFeatures.threadedAnnotations.resolveButtonAriaLabel": "Resolve",
42
- "groupSharedFeatures.threadedAnnotations.resolvedStateAriaLabel": "Resolution status message",
43
- "groupSharedFeatures.threadedAnnotations.seeMore": "See More",
44
- "groupSharedFeatures.threadedAnnotations.showMoreReplies": "{count, plural, one {# more reply} other {# more replies}}",
45
- "groupSharedFeatures.threadedAnnotations.showReplies": "{number, plural, one {Show # reply} other {Show # more replies}}",
46
- "groupSharedFeatures.threadedAnnotations.showRepliesButtonAriaLabel": "Reply button",
47
- "groupSharedFeatures.threadedAnnotations.textMentionAriaLabel": "User mention",
48
- "groupSharedFeatures.threadedAnnotations.textMessageAriaLabel": "Message text",
49
- "groupSharedFeatures.threadedAnnotations.unresolveButtonAriaLabel": "Unresolve",
50
- "groupSharedFeatures.threadedAnnotations.userAvatar": "User avatar",
51
- "groupSharedFeatures.threadedAnnotations.userAvatarButtonAriaLabel": "View user profile button"
52
- };
1
+ // THIS FILE IS INTENTIONALLY LEFT BLANK.
2
+ // Messages for the source locale are loaded from message definitions via react-intl fallback.
3
+ // DO NOT ADD ANY MESSAGES HERE!
4
+ export default {};
@@ -0,0 +1,8 @@
1
+ import { Extension } from '@tiptap/core';
2
+ /**
3
+ * Mention is an atom, so `marks: ''` on the node does not stop addMark.
4
+ * ProseMirror only checks that the parent paragraph allows the mark — toolbar
5
+ * underline therefore wraps the chip. Strip mention marks after doc changes;
6
+ * adjacent text still formats.
7
+ */
8
+ export declare const StripMentionMarks: Extension<any, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/threaded-annotations",
3
- "version": "4.9.8",
3
+ "version": "4.10.1",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "dependencies": {
6
6
  "@floating-ui/dom": "^1.6.0",
@@ -21,23 +21,23 @@
21
21
  "uuid": "^9.0.1"
22
22
  },
23
23
  "peerDependencies": {
24
- "@box/blueprint-web": "^17.5.3",
25
- "@box/blueprint-web-assets": "^5.9.9",
26
- "@box/collaboration-popover": "^2.2.40",
27
- "@box/readable-time": "^2.2.40",
28
- "@box/user-selector": "^3.0.19",
24
+ "@box/blueprint-web": "^17.6.0",
25
+ "@box/blueprint-web-assets": "^5.9.10",
26
+ "@box/collaboration-popover": "^2.2.41",
27
+ "@box/readable-time": "^2.2.41",
28
+ "@box/user-selector": "^3.0.20",
29
29
  "clsx": "^1.2.1",
30
30
  "react": "^18.0.0",
31
31
  "react-dom": "^18.0.0",
32
32
  "react-intl": "^6.4.2"
33
33
  },
34
34
  "devDependencies": {
35
- "@box/blueprint-web": "^17.5.3",
36
- "@box/blueprint-web-assets": "^5.9.9",
35
+ "@box/blueprint-web": "^17.6.0",
36
+ "@box/blueprint-web-assets": "^5.9.10",
37
37
  "@box/eslint-plugin-blueprint": "2.2.13",
38
- "@box/readable-time": "^2.2.40",
39
- "@box/storybook-utils": "^1.2.40",
40
- "@box/user-selector": "^3.0.19",
38
+ "@box/readable-time": "^2.2.41",
39
+ "@box/storybook-utils": "^1.2.41",
40
+ "@box/user-selector": "^3.0.20",
41
41
  "react": "^18.0.0",
42
42
  "react-dom": "^18.0.0"
43
43
  },