@wangeditor-next/video-module 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CHANGELOG.md +220 -0
  2. package/LICENSE +21 -0
  3. package/package.json +3 -2
  4. package/dist/css/style.css +0 -1
  5. package/dist/index.esm.js +0 -17
  6. package/dist/index.esm.js.map +0 -1
  7. package/dist/index.js +0 -17
  8. package/dist/index.js.map +0 -1
  9. package/dist/video-module/src/constants/svg.d.ts +0 -11
  10. package/dist/video-module/src/index.d.ts +0 -8
  11. package/dist/video-module/src/locale/en.d.ts +0 -20
  12. package/dist/video-module/src/locale/index.d.ts +0 -5
  13. package/dist/video-module/src/locale/zh-CN.d.ts +0 -20
  14. package/dist/video-module/src/module/custom-types.d.ts +0 -16
  15. package/dist/video-module/src/module/elem-to-html.d.ts +0 -11
  16. package/dist/video-module/src/module/helper/insert-video.d.ts +0 -12
  17. package/dist/video-module/src/module/helper/upload-videos.d.ts +0 -6
  18. package/dist/video-module/src/module/index.d.ts +0 -7
  19. package/dist/video-module/src/module/menu/EditVideoSizeMenu.d.ts +0 -25
  20. package/dist/video-module/src/module/menu/InsertVideoMenu.d.ts +0 -25
  21. package/dist/video-module/src/module/menu/UploadVideoMenu.d.ts +0 -16
  22. package/dist/video-module/src/module/menu/config.d.ts +0 -33
  23. package/dist/video-module/src/module/menu/index.d.ts +0 -25
  24. package/dist/video-module/src/module/parse-elem-html.d.ts +0 -14
  25. package/dist/video-module/src/module/plugin.d.ts +0 -7
  26. package/dist/video-module/src/module/pre-parse-html.d.ts +0 -15
  27. package/dist/video-module/src/module/render-elem.d.ts +0 -13
  28. package/dist/video-module/src/utils/dom.d.ts +0 -28
  29. package/dist/video-module/src/utils/util.d.ts +0 -11
