From 5d6781f42975f518b72bf87b0f2065450b6eee21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=A6=8F=E6=9C=8B?= Date: Thu, 5 Dec 2024 17:03:01 +0800 Subject: [PATCH] docs: remove video course --- docs/.vuepress/config.js | 296 +++++++++--------- docs/v5/content.md | 2 - docs/v5/development.md | 411 ++++++++++++++----------- docs/v5/editor-config.md | 144 +++++---- docs/v5/for-frame.md | 302 +++++++++--------- docs/v5/getting-started.md | 43 ++- docs/v5/menu-config.md | 616 +++++++++++++++++++------------------ docs/v5/toolbar-config.md | 49 ++- docs/v5/video-course.md | 30 -- 9 files changed, 989 insertions(+), 904 deletions(-) delete mode 100644 docs/v5/video-course.md diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index f2ee735..a431ee2 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -1,18 +1,18 @@ -const { viteBundler, defaultTheme } = require('vuepress'); -const { searchPlugin } = require('@vuepress/plugin-search'); +const { viteBundler, defaultTheme } = require('vuepress') +const { searchPlugin } = require('@vuepress/plugin-search') module.exports = { - title: 'wangEditor', - description: '开源 Web 富文本编辑器,开箱即用,配置简单', - bundler: viteBundler(), - head: [ - ['link', { rel: 'icon', href: '/favicon.ico' }], + title: 'wangEditor', + description: '开源 Web 富文本编辑器,开箱即用,配置简单', + bundler: viteBundler(), + head: [ + ['link', { rel: 'icon', href: '/favicon.ico' }], - // 百度统计 - [ - 'script', - {}, - ` + // 百度统计 + [ + 'script', + {}, + ` var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); @@ -20,146 +20,156 @@ module.exports = { var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); - ` - ], - - // // Google AdSense - // [ - // 'script', - // { - // async: true, - // src: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8334016716119444', - // crossorigin: 'anonymous' - // }, - // ] + `, ], - locales: { - '/': { - lang: 'zh-CN', - }, - '/en/': { - lang: 'en', - }, - }, + // // Google AdSense + // [ + // 'script', + // { + // async: true, + // src: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8334016716119444', + // crossorigin: 'anonymous' + // }, + // ] + ], - theme: defaultTheme({ - logo: '/image/logo.png', + locales: { + '/': { + lang: 'zh-CN', + }, + '/en/': { + lang: 'en', + }, + }, - locales: { - '/': { - lang: 'zh-CN', - selectLanguageName: '简体中文', + theme: defaultTheme({ + logo: '/image/logo.png', - navbar: [ - { text: '指南', link: '/v5/getting-started.md' }, - { text: '视频教程', link: '/v5/video-course.md' }, - { text: 'Demo 示例', link: 'https://www.wangeditor.com/demo/index.html' }, - { text: '插件', link: '/v5/plugins.md' }, - { text: 'Github', link: 'https://github.com/wangeditor-team/wangEditor' }, - { text: 'v4 版本', link: 'https://www.wangeditor.com/v4/' } - ], + locales: { + '/': { + lang: 'zh-CN', + selectLanguageName: '简体中文', - sidebar: [ - '/v5/README.md', - '/v5/installation.md', - { - text: '基础', - children: [ - '/v5/getting-started.md', - '/v5/for-frame.md', - '/v5/content.md', - ] - }, - { - text: '配置和 API', - children: [ - '/v5/toolbar-config.md', - '/v5/editor-config.md', - '/v5/menu-config.md', - '/v5/API.md', - ] - }, - { - text: '高级', - children: [ - '/v5/node-define.md', - '/v5/development.md', - '/v5/i18n.md', - '/v5/theme.md', - '/v5/for-ts.md', - '/v5/plugins.md', - ] - }, - { - text: '资源', - children: [ - '/v5/video-course.md' - ] - } - ], - }, - '/en/': { - lang: 'en', - selectLanguageName: 'English', - description: 'Open source web rich text editor, run right out of the box, config simply.', + navbar: [ + { text: '指南', link: '/v5/getting-started.md' }, + { + text: 'Demo 示例', + link: 'https://www.wangeditor.com/demo/index.html', + }, + { text: '插件', link: '/v5/plugins.md' }, + { + text: 'Github', + link: 'https://github.com/wangeditor-team/wangEditor', + }, + { text: 'v4 版本', link: 'https://www.wangeditor.com/v4/' }, + ], - navbar: [ - { text: 'Guide', link: '/en/v5/' }, - { text: 'Demo', link: 'https://www.wangeditor.com/demo/index.html?lang=en' }, - { text: 'Plugins', link: '/en/v5/plugins.md' }, - { text: 'Github', link: 'https://github.com/wangeditor-team/wangEditor' }, - { text: 'v4', link: 'https://www.wangeditor.com/v4-en/' } - ], + sidebar: [ + '/v5/README.md', + '/v5/installation.md', + { + text: '基础', + children: [ + '/v5/getting-started.md', + '/v5/for-frame.md', + '/v5/content.md', + ], + }, + { + text: '配置和 API', + children: [ + '/v5/toolbar-config.md', + '/v5/editor-config.md', + '/v5/menu-config.md', + '/v5/API.md', + ], + }, + { + text: '高级', + children: [ + '/v5/node-define.md', + '/v5/development.md', + '/v5/i18n.md', + '/v5/theme.md', + '/v5/for-ts.md', + '/v5/plugins.md', + ], + }, + { + text: '资源', + children: ['/v5/video-course.md'], + }, + ], + }, + '/en/': { + lang: 'en', + selectLanguageName: 'English', + description: + 'Open source web rich text editor, run right out of the box, config simply.', - sidebar: [ - '/en/v5/README.md', - '/en/v5/installation.md', - { - text: 'Basic', - children: [ - '/en/v5/getting-started.md', - '/en/v5/for-frame.md', - '/en/v5/content.md', - ] - }, - { - text: 'Config and API', - children: [ - '/en/v5/toolbar-config.md', - '/en/v5/editor-config.md', - '/en/v5/menu-config.md', - '/en/v5/API.md', - ] - }, - { - text: 'Advance', - children: [ - '/en/v5/node-define.md', - '/en/v5/development.md', - '/en/v5/i18n.md', - '/en/v5/theme.md', - '/en/v5/for-ts.md', - '/en/v5/plugins.md', - ] - } - ], - }, - }, - }), + navbar: [ + { text: 'Guide', link: '/en/v5/' }, + { + text: 'Demo', + link: 'https://www.wangeditor.com/demo/index.html?lang=en', + }, + { text: 'Plugins', link: '/en/v5/plugins.md' }, + { + text: 'Github', + link: 'https://github.com/wangeditor-team/wangEditor', + }, + { text: 'v4', link: 'https://www.wangeditor.com/v4-en/' }, + ], - plugins: [ - [ - searchPlugin({ - locales: { - '/': { - placeholder: '搜索', - }, - '/en/': { - placeholder: 'Search', - }, - }, - }) + sidebar: [ + '/en/v5/README.md', + '/en/v5/installation.md', + { + text: 'Basic', + children: [ + '/en/v5/getting-started.md', + '/en/v5/for-frame.md', + '/en/v5/content.md', + ], + }, + { + text: 'Config and API', + children: [ + '/en/v5/toolbar-config.md', + '/en/v5/editor-config.md', + '/en/v5/menu-config.md', + '/en/v5/API.md', + ], + }, + { + text: 'Advance', + children: [ + '/en/v5/node-define.md', + '/en/v5/development.md', + '/en/v5/i18n.md', + '/en/v5/theme.md', + '/en/v5/for-ts.md', + '/en/v5/plugins.md', + ], + }, ], + }, + }, + }), + + plugins: [ + [ + searchPlugin({ + locales: { + '/': { + placeholder: '搜索', + }, + '/en/': { + placeholder: 'Search', + }, + }, + }), ], + ], } diff --git a/docs/v5/content.md b/docs/v5/content.md index 60fe72b..85a9dc0 100644 --- a/docs/v5/content.md +++ b/docs/v5/content.md @@ -1,7 +1,5 @@ # 内容处理 -快速了解可查看[视频教程](./video-course.md)。 - ## 获取内容 ### 获取 HTML 和 Text diff --git a/docs/v5/development.md b/docs/v5/development.md index 7a060b1..714168e 100644 --- a/docs/v5/development.md +++ b/docs/v5/development.md @@ -1,7 +1,5 @@ # 自定义扩展新功能 -快速了解可查看[视频教程](./video-course.md)。 - wangEditor 从 V5 开始,源码上就分离了 core editor 还有各个 module 。
core 是核心 API ,editor 负责汇总集成。所有的具体功能,都分布在各个 module 中来实现。 @@ -27,40 +25,44 @@ core 是核心 API ,editor 负责汇总集成。所有的具体功能,都分 ```ts import { IButtonMenu, IDomEditor } from '@wangeditor/editor' -class MyButtonMenu implements IButtonMenu { // TS 语法 -// class MyButtonMenu { // JS 语法 +class MyButtonMenu implements IButtonMenu { + // TS 语法 + // class MyButtonMenu { // JS 语法 - constructor() { - this.title = 'My menu title' // 自定义菜单标题 - // this.iconSvg = '...' // 可选 - this.tag = 'button' - } + constructor() { + this.title = 'My menu title' // 自定义菜单标题 + // this.iconSvg = '...' // 可选 + this.tag = 'button' + } - // 获取菜单执行时的 value ,用不到则返回空 字符串或 false - getValue(editor: IDomEditor): string | boolean { // TS 语法 + // 获取菜单执行时的 value ,用不到则返回空 字符串或 false + getValue(editor: IDomEditor): string | boolean { + // TS 语法 // getValue(editor) { // JS 语法 - return ' hello ' - } + return ' hello ' + } - // 菜单是否需要激活(如选中加粗文本,“加粗”菜单会激活),用不到则返回 false - isActive(editor: IDomEditor): boolean { // TS 语法 + // 菜单是否需要激活(如选中加粗文本,“加粗”菜单会激活),用不到则返回 false + isActive(editor: IDomEditor): boolean { + // TS 语法 // isActive(editor) { // JS 语法 - return false - } + return false + } - // 菜单是否需要禁用(如选中 H1 ,“引用”菜单被禁用),用不到则返回 false - isDisabled(editor: IDomEditor): boolean { // TS 语法 + // 菜单是否需要禁用(如选中 H1 ,“引用”菜单被禁用),用不到则返回 false + isDisabled(editor: IDomEditor): boolean { + // TS 语法 // isDisabled(editor) { // JS 语法 - return false - } + return false + } - // 点击菜单时触发的函数 - exec(editor: IDomEditor, value: string | boolean) { // TS 语法 + // 点击菜单时触发的函数 + exec(editor: IDomEditor, value: string | boolean) { + // TS 语法 // exec(editor, value) { // JS 语法 - if (this.isDisabled(editor)) return - editor.insertText(value) // value 即 this.value(editor) 的返回值 - } - + if (this.isDisabled(editor)) return + editor.insertText(value) // value 即 this.value(editor) 的返回值 + } } ``` @@ -79,49 +81,58 @@ class MyButtonMenu implements IButtonMenu { // TS 语法 ```ts import { IDomEditor, ISelectMenu } from '@wangeditor/editor' -class MySelectMenu implements ISelectMenu { // TS 语法 -// class MySelectMenu { // JS 语法 +class MySelectMenu implements ISelectMenu { + // TS 语法 + // class MySelectMenu { // JS 语法 - constructor() { - this.title = 'My Select Menu', - this.tag = 'select' - this.width = 60 - } + constructor() { + ;(this.title = 'My Select Menu'), (this.tag = 'select') + this.width = 60 + } - // 下拉框的选项 - getOptions(editor: IDomEditor) { // TS 语法 + // 下拉框的选项 + getOptions(editor: IDomEditor) { + // TS 语法 // getOptions(editor) { // JS 语法 - const options = [ - { value: 'beijing', text: '北京', styleForRenderMenuList: { 'font-size': '32px', 'font-weight': 'bold' } }, - { value: 'shanghai', text: '上海', selected: true }, - { value: 'shenzhen', text: '深圳' } - ] - return options - } - - // 菜单是否需要激活(如选中加粗文本,“加粗”菜单会激活),用不到则返回 false - isActive(editor: IDomEditor): boolean { // TS 语法 + const options = [ + { + value: 'beijing', + text: '北京', + styleForRenderMenuList: { 'font-size': '32px', 'font-weight': 'bold' }, + }, + { value: 'shanghai', text: '上海', selected: true }, + { value: 'shenzhen', text: '深圳' }, + ] + return options + } + + // 菜单是否需要激活(如选中加粗文本,“加粗”菜单会激活),用不到则返回 false + isActive(editor: IDomEditor): boolean { + // TS 语法 // isActive(editor) { // JS 语法 - return false - } + return false + } - // 获取菜单执行时的 value ,用不到则返回空 字符串或 false - getValue(editor: IDomEditor): string | boolean { // TS 语法 + // 获取菜单执行时的 value ,用不到则返回空 字符串或 false + getValue(editor: IDomEditor): string | boolean { + // TS 语法 // getValue(editor) { // JS 语法 - return 'shanghai' // 匹配 options 其中一个 value - } + return 'shanghai' // 匹配 options 其中一个 value + } - // 菜单是否需要禁用(如选中 H1 ,“引用”菜单被禁用),用不到则返回 false - isDisabled(editor: IDomEditor): boolean { // TS 语法 + // 菜单是否需要禁用(如选中 H1 ,“引用”菜单被禁用),用不到则返回 false + isDisabled(editor: IDomEditor): boolean { + // TS 语法 // isDisabled(editor) { // JS 语法 - return false - } + return false + } - // 点击菜单时触发的函数 - exec(editor: IDomEditor, value: string | boolean) { // TS 语法 + // 点击菜单时触发的函数 + exec(editor: IDomEditor, value: string | boolean) { + // TS 语法 // exec(editor, value) { // JS 语法 - // Select menu ,这个函数不用写,空着即可 - } + // Select menu ,这个函数不用写,空着即可 + } } ``` @@ -140,56 +151,62 @@ class MySelectMenu implements ISelectMenu { // TS 语法 ```ts import { IDomEditor, IDropPanelMenu } from '@wangeditor/editor' -class MyDropPanelMenu implements IDropPanelMenu { // TS 语法 -// class MyDropPanelMenu { // JS 语法 +class MyDropPanelMenu implements IDropPanelMenu { + // TS 语法 + // class MyDropPanelMenu { // JS 语法 - constructor() { - this.title = 'My menu' - // this.iconSvg = '...' - this.tag = 'button' - this.showDropPanel = true - } + constructor() { + this.title = 'My menu' + // this.iconSvg = '...' + this.tag = 'button' + this.showDropPanel = true + } - // 菜单是否需要激活(如选中加粗文本,“加粗”菜单会激活),用不到则返回 false - isActive(editor: IDomEditor): boolean { // TS 语法 + // 菜单是否需要激活(如选中加粗文本,“加粗”菜单会激活),用不到则返回 false + isActive(editor: IDomEditor): boolean { + // TS 语法 // isActive(editor) { // JS 语法 - return false - } + return false + } - // 获取菜单执行时的 value ,用不到则返回空 字符串或 false - getValue(editor: IDomEditor): string | boolean { // TS 语法 + // 获取菜单执行时的 value ,用不到则返回空 字符串或 false + getValue(editor: IDomEditor): string | boolean { + // TS 语法 // getValue(editor) { // JS 语法 - return '' - } + return '' + } - // 菜单是否需要禁用(如选中 H1 ,“引用”菜单被禁用),用不到则返回 false - isDisabled(editor: IDomEditor): boolean { // TS 语法 + // 菜单是否需要禁用(如选中 H1 ,“引用”菜单被禁用),用不到则返回 false + isDisabled(editor: IDomEditor): boolean { + // TS 语法 // isDisabled(editor) { // JS 语法 - return false - } + return false + } - // 点击菜单时触发的函数 - exec(editor: IDomEditor, value: string | boolean) { // TS 语法 + // 点击菜单时触发的函数 + exec(editor: IDomEditor, value: string | boolean) { + // TS 语法 // exec(editor, value) { // JS 语法 - // DropPanel menu ,这个函数不用写,空着即可 - } + // DropPanel menu ,这个函数不用写,空着即可 + } - // 定义 DropPanel 内部的 DOM Element - getPanelContentElem(editor: IDomEditor): DOMElement { // TS 语法 + // 定义 DropPanel 内部的 DOM Element + getPanelContentElem(editor: IDomEditor): DOMElement { + // TS 语法 // getPanelContentElem(editor) { // JS 语法 - const $list = $(`