Skip to content

Commit 95d79e1

Browse files
committed
fix: extension mention
1 parent 8af0b95 commit 95d79e1

File tree

7 files changed

+1237
-1141
lines changed

7 files changed

+1237
-1141
lines changed

package.json

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
"types": "./lib/index.d.ts",
3434
"pnpm": {
3535
"overrides": {
36+
"@excalidraw/excalidraw>nanoid": "3.3.11",
3637
"@excalidraw/mermaid-to-excalidraw": "2.0.0",
3738
"@excalidraw/mermaid-to-excalidraw>nanoid": "5.1.6",
38-
"@excalidraw/excalidraw>nanoid": "3.3.11",
3939
"esbuild": "0.25.12",
4040
"prosemirror-view": "1.41.1"
4141
}
@@ -709,7 +709,7 @@
709709
"dependencies": {
710710
"@excalidraw/excalidraw": "^0.18.0",
711711
"@floating-ui/dom": "^1.7.4",
712-
"@hocuspocus/provider": "^3.4.0",
712+
"@hocuspocus/provider": "^3.4.3",
713713
"@radix-ui/react-checkbox": "^1.3.3",
714714
"@radix-ui/react-dialog": "^1.1.15",
715715
"@radix-ui/react-dropdown-menu": "^2.1.16",
@@ -724,80 +724,80 @@
724724
"@radix-ui/react-toast": "^1.2.15",
725725
"@radix-ui/react-toggle": "^1.1.10",
726726
"@radix-ui/react-tooltip": "^1.2.8",
727-
"@tiptap/core": "^3.11.1",
728-
"@tiptap/extension-blockquote": "^3.11.1",
729-
"@tiptap/extension-bold": "^3.11.1",
730-
"@tiptap/extension-bullet-list": "^3.11.1",
731-
"@tiptap/extension-code": "^3.11.1",
732-
"@tiptap/extension-collaboration": "^3.13.0",
733-
"@tiptap/extension-collaboration-caret": "^3.12.0",
734-
"@tiptap/extension-document": "^3.11.1",
735-
"@tiptap/extension-drag-handle": "^3.13.0",
736-
"@tiptap/extension-drag-handle-react": "^3.13.0",
737-
"@tiptap/extension-emoji": "^3.11.1",
738-
"@tiptap/extension-hard-break": "^3.11.1",
739-
"@tiptap/extension-heading": "^3.11.1",
740-
"@tiptap/extension-highlight": "^2.26.1",
741-
"@tiptap/extension-horizontal-rule": "^3.11.1",
742-
"@tiptap/extension-image": "^3.11.1",
743-
"@tiptap/extension-italic": "^3.11.1",
744-
"@tiptap/extension-link": "^3.11.1",
745-
"@tiptap/extension-list": "^3.11.1",
746-
"@tiptap/extension-list-item": "^3.11.1",
747-
"@tiptap/extension-mention": "^3.11.1",
748-
"@tiptap/extension-node-range": "^3.13.0",
749-
"@tiptap/extension-ordered-list": "^3.11.1",
750-
"@tiptap/extension-paragraph": "^3.11.1",
751-
"@tiptap/extension-strike": "^3.11.1",
752-
"@tiptap/extension-subscript": "^3.11.1",
753-
"@tiptap/extension-superscript": "^3.11.1",
754-
"@tiptap/extension-table": "^3.11.1",
755-
"@tiptap/extension-task-item": "^3.11.1",
756-
"@tiptap/extension-task-list": "^3.11.1",
757-
"@tiptap/extension-text": "^3.11.1",
758-
"@tiptap/extension-text-align": "^3.11.1",
759-
"@tiptap/extension-text-style": "^3.11.1",
760-
"@tiptap/extension-underline": "^3.11.1",
761-
"@tiptap/extensions": "^3.11.1",
762-
"@tiptap/pm": "^3.11.1",
763-
"@tiptap/react": "^3.11.1",
764-
"@tiptap/suggestion": "^3.11.1",
727+
"@tiptap/core": "^3.14.0",
728+
"@tiptap/extension-blockquote": "^3.14.0",
729+
"@tiptap/extension-bold": "^3.14.0",
730+
"@tiptap/extension-bullet-list": "^3.14.0",
731+
"@tiptap/extension-code": "^3.14.0",
732+
"@tiptap/extension-collaboration": "^3.14.0",
733+
"@tiptap/extension-collaboration-caret": "^3.14.0",
734+
"@tiptap/extension-document": "^3.14.0",
735+
"@tiptap/extension-drag-handle": "^3.14.0",
736+
"@tiptap/extension-drag-handle-react": "^3.14.0",
737+
"@tiptap/extension-emoji": "^3.14.0",
738+
"@tiptap/extension-hard-break": "^3.14.0",
739+
"@tiptap/extension-heading": "^3.14.0",
740+
"@tiptap/extension-highlight": "^2.27.1",
741+
"@tiptap/extension-horizontal-rule": "^3.14.0",
742+
"@tiptap/extension-image": "^3.14.0",
743+
"@tiptap/extension-italic": "^3.14.0",
744+
"@tiptap/extension-link": "^3.14.0",
745+
"@tiptap/extension-list": "^3.14.0",
746+
"@tiptap/extension-list-item": "^3.14.0",
747+
"@tiptap/extension-mention": "^3.14.0",
748+
"@tiptap/extension-node-range": "^3.14.0",
749+
"@tiptap/extension-ordered-list": "^3.14.0",
750+
"@tiptap/extension-paragraph": "^3.14.0",
751+
"@tiptap/extension-strike": "^3.14.0",
752+
"@tiptap/extension-subscript": "^3.14.0",
753+
"@tiptap/extension-superscript": "^3.14.0",
754+
"@tiptap/extension-table": "^3.14.0",
755+
"@tiptap/extension-task-item": "^3.14.0",
756+
"@tiptap/extension-task-list": "^3.14.0",
757+
"@tiptap/extension-text": "^3.14.0",
758+
"@tiptap/extension-text-align": "^3.14.0",
759+
"@tiptap/extension-text-style": "^3.14.0",
760+
"@tiptap/extension-underline": "^3.14.0",
761+
"@tiptap/extensions": "^3.14.0",
762+
"@tiptap/pm": "^3.14.0",
763+
"@tiptap/react": "^3.14.0",
764+
"@tiptap/suggestion": "^3.14.0",
765765
"@tiptap/y-tiptap": "^3.0.1",
766766
"class-variance-authority": "^0.7.1",
767767
"clsx": "^2.1.1",
768768
"deep-equal": "^2.2.3",
769769
"docx": "^9.5.1",
770770
"easydrawer": "^0.0.15",
771771
"frimousse": "^0.3.0",
772-
"katex": "^0.16.25",
773-
"lodash-es": "^4.17.21",
772+
"katex": "^0.16.27",
773+
"lodash-es": "^4.17.22",
774774
"lucide-react": "^0.427.0",
775-
"mermaid": "^11.12.1",
775+
"mermaid": "^11.12.2",
776776
"prism-code-editor-lightweight": "^0.0.3",
777777
"prosemirror-docx": "^0.2.1",
778778
"re-resizable": "^6.11.2",
779779
"react-colorful": "^5.6.1",
780780
"react-image-crop": "^11.0.10",
781-
"react-tweet": "^3.2.2",
781+
"react-tweet": "^3.3.0",
782782
"reactjs-signal": "^2.0.1",
783783
"scroll-into-view-if-needed": "^3.1.0",
784784
"svg64": "^2.0.0",
785-
"y-protocols": "^1.0.6",
786-
"yjs": "^13.6.27"
785+
"y-protocols": "^1.0.7",
786+
"yjs": "^13.6.28"
787787
},
788788
"devDependencies": {
789789
"@hunghg255/eslint-config": "^1.0.1",
790790
"@types/deep-equal": "^1.0.4",
791791
"@types/katex": "^0.16.7",
792792
"@types/lodash-es": "^4.17.12",
793-
"@types/node": "^24.10.1",
793+
"@types/node": "^24.10.4",
794794
"@types/react": "^19.2.7",
795795
"@types/react-dom": "^19.2.3",
796-
"@vitejs/plugin-react": "^5.1.1",
797-
"autoprefixer": "^10.4.22",
796+
"@vitejs/plugin-react": "^5.1.2",
797+
"autoprefixer": "^10.4.23",
798798
"bumpp": "^10.3.2",
799799
"contributorkit": "^0.0.4",
800-
"eslint": "^9.39.1",
800+
"eslint": "^9.39.2",
801801
"eslint-plugin-tailwindcss": "^3.18.2",
802802
"esno": "^4.8.0",
803803
"execa": "^9.6.1",
@@ -808,11 +808,11 @@
808808
"postcss": "^8.5.6",
809809
"postcss-replace": "^2.0.1",
810810
"postcss-scss": "^4.0.9",
811-
"react": "^19.2.0",
812-
"react-dom": "^19.2.0",
813-
"sass": "^1.94.2",
811+
"react": "^19.2.3",
812+
"react-dom": "^19.2.3",
813+
"sass": "^1.97.1",
814814
"tailwind-merge": "^2.6.0",
815-
"tailwindcss": "^3.4.18",
815+
"tailwindcss": "^3.4.19",
816816
"typescript": "^5.9.3",
817817
"unplugin-dts": "1.0.0-beta.6",
818818
"verify-commit-msg": "^0.1.0",

playground/src/App.tsx

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,43 @@ const DocumentColumn = /* @__PURE__ */ Document.extend({
131131
// echo editor is a block editor
132132
});
133133

134+
const MOCK_USERS = [{
135+
id: '0',
136+
label: 'hunghg255',
137+
avatar: {
138+
src: 'https://avatars.githubusercontent.com/u/42096908?v=4'
139+
}
140+
},
141+
{
142+
id: '1',
143+
label: 'benjamincanac',
144+
avatar: {
145+
src: 'https://avatars.githubusercontent.com/u/739984?v=4'
146+
}
147+
},
148+
{
149+
id: '2',
150+
label: 'atinux',
151+
avatar: {
152+
src: 'https://avatars.githubusercontent.com/u/904724?v=4'
153+
}
154+
},
155+
{
156+
id: '3',
157+
label: 'danielroe',
158+
avatar: {
159+
src: 'https://avatars.githubusercontent.com/u/28706372?v=4'
160+
}
161+
},
162+
{
163+
id: '4',
164+
label: 'pi0',
165+
avatar: {
166+
src: 'https://avatars.githubusercontent.com/u/5158436?v=4'
167+
}
168+
}
169+
];
170+
134171
const BaseKit = [
135172
DocumentColumn,
136173
Text,
@@ -251,7 +288,31 @@ const extensions = [
251288
},
252289
}),
253290
Twitter,
254-
Mention,
291+
Mention.configure({
292+
suggestion: {
293+
char: '@',
294+
items: async ({ query }: any) => {
295+
console.log('query', query);
296+
// const data = MOCK_USERS.map(item => item.label);
297+
// return data.filter(item => item.toLowerCase().startsWith(query.toLowerCase()));
298+
return MOCK_USERS.filter(item => item.label.toLowerCase().startsWith(query.toLowerCase()));
299+
},
300+
}
301+
// suggestions: [
302+
// {
303+
// char: '@',
304+
// items: async ({ query }: any) => {
305+
// return MOCK_USERS.filter(item => item.label.toLowerCase().startsWith(query.toLowerCase()));
306+
// },
307+
// },
308+
// {
309+
// char: '#',
310+
// items: async ({ query }: any) => {
311+
// return MOCK_USERS.filter(item => item.label.toLowerCase().startsWith(query.toLowerCase()));
312+
// },
313+
// }
314+
// ]
315+
}),
255316
SlashCommand,
256317
CodeView,
257318

0 commit comments

Comments
 (0)