@@ -1,11 +0,0 @@
1
- /**
2
- * @description icon svg
3
- * @author wangfupeng
4
- */
5
- /**
6
- * 【注意】svg 字符串的长度 ,否则会导致代码体积过大
7
- * 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293
8
- * 找不到再从 iconfont.com 搜索
9
- */
10
- 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>";
11
- export declare const UPLOAD_VIDEO_SVG = "<svg viewBox=\"0 0 1056 1024\"><path d=\"M805.902261 521.819882a251.441452 251.441452 0 0 0-251.011972 246.600033 251.051015 251.051015 0 1 0 502.023944 8.823877 253.237463 253.237463 0 0 0-251.011972-255.42391z m59.463561 240.001647v129.898403h-116.701631v-129.898403h-44.041298l101.279368-103.504859 101.279368 103.504859z\" p-id=\"6802\"></path><path d=\"M788.254507 0.000781H99.094092A98.663439 98.663439 0 0 0 0.001171 99.093701v590.067495a98.663439 98.663439 0 0 0 99.092921 99.092921h411.7549a266.434235 266.434235 0 0 1-2.186448-41.815807 275.843767 275.843767 0 0 1 275.180024-270.729042 270.650955 270.650955 0 0 1 103.504859 19.834201V99.093701A101.51363 101.51363 0 0 0 788.254507 0.000781zM295.054441 640.747004V147.507894l394.146189 246.600033z\"></path></svg>";
@@ -1,8 +0,0 @@
1
- /**
2
- * @description video module
3
- * @author wangfupeng
4
- */
5
- import './assets/index.less';
6
- import './locale/index';
7
- import wangEditorVideoModule from './module/index';
8
- export default wangEditorVideoModule;
@@ -1,20 +0,0 @@
1
- /**
2
- * @description i18n en
3
- * @author wangfupeng
4
- */
5
- declare const _default: {
6
- videoModule: {
7
- delete: string;
8
- uploadVideo: string;
9
- insertVideo: string;
10
- videoSrc: string;
11
- videoSrcPlaceHolder: string;
12
- videoPoster: string;
13
- videoPosterPlaceHolder: string;
14
- ok: string;
15
- editSize: string;
16
- width: string;
17
- height: string;
18
- };
19
- };
20
- export default _default;
@@ -1,5 +0,0 @@
1
- /**
2
- * @description i18n entry
3
- * @author wangfupeng
4
- */
5
- export {};
@@ -1,20 +0,0 @@
1
- /**
2
- * @description i18n zh-CN
3
- * @author wangfupeng
4
- */
5
- declare const _default: {
6
- videoModule: {
7
- delete: string;
8
- uploadVideo: string;
9
- insertVideo: string;
10
- videoSrc: string;
11
- videoSrcPlaceHolder: string;
12
- videoPoster: string;
13
- videoPosterPlaceHolder: string;
14
- ok: string;
15
- editSize: string;
16
- width: string;
17
- height: string;
18
- };
19
- };
20
- export default _default;
@@ -1,16 +0,0 @@
1
- /**
2
- * @description video element
3
- * @author wangfupeng
4
- */
5
- declare type EmptyText = {
6
- text: '';
7
- };
8
- export declare type VideoElement = {
9
- type: 'video';
10
- src: string;
11
- poster?: string;
12
- width?: string;
13
- height?: string;
14
- children: EmptyText[];
15
- };
16
- export {};
@@ -1,11 +0,0 @@
1
- /**
2
- * @description to html
3
- * @author wangfupeng
4
- */
5
- import { Element } from 'slate';
6
- declare function videoToHtml(elemNode: Element, childrenHtml?: string): string;
7
- export declare const videoToHtmlConf: {
8
- type: string;
9
- elemToHtml: typeof videoToHtml;
10
- };
11
- export {};
@@ -1,12 +0,0 @@
1
- /**
2
- * @description insert video
3
- * @author wangfupeng
4
- */
5
- import { IDomEditor } from '@wangeditor-next/core';
6
- /**
7
- * 插入视频
8
- * @param editor editor
9
- * @param src video src
10
- * @param poster video poster
11
- */
12
- export default function (editor: IDomEditor, src: string, poster?: string): Promise<void>;
@@ -1,6 +0,0 @@
1
- /**
2
- * @description upload video
3
- * @author wangfupeng
4
- */
5
- import { IDomEditor } from '@wangeditor-next/core';
6
- export default function (editor: IDomEditor, files: FileList | null): Promise<void>;
@@ -1,7 +0,0 @@
1
- /**
2
- * @description video module
3
- * @author wangfupeng
4
- */
5
- import { IModuleConf } from '@wangeditor-next/core';
6
- declare const video: Partial<IModuleConf>;
7
- export default video;
@@ -1,25 +0,0 @@
1
- /**
2
- * @description 修改视频尺寸
3
- * @author wangfupeng
4
- */
5
- import { Node as SlateNode } from 'slate';
6
- import { IModalMenu, IDomEditor } from '@wangeditor-next/core';
7
- import { DOMElement } from '../../utils/dom';
8
- declare class EditorVideoSizeMenu implements IModalMenu {
9
- readonly title: string;
10
- readonly tag = "button";
11
- readonly showModal = true;
12
- readonly modalWidth = 320;
13
- private $content;
14
- private readonly widthInputId;
15
- private readonly heightInputId;
16
- private readonly buttonId;
17
- private getSelectedVideoNode;
18
- getValue(editor: IDomEditor): string | boolean;
19
- isActive(editor: IDomEditor): boolean;
20
- exec(editor: IDomEditor, value: string | boolean): void;
21
- isDisabled(editor: IDomEditor): boolean;
22
- getModalPositionNode(editor: IDomEditor): SlateNode | null;
23
- getModalContentElem(editor: IDomEditor): DOMElement;
24
- }
25
- export default EditorVideoSizeMenu;
@@ -1,25 +0,0 @@
1
- /**
2
- * @description insert video menu
3
- * @author wangfupeng
4
- */
5
- import { Node } from 'slate';
6
- import { IModalMenu, IDomEditor } from '@wangeditor-next/core';
7
- import { DOMElement } from '../../utils/dom';
8
- declare class InsertVideoMenu implements IModalMenu {
9
- readonly title: string;
10
- readonly iconSvg = "<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>";
11
- readonly tag = "button";
12
- readonly showModal = true;
13
- readonly modalWidth = 320;
14
- private $content;
15
- private readonly srcInputId;
16
- private readonly posterInputId;
17
- private readonly buttonId;
18
- getValue(editor: IDomEditor): string | boolean;
19
- isActive(editor: IDomEditor): boolean;
20
- exec(editor: IDomEditor, value: string | boolean): void;
21
- isDisabled(editor: IDomEditor): boolean;
22
- getModalPositionNode(editor: IDomEditor): Node | null;
23
- getModalContentElem(editor: IDomEditor): DOMElement;
24
- }
25
- export default InsertVideoMenu;
@@ -1,16 +0,0 @@
1
- /**
2
- * @description upload video menu
3
- * @author wangfupeng
4
- */
5
- import { IButtonMenu, IDomEditor } from '@wangeditor-next/core';
6
- declare class UploadVideoMenu implements IButtonMenu {
7
- readonly title: string;
8
- readonly iconSvg = "<svg viewBox=\"0 0 1056 1024\"><path d=\"M805.902261 521.819882a251.441452 251.441452 0 0 0-251.011972 246.600033 251.051015 251.051015 0 1 0 502.023944 8.823877 253.237463 253.237463 0 0 0-251.011972-255.42391z m59.463561 240.001647v129.898403h-116.701631v-129.898403h-44.041298l101.279368-103.504859 101.279368 103.504859z\" p-id=\"6802\"></path><path d=\"M788.254507 0.000781H99.094092A98.663439 98.663439 0 0 0 0.001171 99.093701v590.067495a98.663439 98.663439 0 0 0 99.092921 99.092921h411.7549a266.434235 266.434235 0 0 1-2.186448-41.815807 275.843767 275.843767 0 0 1 275.180024-270.729042 270.650955 270.650955 0 0 1 103.504859 19.834201V99.093701A101.51363 101.51363 0 0 0 788.254507 0.000781zM295.054441 640.747004V147.507894l394.146189 246.600033z\"></path></svg>";
9
- readonly tag = "button";
10
- getValue(editor: IDomEditor): string | boolean;
11
- isActive(editor: IDomEditor): boolean;
12
- exec(editor: IDomEditor, value: string | boolean): void;
13
- isDisabled(editor: IDomEditor): boolean;
14
- private getMenuConfig;
15
- }
16
- export default UploadVideoMenu;
@@ -1,33 +0,0 @@
1
- /**
2
- * @description video menu config
3
- * @author wangfupeng
4
- */
5
- import { IUploadConfig } from '@wangeditor-next/core';
6
- import { VideoElement } from '../custom-types';
7
- declare type InsertFn = (src: string, poster: string) => void;
8
- export declare type IUploadConfigForVideo = IUploadConfig & {
9
- allowedFileTypes?: string[];
10
- customInsert?: (res: any, insertFn: InsertFn) => void;
11
- customUpload?: (files: File, insertFn: InsertFn) => void;
12
- customBrowseAndUpload?: (insertFn: InsertFn) => void;
13
- };
14
- export declare function genUploadVideoMenuConfig(): IUploadConfigForVideo;
15
- /**
16
- * 生成插入网络视频的配置
17
- */
18
- export declare function genInsertVideoMenuConfig(): {
19
- onInsertedVideo(node: VideoElement): void;
20
- /**
21
- * 检查 video ,支持 async
22
- * @param src src
23
- * @param poster poster
24
- */
25
- checkVideo(src: string, poster: string): boolean | string | undefined;
26
- /**
27
- * 转换 video src
28
- * @param src src
29
- * @returns new src
30
- */
31
- parseVideoSrc(src: string): string;
32
- };
33
- export {};
@@ -1,25 +0,0 @@
1
- /**
2
- * @description video menu
3
- * @author wangfupeng
4
- */
5
- import InsertVideoMenu from './InsertVideoMenu';
6
- import UploadVideoMenu from './UploadVideoMenu';
7
- import EditorVideoSizeMenu from './EditVideoSizeMenu';
8
- export declare const insertVideoMenuConf: {
9
- key: string;
10
- factory(): InsertVideoMenu;
11
- config: {
12
- onInsertedVideo(node: import("../custom-types").VideoElement): void;
13
- checkVideo(src: string, poster: string): string | boolean | undefined;
14
- parseVideoSrc(src: string): string;
15
- };
16
- };
17
- export declare const uploadVideoMenuConf: {
18
- key: string;
19
- factory(): UploadVideoMenu;
20
- config: import("./config").IUploadConfigForVideo;
21
- };
22
- export declare const editorVideSizeMenuConf: {
23
- key: string;
24
- factory(): EditorVideoSizeMenu;
25
- };
@@ -1,14 +0,0 @@
1
- /**
2
- * @description parse html
3
- * @author wangfupeng
4
- */
5
- import { Descendant } from 'slate';
6
- import { IDomEditor } from '@wangeditor-next/core';
7
- import { VideoElement } from './custom-types';
8
- import { DOMElement } from '../utils/dom';
9
- declare function parseHtml(elem: DOMElement, children: Descendant[], editor: IDomEditor): VideoElement;
10
- export declare const parseHtmlConf: {
11
- selector: string;
12
- parseElemHtml: typeof parseHtml;
13
- };
14
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * @description editor 插件,重写 editor API
3
- * @author wangfupeng
4
- */
5
- import { IDomEditor } from '@wangeditor-next/core';
6
- declare function withVideo<T extends IDomEditor>(editor: T): T;
7
- export default withVideo;
@@ -1,15 +0,0 @@
1
- /**
2
- * @description pre parse html
3
- * @author wangfupeng
4
- */
5
- import { DOMElement } from '../utils/dom';
6
- /**
7
- * pre-prase video ,兼容 V4
8
- * @param elem elem
9
- */
10
- declare function preParse(elem: DOMElement): DOMElement;
11
- export declare const preParseHtmlConf: {
12
- selector: string;
13
- preParseHtml: typeof preParse;
14
- };
15
- export {};
@@ -1,13 +0,0 @@
1
- /**
2
- * @description video render elem
3
- * @author wangfupeng
4
- */
5
- import { Element } from 'slate';
6
- import { VNode } from 'snabbdom';
7
- import { IDomEditor } from '@wangeditor-next/core';
8
- declare function renderVideo(elemNode: Element, children: VNode[] | null, editor: IDomEditor): VNode;
9
- declare const renderVideoConf: {
10
- type: string;
11
- renderElem: typeof renderVideo;
12
- };
13
- export { renderVideoConf };
@@ -1,28 +0,0 @@
1
- /**
2
- * @description DOM 操作
3
- * @author wangfupeng
4
- */
5
- import $, { Dom7Array } from 'dom7';
6
- export { Dom7Array } from 'dom7';
7
- export default $;
8
- /**
9
- * 获取 tagName lower-case
10
- * @param $elem $elem
11
- */
12
- export declare function getTagName($elem: Dom7Array): string;
13
- /**
14
- * 生成带 size 样式的 iframe html
15
- * @param iframeHtml iframe html string
16
- * @param width width
17
- * @param height height
18
- * @returns iframe html string with size style
19
- */
20
- export declare function genSizeStyledIframeHtml(iframeHtml: string, width?: string, height?: string): string;
21
- import DOMNode = globalThis.Node;
22
- import DOMComment = globalThis.Comment;
23
- import DOMElement = globalThis.Element;
24
- import DOMText = globalThis.Text;
25
- import DOMRange = globalThis.Range;
26
- import DOMSelection = globalThis.Selection;
27
- import DOMStaticRange = globalThis.StaticRange;
28
- export { DOMNode, DOMComment, DOMElement, DOMText, DOMRange, DOMSelection, DOMStaticRange };
@@ -1,11 +0,0 @@
1
- /**
2
- * @description 工具函数
3
- * @author wangfupeng
4
- */
5
- /**
6
- * 获取随机数字符串
7
- * @param prefix 前缀
8
- * @returns 随机数字符串
9
- */
10
- export declare function genRandomStr(prefix?: string): string;
11
- export declare function replaceSymbols(str: string): string;