prosemirror-slash-menu-react 0.0.6 → 0.0.7

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.
@@ -1,13 +1,13 @@
1
- import { FC } from "react";
2
- import { MenuElement, SlashMenuState } from "prosemirror-slash-menu";
3
- import "./styles/menu-style.css";
4
- import { EditorView } from "prosemirror-view";
5
- export declare const ListItem: FC<{
6
- menuState: SlashMenuState;
7
- el: MenuElement;
8
- view: EditorView;
9
- idx: number;
10
- Icon?: FC;
11
- RightIcon?: FC;
12
- clickable?: boolean;
13
- }>;
1
+ import { FC } from "react";
2
+ import { MenuElement, SlashMenuState } from "prosemirror-slash-menu";
3
+ import "./styles/menu-style.css";
4
+ import { EditorView } from "prosemirror-view";
5
+ export declare const ListItem: FC<{
6
+ menuState: SlashMenuState;
7
+ el: MenuElement;
8
+ view: EditorView;
9
+ idx: number;
10
+ Icon?: FC;
11
+ RightIcon?: FC;
12
+ clickable?: boolean;
13
+ }>;
@@ -1,24 +1,24 @@
1
- import { CommandItem, SubMenu } from "prosemirror-slash-menu";
2
- import React from "react";
3
- export declare enum Icons {
4
- "HeaderMenu" = "HeaderMenu",
5
- "Level1" = "Level1",
6
- "Level2" = "Level2",
7
- "Level3" = "Level3",
8
- "Bold" = "Bold",
9
- "Italic" = "Italic",
10
- "Link" = "Link",
11
- "Code" = "Code"
12
- }
13
- export declare const defaultElements: (CommandItem | SubMenu)[];
14
- export declare const defaultIcons: {
15
- H1Icon: () => React.JSX.Element;
16
- H2Icon: () => React.JSX.Element;
17
- H3Icon: () => React.JSX.Element;
18
- LinkIcon: () => React.JSX.Element;
19
- BoldIcon: () => React.JSX.Element;
20
- CodeIcon: () => React.JSX.Element;
21
- ItalicIcon: () => React.JSX.Element;
22
- ArrowLeft: () => React.JSX.Element;
23
- ArrowRight: () => React.JSX.Element;
24
- };
1
+ import { CommandItem, SubMenu } from "prosemirror-slash-menu";
2
+ import React from "react";
3
+ export declare enum Icons {
4
+ "HeaderMenu" = "HeaderMenu",
5
+ "Level1" = "Level1",
6
+ "Level2" = "Level2",
7
+ "Level3" = "Level3",
8
+ "Bold" = "Bold",
9
+ "Italic" = "Italic",
10
+ "Link" = "Link",
11
+ "Code" = "Code"
12
+ }
13
+ export declare const defaultElements: (CommandItem | SubMenu)[];
14
+ export declare const defaultIcons: {
15
+ H1Icon: () => React.JSX.Element;
16
+ H2Icon: () => React.JSX.Element;
17
+ H3Icon: () => React.JSX.Element;
18
+ LinkIcon: () => React.JSX.Element;
19
+ BoldIcon: () => React.JSX.Element;
20
+ CodeIcon: () => React.JSX.Element;
21
+ ItalicIcon: () => React.JSX.Element;
22
+ ArrowLeft: () => React.JSX.Element;
23
+ ArrowRight: () => React.JSX.Element;
24
+ };
@@ -1,48 +1,48 @@
1
- import { FC, ReactNode } from "react";
2
- import { EditorState } from "prosemirror-state";
3
- import { EditorView } from "prosemirror-view";
4
- import "./styles/menu-style.css";
5
- export declare enum Placement {
6
- auto = "auto",
7
- autoStart = "auto-start",
8
- autoEnd = "auto-end",
9
- top = "top",
10
- topStart = "top-start",
11
- topEnd = "top-end",
12
- bottom = "bottom",
13
- bottomStart = "bottom-start",
14
- bottomEnd = "bottom-end",
15
- right = "right",
16
- rightStart = "right-start",
17
- rightEnd = "right-end",
18
- left = "left",
19
- leftStart = "left-start",
20
- leftEnd = "left-end"
21
- }
22
- export interface PopperOptions {
23
- placement: Placement;
24
- offsetModifier: {
25
- name: string;
26
- options: {
27
- offset: number[];
28
- };
29
- };
30
- }
31
- export interface SlashMenuProps {
32
- editorState: EditorState;
33
- editorView: EditorView;
34
- icons?: {
35
- [key: string]: FC;
36
- };
37
- rightIcons?: {
38
- [key: string]: FC;
39
- };
40
- subMenuIcon?: ReactNode;
41
- filterFieldIcon?: ReactNode;
42
- filterPlaceHolder?: string;
43
- mainMenuLabel?: string;
44
- popperReference?: HTMLElement;
45
- popperOptions?: PopperOptions;
46
- clickable?: boolean;
47
- }
48
- export declare const SlashMenuReact: FC<SlashMenuProps>;
1
+ import { FC, ReactNode } from "react";
2
+ import { EditorState } from "prosemirror-state";
3
+ import { EditorView } from "prosemirror-view";
4
+ import "./styles/menu-style.css";
5
+ export declare enum Placement {
6
+ auto = "auto",
7
+ autoStart = "auto-start",
8
+ autoEnd = "auto-end",
9
+ top = "top",
10
+ topStart = "top-start",
11
+ topEnd = "top-end",
12
+ bottom = "bottom",
13
+ bottomStart = "bottom-start",
14
+ bottomEnd = "bottom-end",
15
+ right = "right",
16
+ rightStart = "right-start",
17
+ rightEnd = "right-end",
18
+ left = "left",
19
+ leftStart = "left-start",
20
+ leftEnd = "left-end"
21
+ }
22
+ export interface PopperOptions {
23
+ placement: Placement;
24
+ offsetModifier: {
25
+ name: string;
26
+ options: {
27
+ offset: number[];
28
+ };
29
+ };
30
+ }
31
+ export interface SlashMenuProps {
32
+ editorState: EditorState;
33
+ editorView: EditorView;
34
+ icons?: {
35
+ [key: string]: FC;
36
+ };
37
+ rightIcons?: {
38
+ [key: string]: FC;
39
+ };
40
+ subMenuIcon?: ReactNode;
41
+ filterFieldIcon?: ReactNode;
42
+ filterPlaceHolder?: string;
43
+ mainMenuLabel?: string;
44
+ popperReference?: HTMLElement;
45
+ popperOptions?: PopperOptions;
46
+ clickable?: boolean;
47
+ }
48
+ export declare const SlashMenuReact: FC<SlashMenuProps>;
@@ -1,2 +1,2 @@
1
- import { SlashMenuState } from "prosemirror-slash-menu";
2
- export declare const getElements: (state: SlashMenuState) => import("prosemirror-slash-menu").MenuElement[] | undefined;
1
+ import { SlashMenuState } from "prosemirror-slash-menu";
2
+ export declare const getElements: (state: SlashMenuState) => import("prosemirror-slash-menu").MenuElement[] | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prosemirror-slash-menu-react",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Implementation of prosemirror-slash-menu in react",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -17,10 +17,9 @@
17
17
  "@types/node": "^16.18.34",
