prosemirror-slash-menu-react 0.0.4 → 0.0.6

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.
package/README.md CHANGED
@@ -21,6 +21,7 @@ Try it out at <https://emergence-engineering.com/blog/prosemirror-slash-menu>
21
21
  - Displaying the menu upwards in case of overflow
22
22
  - Default styling
23
23
  - Custom styling with css classnames
24
+ - Optional popper reference element, placement and offset
24
25
  - Outside click handling
25
26
 
26
27
  # Behavior
@@ -126,8 +127,10 @@ override the following classnames.
126
127
 
127
128
  - `menu-display-root` root div for the menu
128
129
  - `menu-element-wrapper` root of menu elements
130
+ - `menu-element-wrapper-clickable` root of menu elements when the menu items are set to be clickable
129
131
  - `menu-element-selected` classname that is added alongside `menu-element-wrapper` when an element is selected
130
132
  - `menu-element-icon` if icon is provided for the element it's rendered in this div
133
+ - `menu-element-right-icon` if right icon is provided its rendered in this div
131
134
  - `menu-element-label` label of the menu element
132
135
  - `menu-placeholder` when there is no matching items for the filter, this is displayed with the text "No matching items"
133
136
  - `menu-filter-wrapper` root of the filter display, positioned above the menu by default
@@ -142,8 +145,13 @@ override the following classnames.
142
145
  - `editorView` prosemirror editor view
143
146
  - `icons` Optional, if you want to provide icons for your menu elements. Type of `{[key: string]: FC}` where the key is
144
147
  the id of the menu element and the value is a `FunctionComponent` that renders the icon
148
+ - `rightIcons` Same as icons but these appear on the right on the menu element, most commonly used for indicating a
149
+ submenu with an arrow
145
150
  - `subMenuIcon` Optional icon for submenu label. By default, when a submenu is open an arrow is displayed indicating
146
151
  that the user is in a subMenu, it can be replaced with a react node of your choice
147
152
  - `filterFieldIcon` Optional icon in the filter field.
148
153
  - `filterPlaceHolder` Optional placeholder text for the filter field.
149
- - `mainMenuLabel` Optional label for the main menu. By default, there is none.
154
+ - `mainMenuLabel` Optional label for the main menu. By default, there is none.
155
+ - `popperReference` Optional popper reference HTMLElement, for displaying the menu next to whatever element you want
156
+ - `popperOptions` You can pass in `placement` and `offset` to position your menu around the reference Element
157
+ - `clickable` Optional boolean, if true the menu items are clickable, by default they are used only with keyboard
@@ -0,0 +1,73 @@
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
+ }
@@ -0,0 +1,72 @@
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
+ }
@@ -0,0 +1,89 @@
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-wrapper-clickable {
22
+ display: flex;
23
+ border-radius: 0.3rem;
24
+ padding: 0.2rem 0.5rem;
25
+ cursor: pointer;
26
+ }
27
+
28
+ .menu-element-selected {
29
+ background-color: #f1f1f1;
30
+ }
31
+
32
+ .menu-element-icon {
33
+ width: 23px;
34
+ height: auto;
35
+ display: flex;
36
+ align-items: center;
37
+ }
38
+
39
+ .menu-element-right-icon {
40
+ margin-left: auto;
41
+ width: 23px;
42
+ height: auto;
43
+ display: flex;
44
+ align-items: center;
45
+ margin-right: 0.5rem;
46
+ }
47
+
48
+ .menu-element-label {
49
+ color: black;
50
+ display: flex;
51
+ align-items: center;
52
+ margin-left: 0.5rem;
53
+ }
54
+
55
+ .menu-placeholder {
56
+ color: #aaaaaa;
57
+ text-align: center;
58
+ padding: 0 0.5rem;
59
+ }
60
+
61
+ .menu-filter-wrapper {
62
+ display: flex;
63
+ background-color: transparent;
64
+ padding: 0.2rem 0.5rem;
65
+ position: absolute;
66
+ top: -1.5rem;
67
+ width: 200px;
68
+ }
69
+
70
+ .menu-filter-icon {
71
+ width: 23px;
72
+ height: auto;
73
+ display: flex;
74
+ align-items: center;
75
+ }
76
+
77
+ .menu-filter {
78
+ color: #aaaaaa;
79
+ font-style: italic
80
+ }
81
+
82
+ .menu-filter-placeholder {
83
+ color: #aaaaaa;
84
+ font-style: italic
85
+ }
86
+
87
+ .submenu-label {
88
+ margin-left: 0.5rem;
89
+ }
@@ -0,0 +1,71 @@
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
+ }
@@ -0,0 +1,73 @@
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
+ }
@@ -0,0 +1,71 @@
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
+ }
@@ -0,0 +1,89 @@
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-wrapper-clickable {
22
+ display: flex;
23
+ border-radius: 0.3rem;
24
+ padding: 0.2rem 0.5rem;
25
+ cursor: pointer;
26
+ }
27
+
28
+ .menu-element-selected {
29
+ background-color: #f1f1f1;
30
+ }
31
+
32
+ .menu-element-icon {
33
+ width: 23px;
34
+ height: auto;
35
+ display: flex;
36
+ align-items: center;
37
+ }
38
+
39
+ .menu-element-right-icon {
40
+ margin-left: auto;
41
+ width: 23px;
42
+ height: auto;
43
+ display: flex;
44
+ align-items: center;
45
+ margin-right: 0.5rem;
46
+ }
47
+
48
+ .menu-element-label {
49
+ color: black;
50
+ display: flex;
51
+ align-items: center;
52
+ margin-left: 0.5rem;
53
+ }
54
+
55
+ .menu-placeholder {
56
+ color: #aaaaaa;
57
+ text-align: center;
58
+ padding: 0 0.5rem;
59
+ }
60
+
61
+ .menu-filter-wrapper {
62
+ display: flex;
63
+ background-color: transparent;
64
+ padding: 0.2rem 0.5rem;
65
+ position: absolute;
66
+ top: -1.5rem;
67
+ width: 200px;
68
+ }
69
+
70
+ .menu-filter-icon {
71
+ width: 23px;
72
+ height: auto;
73
+ display: flex;
74
+ align-items: center;
75
+ }
76
+
77
+ .menu-filter {
78
+ color: #aaaaaa;
79
+ font-style: italic
80
+ }
81
+
82
+ .menu-filter-placeholder {
83
+ color: #aaaaaa;
84
+ font-style: italic
85
+ }
86
+
87
+ .submenu-label {
88
+ margin-left: 0.5rem;
89
+ }
@@ -0,0 +1,73 @@
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
+ }
@@ -0,0 +1,72 @@
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
+ }