Make neurapress client-only entrypoint (#784)
This commit is contained in:
parent
30742eb62d
commit
748e10e63d
@ -49,6 +49,8 @@ const nextConfig = {
|
||||
"@theme": path.join(__dirname, "src", "components", "theme"),
|
||||
"@templates": path.join(__dirname, "src", "modules", "templates"),
|
||||
"@src": path.join(__dirname, "src"),
|
||||
"@": path.join(__dirname, "vendor", "neurapress", "src"),
|
||||
"@neurapress": path.join(__dirname, "vendor", "neurapress", "src"),
|
||||
};
|
||||
|
||||
// 添加模块搜索路径
|
||||
|
||||
@ -24,10 +24,12 @@
|
||||
"gray-matter": "^4.0.3",
|
||||
"html2canvas": "^1.4.1",
|
||||
"js-yaml": "^4.1.0",
|
||||
"katex": "^0.16.27",
|
||||
"lucide-react": "^0.319.0",
|
||||
"marked": "^16.1.2",
|
||||
"next": "^16.0.9",
|
||||
"pdfjs-dist": "^4.2.67",
|
||||
"prismjs": "^1.30.0",
|
||||
"prop-types": "^15.8.1",
|
||||
"qr.js": "0.0.0",
|
||||
"qrcode": "^1.5.4",
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import Link from 'next/link'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { useLanguage } from '@i18n/LanguageProvider'
|
||||
import { neurapressSample, renderMarkdown } from '../../../../vendor/neurapress/src'
|
||||
import { neurapressSample, renderMarkdown } from '@neurapress'
|
||||
import type { DraftStore } from './storage'
|
||||
|
||||
const defaultContent = `# 编辑器 / Editor
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
"jsx": "react-jsx",
|
||||
"baseUrl": ".", // 👈 根路径基准
|
||||
"paths": {
|
||||
"@/*": ["vendor/neurapress/src/*"],
|
||||
"@components/*": ["src/components/*"],
|
||||
"@i18n/*": ["src/i18n/*"],
|
||||
"@lib/*": ["src/lib/*"],
|
||||
@ -27,7 +28,9 @@
|
||||
"@theme": ["src/components/theme"],
|
||||
"@theme/*": ["src/components/theme/*"],
|
||||
"@templates/*": ["src/modules/templates/*"],
|
||||
"@src/*": ["src/*"]
|
||||
"@src/*": ["src/*"],
|
||||
"@neurapress": ["vendor/neurapress/src/index.ts"],
|
||||
"@neurapress/*": ["vendor/neurapress/src/*"]
|
||||
},
|
||||
"types": ["node", "vitest/globals", "@testing-library/jest-dom"],
|
||||
"plugins": [{ "name": "next" }]
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { MainNav } from '@/components/nav/MainNav'
|
||||
import { Logo } from '@/components/icons/Logo'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { MainNav } from '@neurapress/components/nav/MainNav'
|
||||
import { Logo } from '@neurapress/components/icons/Logo'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@neurapress/components/ui/card'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import Link from 'next/link'
|
||||
import {
|
||||
Heart,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { MainNav } from '@/components/nav/MainNav'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
||||
import { MainNav } from '@neurapress/components/nav/MainNav'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@neurapress/components/ui/card'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@neurapress/components/ui/tabs'
|
||||
import Link from 'next/link'
|
||||
import {
|
||||
BookOpen,
|
||||
|
||||
10
dashboard/vendor/neurapress/src/app/layout.tsx
vendored
10
dashboard/vendor/neurapress/src/app/layout.tsx
vendored
@ -1,12 +1,12 @@
|
||||
import type { Metadata } from 'next'
|
||||
import { Inter } from 'next/font/google'
|
||||
import './globals.css'
|
||||
import '@/styles/code-themes.css'
|
||||
import '@neurapress/styles/code-themes.css'
|
||||
import 'katex/dist/katex.min.css'
|
||||
import { ThemeProvider } from '@/components/theme/ThemeProvider'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Toaster } from '@/components/ui/toaster'
|
||||
import { GoogleAnalytics } from '@/components/GoogleAnalytics'
|
||||
import { ThemeProvider } from '@neurapress/components/theme/ThemeProvider'
|
||||
import { cn } from '@neurapress/lib/utils'
|
||||
import { Toaster } from '@neurapress/components/ui/toaster'
|
||||
import { GoogleAnalytics } from '@neurapress/components/GoogleAnalytics'
|
||||
|
||||
const inter = Inter({ subsets: ['latin'] })
|
||||
|
||||
|
||||
8
dashboard/vendor/neurapress/src/app/page.tsx
vendored
8
dashboard/vendor/neurapress/src/app/page.tsx
vendored
@ -1,10 +1,10 @@
|
||||
'use client'
|
||||
|
||||
import Link from 'next/link'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { MainNav } from '@/components/nav/MainNav'
|
||||
import { Logo } from '@/components/icons/Logo'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@neurapress/components/ui/card'
|
||||
import { MainNav } from '@neurapress/components/nav/MainNav'
|
||||
import { Logo } from '@neurapress/components/icons/Logo'
|
||||
import {
|
||||
FileText,
|
||||
Smartphone,
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
import dynamic from 'next/dynamic'
|
||||
import { Suspense } from 'react'
|
||||
import { Logo } from '@/components/icons/Logo'
|
||||
import { Logo } from '@neurapress/components/icons/Logo'
|
||||
import { Loader2 } from 'lucide-react'
|
||||
import { AdBanner } from '@/components/ui/AdBanner'
|
||||
import { AdBanner } from '@neurapress/components/ui/AdBanner'
|
||||
|
||||
const LoadingLogo = () => (
|
||||
<div className="h-full bg-background flex items-center justify-center">
|
||||
@ -24,7 +24,7 @@ const LoadingLogo = () => (
|
||||
)
|
||||
|
||||
// Dynamically import WechatEditor with no SSR
|
||||
const WechatEditor = dynamic(() => import('@/components/editor/WechatEditor'), {
|
||||
const WechatEditor = dynamic(() => import('@neurapress/components/editor/WechatEditor'), {
|
||||
ssr: false,
|
||||
loading: () => (
|
||||
<LoadingLogo />
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import XiaohongshuMarkdownEditor from '@/components/editor/xiaohongshu/XiaohongshuMarkdownEditor'
|
||||
import { Toaster } from '@/components/ui/toaster'
|
||||
import XiaohongshuMarkdownEditor from '@neurapress/components/editor/xiaohongshu/XiaohongshuMarkdownEditor'
|
||||
import { Toaster } from '@neurapress/components/ui/toaster'
|
||||
|
||||
export default function XiaohongshuPage() {
|
||||
return (
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { cn } from '@neurapress/lib/utils'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import {
|
||||
Sheet,
|
||||
SheetContent,
|
||||
@ -10,7 +10,7 @@ import {
|
||||
SheetHeader,
|
||||
SheetTitle,
|
||||
SheetTrigger,
|
||||
} from '@/components/ui/sheet'
|
||||
} from '@neurapress/components/ui/sheet'
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
@ -21,12 +21,12 @@ import {
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogTrigger,
|
||||
} from "@/components/ui/alert-dialog"
|
||||
import { ScrollArea } from '@/components/ui/scroll-area'
|
||||
} from "@neurapress/components/ui/alert-dialog"
|
||||
import { ScrollArea } from '@neurapress/components/ui/scroll-area'
|
||||
import { FileText, Trash2, Menu, Plus, Save, Edit2, Check } from 'lucide-react'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { ToastAction } from '@/components/ui/toast'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { useToast } from '@neurapress/components/ui/use-toast'
|
||||
import { ToastAction } from '@neurapress/components/ui/toast'
|
||||
import { Input } from '@neurapress/components/ui/input'
|
||||
|
||||
interface Article {
|
||||
id: string
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use client'
|
||||
|
||||
import { codeThemes, type CodeThemeId } from '@/config/code-themes'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { codeThemes, type CodeThemeId } from '@neurapress/config/code-themes'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@neurapress/components/ui/select'
|
||||
import { Label } from '@neurapress/components/ui/label'
|
||||
|
||||
interface CodeThemeSelectorProps {
|
||||
value: CodeThemeId
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@neurapress/components/ui/dialog'
|
||||
import { Label } from '@neurapress/components/ui/label'
|
||||
import { Input } from '@neurapress/components/ui/input'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { Settings } from 'lucide-react'
|
||||
import { type RendererOptions } from '@/lib/markdown'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
|
||||
import { type RendererOptions } from '@neurapress/lib/markdown'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@neurapress/components/ui/select'
|
||||
|
||||
const themeColors = [
|
||||
{ name: '经典黑', value: '#1a1a1a' },
|
||||
|
||||
@ -1,30 +1,30 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useCallback, useRef, useEffect } from 'react'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { ToastAction } from '@/components/ui/toast'
|
||||
import { type RendererOptions } from '@/lib/markdown'
|
||||
import { useToast } from '@neurapress/components/ui/use-toast'
|
||||
import { ToastAction } from '@neurapress/components/ui/toast'
|
||||
import { type RendererOptions } from '@neurapress/lib/markdown'
|
||||
import { useAutoSave } from './hooks/useAutoSave'
|
||||
import { EditorToolbar } from './components/EditorToolbar'
|
||||
import { EditorPreview } from './components/EditorPreview'
|
||||
import { MarkdownToolbar } from './components/MarkdownToolbar'
|
||||
import { type PreviewSize } from './constants'
|
||||
import { useLocalStorage } from '@/hooks/use-local-storage'
|
||||
import { codeThemes, type CodeThemeId } from '@/config/code-themes'
|
||||
import '@/styles/code-themes.css'
|
||||
import { templates } from '@/config/wechat-templates'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useLocalStorage } from '@neurapress/hooks/use-local-storage'
|
||||
import { codeThemes, type CodeThemeId } from '@neurapress/config/code-themes'
|
||||
import '@neurapress/styles/code-themes.css'
|
||||
import { templates } from '@neurapress/config/wechat-templates'
|
||||
import { cn } from '@neurapress/lib/utils'
|
||||
import { usePreviewContent } from './hooks/usePreviewContent'
|
||||
import { useEditorKeyboard } from './hooks/useEditorKeyboard'
|
||||
import { useScrollSync } from './hooks/useScrollSync'
|
||||
import { useWordStats } from './hooks/useWordStats'
|
||||
import { useCopy } from './hooks/useCopy'
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@neurapress/components/ui/tabs'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { Copy } from 'lucide-react'
|
||||
import { MobileEditor } from './components/MobileEditor'
|
||||
import { DesktopEditor } from './components/DesktopEditor'
|
||||
import { getExampleContent } from '@/lib/utils/loadExampleContent'
|
||||
import { getExampleContent } from '@neurapress/lib/utils/loadExampleContent'
|
||||
|
||||
export default function WechatEditor() {
|
||||
const { toast } = useToast()
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import { useEditor, EditorContent } from '@tiptap/react'
|
||||
import StarterKit from '@tiptap/starter-kit'
|
||||
import { useState } from 'react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { cn } from '@neurapress/lib/utils'
|
||||
import { Copy, Eye, Pencil } from 'lucide-react'
|
||||
|
||||
export default function XiaohongshuEditor() {
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import { type RefObject } from 'react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { templates } from '@/config/wechat-templates'
|
||||
import { cn } from '@neurapress/lib/utils'
|
||||
import { templates } from '@neurapress/config/wechat-templates'
|
||||
import { EditorPreview } from './EditorPreview'
|
||||
import { MarkdownToolbar } from './MarkdownToolbar'
|
||||
import { type PreviewSize } from '../constants'
|
||||
import { type CodeThemeId } from '@/config/code-themes'
|
||||
import { type CodeThemeId } from '@neurapress/config/code-themes'
|
||||
|
||||
interface DesktopEditorProps {
|
||||
editorRef: RefObject<HTMLDivElement>
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
'use client'
|
||||
|
||||
import { cn } from '@/lib/utils'
|
||||
import { cn } from '@neurapress/lib/utils'
|
||||
import { PREVIEW_SIZES, type PreviewSize } from '../constants'
|
||||
import { Loader2, ZoomIn, ZoomOut, Maximize2, Minimize2 } from 'lucide-react'
|
||||
import { templates } from '@/config/wechat-templates'
|
||||
import { templates } from '@neurapress/config/wechat-templates'
|
||||
import { useState, useRef, useEffect, useMemo } from 'react'
|
||||
import { type CodeThemeId } from '@/config/code-themes'
|
||||
import { type CodeThemeId } from '@neurapress/config/code-themes'
|
||||
import { useTheme } from 'next-themes'
|
||||
import '@/styles/code-themes.css'
|
||||
import '@neurapress/styles/code-themes.css'
|
||||
import mermaid from 'mermaid'
|
||||
import { useScrollSync } from '../hooks/useScrollSync'
|
||||
|
||||
|
||||
@ -2,22 +2,22 @@
|
||||
|
||||
import { useState } from 'react'
|
||||
import { Copy, Plus, Save, Smartphone, Settings, Github, Trash2 } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { cn } from '@neurapress/lib/utils'
|
||||
import { WechatStylePicker } from '../../template/WechatStylePicker'
|
||||
import { TemplateManager } from '../../template/TemplateManager'
|
||||
import { StyleConfigDialog } from '../StyleConfigDialog'
|
||||
import { ArticleList } from '@/components/ArticleList'
|
||||
import { ArticleList } from '@neurapress/components/ArticleList'
|
||||
import { type Article } from '../constants'
|
||||
import { type RendererOptions } from '@/lib/markdown'
|
||||
import { ThemeToggle } from '@/components/theme/ThemeToggle'
|
||||
import { Logo } from '@/components/icons/Logo'
|
||||
import { type RendererOptions } from '@neurapress/lib/markdown'
|
||||
import { ThemeToggle } from '@neurapress/components/theme/ThemeToggle'
|
||||
import { Logo } from '@neurapress/components/icons/Logo'
|
||||
import Link from 'next/link'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { ToastAction } from '@/components/ui/toast'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { useToast } from '@neurapress/components/ui/use-toast'
|
||||
import { ToastAction } from '@neurapress/components/ui/toast'
|
||||
import { CodeThemeSelector } from '../CodeThemeSelector'
|
||||
import { useLocalStorage } from '@/hooks/use-local-storage'
|
||||
import { codeThemes, type CodeThemeId } from '@/config/code-themes'
|
||||
import { useLocalStorage } from '@neurapress/hooks/use-local-storage'
|
||||
import { codeThemes, type CodeThemeId } from '@neurapress/config/code-themes'
|
||||
|
||||
interface EditorToolbarProps {
|
||||
value: string
|
||||
|
||||
@ -5,8 +5,8 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog"
|
||||
import { Button } from "@/components/ui/button"
|
||||
} from "@neurapress/components/ui/dialog"
|
||||
import { Button } from "@neurapress/components/ui/button"
|
||||
import { HelpCircle } from 'lucide-react'
|
||||
|
||||
const cheatSheet = [
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from '@/components/ui/tooltip'
|
||||
import { Separator } from '@/components/ui/separator'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from '@neurapress/components/ui/tooltip'
|
||||
import { Separator } from '@neurapress/components/ui/separator'
|
||||
import {
|
||||
Bold,
|
||||
Italic,
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import { type RefObject } from 'react'
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@neurapress/components/ui/tabs'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { Copy } from 'lucide-react'
|
||||
import { EditorPreview } from './EditorPreview'
|
||||
import { type PreviewSize } from '../constants'
|
||||
import { type CodeThemeId } from '@/config/code-themes'
|
||||
import { type CodeThemeId } from '@neurapress/config/code-themes'
|
||||
|
||||
interface MobileEditorProps {
|
||||
textareaRef: RefObject<HTMLTextAreaElement>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Copy, Save, Settings } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet'
|
||||
import { cn } from '@neurapress/lib/utils'
|
||||
import { Sheet, SheetContent, SheetTrigger } from '@neurapress/components/ui/sheet'
|
||||
import { WechatStylePicker } from '../../template/WechatStylePicker'
|
||||
|
||||
interface MobileToolbarProps {
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use client'
|
||||
|
||||
import { useCallback } from 'react'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { initializeMermaid } from '@/lib/markdown/mermaid-utils'
|
||||
import { useToast } from '@neurapress/components/ui/use-toast'
|
||||
import { initializeMermaid } from '@neurapress/lib/markdown/mermaid-utils'
|
||||
|
||||
export const useCopy = () => {
|
||||
const { toast } = useToast()
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { useState, useCallback, useEffect } from 'react'
|
||||
import { templates } from '@/config/wechat-templates'
|
||||
import { convertToWechat, getCodeThemeStyles, type RendererOptions } from '@/lib/markdown'
|
||||
import { type CodeThemeId } from '@/config/code-themes'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { initializeMermaid } from '@/lib/markdown/mermaid-utils'
|
||||
import { templates } from '@neurapress/config/wechat-templates'
|
||||
import { convertToWechat, getCodeThemeStyles, type RendererOptions } from '@neurapress/lib/markdown'
|
||||
import { type CodeThemeId } from '@neurapress/config/code-themes'
|
||||
import { useToast } from '@neurapress/components/ui/use-toast'
|
||||
import { initializeMermaid } from '@neurapress/lib/markdown/mermaid-utils'
|
||||
|
||||
interface UsePreviewContentProps {
|
||||
value: string
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { convertToWechat } from '@/lib/markdown'
|
||||
import { convertToWechat } from '@neurapress/lib/markdown'
|
||||
|
||||
// 计算阅读时间(假设每分钟阅读300字)
|
||||
const calculateReadingTime = (text: string): string => {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { useRef, useEffect } from 'react'
|
||||
import { TooltipProvider } from '@/components/ui/tooltip'
|
||||
import { TooltipProvider } from '@neurapress/components/ui/tooltip'
|
||||
import { XiaohongshuToolbar } from './components/XiaohongshuToolbar'
|
||||
import { XiaohongshuEditor } from './components/XiaohongshuEditor'
|
||||
import { XiaohongshuPreview } from './components/XiaohongshuPreview'
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { Textarea } from '@/components/ui/textarea'
|
||||
import { Textarea } from '@neurapress/components/ui/textarea'
|
||||
import { XiaohongshuMarkdownToolbar } from './XiaohongshuMarkdownToolbar'
|
||||
|
||||
interface XiaohongshuEditorProps {
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
'use client'
|
||||
|
||||
import React from 'react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
|
||||
import { Separator } from '@/components/ui/separator'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@neurapress/components/ui/tooltip'
|
||||
import { Separator } from '@neurapress/components/ui/separator'
|
||||
import {
|
||||
Bold,
|
||||
Italic,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { ZoomIn, ZoomOut, Maximize2, Minimize2, ChevronLeft, ChevronRight } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { cn } from '@neurapress/lib/utils'
|
||||
import { xiaohongshuTemplates, type XiaohongshuTemplateId, type PageMode, type PageNumberPosition } from '../constants'
|
||||
|
||||
interface XiaohongshuPreviewProps {
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
'use client'
|
||||
|
||||
import { Save, Copy, Palette, Image as ImageIcon, Settings, FileText } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { Logo } from '@/components/icons/Logo'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@neurapress/components/ui/select'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@neurapress/components/ui/dialog'
|
||||
import { Label } from '@neurapress/components/ui/label'
|
||||
import { Logo } from '@neurapress/components/icons/Logo'
|
||||
import Link from 'next/link'
|
||||
import {
|
||||
xiaohongshuTemplates,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { useState, useCallback } from 'react'
|
||||
import html2canvas from 'html2canvas'
|
||||
import JSZip from 'jszip'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { useToast } from '@neurapress/components/ui/use-toast'
|
||||
import type { PageMode } from '../constants'
|
||||
|
||||
export function useImageGeneration() {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { useState, useEffect, useCallback } from 'react'
|
||||
import { marked } from 'marked'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { useToast } from '@neurapress/components/ui/use-toast'
|
||||
import { defaultMarkdown, STORAGE_KEYS, type XiaohongshuTemplateId } from '../constants'
|
||||
|
||||
export function useXiaohongshuEditor() {
|
||||
|
||||
@ -2,11 +2,11 @@
|
||||
|
||||
import Link from 'next/link'
|
||||
import { usePathname } from 'next/navigation'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { ThemeToggle } from '@/components/theme-toggle'
|
||||
import { Logo } from '@/components/icons/Logo'
|
||||
import { cn } from '@neurapress/lib/utils'
|
||||
import { ThemeToggle } from '@neurapress/components/theme-toggle'
|
||||
import { Logo } from '@neurapress/components/icons/Logo'
|
||||
import { Github } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
|
||||
const navigation = [
|
||||
{ name: '微信公众号', href: '/wechat' },
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@neurapress/components/ui/dialog'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { Settings2, Download, Upload, Star, Plus } from 'lucide-react'
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { Textarea } from '@/components/ui/textarea'
|
||||
import { templates as defaultTemplates, type Template } from '@/config/wechat-templates'
|
||||
import { useLocalStorage } from '@/hooks/use-local-storage'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@neurapress/components/ui/tabs'
|
||||
import { Input } from '@neurapress/components/ui/input'
|
||||
import { Label } from '@neurapress/components/ui/label'
|
||||
import { Textarea } from '@neurapress/components/ui/textarea'
|
||||
import { templates as defaultTemplates, type Template } from '@neurapress/config/wechat-templates'
|
||||
import { useLocalStorage } from '@neurapress/hooks/use-local-storage'
|
||||
import { cn } from '@neurapress/lib/utils'
|
||||
|
||||
interface TemplateManagerProps {
|
||||
onTemplateChange: () => void
|
||||
|
||||
@ -2,16 +2,16 @@
|
||||
|
||||
import * as React from 'react'
|
||||
import { Check } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { cn } from '@neurapress/lib/utils'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog"
|
||||
import { templates } from '@/config/wechat-templates'
|
||||
import { Button } from "@/components/ui/button"
|
||||
} from "@neurapress/components/ui/dialog"
|
||||
import { templates } from '@neurapress/config/wechat-templates'
|
||||
import { Button } from "@neurapress/components/ui/button"
|
||||
|
||||
interface WechatStylePickerProps {
|
||||
value?: string
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
import { Check, ChevronDown } from "lucide-react"
|
||||
import * as SelectPrimitive from '@radix-ui/react-select'
|
||||
import { cn } from "@/lib/utils"
|
||||
import { templates } from '@/config/wechat-templates'
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
import { templates } from '@neurapress/config/wechat-templates'
|
||||
|
||||
export function WechatTemplateSelector({
|
||||
onSelectAction
|
||||
|
||||
@ -4,13 +4,13 @@ import * as React from "react"
|
||||
import { Moon, Sun } from "lucide-react"
|
||||
import { useTheme } from "next-themes"
|
||||
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Button } from "@neurapress/components/ui/button"
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu"
|
||||
} from "@neurapress/components/ui/dropdown-menu"
|
||||
|
||||
export function ThemeToggle() {
|
||||
const { setTheme } = useTheme()
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import * as React from "react"
|
||||
import { Moon, Sun } from "lucide-react"
|
||||
import { useTheme } from "next-themes"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Button } from "@neurapress/components/ui/button"
|
||||
|
||||
export function ThemeToggle() {
|
||||
const { theme, setTheme } = useTheme()
|
||||
|
||||
@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import { X } from "lucide-react"
|
||||
import { Button } from "./button"
|
||||
import { Card } from "./card"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
|
||||
interface AdBannerProps {
|
||||
id?: string // 广告ID,用于本地存储
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
import * as React from "react"
|
||||
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { buttonVariants } from "@/components/ui/button"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
import { buttonVariants } from "@neurapress/components/ui/button"
|
||||
|
||||
const AlertDialog = AlertDialogPrimitive.Root
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import { Slot } from "@radix-ui/react-slot"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
|
||||
const buttonVariants = cva(
|
||||
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
|
||||
const Card = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
|
||||
@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
||||
import { X } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
|
||||
const Dialog = DialogPrimitive.Root
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
||||
import { Check, ChevronRight, Circle } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
|
||||
const DropdownMenu = DropdownMenuPrimitive.Root
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
|
||||
export interface InputProps
|
||||
extends React.InputHTMLAttributes<HTMLInputElement> {}
|
||||
|
||||
@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import * as LabelPrimitive from "@radix-ui/react-label"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
|
||||
const labelVariants = cva(
|
||||
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import * as React from "react"
|
||||
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
|
||||
const ScrollArea = React.forwardRef<
|
||||
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
|
||||
|
||||
@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import * as SelectPrimitive from "@radix-ui/react-select"
|
||||
import { Check, ChevronDown, ChevronUp } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
|
||||
const Select = SelectPrimitive.Root
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import * as React from "react"
|
||||
import * as SeparatorPrimitive from "@radix-ui/react-separator"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
|
||||
const Separator = React.forwardRef<
|
||||
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
||||
|
||||
@ -5,7 +5,7 @@ import * as SheetPrimitive from "@radix-ui/react-dialog"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
import { X } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
|
||||
const Sheet = SheetPrimitive.Root
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import * as React from "react"
|
||||
import * as TabsPrimitive from "@radix-ui/react-tabs"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
|
||||
const Tabs = TabsPrimitive.Root
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
|
||||
export interface TextareaProps
|
||||
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
|
||||
|
||||
@ -5,7 +5,7 @@ import * as ToastPrimitives from "@radix-ui/react-toast"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
import { X } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
|
||||
const ToastProvider = ToastPrimitives.Provider
|
||||
|
||||
|
||||
@ -7,8 +7,8 @@ import {
|
||||
ToastProvider,
|
||||
ToastTitle,
|
||||
ToastViewport,
|
||||
} from "@/components/ui/toast"
|
||||
import { useToast } from "@/components/ui/use-toast"
|
||||
} from "@neurapress/components/ui/toast"
|
||||
import { useToast } from "@neurapress/components/ui/use-toast"
|
||||
|
||||
export function Toaster() {
|
||||
const { toasts } = useToast()
|
||||
|
||||
@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import * as TogglePrimitive from "@radix-ui/react-toggle"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
|
||||
const toggleVariants = cva(
|
||||
"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import * as React from "react"
|
||||
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
|
||||
const TooltipProvider = TooltipPrimitive.Provider
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ import * as React from "react"
|
||||
import type {
|
||||
ToastActionElement,
|
||||
ToastProps,
|
||||
} from "@/components/ui/toast"
|
||||
} from "@neurapress/components/ui/toast"
|
||||
|
||||
const TOAST_LIMIT = 1
|
||||
const TOAST_REMOVE_DELAY = 1000000
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import type { RendererOptions } from '@/lib/markdown'
|
||||
import type { RendererOptions } from '@neurapress/lib/markdown'
|
||||
|
||||
export interface Template {
|
||||
id: string
|
||||
|
||||
5
dashboard/vendor/neurapress/src/index.ts
vendored
5
dashboard/vendor/neurapress/src/index.ts
vendored
@ -1,8 +1,13 @@
|
||||
"use client"
|
||||
|
||||
import { convertToWechat, defaultOptions } from './lib/markdown'
|
||||
import { getExampleContent } from './lib/utils/loadExampleContent'
|
||||
import WechatEditor from './components/editor/WechatEditor'
|
||||
|
||||
export const neurapressSample = getExampleContent()
|
||||
|
||||
export function renderMarkdown(markdown: string): string {
|
||||
return convertToWechat(markdown, defaultOptions)
|
||||
}
|
||||
|
||||
export const Editor = WechatEditor
|
||||
|
||||
@ -16,7 +16,7 @@ import 'prismjs/components/prism-rust'
|
||||
import 'prismjs/components/prism-sql'
|
||||
import 'prismjs/components/prism-docker'
|
||||
import 'prismjs/components/prism-nginx'
|
||||
import type { CodeThemeId } from '@/config/code-themes'
|
||||
import type { CodeThemeId } from '@neurapress/config/code-themes'
|
||||
import { getTokenStyles } from './styles'
|
||||
|
||||
// Helper function to recursively process tokens
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { StyleOptions, RendererOptions } from './types'
|
||||
import { codeThemes, type CodeThemeId } from '@/config/code-themes'
|
||||
import { codeThemes, type CodeThemeId } from '@neurapress/config/code-themes'
|
||||
|
||||
// 将样式对象转换为 CSS 字符串
|
||||
export function cssPropertiesToString(style: StyleOptions = {}): string {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { CSSProperties } from 'react'
|
||||
import type { CodeThemeId } from '@/config/code-themes'
|
||||
import type { CodeThemeId } from '@neurapress/config/code-themes'
|
||||
|
||||
export interface StyleOptions {
|
||||
// Layout
|
||||
|
||||
@ -2229,12 +2229,14 @@ __metadata:
|
||||
html2canvas: "npm:^1.4.1"
|
||||
js-yaml: "npm:^4.1.0"
|
||||
jsdom: "npm:^24.0.0"
|
||||
katex: "npm:^0.16.27"
|
||||
lucide-react: "npm:^0.319.0"
|
||||
marked: "npm:^16.1.2"
|
||||
next: "npm:^16.0.9"
|
||||
pdfjs-dist: "npm:^4.2.67"
|
||||
postcss: "npm:^8.4.32"
|
||||
prettier: "npm:^3.3.3"
|
||||
prismjs: "npm:^1.30.0"
|
||||
prop-types: "npm:^15.8.1"
|
||||
qr.js: "npm:0.0.0"
|
||||
qrcode: "npm:^1.5.4"
|
||||
@ -2293,6 +2295,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"commander@npm:^8.3.0":
|
||||
version: 8.3.0
|
||||
resolution: "commander@npm:8.3.0"
|
||||
checksum: 10/6b7b5d334483ce24bd73c5dac2eab901a7dbb25fd983ea24a1eeac6e7166bb1967f641546e8abf1920afbde86a45fbfe5812fbc69d0dc451bb45ca416a12a3a3
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"concat-map@npm:0.0.1":
|
||||
version: 0.0.1
|
||||
resolution: "concat-map@npm:0.0.1"
|
||||
@ -4407,6 +4416,17 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"katex@npm:^0.16.27":
|
||||
version: 0.16.27
|
||||
resolution: "katex@npm:0.16.27"
|
||||
dependencies:
|
||||
commander: "npm:^8.3.0"
|
||||
bin:
|
||||
katex: cli.js
|
||||
checksum: 10/7666ae11c6c1238626bffaf1a526af6ff679114d62293bf2f0e29f8a34d8e961c0edcb686c5b628158ec92a143b4bef5d83539c81b29a63c7dcf0bdb4544eec9
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"keyv@npm:^4.5.3":
|
||||
version: 4.5.4
|
||||
resolution: "keyv@npm:4.5.4"
|
||||
@ -5458,6 +5478,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"prismjs@npm:^1.30.0":
|
||||
version: 1.30.0
|
||||
resolution: "prismjs@npm:1.30.0"
|
||||
checksum: 10/6b48a2439a82e5c6882f48ebc1564c3890e16463ba17ac10c3ad4f62d98dea5b5c915b172b63b83023a70ad4f5d7be3e8a60304420db34a161fae69dd4e3e2da
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"proc-log@npm:^5.0.0":
|
||||
version: 5.0.0
|
||||
resolution: "proc-log@npm:5.0.0"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user