18
18
  "@types/react": "^18.2.9",
19
19
  "@types/react-dom": "^18.2.4",
20
- "prettier": "^2.8.8",
21
20
  "prosemirror-commands": "^1.5.2",
22
21
  "prosemirror-schema-basic": "^1.2.2",
23
- "prosemirror-slash-menu": "^0.1.4",
22
+ "prosemirror-state": "1.4.3",
24
23
  "prosemirror-view": "^1.31.4",
25
24
  "react": "^18.2.0",
26
25
  "react-dom": "^18.2.0",
@@ -28,14 +27,9 @@
28
27
  "rollup-plugin-import-css": "^3.2.1",
29
28
  "rollup-plugin-peer-deps-external": "^2.2.4",
30
29
  "rollup-plugin-postcss": "^4.0.2",
31
- "typescript": "^4.9.5",
32
- "web-vitals": "^2.1.4"
33
- },
34
- "scripts": {
35
- "test": "echo \"no test specified\" && exit 0",
36
- "build": "rollup -c --bundleConfigAsCjs",
37
- "yalc:watch": "nodemon --watch dist --exec 'yalc push'",
38
- "dev:watch": "npm-run-all --parallel dev yalc:watch"
30
+ "typescript": "^5.1.6",
31
+ "web-vitals": "^2.1.4",
32
+ "prosemirror-slash-menu": "0.1.5"
39
33
  },
