提交 3d1b5c09 authored 作者: 钟是志's avatar 钟是志

27859 招生计划管理-新增或修改字段优化

上级 37155f9c
......@@ -8,6 +8,10 @@
* npm install
* 再在 git bash 中执行
* npm run build 获取编译后的文件/packages/editor/dist 复制出来放在项目代码中并使用
* 2022年6月25日 解决了上传图片功能
* TODO 无法创建自定义菜单 (Pdf上传功能, 视频上传功能);
* TODO https://www.wangeditor.com/v5/development.html#%E6%B3%A8%E5%86%8C%E8%8F%9C%E5%8D%95
*
* */
/**
......@@ -49,6 +53,12 @@
import styles from './css/style.less';
import * as WangEditor5 from './index.esm';
import React, { Fragment, useEffect, useState } from 'react';
import compressImage from '@/webPublic/zyd_public/WangEditor/compressImage';
// import uploadFile from '@/webPublic/zyd_public/WangEditor/uploadFile';
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig';
import { uploadFile as uploadOnestopFile } from '@/webPublic/one_stop_public/libs/PictureSignature/ShowItem';
console.log(WangEditor5);
// console.log(WangEditor5Menus);
export default function WangEditorReactComponent(props) {
const {
......@@ -58,7 +68,6 @@ export default function WangEditorReactComponent(props) {
onChange,
} = props;
useEffect(() => {
console.log(WangEditor5);
let htmlDefault = '';
if (value && value.indexOf('wangEditorHtml') > -1) {
htmlDefault = value;
......@@ -68,6 +77,20 @@ export default function WangEditorReactComponent(props) {
const editorConfig = {
placeholder: '请输入内容',
html: htmlDefault,
MENU_CONF: {
uploadImage: {
customUpload: (file, insertFn) => {
compressImage(file, (fileNew) => {
uploadOnestopFile(fileNew).then((y) => { // 使用一站式的文件上传接口
if (y && y.length) {
insertFn(queryApiActionPath() + y, file.name);
}
});
});
},
},
},
onChange: (editor) => {
// console.log('content', editor.children);
onChange(editor.getHtml());
......@@ -85,6 +108,10 @@ export default function WangEditorReactComponent(props) {
'bulletedList',
'numberedList',
],
// insertKeys: {
// index: 5, // 插入的位置,基于当前的 toolbarKeys
// keys: ['video-upload'],
// },
};
const editor = WangEditor5.createEditor({
......@@ -100,8 +127,8 @@ export default function WangEditorReactComponent(props) {
mode: 'default',
});
console.log(editor.getAllMenuKeys());
console.log(toolBar.getConfig().toolbarKeys);
// console.log(editor.getAllMenuKeys());
// console.log(toolBar.getConfig().toolbarKeys);
}, []);
......
/**
* @description Editor View class
* @author wangfupeng
*/
import { IDomEditor, IEditorConfig, IToolbarConfig, IModuleConf, IRegisterMenuConf, IRenderElemConf, RenderStyleFnType, IElemToHtmlConf, styleToHtmlFnType, IPreParseHtmlConf, ParseStyleHtmlFnType, IParseElemHtmlConf } from '@wangeditor/core';
declare type PluginType = <T extends IDomEditor>(editor: T) => T;
declare class Boot {
constructor();
static editorConfig: Partial<IEditorConfig>;
static setEditorConfig(newConfig?: Partial<IEditorConfig>): void;
static simpleEditorConfig: Partial<IEditorConfig>;
static setSimpleEditorConfig(newConfig?: Partial<IEditorConfig>): void;
static toolbarConfig: Partial<IToolbarConfig>;
static setToolbarConfig(newConfig?: Partial<IToolbarConfig>): void;
static simpleToolbarConfig: Partial<IToolbarConfig>;
static setSimpleToolbarConfig(newConfig?: Partial<IToolbarConfig>): void;
static plugins: PluginType[];
static registerPlugin(plugin: PluginType): void;
static registerMenu(menuConf: IRegisterMenuConf, customConfig?: {
[key: string]: any;
}): void;
static registerRenderElem(renderElemConf: IRenderElemConf): void;
static registerRenderStyle(fn: RenderStyleFnType): void;
static registerElemToHtml(elemToHtmlConf: IElemToHtmlConf): void;
static registerStyleToHtml(fn: styleToHtmlFnType): void;
static registerPreParseHtml(preParseHtmlConf: IPreParseHtmlConf): void;
static registerParseElemHtml(parseElemHtmlConf: IParseElemHtmlConf): void;
static registerParseStyleHtml(fn: ParseStyleHtmlFnType): void;
static registerModule(module: Partial<IModuleConf>): void;
}
export default Boot;
/**
* @description svg tag
* @author wangfupeng
*/
/**
* 【注意】svg 字符串的长度 ,否则会导致代码体积过大
* 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293
* 找不到再从 iconfont.com 搜索
*/
export declare const INDENT_RIGHT_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M0 64h1024v128H0z m384 192h640v128H384z m0 192h640v128H384z m0 192h640v128H384zM0 832h1024v128H0z m0-128V320l256 192z\"></path></svg>";
export declare const JUSTIFY_LEFT_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M768 793.6v102.4H51.2v-102.4h716.8z m204.8-230.4v102.4H51.2v-102.4h921.6z m-204.8-230.4v102.4H51.2v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z\"></path></svg>";
export declare const IMAGE_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M959.877 128l0.123 0.123v767.775l-0.123 0.122H64.102l-0.122-0.122V128.123l0.122-0.123h895.775zM960 64H64C28.795 64 0 92.795 0 128v768c0 35.205 28.795 64 64 64h896c35.205 0 64-28.795 64-64V128c0-35.205-28.795-64-64-64zM832 288.01c0 53.023-42.988 96.01-96.01 96.01s-96.01-42.987-96.01-96.01S682.967 192 735.99 192 832 234.988 832 288.01zM896 832H128V704l224.01-384 256 320h64l224.01-192z\"></path></svg>";
export declare const MORE_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M204.8 505.6m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z\"></path><path d=\"M505.6 505.6m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z\"></path><path d=\"M806.4 505.6m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z\"></path></svg>";
export declare const VIDEO_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M981.184 160.096C837.568 139.456 678.848 128 512 128S186.432 139.456 42.816 160.096C15.296 267.808 0 386.848 0 512s15.264 244.16 42.816 351.904C186.464 884.544 345.152 896 512 896s325.568-11.456 469.184-32.096C1008.704 756.192 1024 637.152 1024 512s-15.264-244.16-42.816-351.904zM384 704V320l320 192-320 192z\"></path></svg>";
/**
* @description create
* @author wangfupeng
*/
import { Descendant } from 'slate';
import { DOMElement } from './utils/dom';
import { IEditorConfig, IDomEditor, IToolbarConfig, Toolbar } from '@wangeditor/core';
export interface ICreateEditorOption {
selector: string | DOMElement;
config: Partial<IEditorConfig>;
content?: Descendant[];
html?: string;
mode: string;
}
export interface ICreateToolbarOption {
editor: IDomEditor | null;
selector: string | DOMElement;
config?: Partial<IToolbarConfig>;
mode?: string;
}
/**
* 创建 editor 实例
*/
export declare function createEditor(option?: Partial<ICreateEditorOption>): IDomEditor;
/**
* 创建 toolbar 实例
*/
export declare function createToolbar(option: ICreateToolbarOption): Toolbar;
/**
* @description editor entry
* @author wangfupeng
*/
import './assets/index.less';
import '@wangeditor/core/dist/css/style.css';
import './utils/browser-polyfill';
import './utils/node-polyfill';
import './locale/index';
import './register-builtin-modules/index';
import './init-default-config';
import Boot from './Boot';
export { Boot };
export { DomEditor, IDomEditor, IEditorConfig, IToolbarConfig, Toolbar, IModuleConf, IButtonMenu, ISelectMenu, IDropPanelMenu, IModalMenu, i18nChangeLanguage, i18nAddResources, i18nGetResources, t, genModalTextareaElems, genModalInputElems, genModalButtonElems, createUploader, IUploadConfig, } from '@wangeditor/core';
export { Transforms as SlateTransforms, Descendant as SlateDescendant, Editor as SlateEditor, Node as SlateNode, Element as SlateElement, Text as SlateText, Path as SlatePath, Range as SlateRange, Location as SlateLocation, Point as SlatePoint, } from 'slate';
export { createEditor, createToolbar } from './create';
declare const _default: {};
export default _default;
/**
* @description hoverbar 配置
* @author wangfupeng
*/
export declare function genDefaultHoverbarKeys(): {
text: {
menuKeys: string[];
};
link: {
menuKeys: string[];
};
image: {
menuKeys: string[];
};
pre: {
menuKeys: string[];
};
table: {
menuKeys: string[];
};
divider: {
menuKeys: string[];
};
video: {
menuKeys: string[];
};
};
export declare function genSimpleHoverbarKeys(): {
link: {
menuKeys: string[];
};
image: {
menuKeys: string[];
};
pre: {
menuKeys: string[];
};
table: {
menuKeys: string[];
};
divider: {
menuKeys: string[];
};
video: {
menuKeys: string[];
};
};
/**
* @description 获取编辑器默认配置
* @author wangfupeng
*/
export declare function getDefaultEditorConfig(): {
hoverbarKeys: {
text: {
menuKeys: string[];
};
link: {
menuKeys: string[];
};
image: {
menuKeys: string[];
};
pre: {
menuKeys: string[];
};
table: {
menuKeys: string[];
};
divider: {
menuKeys: string[];
};
video: {
menuKeys: string[];
};
};
};
export declare function getSimpleEditorConfig(): {
hoverbarKeys: {
link: {
menuKeys: string[];
};
image: {
menuKeys: string[];
};
pre: {
menuKeys: string[];
};
table: {
menuKeys: string[];
};
divider: {
menuKeys: string[];
};
video: {
menuKeys: string[];
};
};
};
export declare function getDefaultToolbarConfig(): {
toolbarKeys: (string | {
key: string;
title: string;
iconSvg: string;
menuKeys: string[];
})[];
};
export declare function getSimpleToolbarConfig(): {
toolbarKeys: (string | {
key: string;
title: string;
iconSvg: string;
menuKeys: string[];
})[];
};
/**
* @description toolbar 配置
* @author wangfupeng
*/
export declare function genDefaultToolbarKeys(): (string | {
key: string;
title: string;
iconSvg: string;
menuKeys: string[];
})[];
export declare function genSimpleToolbarKeys(): (string | {
key: string;
title: string;
iconSvg: string;
menuKeys: string[];
})[];
/**
* @description set default config
* @author wangfupeng
*/
export {};
/**
* @description i18n en
* @author wangfupeng
*/
declare const _default: {
editor: {
more: string;
justify: string;
indent: string;
image: string;
video: string;
};
};
export default _default;
/**
* @description i18n entry
* @author wangfupeng
*/
export {};
/**
* @description i18n zh-CN
* @author wangfupeng
*/
declare const _default: {
editor: {
more: string;
justify: string;
indent: string;
image: string;
video: string;
};
};
export default _default;
/**
* @description register builtin modules
* @author wangfupeng
*/
import '@wangeditor/basic-modules/dist/css/style.css';
import '@wangeditor/list-module/dist/css/style.css';
import '@wangeditor/table-module/dist/css/style.css';
import '@wangeditor/video-module/dist/css/style.css';
import '@wangeditor/upload-image-module/dist/css/style.css';
import '@wangeditor/code-highlight/dist/css/style.css';
/**
* @description 注册 module
* @author wangfupeng
*/
import { IModuleConf } from '@wangeditor/core';
declare function registerModule(module: Partial<IModuleConf>): void;
export default registerModule;
/**
* @description browser polyfill
* @author wangfupeng
*/
declare function globalThisPolyfill(): void;
declare function AggregateErrorPolyfill(): void;
/**
* @description dom utils
* @author wangfupeng
*/
import DOMElement = globalThis.Element;
export { DOMElement };
/**
* @description node polyfill
* @author wangfupeng
*/
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论