2021-11-03 19:58:08 +08:00
|
|
|
import { defineConfig } from 'dumi';
|
|
|
|
|
|
|
|
function getMenus(opts: { lang?: string; base: '/docs' | '/plugin' | '/api' }) {
|
|
|
|
const menus = {
|
|
|
|
'/docs': [
|
|
|
|
{
|
|
|
|
title: 'Introduction',
|
|
|
|
'title_zh-CN': '介绍',
|
|
|
|
children: ['/docs/README', '/docs/getting-started'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Basis',
|
|
|
|
'title_zh-CN': '基础',
|
|
|
|
children: [
|
|
|
|
'/docs/concepts-node',
|
|
|
|
'/docs/concepts-schema',
|
|
|
|
'/docs/concepts-range',
|
|
|
|
'/docs/concepts-editor',
|
|
|
|
'/docs/concepts-event',
|
|
|
|
'/docs/concepts-plugin',
|
|
|
|
'/docs/concepts-history',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Resource',
|
|
|
|
'title_zh-CN': '资源文件',
|
|
|
|
children: ['/docs/resources-icon'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Contribution',
|
|
|
|
'title_zh-CN': '贡献',
|
|
|
|
path: '/docs/contributing',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'FAQ',
|
|
|
|
path: '/docs/faq',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'/plugin': [
|
|
|
|
{
|
|
|
|
title: 'Plug-in development',
|
|
|
|
'title_zh-CN': '插件开发',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
title: opts.lang === 'zh-CN' ? '基础' : 'Basis',
|
|
|
|
path: `${
|
|
|
|
opts.lang === 'zh-CN' ? '/zh-CN' : ''
|
|
|
|
}/plugin/tutorials`,
|
|
|
|
exact: true,
|
|
|
|
},
|
|
|
|
'plugin/tutorials-element',
|
|
|
|
'plugin/tutorials-mark',
|
|
|
|
'plugin/tutorials-inline',
|
|
|
|
'plugin/tutorials-block',
|
|
|
|
'plugin/tutorials-list',
|
|
|
|
'plugin/tutorials-card',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'List of plugins',
|
|
|
|
'title_zh-CN': '插件列表',
|
|
|
|
children: [
|
|
|
|
'/plugin/plugin-alignment',
|
|
|
|
'/plugin/plugin-backcolor',
|
|
|
|
'/plugin/plugin-bold',
|
|
|
|
'/plugin/plugin-code',
|
|
|
|
'/plugin/plugin-codelock',
|
2021-11-29 00:40:28 +08:00
|
|
|
'/plugin/plugin-embed',
|
2021-11-03 19:58:08 +08:00
|
|
|
'/plugin/plugin-file',
|
|
|
|
'/plugin/plugin-fontcolor',
|
|
|
|
'/plugin/plugin-fontsize',
|
|
|
|
'/plugin/plugin-fontfamily',
|
|
|
|
'/plugin/plugin-heading',
|
|
|
|
'/plugin/plugin-hr',
|
|
|
|
'/plugin/plugin-indent',
|
|
|
|
'/plugin/plugin-italic',
|
|
|
|
'/plugin/plugin-image',
|
|
|
|
'/plugin/plugin-link',
|
|
|
|
'/plugin/plugin-line-height',
|
|
|
|
{
|
|
|
|
title: '@aomao/plugin-mark',
|
|
|
|
path: '/plugin/plugin-mark',
|
|
|
|
exact: true,
|
|
|
|
},
|
|
|
|
'/plugin/plugin-mark-range',
|
|
|
|
'/plugin/plugin-math',
|
|
|
|
'/plugin/plugin-mention',
|
|
|
|
'/plugin/plugin-orderedlist',
|
|
|
|
'/plugin/plugin-paintformat',
|
|
|
|
'/plugin/plugin-quote',
|
|
|
|
'/plugin/plugin-redo',
|
|
|
|
'/plugin/plugin-removeformat',
|
|
|
|
'/plugin/plugin-selectall',
|
|
|
|
'/plugin/plugin-strikethrough',
|
|
|
|
'/plugin/plugin-status',
|
|
|
|
'/plugin/plugin-sub',
|
|
|
|
'/plugin/plugin-sup',
|
|
|
|
'/plugin/plugin-table',
|
|
|
|
'/plugin/plugin-tasklist',
|
|
|
|
'/plugin/plugin-underline',
|
|
|
|
'/plugin/plugin-undo',
|
|
|
|
'/plugin/plugin-unorderedlist',
|
|
|
|
'/plugin/plugin-video',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'/api': [
|
|
|
|
{
|
|
|
|
title: 'Node',
|
|
|
|
'title_zh-CN': 'DOM节点',
|
|
|
|
children: [
|
|
|
|
'/api/node',
|
|
|
|
'/api/editor-node',
|
|
|
|
'/api/editor-mark',
|
|
|
|
'/api/editor-inline',
|
|
|
|
'/api/editor-block',
|
|
|
|
'/api/editor-list',
|
2021-11-08 20:09:23 +08:00
|
|
|
'/api/editor-node-id',
|
2021-11-03 19:58:08 +08:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Card',
|
|
|
|
'title_zh-CN': '卡片',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
title: 'Card',
|
|
|
|
path: `${
|
|
|
|
opts.lang === 'zh-CN' ? '/zh-CN' : ''
|
|
|
|
}/api/editor-card`,
|
|
|
|
exact: true,
|
|
|
|
},
|
|
|
|
'/api/editor-card-toolbar',
|
|
|
|
'/api/editor-card-resize',
|
|
|
|
'/api/editor-card-maximize',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Schema',
|
2021-11-08 20:09:23 +08:00
|
|
|
'title_zh-CN': 'Schema',
|
2021-11-03 19:58:08 +08:00
|
|
|
path: '/api/schema',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Range',
|
2021-11-08 20:09:23 +08:00
|
|
|
'title_zh-CN': 'Range',
|
2021-11-03 19:58:08 +08:00
|
|
|
children: ['/api/range', '/api/selection'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'History',
|
2021-11-08 20:09:23 +08:00
|
|
|
'title_zh-CN': 'History',
|
2021-11-03 19:58:08 +08:00
|
|
|
path: '/api/history',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Editor',
|
2021-11-08 20:09:23 +08:00
|
|
|
'title_zh-CN': 'Editor',
|
2021-11-03 19:58:08 +08:00
|
|
|
children: [
|
|
|
|
{
|
|
|
|
title: 'Change',
|
|
|
|
path: `${
|
|
|
|
opts.lang === 'zh-CN' ? '/zh-CN' : ''
|
|
|
|
}/api/editor-change`,
|
|
|
|
children: [
|
|
|
|
`${
|
|
|
|
opts.lang === 'zh-CN' ? '/zh-CN' : ''
|
|
|
|
}/api/editor-change-event`,
|
2021-11-08 20:09:23 +08:00
|
|
|
`${
|
|
|
|
opts.lang === 'zh-CN' ? '/zh-CN' : ''
|
|
|
|
}/api/editor-change-range`,
|
2021-11-03 19:58:08 +08:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title:
|
|
|
|
opts.lang === 'zh-CN'
|
2021-11-08 20:09:23 +08:00
|
|
|
? 'Engine & View'
|
2021-11-03 19:58:08 +08:00
|
|
|
: 'Common attributes and methods',
|
|
|
|
path: `${
|
|
|
|
opts.lang === 'zh-CN' ? '/zh-CN' : ''
|
|
|
|
}/api/editor`,
|
|
|
|
exact: true,
|
|
|
|
},
|
|
|
|
{
|
2021-11-08 20:09:23 +08:00
|
|
|
title: opts.lang === 'zh-CN' ? 'Engine' : 'Engine',
|
2021-11-03 19:58:08 +08:00
|
|
|
path: `${
|
|
|
|
opts.lang === 'zh-CN' ? '/zh-CN' : ''
|
|
|
|
}/api/engine`,
|
|
|
|
},
|
|
|
|
{
|
2021-11-08 20:09:23 +08:00
|
|
|
title: opts.lang === 'zh-CN' ? 'View' : 'View',
|
2021-11-03 19:58:08 +08:00
|
|
|
path: `${
|
|
|
|
opts.lang === 'zh-CN' ? '/zh-CN' : ''
|
|
|
|
}/api/view`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Language',
|
|
|
|
'title_zh-CN': '语言',
|
|
|
|
path: '/api/language',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Command',
|
|
|
|
'title_zh-CN': '命令',
|
|
|
|
path: '/api/command',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Constants',
|
|
|
|
'title_zh-CN': '常量',
|
|
|
|
path: '/api/constants',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Hotkey',
|
|
|
|
'title_zh-CN': '热键',
|
|
|
|
path: '/api/hotkey',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Clipboard',
|
|
|
|
'title_zh-CN': '剪贴板',
|
|
|
|
path: '/api/clipboard',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Parser',
|
|
|
|
'title_zh-CN': '解析器',
|
|
|
|
path: '/api/parser',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Utility method/constant',
|
|
|
|
'title_zh-CN': '实用方法/常量',
|
|
|
|
path: '/api/utils',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
return (menus[opts.base] as []).map((menu: any) => {
|
|
|
|
if (!opts.lang) return menu;
|
|
|
|
return {
|
|
|
|
...menu,
|
|
|
|
title: menu[`title_${opts.lang}`] || menu.title,
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
title: 'AoMao Editor',
|
2021-12-05 00:37:05 +08:00
|
|
|
favicon: 'https://cdn-object.aomao.com/icon/shortcut.png',
|
|
|
|
logo: 'https://cdn-object.aomao.com/icon/icon.svg',
|
2021-11-03 19:58:08 +08:00
|
|
|
outputPath: 'docs-dist',
|
|
|
|
hash: true,
|
|
|
|
mode: 'site',
|
|
|
|
locales: [
|
|
|
|
['en-US', 'English'],
|
|
|
|
['zh-CN', '中文'],
|
|
|
|
],
|
|
|
|
ssr: {
|
|
|
|
devServerRender: false,
|
|
|
|
removeWindowInitialProps: true,
|
|
|
|
},
|
|
|
|
navs: {
|
|
|
|
'en-US': [
|
|
|
|
{
|
|
|
|
title: 'Edit',
|
|
|
|
path: '/',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'View',
|
|
|
|
path: '/view',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Docs',
|
|
|
|
path: '/docs',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Config',
|
|
|
|
path: '/config',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Plug-in',
|
|
|
|
path: '/plugin',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'API',
|
|
|
|
path: '/api',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'AoMao',
|
2021-12-05 00:37:05 +08:00
|
|
|
path: 'https://www.aomao.com',
|
2021-11-03 19:58:08 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Github',
|
|
|
|
path: 'https://github.com/yanmao-cc/am-editor',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'zh-CN': [
|
|
|
|
{
|
|
|
|
title: '编辑',
|
|
|
|
path: '/zh-CN',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '阅读',
|
|
|
|
path: '/zh-CN/view',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '文档',
|
|
|
|
path: '/zh-CN/docs',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '配置',
|
|
|
|
path: '/zh-CN/config',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '插件',
|
|
|
|
path: '/zh-CN/plugin',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'API',
|
|
|
|
path: '/zh-CN/api',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'AoMao',
|
2021-12-05 00:37:05 +08:00
|
|
|
path: 'https://www.aomao.com',
|
2021-11-03 19:58:08 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Github',
|
|
|
|
path: 'https://github.com/yanmao-cc/am-editor',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
menus: {
|
|
|
|
'/zh-CN/docs': getMenus({ lang: 'zh-CN', base: '/docs' }),
|
|
|
|
'/docs': getMenus({ base: '/docs' }),
|
|
|
|
'/zh-CN/plugin': getMenus({ lang: 'zh-CN', base: '/plugin' }),
|
|
|
|
'/plugin': getMenus({ base: '/plugin' }),
|
|
|
|
'/zh-CN/api': getMenus({ lang: 'zh-CN', base: '/api' }),
|
|
|
|
'/api': getMenus({ base: '/api' }),
|
|
|
|
},
|
|
|
|
analytics: {
|
2021-12-13 00:18:22 +08:00
|
|
|
baidu: '285af37fc760a8f865a67cb9120bfd8f',
|
2021-11-03 19:58:08 +08:00
|
|
|
},
|
|
|
|
manifest: {
|
|
|
|
fileName: 'manifest.json',
|
|
|
|
},
|
|
|
|
metas: [
|
|
|
|
{
|
|
|
|
name: 'viewport',
|
|
|
|
content:
|
|
|
|
'viewport-fit=cover,width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'apple-mobile-web-app-capable',
|
|
|
|
content: 'yes',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'apple-mobile-web-app-status-bar-style',
|
|
|
|
content: 'black',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'renderer',
|
|
|
|
content: 'webkit',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
headScripts: [
|
|
|
|
{
|
|
|
|
src: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js',
|
|
|
|
'data-ad-client': 'ca-pub-3706417744839656',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
// more config: https://d.umijs.org/config
|
|
|
|
});
|