@wangeditor-next/plugin-link-card 2.0.3 → 2.0.5

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.
@@ -47,6 +47,7 @@ declare const _default: {
47
47
  delete: string;
48
48
  edit: string;
49
49
  editSize: string;
50
+ preview: string;
50
51
  viewLink: string;
51
52
  src: string;
52
53
  desc: string;
@@ -47,6 +47,7 @@ declare const _default: {
47
47
  delete: string;
48
48
  edit: string;
49
49
  editSize: string;
50
+ preview: string;
50
51
  viewLink: string;
51
52
  src: string;
52
53
  desc: string;
@@ -4,9 +4,17 @@
4
4
  */
5
5
  import { IButtonMenu, IDomEditor } from '@wangeditor-next/core';
6
6
  import { Text } from 'slate';
7
+ type BlockTypeForFormatPainter = 'header1' | 'header2' | 'header3' | 'header4' | 'header5' | 'header6' | 'blockquote' | 'list-item' | 'todo';
8
+ type OrderedListTypeForFormatPainter = '1' | 'a' | 'A' | 'i' | 'I';
9
+ interface BlockStyleForFormatPainter {
10
+ type: BlockTypeForFormatPainter;
11
+ ordered?: boolean;
12
+ orderType?: OrderedListTypeForFormatPainter;
13
+ }
7
14
  interface FormatPaintAttributes {
8
15
  isSelect: boolean;
9
16
  formatStyle: Omit<Text, 'text'> | null;
17
+ formatBlockStyle: BlockStyleForFormatPainter | null;
10
18
  }
11
19
  declare class FormatPainter implements IButtonMenu {
12
20
  title: string;
@@ -16,6 +24,13 @@ declare class FormatPainter implements IButtonMenu {
16
24
  getValue(_editor: IDomEditor): string | boolean;
17
25
  isActive(_editor: IDomEditor): boolean;
18
26
  isDisabled(_editor: IDomEditor): boolean;
27
+ private isSourceBlockType;
28
+ private isTargetBlockType;
29
+ private getTopLevelSelectedBlocks;
30
+ private normalizeListOrderType;
31
+ private getSelectedBlockStyle;
32
+ private unsetListAttrs;
33
+ private applyBlockStyle;
19
34
  setFormatHtml(editor: IDomEditor): void;
20
35
  exec(editor: IDomEditor): void;
21
36
  }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @description preview image menu
3
+ */
4
+ import { IButtonMenu, IDomEditor } from '@wangeditor-next/core';
5
+ declare class PreviewImage implements IButtonMenu {
6
+ readonly title: string;
7
+ readonly iconSvg = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M924.402464 1023.068211H0.679665V99.345412h461.861399v98.909208H99.596867v725.896389h725.896389V561.206811h98.909208z\" p-id=\"10909\"></path><path d=\"M930.805104 22.977336l69.965436 69.965436-453.492405 453.492404-69.965435-69.901489z\" p-id=\"10910\"></path><path d=\"M1022.464381 304.030081h-98.917201V99.345412H709.230573V0.428211h313.233808z\"></path></svg>";
8
+ readonly tag = "button";
9
+ getValue(editor: IDomEditor): string | boolean;
10
+ isActive(_editor: IDomEditor): boolean;
11
+ isDisabled(editor: IDomEditor): boolean;
12
+ exec(editor: IDomEditor, value: string | boolean): void;
13
+ }
14
+ export default PreviewImage;
@@ -6,6 +6,7 @@ import DeleteImage from './DeleteImage';
6
6
  import EditImage from './EditImage';
7
7
  import EditorImageSizeMenu from './EditImageSizeMenu';
8
8
  import InsertImage from './InsertImage';
9
+ import PreviewImage from './PreviewImage';
9
10
  import ViewImageLink from './ViewImageLink';
10
11
  import ImageWidth30 from './Width30';
11
12
  import ImageWidth50 from './Width50';
@@ -38,6 +39,10 @@ export declare const viewImageLinkMenuConf: {
38
39
  key: string;
39
40
  factory(): ViewImageLink;
40
41
  };
42
+ export declare const previewImageMenuConf: {
43
+ key: string;
44
+ factory(): PreviewImage;
45
+ };
41
46
  export declare const imageWidth30MenuConf: {
42
47
  key: string;
43
48
  factory(): ImageWidth30;
@@ -95,6 +95,9 @@ interface IInsertTableConfig {
95
95
  selected: boolean;
96
96
  };
97
97
  }
98
+ interface IInsertTableColConfig {
99
+ insertPosition: 'before' | 'after';
100
+ }
98
101
  interface ILinkConfig {
99
102
  checkLink: (text: string, url: string) => string | boolean | undefined;
100
103
  parseLinkUrl: (url: string) => string;
@@ -138,6 +141,7 @@ export interface IMenuConfig {
138
141
  insertImage: IInsertImageConfig;
139
142
  deleteImage: ISingleMenuConfig;
140
143
  editImage: IEditImageConfig;
144
+ previewImage: ISingleMenuConfig;
141
145
  viewImageLink: ISingleMenuConfig;
142
146
  imageWidth30: ISingleMenuConfig;
143
147
  imageWidth50: ISingleMenuConfig;
@@ -166,11 +170,12 @@ export interface IMenuConfig {
166
170
  enter: ISingleMenuConfig;
167
171
  bulletedList: ISingleMenuConfig;
168
172
  numberedList: ISingleMenuConfig;
173
+ numberedListLowerAlpha: ISingleMenuConfig;
169
174
  insertTable: ISingleMenuConfig;
170
175
  deleteTable: ISingleMenuConfig;
171
176
  insertTableRow: IInsertTableConfig;
172
177
  deleteTableRow: ISingleMenuConfig;
173
- insertTableCol: ISingleMenuConfig;
178
+ insertTableCol: IInsertTableColConfig;
174
179
  deleteTableCol: ISingleMenuConfig;
175
180
  tableHeader: ISingleMenuConfig;
176
181
  tableFullWidth: ISingleMenuConfig;
@@ -6,6 +6,7 @@ declare const _default: {
6
6
  listModule: {
7
7
  unOrderedList: string;
8
8
  orderedList: string;
9
+ lowerAlphaList: string;
9
10
  };
10
11
  };
11
12
  export default _default;
@@ -6,6 +6,7 @@ declare const _default: {
6
6
  listModule: {
7
7
  unOrderedList: string;
8
8
  orderedList: string;
9
+ lowerAlphaList: string;
9
10
  };
10
11
  };
11
12
  export default _default;
@@ -3,9 +3,12 @@
3
3
  * @author wangfupeng
4
4
  */
5
5
  import { Text } from 'slate';
6
+ export type OrderedListType = '1' | 'a' | 'A' | 'i' | 'I';
6
7
  export type ListItemElement = {
7
8
  type: 'list-item';
8
9
  ordered: boolean;
9
10
  level: number;
11
+ start?: number;
12
+ orderType?: OrderedListType;
10
13
  children: Text[];
11
14
  };
@@ -3,7 +3,10 @@
3
3
  * @author wangfupeng
4
4
  */
5
5
  import { IDomEditor } from '@wangeditor-next/core';
6
- import { ListItemElement } from './custom-types';
6
+ import { ListItemElement, OrderedListType } from './custom-types';
7
+ export declare function getNormalizedOrderedListStart(elem: ListItemElement): number;
8
+ export declare function getNormalizedOrderedListType(elem: ListItemElement): OrderedListType;
9
+ export declare function hasSameListConfig(a: ListItemElement, b: ListItemElement): boolean;
7
10
  /**
8
11
  * 获取上一个同一 level 的 list item
9
12
  * @param editor 编辑器实例
@@ -3,9 +3,11 @@
3
3
  * @author wangfupeng
4
4
  */
5
5
  import { IButtonMenu, IDomEditor } from '@wangeditor-next/core';
6
+ import { OrderedListType } from '../custom-types';
6
7
  declare abstract class BaseMenu implements IButtonMenu {
7
8
  readonly type = "list-item";
8
9
  abstract readonly ordered: boolean;
10
+ readonly orderType?: OrderedListType;
9
11
  abstract readonly title: string;
10
12
  abstract readonly iconSvg: string;
11
13
  readonly tag = "button";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @description lower-alpha ordered list menu
3
+ * @author wangfupeng
4
+ */
5
+ import { OrderedListType } from '../custom-types';
6
+ import BaseMenu from './BaseMenu';
7
+ declare class LowerAlphaListMenu extends BaseMenu {
8
+ readonly ordered = true;
9
+ readonly orderType: OrderedListType;
10
+ readonly title: string;
11
+ readonly iconSvg = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M384 832h640v128H384z m0-384h640v128H384z m0-384h640v128H384zM192 0v256H128V64H64V0zM128 526.016v50.016h128v64H64v-146.016l128-60V384H64v-64h192v146.016zM256 704v320H64v-64h128v-64H64v-64h128v-64H64v-64z\"></path></svg>";
12
+ }
13
+ export default LowerAlphaListMenu;
@@ -3,6 +3,7 @@
3
3
  * @author wangfupeng
4
4
  */
5
5
  import BulletedListMenu from './BulletedListMenu';
6
+ import LowerAlphaListMenu from './LowerAlphaListMenu';
6
7
  import NumberedListMenu from './NumberedListMenu';
7
8
  export declare const bulletedListMenuConf: {
8
9
  key: string;
@@ -12,3 +13,7 @@ export declare const numberedListMenuConf: {
12
13
  key: string;
13
14
  factory(): NumberedListMenu;
14
15
  };
16
+ export declare const numberedListLowerAlphaMenuConf: {
17
+ key: string;
18
+ factory(): LowerAlphaListMenu;
19
+ };
@@ -6,7 +6,7 @@ import { IDomEditor } from '@wangeditor-next/core';
6
6
  import { Descendant } from 'slate';
7
7
  import { DOMElement } from '../utils/dom';
8
8
  import { ListItemElement } from './custom-types';
9
- declare function parseItemHtml(elem: DOMElement, children: Descendant[], editor: IDomEditor): ListItemElement;
9
+ declare function parseItemHtml(elem: DOMElement, children: Descendant[], editor: IDomEditor): ListItemElement | ListItemElement[];
10
10
  export declare const parseItemHtmlConf: {
11
11
  selector: string;
12
12
  parseElemHtml: typeof parseItemHtml;
@@ -29,6 +29,7 @@ export type TableRowElement = {
29
29
  export type TableElement = {
30
30
  type: 'table';
31
31
  width: string;
32
+ caption?: string;
32
33
  children: TableRowElement[];
33
34
  /** resize bar */
34
35
  scrollWidth?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wangeditor-next/plugin-link-card",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "wangEditor link card plugin",
5
5
  "author": "cycleccc <2991205548@qq.com>",
6
6
  "type": "module",
@@ -34,7 +34,7 @@
34
34
  "url": "https://github.com/wangeditor-next/wangeditor-next/issues"
35
35
  },
36
36
  "peerDependencies": {
37
- "@wangeditor-next/editor": "5.7.3",
37
+ "@wangeditor-next/editor": "5.7.5",
38
38
  "dom7": "^3.0.0 || ^4.0.0",
39
39
  "slate": "^0.123.0",
40
40
  "snabbdom": "^3.6.0"