diff --git a/.gitmodules b/.gitmodules index 21062cb..b7996ab 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,3 +14,6 @@ [submodule "genui/genui-sdk"] path = genui/genui-sdk url = git@github.com:opentiny/genui-sdk.git +[submodule "tiny-editor"] + path = tiny-editor + url = git@github.com:opentiny/tiny-editor.git diff --git a/.vitepress/config.mts b/.vitepress/config.mts index a42f7a8..168f93c 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -7,7 +7,63 @@ import { fileURLToPath } from 'url' const __dirname = path.dirname(fileURLToPath(import.meta.url)) const rootDir = path.resolve(__dirname, '..') - +const TinyEditorSidebar = [ + { + text: '基础', + base: '/tiny-editor/guide/', + items: [ + { text: '快速开始', link: 'quick-start' }, + { text: '在前端框架中使用', link: 'used-in-framework' }, + { text: '封装成组件', link: 'componentize' }, + ], + }, + { + text: '使用示例', + base: '/tiny-editor/demo/', + items: [ + { text: '基本用法', link: 'basic-usage' }, + { text: '内容初始化', link: 'set-content' }, + { text: '获取内容', link: 'get-content' }, + { text: '自定义工具栏', link: 'custom-toolbar' }, + { text: '增加工具栏', link: 'add-toolbar-item' }, + { text: '文件上传', link: 'file-upload' }, + { text: '代码块高亮', link: 'code-block-highlight' }, + { text: '表格', link: 'table-up' }, + { text: '@提醒', link: 'mention' }, + { text: '快捷菜单', link: 'shortcut-key' }, + { text: '插入表情', link: 'emoji' }, + { text: '格式刷', link: 'format-painter' }, + { text: '公式', link: 'formula' }, + { text: 'Markdown', link: 'markdown' }, + { text: '字符统计', link: 'counter' }, + { text: '截屏', link: 'screenshot' }, + { text: '国际化', link: 'i18n' }, + { text: '标题列表', link: 'header-list' }, + { text: '工具栏提示', link: 'toolbar-tip' }, + { text: '只读模式', link: 'readonly' }, + { text: '模拟语雀文档', link: 'https://opentiny.github.io/tiny-editor/projects' }, + { text: '图片工具栏', link: 'image-tool' }, + { text: '协同编辑', link: 'collaborative-editing' }, + ], + }, + { + text: 'API 参考', + base: '/tiny-editor/api/', + items: [ + { text: '配置项', link: 'options' }, + { text: 'TinyEditor 实例', link: 'fluent-editor-instance' }, + { text: 'TinyEditor 类', link: 'fluent-editor-class' }, + ], + }, + { + text: '模块生态', + base: '/tiny-editor/modules/', + items: [ + { text: '工具栏提示', link: 'toolbar-tip' }, + { text: '标题列表', link: 'header-list' }, + ], + }, + ] const normalizePath = (path: string, targetStyle: 'windows' | 'linux' = 'linux') => { if (targetStyle === 'windows') { return path.replace(/\//g, '\\') @@ -145,7 +201,11 @@ export default defineConfig({ 'tiny-engine/docs/:section(practical-cases|api|extension-capabilities-tutorial|development-getting-started|changelog|solutions|extension-capabilities-overview)/:path*': 'tiny-engine/dev/:path*', 'tiny-engine/docs/:section(ecosystem-center|about-applications|about-materials|about-designer)/:path*': - 'tiny-engine/portal/:path*' + 'tiny-engine/portal/:path*', + 'tiny-editor/packages/docs/fluent-editor/docs/guide/:path*': 'tiny-editor/guide/:path*', + 'tiny-editor/packages/docs/fluent-editor/docs/demo/:path*': 'tiny-editor/demo/:path*', + 'tiny-editor/packages/docs/fluent-editor/docs/api/:path*': 'tiny-editor/api/:path*', + 'tiny-editor/packages/docs/fluent-editor/docs/modules/:path*': 'tiny-editor/modules/:path*', }, themeConfig: { // https://vitepress.dev/reference/default-theme-config @@ -589,7 +649,11 @@ export default defineConfig({ { text: '定制设计器', link: 'customize-designer' } ] } - ] + ], + '/tiny-editor/guide/':TinyEditorSidebar, + '/tiny-editor/demo/': TinyEditorSidebar, + '/tiny-editor/api/': TinyEditorSidebar, + '/tiny-editor/modules/': TinyEditorSidebar, }, search: { provider: 'local' diff --git a/.vitepress/theme/components/CustomHeader.vue b/.vitepress/theme/components/CustomHeader.vue index c032c59..b24e5a6 100644 --- a/.vitepress/theme/components/CustomHeader.vue +++ b/.vitepress/theme/components/CustomHeader.vue @@ -23,7 +23,7 @@ :tabs="productTabs" :activeTab="activeProductTab" @tab-change="handleProductTabChange" - style="width: 610px" + style="width: 810px" /> @@ -31,35 +31,16 @@
-
-
-
- - - -
- + + -
- Ctrl K -
-
-
+ + OpenTiny @@ -341,11 +322,17 @@ const getActiveNavTab = () => { const currentTab = navigationTabs.value.find((tab: TabItem) => isActiveNav({ text: tab.name, link: tab.key, activeMatch: undefined }) ); - const ifProductTab = (activeProductTab.value === "next-sdk" && route.path.includes("/next-sdk/")) ||( activeProductTab.value === "tiny-robot" && route.path.includes("/components/"))|| (activeProductTab.value === "tiny-robot" && route.path.includes("/tools/")) - activeNavTab.value = - ifProductTab - ? "guide" - : currentTab?.key || ""; + + const productPathMap: Record = { + "next-sdk": ["/next-sdk/"], + "tiny-robot": ["/components/", "/tools/"], + "tiny-editor": ["/demo/", "/api/", "/modules/"], + }; + + const segments = productPathMap[activeProductTab.value] || []; + const isProductRoute = segments.some((seg) => route.path.includes(seg)); + + activeNavTab.value = isProductRoute ? "guide" : currentTab?.key || ""; }; // 处理导航标签变化 @@ -464,6 +451,14 @@ const productTabs = computed(() => [ activeProductTab.value === "tiny-engine" ? "active" : "normal" }-tiny-engine.svg`, }, + { + key: "tiny-editor", + name: "TinyEditor", + link: `${prefix}tiny-editor/guide/quick-start`, + src: `${prefix}images/logo-${ + activeProductTab.value === "tiny-editor" ? "active" : "normal" + }-tiny-editor.svg`, + }, ]); // 切换tab时路由跳转 @@ -491,6 +486,8 @@ watch( activeProductTab.value = "tiny-vue"; } else if (path.includes("/tiny-engine/")) { activeProductTab.value = "tiny-engine"; + } else if (path.includes("/tiny-editor/")) { + activeProductTab.value = "tiny-editor"; } else { activeProductTab.value = ""; } diff --git a/.vitepress/theme/entity/nav-tab.ts b/.vitepress/theme/entity/nav-tab.ts index 53d35aa..6961f2c 100644 --- a/.vitepress/theme/entity/nav-tab.ts +++ b/.vitepress/theme/entity/nav-tab.ts @@ -75,18 +75,30 @@ class GenuiSdkNavTab extends NavTab { } } +class TinyEditorNavTab extends NavTab { + constructor(activeProductTab: string, site: any, themeConfig?: any) { + super(activeProductTab, site, themeConfig) + } + + getTabs(): TabItem[] { + return [{ key: 'guide', name: '使用文档', link: '/tiny-editor/guide/quick-start' }] + } +} + const navTabClassMap: Record = { 'next-sdk': NextSdkNavTab, 'tiny-vue': TinyVueNavTab, 'tiny-engine': TinyEngineNavTab, - 'genui-sdk': GenuiSdkNavTab + 'genui-sdk': GenuiSdkNavTab, + 'tiny-editor': TinyEditorNavTab } const navPathMap: Record = { 'next-sdk': '/next-sdk/', 'tiny-vue': '/tiny-vue/', 'tiny-engine': '/tiny-engine/', - 'genui-sdk': '/genui-sdk/' + 'genui-sdk': '/genui-sdk/', + 'tiny-editor': '/tiny-editor/' } const NavTabFactory = (activeProductTab: string, route: any, site: any, themeConfig: any) => { @@ -102,4 +114,5 @@ const NavTabFactory = (activeProductTab: string, route: any, site: any, themeCon return new NavTab(activeProductTab, site, themeConfig) } + export { NavTabFactory } diff --git a/public/images/logo-active-tiny-editor.svg b/public/images/logo-active-tiny-editor.svg new file mode 100644 index 0000000..09cab5d --- /dev/null +++ b/public/images/logo-active-tiny-editor.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/images/logo-normal-tiny-editor.svg b/public/images/logo-normal-tiny-editor.svg new file mode 100644 index 0000000..82c91c1 --- /dev/null +++ b/public/images/logo-normal-tiny-editor.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/tiny-editor b/tiny-editor new file mode 160000 index 0000000..a41f8f5 --- /dev/null +++ b/tiny-editor @@ -0,0 +1 @@ +Subproject commit a41f8f5a7abf543600edf167895ed3c8ed942fac