40
34
  "repository": {
41
35
  "type": "git",
@@ -62,8 +56,15 @@
62
56
  "@babel/preset-react": "^7.22.3",
63
57
  "@rollup/plugin-babel": "^6.0.3",
64
58
  "@rollup/plugin-node-resolve": "^15.1.0",
59
+ "@typescript-eslint/eslint-plugin": "^6.2.0",
60
+ "@typescript-eslint/parser": "^6.2.0",
61
+ "eslint": "^8.45.0",
62
+ "eslint-config-prettier": "^8.5.0",
63
+ "eslint-plugin-prettier": "^4.2.1",
64
+ "eslint-plugin-react": "^7.33.0",
65
65
  "nodemon": "^2.0.22",
66
66
  "np": "^8.0.4",
67
+ "prettier": "^2.8.8",
67
68
  "rollup": "^2.79.1",
68
69
  "rollup-plugin-babel": "^4.4.0",
69
70
  "rollup-plugin-copy": "^3.4.0",
@@ -75,5 +76,14 @@
75
76
  "engines": {
76
77
  "node": ">=12",
77
78
  "npm": ">=7"
79
+ },
80
+ "scripts": {
81
+ "preinstall": "npx only-allow pnpm",
82
+ "test": "echo \"no test specified\" && exit 0",
83
+ "build": "rollup -c --bundleConfigAsCjs",
84
+ "dev": "rollup -c -w --bundleConfigAsCjs",
85
+ "yalc:watch": "nodemon --watch dist --exec 'yalc push'",
86
+ "lint": "tsc --noEmit && eslint src --ext .ts",
87
+ "dev:watch": "npm-run-all --parallel dev yalc:watch"
78
88
  }
79
- }
89
+ }
@@ -1,73 +0,0 @@
1
- .menu-display-root {
2
- position: absolute;
3
- display: flex;
4
- flex-direction: column;
5
- flex: 1;
6
- max-height: 150px;
7
- width: 200px;
8
- z-index: 100;
9
- overflow: scroll;
10
- border-radius: 0.3rem;
11
- background-color: #fafafa;
12
- border: 2px solid #dddddd;
13
- }
14
-
15
- .menu-element-wrapper {
16
- display: flex;
17
- border-radius: 0.3rem;
18
- padding: 0.2rem 0.5rem;
19
- }
20
-
21
- .menu-element-selected {
22
- background-color: #f1f1f1;
23
- }
24
-
25
- .menu-element-icon {
26
- width: 23px;
27
- height: auto;
28
- display: flex;
29
- align-items: center;
30
- }
31
-
32
- .menu-element-label {
33
- color: black;
34
- display: flex;
35
- align-items: center;
36
- margin-left: 0.5rem;
37
- }
38
-
39
- .menu-placeholder {
40
- color: #aaaaaa;
41
- text-align: center;
42
- padding-top: 1rem;
43
- }
44
-
45
- .menu-filter-wrapper {
46
- display: flex;
47
- background-color: transparent;
48
- padding: 0.2rem 0.5rem;
49
- position: absolute;
50
- top: -1.5rem;
51
- width: 200px;
52
- }
53
-
54
- .menu-filter-icon {
55
- width: 23px;
56
- height: auto;
57
- display: flex;
58
- align-items: center;
59
- }
60
-
61
- .menu-filter {
62
- color: #aaaaaa;
63
- font-style: italic
64
- }
65
-
66
- .menu-filter-placeholder {
67
- color: #aaaaaa;
68
- font-style: italic
69
- }
70
-
71
- .submenu-label {
72
- margin-left: 0.5rem;
73
- }
@@ -1,72 +0,0 @@
1
- .menu-display-root {
2
- position: absolute;
3
- display: flex;
4
- flex-direction: column;
5
- height: 150px;
6
- width: 200px;
7
- z-index: 100;
8
- overflow: scroll;
9
- border-radius: 0.3rem;
10
- background-color: #fafafa;
11
- border: 2px solid #dddddd;
12
- }
13
-
14
- .menu-element-wrapper {
15
- display: flex;
16
- border-radius: 0.3rem;
17
- padding: 0.2rem 0.5rem;
18
- }
19
-
20
- .menu-element-selected {
21
- background-color: #f1f1f1;
22
- }
23
-
24
- .menu-element-icon {
25
- width: 23px;
26
- height: auto;
27
- display: flex;
28
- align-items: center;
29
- }
30
-
31
- .menu-element-label {
32
- color: black;
33
- display: flex;
34
- align-items: center;
35
- margin-left: 0.5rem;
36
- }
37
-
38
- .menu-placeholder {
39
- color: #aaaaaa;
40
- text-align: center;
41
- padding-top: 1rem;
42
- }
43
-
44
- .menu-filter-wrapper {
45
- display: flex;
46
- background-color: transparent;
47
- padding: 0.2rem 0.5rem;
48
- position: absolute;
49
- top: -1.5rem;
50
- width: 200px;
51
- }
52
-
53
- .menu-filter-icon {
54
- width: 23px;
55
- height: auto;
56
- display: flex;
57
- align-items: center;
58
- }
59
-
60
- .menu-filter {
61
- color: #aaaaaa;
62
- font-style: italic
63
- }
64
-
65
- .menu-filter-placeholder {
66
- color: #aaaaaa;
67
- font-style: italic
68
- }
69
-
70
- .submenu-label {
71
- margin-left: 0.5rem;
72
- }
@@ -1,71 +0,0 @@
1
- .menu-display-root {
2
- position: absolute;
3
- display: flex;
4
- flex-direction: column;
5
- height: 150px;
6
- width: 200px;
7
- z-index: 100;
8
- overflow: scroll;
9
- border-radius: 0.3rem;
10
- background-color: #fafafa;
11
- border: 2px solid #dddddd;
12
- }
13
-
14
- .menu-element-wrapper {
15
- display: flex;
16
- border-radius: 0.3rem;
17
- padding: 0.2rem 0.5rem;
18
- }
19
-
20
- .menu-element-selected {
21
- background-color: #f1f1f1;
22
- }
23
-
24
- .menu-element-icon {
25
- width: 23px;
26
- height: auto;
27
- display: flex;
28
- align-items: center;
29
- }
30
-
31
- .menu-element-label {
32
- color: black;
33
- display: flex;
34
- align-items: center;
35
- margin-left: 0.5rem;
36
- }
37
-
38
- .menu-placeholder {
39
- color: #aaaaaa;
40
- text-align: center;
41
- padding-top: 1rem;
42
- }
43
-
44
- .menu-filter-wrapper {
45
- display: flex;
46
- background-color: transparent;
47
- padding: 0.2rem 0.5rem;
48
- position: absolute;
49
- top: -1.5rem;
50
- }
51
-
52
- .menu-filter-icon {
53
- width: 23px;
54
- height: auto;
55
- display: flex;
56
- align-items: center;
57
- }
58
-
59
- .menu-filter {
60
- color: #aaaaaa;
61
- font-style: italic
62
- }
63
-
64
- .menu-filter-placeholder {
65
- color: #aaaaaa;
66
- font-style: italic
67
- }
68
-
69
- .submenu-label {
70
- margin-left: 0.5rem;
71
- }
@@ -1,73 +0,0 @@
1
- .menu-display-root {
2
- position: absolute;
3
- display: flex;
4
- flex-direction: column;
5
- flex: 1;
6
- max-height: 150px;
7
- width: 200px;
8
- z-index: 100;
9
- overflow: scroll;
10
- border-radius: 0.3rem;
11
- background-color: #fafafa;
12
- border: 2px solid #dddddd;
13
- }
14
-
15
- .menu-element-wrapper {
16
- display: flex;
17
- border-radius: 0.3rem;
18
- padding: 0.2rem 0.5rem;
19
- }
20
-
21
- .menu-element-selected {
22
- background-color: #f1f1f1;
23
- }
24
-
25
- .menu-element-icon {
26
- width: 23px;
27
- height: auto;
28
- display: flex;
29
- align-items: center;
30
- }
31
-
32
- .menu-element-label {
33
- color: black;
34
- display: flex;
35
- align-items: center;
36
- margin-left: 0.5rem;
37
- }
38
-
39
- .menu-placeholder {
40
- color: #aaaaaa;
41
- text-align: center;
42
- padding: 0 0.5rem;
43
- }
44
-
45
- .menu-filter-wrapper {
46
- display: flex;
47
- background-color: transparent;
48
- padding: 0.2rem 0.5rem;
49
- position: absolute;
50
- top: -1.5rem;
51
- width: 200px;
52
- }
53
-
54
- .menu-filter-icon {
55
- width: 23px;
56
- height: auto;
57
- display: flex;
58
- align-items: center;
59
- }
60
-
61
- .menu-filter {
62
- color: #aaaaaa;
63
- font-style: italic
64
- }
65
-
66
- .menu-filter-placeholder {
67
- color: #aaaaaa;
68
- font-style: italic
69
- }
70
-
71
- .submenu-label {
72
- margin-left: 0.5rem;
73
- }
@@ -1,71 +0,0 @@
1
- .menu-display-root {
2
- position: absolute;
3
- display: flex;
4
- flex-direction: column;
5
- height: 150px;
6
- width: 200px;
7
- z-index: 100;
8
- overflow: scroll;
9
- border-radius: 0.3rem;
10
- background-color: #fafafa;
11
- border: 2px solid #dddddd;
12
- }
13
-
14
- .menu-element-wrapper {
15
- display: flex;
16
- border-radius: 0.3rem;
17
- padding: 0.2rem 0.5rem;
18
- }
19
-
20
- .menu-element-selected {
21
- background-color: #f1f1f1;
22
- }
23
-
24
- .menu-element-icon {
25
- width: 23px;
26
- height: auto;
27
- display: flex;
28
- align-items: center;
29
- }
30
-
31
- .menu-element-label {
32
- color: black;
33
- display: flex;
34
- align-items: center;
35
- margin-left: 0.5rem;
36
- }
37
-
38
- .menu-placeholder {
39
- color: #aaaaaa;
40
- text-align: center;
41
- padding-top: 1rem;
42
- }
43
-
44
- .menu-filter-wrapper {
45
- display: flex;
46
- background-color: transparent;
47
- padding: 0.2rem 0.5rem;
48
- position: absolute;
49
- top: -1.5rem;
50
- }
51
-
52
- .menu-filter-icon {
53
- width: 23px;
54
- height: auto;
55
- display: flex;
56
- align-items: center;
57
- }
58
-
59
- .menu-filter {
60
- color: #aaaaaa;
61
- font-style: italic
62
- }
63
-
64
- .menu-filter-placeholder {
65
- color: #aaaaaa;
66
- font-style: italic
67
- }
68
-
69
- .submenu-label {
70
- margin-left: 0.5rem;
71
- }
@@ -1,73 +0,0 @@
1
- .menu-display-root {
2
- position: absolute;
3
- display: flex;
4
- flex-direction: column;
5
- flex: 1;
6
- max-height: 150px;
7
- width: 200px;
8
- z-index: 100;
9
- overflow: scroll;
10
- border-radius: 0.3rem;
11
- background-color: #fafafa;
12
- border: 2px solid #dddddd;
13
- }
14
-
15
- .menu-element-wrapper {
16
- display: flex;
17
- border-radius: 0.3rem;
18
- padding: 0.2rem 0.5rem;
19
- }
20
-
21
- .menu-element-selected {
22
- background-color: #f1f1f1;
23
- }
24
-
25
- .menu-element-icon {
26
- width: 23px;
27
- height: auto;
28
- display: flex;
29
- align-items: center;
30
- }
31
-
32
- .menu-element-label {
33
- color: black;
34
- display: flex;
35
- align-items: center;
36
- margin-left: 0.5rem;
37
- }
38
-
39
- .menu-placeholder {
40
- color: #aaaaaa;
41
- text-align: center;
42
- padding: 0 0.5rem;
43
- }
44
-
45
- .menu-filter-wrapper {
46
- display: flex;
47
- background-color: transparent;
48
- padding: 0.2rem 0.5rem;
49
- position: absolute;
50
- top: -1.5rem;
51
- width: 200px;
52
- }
53
-
54
- .menu-filter-icon {
55
- width: 23px;
56
- height: auto;
57
- display: flex;
58
- align-items: center;
59
- }
60
-
61
- .menu-filter {
62
- color: #aaaaaa;
63
- font-style: italic
64
- }
65
-
66
- .menu-filter-placeholder {
67
- color: #aaaaaa;
68
- font-style: italic
69
- }
70
-
71
- .submenu-label {
72
- margin-left: 0.5rem;
73
- }