chore: move neurapress to internal package (#786)
@ -12,16 +12,16 @@ This repository contains the API server, agent code and a Next.js-based UI.
|
||||
- **xcontrol-server**
|
||||
- **markdown studio** (NeuraPress-based, MIT-licensed) available at `/editor` (public)
|
||||
and `/dashboard/cms` (SaaS shell). The upstream license and NOTICE live under
|
||||
`dashboard/vendor/neurapress`, keeping attribution to
|
||||
`packages/neurapress`, keeping attribution to
|
||||
[tianyaxiang](https://github.com/tianyaxiang/neurapress).
|
||||
|
||||
### NeuraPress integration · 集成说明
|
||||
|
||||
The `/editor` route ships the original NeuraPress online editing core vendored under
|
||||
`dashboard/vendor/neurapress`. Routing, authentication, and storage selection are layered on
|
||||
`packages/neurapress`. Routing, authentication, and storage selection are layered on
|
||||
top inside XControl, while the editing experience stays aligned with the upstream project.
|
||||
|
||||
上游 NeuraPress 由 tianyaxiang 以 MIT 协议发布。本项目在 `dashboard/vendor/neurapress` 中保留
|
||||
上游 NeuraPress 由 tianyaxiang 以 MIT 协议发布。本项目在 `packages/neurapress` 中保留
|
||||
LICENSE 与 NOTICE 以持续标注版权与来源。
|
||||
|
||||
|
||||
|
||||
@ -49,8 +49,7 @@ 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"),
|
||||
"@": path.join(__dirname, "src"),
|
||||
};
|
||||
|
||||
// 添加模块搜索路径
|
||||
@ -63,6 +62,7 @@ const nextConfig = {
|
||||
return config;
|
||||
},
|
||||
reactStrictMode: true,
|
||||
transpilePackages: ['@internal/neurapress'],
|
||||
typedRoutes: false,
|
||||
turbopack: {
|
||||
root: path.resolve(__dirname),
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
"test:e2e": "playwright test --config tests/e2e/playwright.config.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@internal/neurapress": "file:../packages/neurapress",
|
||||
"dompurify": "^3.2.6",
|
||||
"gray-matter": "^4.0.3",
|
||||
"html2canvas": "^1.4.1",
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import Link from 'next/link'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { useLanguage } from '@i18n/LanguageProvider'
|
||||
import { neurapressSample, renderMarkdown } from '@neurapress'
|
||||
import { neurapressSample, renderMarkdown } from '@internal/neurapress'
|
||||
import type { DraftStore } from './storage'
|
||||
|
||||
const defaultContent = `# 编辑器 / Editor
|
||||
@ -188,7 +188,7 @@ export default function EditorShell({ store, fallbackStore, mode }: EditorShellP
|
||||
<div className="mt-3 inline-flex items-center gap-2 rounded-full border border-indigo-500/30 bg-indigo-500/10 px-3 py-1 text-xs font-medium text-indigo-100">
|
||||
{status ?? storeNotice ?? (isChinese ? '仅本地保存 · 未来支持云端账号' : 'Local-only save · SaaS sync coming soon')}
|
||||
</div>
|
||||
<p className="mt-2 text-xs text-indigo-100/80">{isChinese ? '左侧展示的是 vendor/neurapress 的原版在线编辑器内核,保持与上游一致的操作体验。' : 'The left pane runs the upstream NeuraPress online editor core from vendor/neurapress to mirror the original experience.'}</p>
|
||||
<p className="mt-2 text-xs text-indigo-100/80">{isChinese ? '左侧展示的是 packages/neurapress 的原版在线编辑器内核,保持与上游一致的操作体验。' : 'The left pane runs the upstream NeuraPress online editor core from packages/neurapress to mirror the original experience.'}</p>
|
||||
</div>
|
||||
<div className="hidden flex-col items-end gap-2 text-right text-xs text-slate-400 sm:flex">
|
||||
<span>{mode === 'public' ? (isChinese ? '无需登录 · 本地存储' : 'No sign-in required · Local storage only') : isChinese ? '登录后将提供云端草稿' : 'Cloud drafts will be available after sign-in'}</span>
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
"jsx": "react-jsx",
|
||||
"baseUrl": ".", // 👈 根路径基准
|
||||
"paths": {
|
||||
"@/*": ["vendor/neurapress/src/*"],
|
||||
"@/*": ["src/*"],
|
||||
"@components/*": ["src/components/*"],
|
||||
"@i18n/*": ["src/i18n/*"],
|
||||
"@lib/*": ["src/lib/*"],
|
||||
@ -29,8 +29,8 @@
|
||||
"@theme/*": ["src/components/theme/*"],
|
||||
"@templates/*": ["src/modules/templates/*"],
|
||||
"@src/*": ["src/*"],
|
||||
"@neurapress": ["vendor/neurapress/src/index.ts"],
|
||||
"@neurapress/*": ["vendor/neurapress/src/*"]
|
||||
"@internal/neurapress": ["../packages/neurapress/src/index.ts"],
|
||||
"@internal/neurapress/*": ["../packages/neurapress/src/*"]
|
||||
},
|
||||
"types": ["node", "vitest/globals", "@testing-library/jest-dom"],
|
||||
"plugins": [{ "name": "next" }]
|
||||
|
||||
13
dashboard/vendor/neurapress/src/index.ts
vendored
@ -1,13 +0,0 @@
|
||||
"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
|
||||
@ -1,7 +1,21 @@
|
||||
{
|
||||
"name": "neurapress",
|
||||
"name": "@internal/neurapress",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"main": "./src/index.ts",
|
||||
"module": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
"import": "./src/index.ts"
|
||||
},
|
||||
"./package.json": "./package.json",
|
||||
"./*": {
|
||||
"types": "./src/*",
|
||||
"import": "./src/*"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "cross-env NODE_NO_WARNINGS=1 next dev",
|
||||
"build": "NODE_NO_WARNINGS=1 next build",
|
||||
@ -39,11 +53,9 @@
|
||||
"lucide-react": "^0.474.0",
|
||||
"marked": "^16.0.0",
|
||||
"mermaid": "^11.4.1",
|
||||
"next": "14.1.0",
|
||||
"next": "^16.0.0",
|
||||
"next-themes": "^0.4.4",
|
||||
"prismjs": "^1.29.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"tailwind-merge": "^2.6.0",
|
||||
"tailwindcss-animate": "^1.0.7"
|
||||
},
|
||||
@ -58,5 +70,9 @@
|
||||
"postcss": "^8.5.1",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 254 KiB |
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@ -1,7 +1,7 @@
|
||||
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 { MainNav } from '@internal/neurapress/components/nav/MainNav'
|
||||
import { Logo } from '@internal/neurapress/components/icons/Logo'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@internal/neurapress/components/ui/card'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
import Link from 'next/link'
|
||||
import {
|
||||
Heart,
|
||||
@ -1,7 +1,7 @@
|
||||
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 { MainNav } from '@internal/neurapress/components/nav/MainNav'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@internal/neurapress/components/ui/card'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@internal/neurapress/components/ui/tabs'
|
||||
import Link from 'next/link'
|
||||
import {
|
||||
BookOpen,
|
||||
@ -1,12 +1,12 @@
|
||||
import type { Metadata } from 'next'
|
||||
import { Inter } from 'next/font/google'
|
||||
import './globals.css'
|
||||
import '@neurapress/styles/code-themes.css'
|
||||
import '@internal/neurapress/styles/code-themes.css'
|
||||
import 'katex/dist/katex.min.css'
|
||||
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'
|
||||
import { ThemeProvider } from '@internal/neurapress/components/theme/ThemeProvider'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import { Toaster } from '@internal/neurapress/components/ui/toaster'
|
||||
import { GoogleAnalytics } from '@internal/neurapress/components/GoogleAnalytics'
|
||||
|
||||
const inter = Inter({ subsets: ['latin'] })
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
'use client'
|
||||
|
||||
import Link from 'next/link'
|
||||
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 { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@internal/neurapress/components/ui/card'
|
||||
import { MainNav } from '@internal/neurapress/components/nav/MainNav'
|
||||
import { Logo } from '@internal/neurapress/components/icons/Logo'
|
||||
import {
|
||||
FileText,
|
||||
Smartphone,
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
import dynamic from 'next/dynamic'
|
||||
import { Suspense } from 'react'
|
||||
import { Logo } from '@neurapress/components/icons/Logo'
|
||||
import { Logo } from '@internal/neurapress/components/icons/Logo'
|
||||
import { Loader2 } from 'lucide-react'
|
||||
import { AdBanner } from '@neurapress/components/ui/AdBanner'
|
||||
import { AdBanner } from '@internal/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('@neurapress/components/editor/WechatEditor'), {
|
||||
const WechatEditor = dynamic(() => import('@internal/neurapress/components/editor/WechatEditor'), {
|
||||
ssr: false,
|
||||
loading: () => (
|
||||
<LoadingLogo />
|
||||
@ -1,5 +1,5 @@
|
||||
import XiaohongshuMarkdownEditor from '@neurapress/components/editor/xiaohongshu/XiaohongshuMarkdownEditor'
|
||||
import { Toaster } from '@neurapress/components/ui/toaster'
|
||||
import XiaohongshuMarkdownEditor from '@internal/neurapress/components/editor/xiaohongshu/XiaohongshuMarkdownEditor'
|
||||
import { Toaster } from '@internal/neurapress/components/ui/toaster'
|
||||
|
||||
export default function XiaohongshuPage() {
|
||||
return (
|
||||
@ -1,8 +1,8 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
import { cn } from '@neurapress/lib/utils'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
import {
|
||||
Sheet,
|
||||
SheetContent,
|
||||
@ -10,7 +10,7 @@ import {
|
||||
SheetHeader,
|
||||
SheetTitle,
|
||||
SheetTrigger,
|
||||
} from '@neurapress/components/ui/sheet'
|
||||
} from '@internal/neurapress/components/ui/sheet'
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
@ -21,12 +21,12 @@ import {
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogTrigger,
|
||||
} from "@neurapress/components/ui/alert-dialog"
|
||||
import { ScrollArea } from '@neurapress/components/ui/scroll-area'
|
||||
} from "@internal/neurapress/components/ui/alert-dialog"
|
||||
import { ScrollArea } from '@internal/neurapress/components/ui/scroll-area'
|
||||
import { FileText, Trash2, Menu, Plus, Save, Edit2, Check } from 'lucide-react'
|
||||
import { useToast } from '@neurapress/components/ui/use-toast'
|
||||
import { ToastAction } from '@neurapress/components/ui/toast'
|
||||
import { Input } from '@neurapress/components/ui/input'
|
||||
import { useToast } from '@internal/neurapress/components/ui/use-toast'
|
||||
import { ToastAction } from '@internal/neurapress/components/ui/toast'
|
||||
import { Input } from '@internal/neurapress/components/ui/input'
|
||||
|
||||
interface Article {
|
||||
id: string
|
||||
@ -1,8 +1,8 @@
|
||||
'use client'
|
||||
|
||||
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'
|
||||
import { codeThemes, type CodeThemeId } from '@internal/neurapress/config/code-themes'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@internal/neurapress/components/ui/select'
|
||||
import { Label } from '@internal/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 '@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 { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@internal/neurapress/components/ui/dialog'
|
||||
import { Label } from '@internal/neurapress/components/ui/label'
|
||||
import { Input } from '@internal/neurapress/components/ui/input'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { Settings } from 'lucide-react'
|
||||
import { type RendererOptions } from '@neurapress/lib/markdown'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@neurapress/components/ui/select'
|
||||
import { type RendererOptions } from '@internal/neurapress/lib/markdown'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@internal/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 '@neurapress/components/ui/use-toast'
|
||||
import { ToastAction } from '@neurapress/components/ui/toast'
|
||||
import { type RendererOptions } from '@neurapress/lib/markdown'
|
||||
import { useToast } from '@internal/neurapress/components/ui/use-toast'
|
||||
import { ToastAction } from '@internal/neurapress/components/ui/toast'
|
||||
import { type RendererOptions } from '@internal/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 '@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 { useLocalStorage } from '@internal/neurapress/hooks/use-local-storage'
|
||||
import { codeThemes, type CodeThemeId } from '@internal/neurapress/config/code-themes'
|
||||
import '@internal/neurapress/styles/code-themes.css'
|
||||
import { templates } from '@internal/neurapress/config/wechat-templates'
|
||||
import { cn } from '@internal/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 '@neurapress/components/ui/tabs'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@internal/neurapress/components/ui/tabs'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { Copy } from 'lucide-react'
|
||||
import { MobileEditor } from './components/MobileEditor'
|
||||
import { DesktopEditor } from './components/DesktopEditor'
|
||||
import { getExampleContent } from '@neurapress/lib/utils/loadExampleContent'
|
||||
import { getExampleContent } from '@internal/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 '@neurapress/lib/utils'
|
||||
import { cn } from '@internal/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 '@neurapress/lib/utils'
|
||||
import { templates } from '@neurapress/config/wechat-templates'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import { templates } from '@internal/neurapress/config/wechat-templates'
|
||||
import { EditorPreview } from './EditorPreview'
|
||||
import { MarkdownToolbar } from './MarkdownToolbar'
|
||||
import { type PreviewSize } from '../constants'
|
||||
import { type CodeThemeId } from '@neurapress/config/code-themes'
|
||||
import { type CodeThemeId } from '@internal/neurapress/config/code-themes'
|
||||
|
||||
interface DesktopEditorProps {
|
||||
editorRef: RefObject<HTMLDivElement>
|
||||
@ -1,13 +1,13 @@
|
||||
'use client'
|
||||
|
||||
import { cn } from '@neurapress/lib/utils'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import { PREVIEW_SIZES, type PreviewSize } from '../constants'
|
||||
import { Loader2, ZoomIn, ZoomOut, Maximize2, Minimize2 } from 'lucide-react'
|
||||
import { templates } from '@neurapress/config/wechat-templates'
|
||||
import { templates } from '@internal/neurapress/config/wechat-templates'
|
||||
import { useState, useRef, useEffect, useMemo } from 'react'
|
||||
import { type CodeThemeId } from '@neurapress/config/code-themes'
|
||||
import { type CodeThemeId } from '@internal/neurapress/config/code-themes'
|
||||
import { useTheme } from 'next-themes'
|
||||
import '@neurapress/styles/code-themes.css'
|
||||
import '@internal/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 '@neurapress/lib/utils'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import { WechatStylePicker } from '../../template/WechatStylePicker'
|
||||
import { TemplateManager } from '../../template/TemplateManager'
|
||||
import { StyleConfigDialog } from '../StyleConfigDialog'
|
||||
import { ArticleList } from '@neurapress/components/ArticleList'
|
||||
import { ArticleList } from '@internal/neurapress/components/ArticleList'
|
||||
import { type Article } from '../constants'
|
||||
import { type RendererOptions } from '@neurapress/lib/markdown'
|
||||
import { ThemeToggle } from '@neurapress/components/theme/ThemeToggle'
|
||||
import { Logo } from '@neurapress/components/icons/Logo'
|
||||
import { type RendererOptions } from '@internal/neurapress/lib/markdown'
|
||||
import { ThemeToggle } from '@internal/neurapress/components/theme/ThemeToggle'
|
||||
import { Logo } from '@internal/neurapress/components/icons/Logo'
|
||||
import Link from 'next/link'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { useToast } from '@neurapress/components/ui/use-toast'
|
||||
import { ToastAction } from '@neurapress/components/ui/toast'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { useToast } from '@internal/neurapress/components/ui/use-toast'
|
||||
import { ToastAction } from '@internal/neurapress/components/ui/toast'
|
||||
import { CodeThemeSelector } from '../CodeThemeSelector'
|
||||
import { useLocalStorage } from '@neurapress/hooks/use-local-storage'
|
||||
import { codeThemes, type CodeThemeId } from '@neurapress/config/code-themes'
|
||||
import { useLocalStorage } from '@internal/neurapress/hooks/use-local-storage'
|
||||
import { codeThemes, type CodeThemeId } from '@internal/neurapress/config/code-themes'
|
||||
|
||||
interface EditorToolbarProps {
|
||||
value: string
|
||||
@ -5,8 +5,8 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@neurapress/components/ui/dialog"
|
||||
import { Button } from "@neurapress/components/ui/button"
|
||||
} from "@internal/neurapress/components/ui/dialog"
|
||||
import { Button } from "@internal/neurapress/components/ui/button"
|
||||
import { HelpCircle } from 'lucide-react'
|
||||
|
||||
const cheatSheet = [
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
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 { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from '@internal/neurapress/components/ui/tooltip'
|
||||
import { Separator } from '@internal/neurapress/components/ui/separator'
|
||||
import {
|
||||
Bold,
|
||||
Italic,
|
||||
@ -1,12 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import { type RefObject } from 'react'
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@neurapress/components/ui/tabs'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@internal/neurapress/components/ui/tabs'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { Copy } from 'lucide-react'
|
||||
import { EditorPreview } from './EditorPreview'
|
||||
import { type PreviewSize } from '../constants'
|
||||
import { type CodeThemeId } from '@neurapress/config/code-themes'
|
||||
import { type CodeThemeId } from '@internal/neurapress/config/code-themes'
|
||||
|
||||
interface MobileEditorProps {
|
||||
textareaRef: RefObject<HTMLTextAreaElement>
|
||||
@ -1,6 +1,6 @@
|
||||
import { Copy, Save, Settings } from 'lucide-react'
|
||||
import { cn } from '@neurapress/lib/utils'
|
||||
import { Sheet, SheetContent, SheetTrigger } from '@neurapress/components/ui/sheet'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import { Sheet, SheetContent, SheetTrigger } from '@internal/neurapress/components/ui/sheet'
|
||||
import { WechatStylePicker } from '../../template/WechatStylePicker'
|
||||
|
||||
interface MobileToolbarProps {
|
||||
@ -1,8 +1,8 @@
|
||||
'use client'
|
||||
|
||||
import { useCallback } from 'react'
|
||||
import { useToast } from '@neurapress/components/ui/use-toast'
|
||||
import { initializeMermaid } from '@neurapress/lib/markdown/mermaid-utils'
|
||||
import { useToast } from '@internal/neurapress/components/ui/use-toast'
|
||||
import { initializeMermaid } from '@internal/neurapress/lib/markdown/mermaid-utils'
|
||||
|
||||
export const useCopy = () => {
|
||||
const { toast } = useToast()
|
||||
@ -1,9 +1,9 @@
|
||||
import { useState, useCallback, useEffect } from 'react'
|
||||
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'
|
||||
import { templates } from '@internal/neurapress/config/wechat-templates'
|
||||
import { convertToWechat, getCodeThemeStyles, type RendererOptions } from '@internal/neurapress/lib/markdown'
|
||||
import { type CodeThemeId } from '@internal/neurapress/config/code-themes'
|
||||
import { useToast } from '@internal/neurapress/components/ui/use-toast'
|
||||
import { initializeMermaid } from '@internal/neurapress/lib/markdown/mermaid-utils'
|
||||
|
||||
interface UsePreviewContentProps {
|
||||
value: string
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { convertToWechat } from '@neurapress/lib/markdown'
|
||||
import { convertToWechat } from '@internal/neurapress/lib/markdown'
|
||||
|
||||
// 计算阅读时间(假设每分钟阅读300字)
|
||||
const calculateReadingTime = (text: string): string => {
|
||||
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { useRef, useEffect } from 'react'
|
||||
import { TooltipProvider } from '@neurapress/components/ui/tooltip'
|
||||
import { TooltipProvider } from '@internal/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 '@neurapress/components/ui/textarea'
|
||||
import { Textarea } from '@internal/neurapress/components/ui/textarea'
|
||||
import { XiaohongshuMarkdownToolbar } from './XiaohongshuMarkdownToolbar'
|
||||
|
||||
interface XiaohongshuEditorProps {
|
||||
@ -1,9 +1,9 @@
|
||||
'use client'
|
||||
|
||||
import React from 'react'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@neurapress/components/ui/tooltip'
|
||||
import { Separator } from '@neurapress/components/ui/separator'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@internal/neurapress/components/ui/tooltip'
|
||||
import { Separator } from '@internal/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 '@neurapress/lib/utils'
|
||||
import { cn } from '@internal/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 '@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 { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@internal/neurapress/components/ui/select'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@internal/neurapress/components/ui/dialog'
|
||||
import { Label } from '@internal/neurapress/components/ui/label'
|
||||
import { Logo } from '@internal/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 '@neurapress/components/ui/use-toast'
|
||||
import { useToast } from '@internal/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 '@neurapress/components/ui/use-toast'
|
||||
import { useToast } from '@internal/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 '@neurapress/lib/utils'
|
||||
import { ThemeToggle } from '@neurapress/components/theme-toggle'
|
||||
import { Logo } from '@neurapress/components/icons/Logo'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import { ThemeToggle } from '@internal/neurapress/components/theme-toggle'
|
||||
import { Logo } from '@internal/neurapress/components/icons/Logo'
|
||||
import { Github } from 'lucide-react'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { Button } from '@internal/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 '@neurapress/components/ui/dialog'
|
||||
import { Button } from '@neurapress/components/ui/button'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@internal/neurapress/components/ui/dialog'
|
||||
import { Button } from '@internal/neurapress/components/ui/button'
|
||||
import { Settings2, Download, Upload, Star, Plus } from 'lucide-react'
|
||||
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'
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@internal/neurapress/components/ui/tabs'
|
||||
import { Input } from '@internal/neurapress/components/ui/input'
|
||||
import { Label } from '@internal/neurapress/components/ui/label'
|
||||
import { Textarea } from '@internal/neurapress/components/ui/textarea'
|
||||
import { templates as defaultTemplates, type Template } from '@internal/neurapress/config/wechat-templates'
|
||||
import { useLocalStorage } from '@internal/neurapress/hooks/use-local-storage'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
|
||||
interface TemplateManagerProps {
|
||||
onTemplateChange: () => void
|
||||
@ -2,16 +2,16 @@
|
||||
|
||||
import * as React from 'react'
|
||||
import { Check } from 'lucide-react'
|
||||
import { cn } from '@neurapress/lib/utils'
|
||||
import { cn } from '@internal/neurapress/lib/utils'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@neurapress/components/ui/dialog"
|
||||
import { templates } from '@neurapress/config/wechat-templates'
|
||||
import { Button } from "@neurapress/components/ui/button"
|
||||
} from "@internal/neurapress/components/ui/dialog"
|
||||
import { templates } from '@internal/neurapress/config/wechat-templates'
|
||||
import { Button } from "@internal/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 "@neurapress/lib/utils"
|
||||
import { templates } from '@neurapress/config/wechat-templates'
|
||||
import { cn } from "@internal/neurapress/lib/utils"
|
||||
import { templates } from '@internal/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 "@neurapress/components/ui/button"
|
||||
import { Button } from "@internal/neurapress/components/ui/button"
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@neurapress/components/ui/dropdown-menu"
|
||||
} from "@internal/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 "@neurapress/components/ui/button"
|
||||
import { Button } from "@internal/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 "@neurapress/lib/utils"
|
||||
import { cn } from "@internal/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 "@neurapress/lib/utils"
|
||||
import { buttonVariants } from "@neurapress/components/ui/button"
|
||||
import { cn } from "@internal/neurapress/lib/utils"
|
||||
import { buttonVariants } from "@internal/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 "@neurapress/lib/utils"
|
||||
import { cn } from "@internal/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 "@neurapress/lib/utils"
|
||||
import { cn } from "@internal/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 "@neurapress/lib/utils"
|
||||
import { cn } from "@internal/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 "@neurapress/lib/utils"
|
||||
import { cn } from "@internal/neurapress/lib/utils"
|
||||
|
||||
const DropdownMenu = DropdownMenuPrimitive.Root
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
import { cn } from "@internal/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 "@neurapress/lib/utils"
|
||||
import { cn } from "@internal/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 "@neurapress/lib/utils"
|
||||
import { cn } from "@internal/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 "@neurapress/lib/utils"
|
||||
import { cn } from "@internal/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 "@neurapress/lib/utils"
|
||||
import { cn } from "@internal/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 "@neurapress/lib/utils"
|
||||
import { cn } from "@internal/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 "@neurapress/lib/utils"
|
||||
import { cn } from "@internal/neurapress/lib/utils"
|
||||
|
||||
const Tabs = TabsPrimitive.Root
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@neurapress/lib/utils"
|
||||
import { cn } from "@internal/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 "@neurapress/lib/utils"
|
||||
import { cn } from "@internal/neurapress/lib/utils"
|
||||
|
||||
const ToastProvider = ToastPrimitives.Provider
|
||||
|
||||
@ -7,8 +7,8 @@ import {
|
||||
ToastProvider,
|
||||
ToastTitle,
|
||||
ToastViewport,
|
||||
} from "@neurapress/components/ui/toast"
|
||||
import { useToast } from "@neurapress/components/ui/use-toast"
|
||||
} from "@internal/neurapress/components/ui/toast"
|
||||
import { useToast } from "@internal/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 "@neurapress/lib/utils"
|
||||
import { cn } from "@internal/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 "@neurapress/lib/utils"
|
||||
import { cn } from "@internal/neurapress/lib/utils"
|
||||
|
||||
const TooltipProvider = TooltipPrimitive.Provider
|
||||
|
||||
@ -5,7 +5,7 @@ import * as React from "react"
|
||||
import type {
|
||||
ToastActionElement,
|
||||
ToastProps,
|
||||
} from "@neurapress/components/ui/toast"
|
||||
} from "@internal/neurapress/components/ui/toast"
|
||||
|
||||
const TOAST_LIMIT = 1
|
||||
const TOAST_REMOVE_DELAY = 1000000
|
||||
@ -1,4 +1,4 @@
|
||||
import type { RendererOptions } from '@neurapress/lib/markdown'
|
||||
import type { RendererOptions } from '@internal/neurapress/lib/markdown'
|
||||
|
||||
export interface Template {
|
||||
id: string
|
||||
13
packages/neurapress/src/editor/index.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { convertToWechat, defaultOptions } from '../lib/markdown'
|
||||
import { getExampleContent } from '../lib/utils/loadExampleContent'
|
||||
import XiaohongshuEditor from '../components/editor/XiaohongshuEditor'
|
||||
import WechatEditor from '../components/editor/WechatEditor'
|
||||
|
||||
export const neurapressSample = getExampleContent()
|
||||
|
||||
export function renderMarkdown(markdown: string): string {
|
||||
return convertToWechat(markdown, defaultOptions)
|
||||
}
|
||||
|
||||
export const Editor = WechatEditor
|
||||
export { WechatEditor, XiaohongshuEditor }
|
||||
4
packages/neurapress/src/index.ts
Normal file
@ -0,0 +1,4 @@
|
||||
'use client'
|
||||
|
||||
export * from './editor'
|
||||
export * from './lib/markdown'
|
||||
@ -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 '@neurapress/config/code-themes'
|
||||
import type { CodeThemeId } from '@internal/neurapress/config/code-themes'
|
||||
import { getTokenStyles } from './styles'
|
||||
|
||||
// Helper function to recursively process tokens
|
||||