@wangeditor-next/editor 5.7.16 → 6.0.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.
@@ -0,0 +1,11 @@
1
+ import { IDomEditor } from '@wangeditor-next/core';
2
+ import { Path, Range } from 'slate';
3
+ /** Builds a directional Slate range that includes both boundary cells completely. */
4
+ export declare function getCellDragSelectionRange(editor: IDomEditor, anchorPath: Path, targetPath: Path): Range;
5
+ /** Records the starting cell without disturbing native text selection inside that cell. */
6
+ export declare function handleCellDragSelectionMouseDown(editor: IDomEditor, event: MouseEvent): void;
7
+ /**
8
+ * Takes over only after the pointer crosses into another cell. This avoids Chrome collapsing the
9
+ * native range for wrapped cells while preserving ordinary text selection within one cell.
10
+ */
11
+ export declare function handleCellDragSelectionMouseMove(editor: IDomEditor, event: MouseEvent): void;
@@ -4,8 +4,8 @@ import { Element as SlateElement } from 'slate';
4
4
  * 用于计算拖动 cell 时,cell 宽度变化的比例
5
5
  */
6
6
  export declare function getColumnWidthRatios(columnWidths: number[]): number[];
7
- export declare function observerTableResize(editor: IDomEditor, elm: Node | undefined): void;
8
- export declare function unObserveTableResize(): void;
7
+ export declare function unObserveTableResize(elm?: Node): void;
8
+ export declare function observerTableResize(editor: IDomEditor, elm: Node | undefined, elemNode: SlateElement): void;
9
9
  /**
10
10
  * 鼠标移动时,判断在哪个 Cell border 上
11
11
  * Class 先 visible 后 highlight @跟随飞书
@@ -16,5 +16,5 @@ export declare function handleCellBorderVisible(editor: IDomEditor, elemNode: Sl
16
16
  * 设置 class highlight
17
17
  * 将 render-cell.tsx 拖动功能迁移至 div.column-resize
18
18
  */
19
- export declare function handleCellBorderHighlight(editor: IDomEditor, e: MouseEvent): void;
19
+ export declare function handleCellBorderHighlight(editor: IDomEditor, elemNode: SlateElement, e: MouseEvent): void;
20
20
  export declare function handleCellBorderMouseDown(editor: IDomEditor, elemNode: SlateElement): void;
@@ -3,7 +3,12 @@
3
3
  * @author wangfupeng
4
4
  */
5
5
  import { IDomEditor } from '@wangeditor-next/core';
6
+ import { Element as SlateElement } from 'slate';
6
7
  import { TableCellElement, TableElement } from './custom-types';
8
+ /**
9
+ * Update a rendered table by its own path instead of relying on the current selection.
10
+ */
11
+ export declare function setTableNodeProps(editor: IDomEditor, tableNode: SlateElement, props: Partial<TableElement>): void;
7
12
  /**
8
13
  * 获取第一行所有 cells
9
14
  * @param tableNode table node
@@ -11,5 +11,5 @@ export declare function handleRowBorderVisible(editor: IDomEditor, elemNode: Sla
11
11
  /**
12
12
  * 设置行拖拽高亮
13
13
  */
14
- export declare function handleRowBorderHighlight(editor: IDomEditor, e: MouseEvent): void;
15
- export declare function handleRowBorderMouseDown(editor: IDomEditor, _elemNode: SlateElement): void;
14
+ export declare function handleRowBorderHighlight(editor: IDomEditor, elemNode: SlateElement, e: MouseEvent): void;
15
+ export declare function handleRowBorderMouseDown(editor: IDomEditor, elemNode: SlateElement): void;
@@ -10,3 +10,6 @@
10
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
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>";
12
12
  export declare const PENCIL_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M864 0a160 160 0 0 1 128 256l-64 64-224-224 64-64c26.752-20.096 59.968-32 96-32zM64 736l-64 288 288-64 592-592-224-224L64 736z m651.584-372.416l-448 448-55.168-55.168 448-448 55.168 55.168z\"></path></svg>";
13
+ export declare const VIDEO_ALIGN_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>";
14
+ export declare const VIDEO_ALIGN_CENTER_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M870.4 793.6v102.4H153.6v-102.4h716.8z m102.4-230.4v102.4H51.2v-102.4h921.6z m-102.4-230.4v102.4H153.6v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z\"></path></svg>";
15
+ export declare const VIDEO_ALIGN_RIGHT_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M972.8 793.6v102.4H256v-102.4h716.8z m0-230.4v102.4H51.2v-102.4h921.6z m0-230.4v102.4H256v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z\"></path></svg>";
@@ -16,6 +16,9 @@ declare const _default: {
16
16
  edit: string;
17
17
  width: string;
18
18
  height: string;
19
+ alignLeft: string;
20
+ alignCenter: string;
21
+ alignRight: string;
19
22
  };
