diff --git a/README.md b/README.md index 40b3da3..29cbcae 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,5 @@ docker run -dit --name=tsdb -v /Users/veypi/test/vdb:/victoria-metrics-data -p 8428:8428 victoriametrics/victoria-metrics -search.latencyOffset=1s nats-server -c ./script/nats.cfg ``` + + diff --git a/oaweb/app.vue b/oaweb/app.vue index af646bb..33ea6cb 100644 --- a/oaweb/app.vue +++ b/oaweb/app.vue @@ -1,15 +1,16 @@ - diff --git a/oaweb/components/crud.vue b/oaweb/components/crud.vue new file mode 100644 index 0000000..5828c9d --- /dev/null +++ b/oaweb/components/crud.vue @@ -0,0 +1,246 @@ + + + + + + + diff --git a/oaweb/components/editor/index.vue b/oaweb/components/editor/index.vue new file mode 100644 index 0000000..a2cc41b --- /dev/null +++ b/oaweb/components/editor/index.vue @@ -0,0 +1,128 @@ + + + + + + + diff --git a/oaweb/components/editor/options.ts b/oaweb/components/editor/options.ts new file mode 100644 index 0000000..adfe005 --- /dev/null +++ b/oaweb/components/editor/options.ts @@ -0,0 +1,207 @@ +/* + * options.ts + * Copyright (C) 2023 veypi + * 2023-10-07 20:21 + * Distributed under terms of the MIT license. + */ + + +import { CherryOptions } from 'cherry-markdown/types/cherry'; + +const basicConfig: CherryOptions = { + id: '', + value: '', + externals: { + // echarts: window.echarts, + // katex: window.katex, + // MathJax: window.MathJax, + }, + /** 预览区域跟随编辑器光标自动滚动 */ + autoScrollByCursor: true, + forceAppend: false, + locale: 'zh_CN', + previewer: { + dom: false, + className: 'cherry-markdown', + // Whether to enable the editing ability of preview area (currently supports editing picture size and table content) + enablePreviewerBubble: true, + // 配置图片懒加载的逻辑 + lazyLoadImg: { + // 加载图片时如果需要展示loaing图,则配置loading图的地址 + loadingImgPath: '', + // 同一时间最多有几个图片请求,最大同时加载6张图片 + maxNumPerTime: 1, + // 不进行懒加载处理的图片数量,如果为0,即所有图片都进行懒加载处理, 如果设置为-1,则所有图片都不进行懒加载处理 + noLoadImgNum: 0, + // 首次自动加载几张图片(不论图片是否滚动到视野内),autoLoadImgNum = -1 表示会自动加载完所有图片 + autoLoadImgNum: 3, + // 针对加载失败的图片 或 beforeLoadOneImgCallback 返回false 的图片,最多尝试加载几次,为了防止死循环,最多5次。以图片的src为纬度统计重试次数 + maxTryTimesPerSrc: 1, + // 加载一张图片之前的回调函数,函数return false 会终止加载操作 + beforeLoadOneImgCallback: (img: HTMLImageElement) => true, + // 加载一张图片失败之后的回调函数 + failLoadOneImgCallback: (img: HTMLImageElement) => { }, + // 加载一张图片之后的回调函数,如果图片加载失败,则不会回调该函数 + afterLoadOneImgCallback: (img: HTMLImageElement) => { }, + // 加载完所有图片后调用的回调函数 + afterLoadAllImgCallback: () => { }, + } + }, + theme: [], + callback: { + afterChange: () => { }, + /** 编辑器完成初次渲染后触发 */ + afterInit: () => { }, + /** img 标签挂载前触发,可用于懒加载等场景 */ + beforeImageMounted: (srcProp: string, src: string) => { + return { srcProp: srcProp, src: src } + }, + onClickPreview: () => { }, + onCopyCode: (e: ClipboardEvent, code: string) => code, + changeString2Pinyin: (s: any) => s, + }, + isPreviewOnly: false, + fileUpload: (f: any) => { console.log('upload file: ' + f) }, + fileTypeLimitMap: { + video: "", + audio: "", + image: "", + word: "", + pdf: "", + file: "", + }, + openai: false, + engine: { + global: { + urlProcessor(url: any, srcType: any) { + // console.log(`url-processor`, url, srcType); + return url; + }, + }, + syntax: { + autoLink: { + /** default open short link display */ + enableShortLink: true, + /** default display 20 characters */ + shortLinkLength: 20, + }, + list: { + listNested: false, // The sibling list type becomes a child after conversion + indentSpace: 2, // Default 2 space indents + }, + table: { + enableChart: false, + // chartRenderEngine: EChartsTableEngine, + // externals: ['echarts'], + }, + inlineCode: { + theme: 'red', + }, + codeBlock: { + theme: 'twilight', // Default to dark theme + wrap: true, // If it exceeds the length, whether to wrap the line. If false, the scroll bar will be displayed + lineNumber: true, // Default display line number + customRenderer: { + // Custom syntax renderer + }, + /** + * indentedCodeBlock Is the switch whether indent code block is enabled + * + * this syntax is not supported by default in versions before 6.X. + * Because cherry's development team thinks the syntax is too ugly (easy to touch by mistake) + * The development team hopes to completely replace this syntax with ` ` code block syntax + * However, in the subsequent communication, the development team found that the syntax had better display effect in some scenarios + * Therefore, the development team in 6 This syntax was introduced in version X + * if you want to upgrade the following versions of services without users' awareness, you can remove this syntax: + * indentedCodeBlock:false + */ + indentedCodeBlock: true, + }, + fontEmphasis: { + allowWhitespace: false, // 是否允许首尾空格 + }, + strikethrough: { + needWhitespace: false, // 是否必须有前后空格 + }, + mathBlock: { + engine: 'MathJax', // katex或MathJax + src: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js', // 如果使用MathJax plugins,则需要使用该url通过script标签引入 + // src: '/deps/mathjax/tex-svg.js', + plugins: true, + }, + inlineMath: { + engine: 'MathJax', // katex或MathJax + }, + emoji: { + useUnicode: false, + // customResourceURL: 'https://github.githubassets.com/images/icons/emoji/unicode/${code}.png?v8', + upperCase: true, + }, + toc: { + /** By default, only one directory is rendered */ + allowMultiToc: false, + }, + header: { + /** + * Style of title: + * - default Default style with anchor in front of title + * - autonumber There is a self incrementing sequence number anchor in front of the title + * - none Title has no anchor + */ + anchorStyle: 'autonumber', + }, + // toc: { + // tocStyle: 'nested' + // } + // 'header': { + // strict: false + // } + }, + }, + toolbars: { + showToolbar: true, + theme: 'light', + toolbar: [ + 'bold', + 'italic', + // { + // strikethrough: ['strikethrough', 'underline', 'sub', 'sup', 'ruby'], + // }, + 'size', + '|', + 'color', + 'header', + '|', + 'drawIo', + '|', + 'ol', + 'ul', + 'checklist', + 'panel', + 'justify', + 'detail', + '|', + 'formula', + { + insert: ['image', 'audio', 'video', 'link', 'hr', 'br', 'code', 'formula', 'toc', 'table', 'pdf', 'word', 'ruby'], + }, + 'graph', + 'togglePreview', + 'export', + 'saveMenu', + 'backMenu' + ], + // toolbarRight: [], + bubble: ['bold', 'italic', 'underline', 'strikethrough', 'sub', 'sup', 'quote', 'ruby', '|', 'size', 'color'], // array or false + // sidebar: false, + // float: false + customMenu: { + } as any, + }, + drawioIframeUrl: '/cherry/drawio.html', + editor: { + defaultModel: 'edit&preview', + }, +}; + +export default basicConfig diff --git a/oaweb/components/menu.vue b/oaweb/components/menu.vue index 4c46e95..d0f0ec2 100644 --- a/oaweb/components/menu.vue +++ b/oaweb/components/menu.vue @@ -6,12 +6,12 @@ -->