Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
70 changes: 67 additions & 3 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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, '\\')
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down
65 changes: 31 additions & 34 deletions .vitepress/theme/components/CustomHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,24 @@
:tabs="productTabs"
:activeTab="activeProductTab"
@tab-change="handleProductTabChange"
style="width: 610px"
style="width: 810px"
/>
</div>
</div>

<!-- 右侧工具栏 -->
<div class="tools-section">
<!-- 中央搜索栏 -->
<div class="search-section">
<div class="search-container">
<div class="search-icon">
<svg
width="16"
height="16"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
/>
</svg>
</div>
<input
type="text"
placeholder="Search..."
class="search-input"
@click="openSearch"
<button @click="openSearch" class="tool-button" title="Toggle theme">
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
/>
<div class="search-shortcut">
<kbd class="kbd">Ctrl K</kbd>
</div>
</div>
</div>
</svg>
</button>
<!-- OpenTiny 链接 -->
<a href="https://opentiny.design" title="OpenTiny" class="home-link">
<span>OpenTiny</span>
Expand Down Expand Up @@ -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<string, string[]> = {
"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 || "";
};

// 处理导航标签变化
Expand Down Expand Up @@ -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时路由跳转
Expand Down Expand Up @@ -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 = "";
}
Expand Down
17 changes: 15 additions & 2 deletions .vitepress/theme/entity/nav-tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, NavTabConstructor> = {
'next-sdk': NextSdkNavTab,
'tiny-vue': TinyVueNavTab,
'tiny-engine': TinyEngineNavTab,
'genui-sdk': GenuiSdkNavTab
'genui-sdk': GenuiSdkNavTab,
'tiny-editor': TinyEditorNavTab
}

const navPathMap: Record<string, string> = {
'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) => {
Expand All @@ -102,4 +114,5 @@ const NavTabFactory = (activeProductTab: string, route: any, site: any, themeCon
return new NavTab(activeProductTab, site, themeConfig)
}


export { NavTabFactory }
22 changes: 22 additions & 0 deletions public/images/logo-active-tiny-editor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions public/images/logo-normal-tiny-editor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tiny-editor
Submodule tiny-editor added at a41f8f
Loading