20
23
  };
21
24
  export default _default;
@@ -16,6 +16,9 @@ declare const _default: {
16
16
  edit: string;
17
17
  width: string;
18
18
  height: string;
19
+ alignLeft: string;
20
+ alignCenter: string;
21
+ alignRight: string;
19
22
  };
20
23
  };
21
24
  export default _default;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @description video alignment helpers
3
+ */
4
+ import { Element } from 'slate';
5
+ import { VideoAlign } from './custom-types';
6
+ export declare const DEFAULT_VIDEO_ALIGN: VideoAlign;
7
+ export declare function normalizeVideoAlign(value: unknown): VideoAlign;
8
+ export declare function getVideoAlign(elemNode: Element): VideoAlign;
9
+ export declare function getVideoAlignClass(align: VideoAlign): string;
10
+ export declare function getVideoJustifyContent(align: VideoAlign): string;
@@ -9,12 +9,13 @@ export type videoStyle = {
9
9
  width?: string;
10
10
  height?: string;
11
11
  };
12
+ export type VideoAlign = 'left' | 'center' | 'right';
12
13
  export type VideoElement = {
13
14
  type: 'video';
14
15
  key?: string;
15
16
  src: string;
16
17
  poster?: string;
17
- textAlign?: string;
18
+ align?: VideoAlign;
18
19
  width?: string;
19
20
  height?: string;
20
21
  style?: videoStyle;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @description align video menu
3
+ */
4
+ import { IButtonMenu, IDomEditor } from '@wangeditor-next/core';
5
+ import { VideoAlign } from '../custom-types';
6
+ declare class VideoAlignMenu implements IButtonMenu {
7
+ readonly align: VideoAlign;
8
+ readonly iconSvg: string;
9
+ readonly tag = "button";
10
+ readonly title: string;
11
+ constructor(align: VideoAlign, titleKey: string, iconSvg: string);
12
+ private getSelectedVideo;
13
+ getValue(editor: IDomEditor): string | boolean;
14
+ isActive(editor: IDomEditor): boolean;
15
+ isDisabled(editor: IDomEditor): boolean;
16
+ exec(editor: IDomEditor, _value: string | boolean): void;
17
+ }
18
+ export default VideoAlignMenu;
@@ -6,6 +6,7 @@ import EditorVideoSizeMenu from './EditVideoSizeMenu';
6
6
  import EditorVideoSrcMenu from './EditVideoSrcMenu';
7
7
  import InsertVideoMenu from './InsertVideoMenu';
8
8
  import UploadVideoMenu from './UploadVideoMenu';
9
+ import VideoAlignMenu from './VideoAlignMenu';
9
10
  export declare const insertVideoMenuConf: {
10
11
  key: string;
11
12
  factory(): InsertVideoMenu;
@@ -28,3 +29,15 @@ export declare const editorVideoSrcMenuConf: {
28
29
  key: string;
29
30
  factory(): EditorVideoSrcMenu;
30
31
  };
32
+ export declare const videoAlignLeftMenuConf: {
33
+ key: string;
34
+ factory(): VideoAlignMenu;
35
+ };
36
+ export declare const videoAlignCenterMenuConf: {
37
+ key: string;
38
+ factory(): VideoAlignMenu;
39
+ };
40
+ export declare const videoAlignRightMenuConf: {
41
+ key: string;
42
+ factory(): VideoAlignMenu;
43
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wangeditor-next/editor",
3
- "version": "5.7.16",
3
+ "version": "6.0.0",
4
4
  "description": "Web rich text editor, Web 富文本编辑器",
5
5
  "keywords": [
6
6
  "wangeditor",
@@ -56,13 +56,13 @@
56
56
  "dependencies": {
57
57
  "@uppy/core": "^5.0.0",
58
58
  "@uppy/xhr-upload": "^5.0.0",
59
- "@wangeditor-next/basic-modules": "3.0.3",
59
+ "@wangeditor-next/basic-modules": "3.1.0",
60
60
  "@wangeditor-next/code-highlight": "3.0.2",
61
- "@wangeditor-next/core": "1.9.5",
61
+ "@wangeditor-next/core": "1.9.6",
62
62
  "@wangeditor-next/list-module": "3.0.3",
63
- "@wangeditor-next/table-module": "3.0.7",
64
- "@wangeditor-next/upload-image-module": "3.0.3",
65
- "@wangeditor-next/video-module": "3.0.2",
63
+ "@wangeditor-next/table-module": "3.0.8",
64
+ "@wangeditor-next/upload-image-module": "4.0.0",
65
+ "@wangeditor-next/video-module": "4.0.0",
66
66
  "dom7": "^4.0.0",
67
67
  "is-hotkey": "^0.2.0",
68
68
  "lodash.camelcase": "^4.3.0",