fix build issues

This commit is contained in:
Arjun 2026-05-06 22:22:27 +05:30
parent 0e3d058c29
commit d6651c4bf8
5 changed files with 250 additions and 360 deletions

View file

@ -25,15 +25,16 @@
"@radix-ui/react-tooltip": "^1.2.8",
"@radix-ui/react-use-controllable-state": "^1.2.2",
"@tailwindcss/vite": "^4.1.18",
"@tiptap/extension-image": "^3.16.0",
"@tiptap/extension-link": "^3.15.3",
"@tiptap/extension-placeholder": "^3.15.3",
"@tiptap/extension-table": "^3.22.4",
"@tiptap/extension-task-item": "^3.15.3",
"@tiptap/extension-task-list": "^3.15.3",
"@tiptap/pm": "^3.15.3",
"@tiptap/react": "^3.15.3",
"@tiptap/starter-kit": "^3.15.3",
"@tiptap/core": "3.22.4",
"@tiptap/extension-image": "3.22.4",
"@tiptap/extension-link": "3.22.4",
"@tiptap/extension-placeholder": "3.22.4",
"@tiptap/extension-table": "3.22.4",
"@tiptap/extension-task-item": "3.22.4",
"@tiptap/extension-task-list": "3.22.4",
"@tiptap/pm": "3.22.4",
"@tiptap/react": "3.22.4",
"@tiptap/starter-kit": "3.22.4",
"@x/preload": "workspace:*",
"@x/shared": "workspace:*",
"ai": "^5.0.117",

View file

@ -713,7 +713,7 @@ export const MarkdownEditor = forwardRef<MarkdownEditorHandle, MarkdownEditorPro
MermaidBlockExtension,
WikiLink.configure({
onCreate: wikiLinks?.onCreate
? (path) => {
? (path: string) => {
void wikiLinks.onCreate(path)
}
: undefined,

View file

@ -117,7 +117,6 @@ function EmailExpandedBody({
? `https://mail.google.com/mail/u/0/#all/${config.threadId}`
: null
const senderName = config.from ? extractName(config.from) : 'Unknown'
const initial = config.from ? getInitial(config.from) : '?'
const color = config.from ? avatarColor(config.from) : '#5f6368'
const hasDraft = !!config.draft_response

View file

@ -1,5 +1,4 @@
import { Node, mergeAttributes } from '@tiptap/react'
import { InputRule, inputRules } from '@tiptap/pm/inputrules'
import { InputRule, Node, mergeAttributes } from '@tiptap/core'
import { ensureMarkdownExtension, normalizeWikiPath, wikiLabel } from '@/lib/wiki-links'
const wikiLinkInputRegex = /\[\[([^[\]]+)\]\]$/
@ -88,13 +87,13 @@ export const WikiLink = Node.create<WikiLinkOptions>({
return [
{
tag: 'wiki-link[data-path]',
getAttrs: (element) => ({
getAttrs: (element: Element) => ({
path: (element as HTMLElement).getAttribute('data-path') ?? '',
}),
},
{
tag: 'a[data-type="wiki-link"]',
getAttrs: (element) => ({
getAttrs: (element: Element) => ({
path: (element as HTMLElement).getAttribute('data-path') ?? '',
}),
},
@ -132,23 +131,23 @@ export const WikiLink = Node.create<WikiLinkOptions>({
}
},
addProseMirrorPlugins() {
addInputRules() {
const onCreate = this.options.onCreate
const rules = [
new InputRule(wikiLinkInputRegex, (state, match, start, end) => {
const rawPath = match[1]?.trim()
const normalizedPath = rawPath ? normalizeWikiPath(rawPath) : ''
if (!normalizedPath || normalizedPath.endsWith('/') || normalizedPath.includes('..')) return null
if (state.selection.$from.parent.type.spec.code) return null
if (state.selection.$from.marks().some((mark) => mark.type.spec.code)) return null
return [
new InputRule({
find: wikiLinkInputRegex,
handler: ({ state, range, match }) => {
const rawPath = match[1]?.trim()
const normalizedPath = rawPath ? normalizeWikiPath(rawPath) : ''
if (!normalizedPath || normalizedPath.endsWith('/') || normalizedPath.includes('..')) return null
if (state.selection.$from.parent.type.spec.code) return null
if (state.selection.$from.marks().some((mark) => mark.type.spec.code)) return null
const finalPath = ensureMarkdownExtension(normalizedPath)
const tr = state.tr.replaceWith(start, end, this.type.create({ path: finalPath }))
onCreate?.(finalPath)
return tr
const finalPath = ensureMarkdownExtension(normalizedPath)
state.tr.replaceWith(range.from, range.to, this.type.create({ path: finalPath }))
onCreate?.(finalPath)
},
}),
]
return [inputRules({ rules })]
},
})