@vev/silke 1.1.9 → 1.2.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.
- package/.turbo/turbo-build.log +162 -77
- package/CHANGELOG.md +40 -0
- package/dist/index.js +47 -40
- package/dist/index.js.LEGAL.txt +1 -1
- package/dist/index.js.map +7 -0
- package/dist/styles.css +1596 -1013
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/silke-autocomplete-field/autocomplete-item.d.ts +1 -1
- package/dist/types/components/silke-autocomplete-field/silke-autocomplete-field-native.d.ts +5 -0
- package/dist/types/components/silke-box/silke-box.d.ts +2 -0
- package/dist/types/components/silke-button/silke-dropdown-button.d.ts +3 -1
- package/dist/types/components/silke-card/silke-card-grid.d.ts +1 -0
- package/dist/types/components/silke-card/silke-card.d.ts +1 -0
- package/dist/types/components/silke-command-text-field/index.d.ts +1 -1
- package/dist/types/components/silke-command-text-field/silke-command-text-field.d.ts +16 -0
- package/dist/types/components/silke-command-text-field/utils.d.ts +25 -0
- package/dist/types/components/silke-css-number-field/silke-css-number-field.spec.d.ts +1 -0
- package/dist/types/components/silke-expression-input/index.d.ts +3 -0
- package/dist/types/components/silke-expression-input/silke-expression-input-tag.d.ts +6 -0
- package/dist/types/components/silke-expression-input/silke-expression-input.d.ts +29 -0
- package/dist/types/components/silke-expression-input/utils.d.ts +18 -0
- package/dist/types/components/silke-form-schema/fields/array-field-inline.d.ts +2 -1
- package/dist/types/components/silke-form-schema/fields/array-field-modal.d.ts +2 -1
- package/dist/types/components/silke-form-schema/fields/array-field.d.ts +1 -1
- package/dist/types/components/silke-form-schema/fields/group-field.d.ts +1 -1
- package/dist/types/components/silke-form-schema/fields/layout-field.d.ts +1 -1
- package/dist/types/components/silke-form-schema/fields/object-field.d.ts +1 -1
- package/dist/types/components/silke-form-schema/fields/popover-field.d.ts +1 -1
- package/dist/types/components/silke-form-schema/fields/string-field.d.ts +1 -1
- package/dist/types/components/silke-form-schema/index.d.ts +1 -0
- package/dist/types/components/silke-form-schema/silke-form-schema.d.ts +4 -1
- package/dist/types/components/silke-form-schema/silke-schema-decorator.d.ts +17 -0
- package/dist/types/components/silke-form-schema/silke-schema-field.d.ts +2 -1
- package/dist/types/components/silke-form-schema/silke-schema-fields.d.ts +2 -0
- package/dist/types/components/silke-form-schema/silke-schema-path.spec.d.ts +1 -0
- package/dist/types/components/silke-gradient-picker/silke-gradient-utils.d.ts +2 -0
- package/dist/types/components/silke-icon-picker/color-swatch-section.d.ts +6 -0
- package/dist/types/components/silke-icon-picker/emoji-tab.d.ts +1 -1
- package/dist/types/components/silke-icon-picker/icons-tab.d.ts +1 -1
- package/dist/types/components/silke-icon-picker/silke-icon-picker.d.ts +2 -0
- package/dist/types/components/silke-icon-picker/utils.d.ts +2 -0
- package/dist/types/components/silke-list/silke-list-item.d.ts +5 -1
- package/dist/types/components/silke-list/types.d.ts +1 -0
- package/dist/types/components/silke-navigation-link/silke-navigation-link.d.ts +15 -0
- package/dist/types/components/silke-popover/popover-context.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/blockquote.d.ts +21 -0
- package/dist/types/components/silke-rich-text-field/blockquote.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/dropcap.d.ts +27 -0
- package/dist/types/components/silke-rich-text-field/dropcap.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/floating-layer.d.ts +12 -0
- package/dist/types/components/silke-rich-text-field/font-size.d.ts +2 -0
- package/dist/types/components/silke-rich-text-field/formatting-toolbar.d.ts +9 -0
- package/dist/types/components/silke-rich-text-field/index.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/jsdom-rects.d.ts +10 -0
- package/dist/types/components/silke-rich-text-field/link-menu.d.ts +26 -0
- package/dist/types/components/silke-rich-text-field/link-menu.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/link-suggestions.d.ts +48 -0
- package/dist/types/components/silke-rich-text-field/link-suggestions.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/link-tooltip.d.ts +15 -0
- package/dist/types/components/silke-rich-text-field/list-item.d.ts +15 -0
- package/dist/types/components/silke-rich-text-field/list-link-fontsize.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/lorem-ipsum.d.ts +10 -0
- package/dist/types/components/silke-rich-text-field/lorem-ipsum.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/paste.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/paste.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/plugins.d.ts +18 -0
- package/dist/types/components/silke-rich-text-field/plugins.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/silke-rich-text-field.d.ts +60 -0
- package/dist/types/components/silke-rich-text-field/slash-menu-items.d.ts +10 -0
- package/dist/types/components/silke-rich-text-field/slash-menu.d.ts +11 -0
- package/dist/types/components/silke-rich-text-field/table-content-sync.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/table-toolbar.d.ts +17 -0
- package/dist/types/components/silke-rich-text-field/table-toolbar.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/table.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/use-link-hover.d.ts +15 -0
- package/dist/types/components/silke-rich-text-field/use-slash-menu.d.ts +13 -0
- package/dist/types/components/silke-rich-text-field/utils.d.ts +13 -0
- package/dist/types/components/silke-sortable-list/index.d.ts +1 -1
- package/dist/types/components/silke-sortable-list/silke-nested-sortable-list.d.ts +8 -1
- package/dist/types/components/silke-theme-card/silke-theme-card.d.ts +13 -6
- package/dist/types/components/silke-theme-swatch/silke-theme-swatch.d.ts +6 -1
- package/dist/types/icons.d.ts +18 -0
- package/esbuild.config.mjs +9 -4
- package/package.json +22 -9
- package/src/components/index.ts +2 -0
- package/src/components/silke-alert-banner/silke-alert-banner.tsx +1 -1
- package/src/components/silke-autocomplete-field/autocomplete-item.tsx +47 -61
- package/src/components/silke-autocomplete-field/silke-autocomplete-field-native.tsx +13 -2
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +8 -5
- package/src/components/silke-autocomplete-field/silke-autocomplete-popup-native.tsx +2 -1
- package/src/components/silke-box/silke-box.scss +4 -0
- package/src/components/silke-box/silke-box.tsx +4 -0
- package/src/components/silke-button/silke-dropdown-button.tsx +4 -1
- package/src/components/silke-card/silke-card.scss +4 -0
- package/src/components/silke-card/silke-card.tsx +3 -0
- package/src/components/silke-command-text-field/index.ts +1 -0
- package/src/components/silke-command-text-field/silke-command-parser.spec.ts +55 -0
- package/src/components/silke-command-text-field/silke-command-parser.ts +33 -2
- package/src/components/silke-command-text-field/silke-command-text-field.module.scss +3 -0
- package/src/components/silke-command-text-field/silke-command-text-field.tsx +53 -48
- package/src/components/silke-command-text-field/utils.spec.ts +192 -0
- package/src/components/silke-command-text-field/utils.ts +99 -16
- package/src/components/silke-css-number-field/silke-css-number-field.spec.tsx +115 -0
- package/src/components/silke-css-number-field/silke-css-number-field.tsx +33 -0
- package/src/components/silke-expression-input/index.ts +3 -0
- package/src/components/silke-expression-input/silke-expression-input-tag.tsx +37 -0
- package/src/components/silke-expression-input/silke-expression-input.mdx +40 -0
- package/src/components/silke-expression-input/silke-expression-input.scss +24 -0
- package/src/components/silke-expression-input/silke-expression-input.tsx +343 -0
- package/src/components/silke-expression-input/utils.ts +144 -0
- package/src/components/silke-form-schema/fields/array-field-inline.tsx +4 -0
- package/src/components/silke-form-schema/fields/array-field-modal.tsx +4 -0
- package/src/components/silke-form-schema/fields/array-field.tsx +6 -11
- package/src/components/silke-form-schema/fields/group-field.tsx +2 -0
- package/src/components/silke-form-schema/fields/layout-field.tsx +2 -0
- package/src/components/silke-form-schema/fields/number-field.tsx +114 -4
- package/src/components/silke-form-schema/fields/object-field.tsx +2 -0
- package/src/components/silke-form-schema/fields/popover-field.tsx +2 -0
- package/src/components/silke-form-schema/fields/string-field.tsx +27 -1
- package/src/components/silke-form-schema/index.ts +1 -0
- package/src/components/silke-form-schema/silke-form-schema.mdx +30 -1
- package/src/components/silke-form-schema/silke-form-schema.tsx +12 -6
- package/src/components/silke-form-schema/silke-schema-decorator.tsx +32 -0
- package/src/components/silke-form-schema/silke-schema-field.tsx +19 -2
- package/src/components/silke-form-schema/silke-schema-fields.tsx +30 -4
- package/src/components/silke-form-schema/silke-schema-path.spec.tsx +160 -0
- package/src/components/silke-gradient-picker/silke-gradient-picker.tsx +3 -1
- package/src/components/silke-gradient-picker/silke-gradient-utils.ts +23 -3
- package/src/components/silke-icon/silke-shape.tsx +1 -1
- package/src/components/silke-icon-picker/color-swatch-section.tsx +61 -0
- package/src/components/silke-icon-picker/emoji-tab.tsx +8 -6
- package/src/components/silke-icon-picker/icons-tab.tsx +8 -7
- package/src/components/silke-icon-picker/silke-icon-picker.tsx +52 -25
- package/src/components/silke-icon-picker/styles.scss +66 -1
- package/src/components/silke-icon-picker/utils.ts +2 -0
- package/src/components/silke-list/silke-list-item.scss +10 -0
- package/src/components/silke-list/silke-list-item.tsx +16 -3
- package/src/components/silke-list/silke-list.mdx +18 -0
- package/src/components/silke-list/types.ts +1 -0
- package/src/components/silke-navigation-link/silke-navigation-link.scss +162 -42
- package/src/components/silke-navigation-link/silke-navigation-link.tsx +99 -21
- package/src/components/silke-popover/popover-context.spec.tsx +44 -0
- package/src/components/silke-popover-native/silke-popover-native.scss +5 -3
- package/src/components/silke-rich-text-field/blockquote.spec.ts +151 -0
- package/src/components/silke-rich-text-field/blockquote.ts +90 -0
- package/src/components/silke-rich-text-field/dropcap.spec.ts +67 -0
- package/src/components/silke-rich-text-field/dropcap.ts +59 -0
- package/src/components/silke-rich-text-field/floating-layer.tsx +15 -0
- package/src/components/silke-rich-text-field/font-size.ts +62 -0
- package/src/components/silke-rich-text-field/formatting-toolbar.tsx +145 -0
- package/src/components/silke-rich-text-field/index.ts +1 -0
- package/src/components/silke-rich-text-field/jsdom-rects.ts +15 -0
- package/src/components/silke-rich-text-field/link-menu.spec.tsx +502 -0
- package/src/components/silke-rich-text-field/link-menu.tsx +553 -0
- package/src/components/silke-rich-text-field/link-suggestions.spec.ts +203 -0
- package/src/components/silke-rich-text-field/link-suggestions.ts +188 -0
- package/src/components/silke-rich-text-field/link-tooltip.tsx +60 -0
- package/src/components/silke-rich-text-field/list-item.ts +64 -0
- package/src/components/silke-rich-text-field/list-link-fontsize.spec.ts +135 -0
- package/src/components/silke-rich-text-field/lorem-ipsum.spec.ts +131 -0
- package/src/components/silke-rich-text-field/lorem-ipsum.ts +51 -0
- package/src/components/silke-rich-text-field/paste.spec.ts +93 -0
- package/src/components/silke-rich-text-field/paste.ts +39 -0
- package/src/components/silke-rich-text-field/plugins.spec.ts +143 -0
- package/src/components/silke-rich-text-field/plugins.ts +230 -0
- package/src/components/silke-rich-text-field/silke-rich-text-field.mdx +180 -0
- package/src/components/silke-rich-text-field/silke-rich-text-field.scss +343 -0
- package/src/components/silke-rich-text-field/silke-rich-text-field.tsx +505 -0
- package/src/components/silke-rich-text-field/slash-menu-items.ts +112 -0
- package/src/components/silke-rich-text-field/slash-menu.tsx +50 -0
- package/src/components/silke-rich-text-field/table-content-sync.spec.tsx +61 -0
- package/src/components/silke-rich-text-field/table-toolbar.spec.tsx +168 -0
- package/src/components/silke-rich-text-field/table-toolbar.tsx +121 -0
- package/src/components/silke-rich-text-field/table.spec.ts +87 -0
- package/src/components/silke-rich-text-field/use-link-hover.ts +63 -0
- package/src/components/silke-rich-text-field/use-slash-menu.ts +130 -0
- package/src/components/silke-rich-text-field/utils.ts +55 -0
- package/src/components/silke-sortable-list/index.ts +1 -1
- package/src/components/silke-sortable-list/silke-nested-sortable-list.scss +11 -1
- package/src/components/silke-sortable-list/silke-nested-sortable-list.tsx +9 -0
- package/src/components/silke-sortable-list/silke-sortable-list.mdx +13 -0
- package/src/components/silke-tag/silke-tag.scss +12 -3
- package/src/components/silke-theme-card/silke-theme-card.module.scss +141 -45
- package/src/components/silke-theme-card/silke-theme-card.tsx +76 -47
- package/src/components/silke-theme-swatch/silke-theme-swatch.mdx +56 -0
- package/src/components/silke-theme-swatch/silke-theme-swatch.module.scss +53 -63
- package/src/components/silke-theme-swatch/silke-theme-swatch.tsx +99 -14
- package/src/icons.tsx +65 -4
- package/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
@use '../../variables' as *;
|
|
2
2
|
|
|
3
3
|
body {
|
|
4
|
-
--nav-item-color: var(--color-neutral-
|
|
5
|
-
--nav-item-color-hover: var(--color-neutral-
|
|
4
|
+
--nav-item-color: var(--color-neutral-90);
|
|
5
|
+
--nav-item-color-hover: var(--color-neutral-100);
|
|
6
6
|
--nav-item-color-pressed: var(--color);
|
|
7
7
|
--nav-item-background-pressed: var(--color);
|
|
8
8
|
}
|
|
@@ -28,40 +28,18 @@ body {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
&:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
&:not(.compactExpand) {
|
|
32
|
+
&:hover,
|
|
33
|
+
&.expanded,
|
|
34
|
+
&.menuOpen {
|
|
35
|
+
> .linkContainer > .link .rightButtons {
|
|
36
|
+
display: block;
|
|
37
|
+
opacity: 1;
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
|
|
39
|
-
&::before {
|
|
40
|
-
position: absolute;
|
|
41
|
-
content: '';
|
|
42
|
-
display: block;
|
|
43
|
-
height: 16px;
|
|
44
|
-
width: 4px;
|
|
45
|
-
border-radius: var(--border-radius-tiny);
|
|
46
|
-
|
|
47
|
-
margin: 8px 0 8px 0;
|
|
48
|
-
pointer-events: none;
|
|
49
|
-
transform: translateX(-20px);
|
|
50
|
-
opacity: 1;
|
|
51
|
-
transition: all 0.2s ease-out;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
42
|
&.active {
|
|
55
|
-
& > .linkContainer {
|
|
56
|
-
background: var(--color-surface-1);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&::before {
|
|
60
|
-
background: var(--color-accent-30);
|
|
61
|
-
transform: translateX(-8px);
|
|
62
|
-
opacity: 1;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
43
|
.linkContainer,
|
|
66
44
|
.link {
|
|
67
45
|
color: var(--color-neutral-100);
|
|
@@ -91,7 +69,6 @@ body {
|
|
|
91
69
|
padding: 0 $space-xs;
|
|
92
70
|
|
|
93
71
|
&:hover {
|
|
94
|
-
background: var(--color-surface-1);
|
|
95
72
|
color: var(--nav-item-color-hover);
|
|
96
73
|
.overflowMenu {
|
|
97
74
|
opacity: 1;
|
|
@@ -130,35 +107,178 @@ body {
|
|
|
130
107
|
.link {
|
|
131
108
|
color: var(--nav-item-color);
|
|
132
109
|
}
|
|
133
|
-
.main {
|
|
110
|
+
.main:not(.compactExpand) {
|
|
134
111
|
margin: 0;
|
|
135
112
|
.subLink {
|
|
136
113
|
.linkIcon {
|
|
137
114
|
margin-left: 30px;
|
|
138
115
|
}
|
|
139
116
|
}
|
|
140
|
-
&.active {
|
|
141
|
-
|
|
142
|
-
color: var(--color-neutral-100);
|
|
143
|
-
}
|
|
144
|
-
&::before {
|
|
145
|
-
opacity: 0;
|
|
146
|
-
}
|
|
117
|
+
&.active .link {
|
|
118
|
+
color: var(--color-neutral-100);
|
|
147
119
|
}
|
|
148
120
|
}
|
|
149
121
|
}
|
|
150
122
|
}
|
|
151
123
|
|
|
124
|
+
.linkIconDefault {
|
|
125
|
+
font-size: 14px;
|
|
126
|
+
opacity: 0.7;
|
|
127
|
+
|
|
128
|
+
.active > .linkContainer > .link & {
|
|
129
|
+
opacity: 1;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.linkIconCompact {
|
|
134
|
+
font-size: 12px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.labelText {
|
|
138
|
+
font-size: $font-base;
|
|
139
|
+
}
|
|
140
|
+
|
|
152
141
|
.label {
|
|
153
142
|
min-width: 0;
|
|
154
143
|
}
|
|
155
144
|
|
|
156
145
|
.rightButtons {
|
|
146
|
+
display: none;
|
|
157
147
|
opacity: 0;
|
|
158
|
-
transition: all 0.3s ease-out;
|
|
159
148
|
}
|
|
160
149
|
|
|
161
150
|
.dragIcon {
|
|
162
151
|
opacity: 0;
|
|
163
152
|
position: absolute;
|
|
153
|
+
font-size: 12px;
|
|
154
|
+
font-weight: 400;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.iconContent {
|
|
158
|
+
display: flex;
|
|
159
|
+
align-items: center;
|
|
160
|
+
justify-content: center;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.expandCaret {
|
|
164
|
+
position: absolute;
|
|
165
|
+
display: none;
|
|
166
|
+
align-items: center;
|
|
167
|
+
justify-content: center;
|
|
168
|
+
inset: 0;
|
|
169
|
+
cursor: pointer;
|
|
170
|
+
background: none;
|
|
171
|
+
border: none;
|
|
172
|
+
padding: 0;
|
|
173
|
+
color: var(--color-neutral-60);
|
|
174
|
+
font-size: 10px;
|
|
175
|
+
transition: transform 0.15s ease-out;
|
|
176
|
+
|
|
177
|
+
&.expanded {
|
|
178
|
+
transform: rotate(90deg);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.compactExpand {
|
|
183
|
+
.linkIcon {
|
|
184
|
+
position: relative;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Default team/folder label color
|
|
188
|
+
> .linkContainer > .link {
|
|
189
|
+
color: var(--color-neutral-90);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Folder/team icon opacity: 80% default, 100% on hover/active
|
|
193
|
+
.linkIcon {
|
|
194
|
+
opacity: 0.8;
|
|
195
|
+
|
|
196
|
+
// Size SVG icons rendered by SilkeShape (which have no intrinsic dimensions)
|
|
197
|
+
svg {
|
|
198
|
+
width: 1.125em;
|
|
199
|
+
height: 1.125em;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&.active > .linkContainer > .link .linkIcon,
|
|
204
|
+
> .linkContainer > .link:hover .linkIcon {
|
|
205
|
+
opacity: 1;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Gap between link and sub-items
|
|
209
|
+
.linkContainer {
|
|
210
|
+
gap: $space-xxs;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Hover color for team/folder links
|
|
214
|
+
> .linkContainer > .link:hover {
|
|
215
|
+
color: var(--color-neutral-100);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Active text color — background is owned by the parent container
|
|
219
|
+
// (e.g. SilkeNestedSortableList via .item.selected)
|
|
220
|
+
&.active > .linkContainer > .link {
|
|
221
|
+
color: var(--color-neutral-100);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Indentation via link padding so nested rows sit correctly when the
|
|
225
|
+
// component nests sub-items itself (standalone use)
|
|
226
|
+
.subLink {
|
|
227
|
+
padding: 0;
|
|
228
|
+
|
|
229
|
+
.main.active > .linkContainer > .link {
|
|
230
|
+
color: var(--color-neutral-100);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.link {
|
|
234
|
+
padding-left: 16px;
|
|
235
|
+
color: var(--color-neutral-90);
|
|
236
|
+
|
|
237
|
+
.linkIcon {
|
|
238
|
+
opacity: 0.8;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
&:hover {
|
|
242
|
+
color: var(--color-neutral-100);
|
|
243
|
+
|
|
244
|
+
.linkIcon {
|
|
245
|
+
opacity: 1;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.main.active > .linkContainer > .link .linkIcon {
|
|
251
|
+
opacity: 1;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.subLink .link {
|
|
255
|
+
padding-left: 32px;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.subLink .subLink .link {
|
|
259
|
+
padding-left: 48px;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Show rightButtons/expandCaret only on the directly hovered link
|
|
264
|
+
.link:hover {
|
|
265
|
+
> .rightButtons {
|
|
266
|
+
display: block;
|
|
267
|
+
opacity: 1;
|
|
268
|
+
}
|
|
269
|
+
.expandCaret {
|
|
270
|
+
display: flex;
|
|
271
|
+
}
|
|
272
|
+
// Only hide icon when there's a caret to replace it
|
|
273
|
+
.linkIcon:has(.expandCaret) .iconContent {
|
|
274
|
+
visibility: hidden;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Keep rightButtons visible when context menu is open
|
|
279
|
+
&.menuOpen > .linkContainer > .link .rightButtons {
|
|
280
|
+
display: block;
|
|
281
|
+
opacity: 1;
|
|
282
|
+
}
|
|
164
283
|
}
|
|
284
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IEmojiIcon } from '@vev/utils';
|
|
1
|
+
import { EmojiType, IEmojiIcon } from '@vev/utils';
|
|
2
2
|
import { isString } from 'lodash';
|
|
3
|
-
import React, { ReactNode,
|
|
3
|
+
import React, { ReactNode, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { SilkeButton } from '../silke-button';
|
|
5
5
|
import { BoxButtonProps, BoxLinkProps, SilkeBox } from '../silke-box';
|
|
6
6
|
import ButtonContext from '../silke-button/context';
|
|
@@ -26,6 +26,21 @@ type SilkeNavigationLinkProps = {
|
|
|
26
26
|
*/
|
|
27
27
|
rightButtons?: ReactNode;
|
|
28
28
|
expanded?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* When true, the expand caret replaces the icon on hover instead of
|
|
31
|
+
* showing a separate chevron button. No blue active indicator bar.
|
|
32
|
+
*/
|
|
33
|
+
compactExpand?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* When true, renders the expand caret on hover (compactExpand mode) even
|
|
36
|
+
* if `items` is empty. Use when child rows are rendered by a parent
|
|
37
|
+
* container (e.g. SilkeNestedSortableList) rather than by this component.
|
|
38
|
+
*/
|
|
39
|
+
hasChildren?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Called when the expand caret is clicked. Use for parent-controlled expand.
|
|
42
|
+
*/
|
|
43
|
+
onToggleExpand?: () => void;
|
|
29
44
|
} & (
|
|
30
45
|
| ({ link: string } & Omit<BoxLinkProps, 'to' | 'tag' | 'link'>)
|
|
31
46
|
| ({ link?: undefined } & Omit<BoxButtonProps, 'tag' | 'type'>)
|
|
@@ -46,18 +61,24 @@ export const SilkeNavigationLink = React.forwardRef(
|
|
|
46
61
|
color,
|
|
47
62
|
draggable,
|
|
48
63
|
expanded,
|
|
64
|
+
compactExpand,
|
|
49
65
|
items,
|
|
50
66
|
menu = [],
|
|
67
|
+
onToggleExpand,
|
|
68
|
+
hasChildren,
|
|
51
69
|
...rest
|
|
52
70
|
}: SilkeNavigationLinkProps,
|
|
53
71
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
54
72
|
) => {
|
|
55
|
-
const [expand, setExpand] = useState(
|
|
73
|
+
const [expand, setExpand] = useState(!!expanded || !!active);
|
|
74
|
+
const prevActiveRef = useRef(active);
|
|
75
|
+
const prevExpandedRef = useRef(expanded);
|
|
56
76
|
const [openMenu, setOpenMenu] = useState(false);
|
|
57
77
|
const menuRef = useRef<HTMLButtonElement>(null);
|
|
58
78
|
const cl = [styles.main];
|
|
59
79
|
const linkClass = [styles.link];
|
|
60
80
|
const hasItems = !!items?.length;
|
|
81
|
+
const showCaret = hasItems || !!hasChildren;
|
|
61
82
|
|
|
62
83
|
if (className) cl.push(className);
|
|
63
84
|
if (active) cl.push(styles.active);
|
|
@@ -65,14 +86,20 @@ export const SilkeNavigationLink = React.forwardRef(
|
|
|
65
86
|
if (color) linkClass.push(styles[color]);
|
|
66
87
|
if (linkClassName) linkClass.push(linkClassName);
|
|
67
88
|
if (expanded) cl.push(styles.expanded);
|
|
89
|
+
if (compactExpand) cl.push(styles.compactExpand);
|
|
90
|
+
if (openMenu) cl.push(styles.menuOpen);
|
|
68
91
|
|
|
69
92
|
const toggleExpand = useMemo(
|
|
70
93
|
() => (e: React.MouseEvent) => {
|
|
71
94
|
e.stopPropagation();
|
|
72
95
|
e.preventDefault();
|
|
73
|
-
|
|
96
|
+
if (onToggleExpand) {
|
|
97
|
+
onToggleExpand();
|
|
98
|
+
} else {
|
|
99
|
+
setExpand(!expand);
|
|
100
|
+
}
|
|
74
101
|
},
|
|
75
|
-
[expand],
|
|
102
|
+
[expand, onToggleExpand],
|
|
76
103
|
);
|
|
77
104
|
|
|
78
105
|
const toggleMenu = useMemo(
|
|
@@ -84,9 +111,17 @@ export const SilkeNavigationLink = React.forwardRef(
|
|
|
84
111
|
[openMenu],
|
|
85
112
|
);
|
|
86
113
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
114
|
+
// Synchronous expand/collapse when active/expanded change (avoids flash vs useEffect)
|
|
115
|
+
// Use strict === false so that undefined ("no opinion") preserves current state.
|
|
116
|
+
if ((active && !prevActiveRef.current) || (expanded && !prevExpandedRef.current)) {
|
|
117
|
+
setExpand(true);
|
|
118
|
+
} else if (compactExpand && prevActiveRef.current && !active && expanded === false) {
|
|
119
|
+
setExpand(false);
|
|
120
|
+
} else if (prevExpandedRef.current === true && expanded === false) {
|
|
121
|
+
setExpand(false);
|
|
122
|
+
}
|
|
123
|
+
prevActiveRef.current = active;
|
|
124
|
+
prevExpandedRef.current = expanded;
|
|
90
125
|
|
|
91
126
|
return (
|
|
92
127
|
<SilkeBox
|
|
@@ -102,6 +137,7 @@ export const SilkeNavigationLink = React.forwardRef(
|
|
|
102
137
|
? {
|
|
103
138
|
tag: 'link',
|
|
104
139
|
to: link,
|
|
140
|
+
draggable: false,
|
|
105
141
|
...(rest as Omit<BoxLinkProps, 'to' | 'tag' | 'link'>),
|
|
106
142
|
}
|
|
107
143
|
: {
|
|
@@ -120,7 +156,6 @@ export const SilkeNavigationLink = React.forwardRef(
|
|
|
120
156
|
<SilkeIcon
|
|
121
157
|
icon="drag.dots"
|
|
122
158
|
color="neutral-60"
|
|
123
|
-
style={{ fontSize: 12, fontWeight: 400 }}
|
|
124
159
|
/>
|
|
125
160
|
</SilkeBox>
|
|
126
161
|
)}
|
|
@@ -128,14 +163,28 @@ export const SilkeNavigationLink = React.forwardRef(
|
|
|
128
163
|
<SilkeBox
|
|
129
164
|
size="s"
|
|
130
165
|
align="center"
|
|
131
|
-
pad=
|
|
132
|
-
className={
|
|
133
|
-
|
|
166
|
+
pad={compactExpand && React.isValidElement(icon) ? undefined : 'xs'}
|
|
167
|
+
className={[
|
|
168
|
+
styles.linkIcon,
|
|
169
|
+
compactExpand ? styles.linkIconCompact : styles.linkIconDefault,
|
|
170
|
+
].join(' ')}
|
|
134
171
|
>
|
|
135
|
-
{
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
172
|
+
<span className={compactExpand ? styles.iconContent : undefined}>
|
|
173
|
+
{React.isValidElement(icon) || isString(icon) || compactExpand ? (
|
|
174
|
+
<SilkeIcon icon={icon || 'error'} />
|
|
175
|
+
) : (
|
|
176
|
+
<SilkeImage icon={icon as any} avatar="s" />
|
|
177
|
+
)}
|
|
178
|
+
</span>
|
|
179
|
+
{compactExpand && showCaret && (
|
|
180
|
+
<button
|
|
181
|
+
className={[styles.expandCaret, expand ? styles.expanded : ''].join(' ')}
|
|
182
|
+
onMouseDown={(e) => e.stopPropagation()}
|
|
183
|
+
onClick={toggleExpand}
|
|
184
|
+
type="button"
|
|
185
|
+
>
|
|
186
|
+
<SilkeIcon icon="caret.right" />
|
|
187
|
+
</button>
|
|
139
188
|
)}
|
|
140
189
|
</SilkeBox>
|
|
141
190
|
) : (
|
|
@@ -146,7 +195,7 @@ export const SilkeNavigationLink = React.forwardRef(
|
|
|
146
195
|
<SilkeText
|
|
147
196
|
flex
|
|
148
197
|
overflow
|
|
149
|
-
|
|
198
|
+
className={styles.labelText}
|
|
150
199
|
>
|
|
151
200
|
{label || 'just a link'}
|
|
152
201
|
</SilkeText>
|
|
@@ -156,7 +205,36 @@ export const SilkeNavigationLink = React.forwardRef(
|
|
|
156
205
|
</SilkeText>
|
|
157
206
|
)}
|
|
158
207
|
</SilkeBox>
|
|
159
|
-
{
|
|
208
|
+
{/* compactExpand: group rightButtons + overflow in one container */}
|
|
209
|
+
{compactExpand && (rightButtons || !!menu.length) && (
|
|
210
|
+
<ButtonContext size="s" kind="ghost">
|
|
211
|
+
<div
|
|
212
|
+
className={styles.rightButtons}
|
|
213
|
+
onClick={(e: React.MouseEvent) => e.stopPropagation()}
|
|
214
|
+
>
|
|
215
|
+
<SilkeBox vAlign="center" gap="xs">
|
|
216
|
+
{rightButtons}
|
|
217
|
+
{!!menu.length && (
|
|
218
|
+
<SilkeButton
|
|
219
|
+
onMouseDown={toggleMenu}
|
|
220
|
+
onClick={(e) => {
|
|
221
|
+
e.stopPropagation();
|
|
222
|
+
e.preventDefault();
|
|
223
|
+
}}
|
|
224
|
+
ref={menuRef}
|
|
225
|
+
icon="menuMore"
|
|
226
|
+
kind="ghost"
|
|
227
|
+
size="s"
|
|
228
|
+
selected={openMenu}
|
|
229
|
+
/>
|
|
230
|
+
)}
|
|
231
|
+
</SilkeBox>
|
|
232
|
+
</div>
|
|
233
|
+
</ButtonContext>
|
|
234
|
+
)}
|
|
235
|
+
|
|
236
|
+
{/* Non-compactExpand: existing separate containers */}
|
|
237
|
+
{!compactExpand && (children || rightButtons) ? (
|
|
160
238
|
<ButtonContext size="s" kind="ghost">
|
|
161
239
|
<SilkeBox className={styles.rightContent} vAlign="center" height="s">
|
|
162
240
|
{children}
|
|
@@ -172,7 +250,7 @@ export const SilkeNavigationLink = React.forwardRef(
|
|
|
172
250
|
</ButtonContext>
|
|
173
251
|
) : null}
|
|
174
252
|
|
|
175
|
-
{(hasItems || !!menu.length) && (
|
|
253
|
+
{!compactExpand && (hasItems || !!menu.length) && (
|
|
176
254
|
<SilkeBox gap="xxs" hPad="xs">
|
|
177
255
|
{!!menu.length && (
|
|
178
256
|
<SilkeButton
|
|
@@ -186,6 +264,7 @@ export const SilkeNavigationLink = React.forwardRef(
|
|
|
186
264
|
icon="menuMore"
|
|
187
265
|
kind="ghost"
|
|
188
266
|
size="s"
|
|
267
|
+
selected={openMenu}
|
|
189
268
|
/>
|
|
190
269
|
)}
|
|
191
270
|
{hasItems && (
|
|
@@ -205,7 +284,6 @@ export const SilkeNavigationLink = React.forwardRef(
|
|
|
205
284
|
{openMenu && (
|
|
206
285
|
<SilkeContextMenu
|
|
207
286
|
anchor={menuRef}
|
|
208
|
-
width={82}
|
|
209
287
|
anchorOrigin="bottom-right"
|
|
210
288
|
targetOrigin="top-right"
|
|
211
289
|
offsetY={1}
|
|
@@ -217,7 +295,7 @@ export const SilkeNavigationLink = React.forwardRef(
|
|
|
217
295
|
</SilkeBox>
|
|
218
296
|
|
|
219
297
|
{hasItems && expand && (
|
|
220
|
-
<SilkeBox column gap=
|
|
298
|
+
<SilkeBox column gap={compactExpand ? 'xxs' : 'xs'} pad={compactExpand ? undefined : 'xs'} className={styles.subLink}>
|
|
221
299
|
{items?.map((item) => {
|
|
222
300
|
if (React.isValidElement(item)) {
|
|
223
301
|
return item;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import SilkePopoverProvider from './popover-context';
|
|
4
|
+
import { SilkePopover } from './silke-popover';
|
|
5
|
+
|
|
6
|
+
describe('SilkePopover contextId', () => {
|
|
7
|
+
it('asks an open popover to close when another one claims the same context id', () => {
|
|
8
|
+
const closeFirst = jest.fn();
|
|
9
|
+
const closeSecond = jest.fn();
|
|
10
|
+
|
|
11
|
+
render(
|
|
12
|
+
<SilkePopoverProvider>
|
|
13
|
+
<SilkePopover contextId="inspect" onRequestClose={closeFirst}>
|
|
14
|
+
<div>first</div>
|
|
15
|
+
</SilkePopover>
|
|
16
|
+
<SilkePopover contextId="inspect" onRequestClose={closeSecond}>
|
|
17
|
+
<div>second</div>
|
|
18
|
+
</SilkePopover>
|
|
19
|
+
</SilkePopoverProvider>,
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
expect(closeFirst).toHaveBeenCalledTimes(1);
|
|
23
|
+
expect(closeSecond).not.toHaveBeenCalled();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('leaves popovers with different context ids alone', () => {
|
|
27
|
+
const closeFirst = jest.fn();
|
|
28
|
+
const closeSecond = jest.fn();
|
|
29
|
+
|
|
30
|
+
render(
|
|
31
|
+
<SilkePopoverProvider>
|
|
32
|
+
<SilkePopover contextId="inspect" onRequestClose={closeFirst}>
|
|
33
|
+
<div>first</div>
|
|
34
|
+
</SilkePopover>
|
|
35
|
+
<SilkePopover contextId="color-picker" onRequestClose={closeSecond}>
|
|
36
|
+
<div>second</div>
|
|
37
|
+
</SilkePopover>
|
|
38
|
+
</SilkePopoverProvider>,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
expect(closeFirst).not.toHaveBeenCalled();
|
|
42
|
+
expect(closeSecond).not.toHaveBeenCalled();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -11,9 +11,11 @@
|
|
|
11
11
|
background: transparent;
|
|
12
12
|
color: inherit;
|
|
13
13
|
|
|
14
|
-
/* Reset positioning properties - will be set by position-area when anchored
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/* Reset positioning properties - will be set by position-area when anchored.
|
|
15
|
+
Reset the full inset (not just top/left): the UA [popover] style sets
|
|
16
|
+
inset: 0, and Chrome 149 no longer lets position-area override a stale
|
|
17
|
+
right/bottom, so leftover insets pin the popover to the bottom-right. */
|
|
18
|
+
inset: auto;
|
|
17
19
|
transform: none;
|
|
18
20
|
|
|
19
21
|
/* Center popover when no anchor is provided */
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
import { buildExtensions } from './plugins';
|
|
3
|
+
import { SLASH_MENU_ITEMS } from './slash-menu-items';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Regression tests for the "quote uses the H3 font" report.
|
|
7
|
+
*
|
|
8
|
+
* `setBlockquote` is `wrapIn` and blockquote's content spec is `block+`, so the
|
|
9
|
+
* Quote menu item wrapped the current block instead of converting it, and wrapped
|
|
10
|
+
* again on every use. The reported element was saved as:
|
|
11
|
+
*
|
|
12
|
+
* <blockquote><blockquote><h3>…</h3></blockquote></blockquote>
|
|
13
|
+
* <blockquote><h5><strong>…</strong></h5></blockquote>
|
|
14
|
+
*
|
|
15
|
+
* The inner heading keeps the theme's heading typography, and anything nested in
|
|
16
|
+
* the quote inherits the quote's font-family, which is how the attribution line
|
|
17
|
+
* came out serif.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const createEditor = (content: string) =>
|
|
21
|
+
new Editor({ extensions: buildExtensions({ current: '' }), content });
|
|
22
|
+
|
|
23
|
+
const runMenuItem = (editor: Editor, label: string) =>
|
|
24
|
+
SLASH_MENU_ITEMS.find((i) => i.label === label)!.command(editor);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Input rules run off ProseMirror's `handleTextInput`, which `insertContent` does
|
|
28
|
+
* not go through — typing has to be simulated at the view level.
|
|
29
|
+
*/
|
|
30
|
+
const typeChar = (editor: Editor, char: string) => {
|
|
31
|
+
const { from, to } = editor.state.selection;
|
|
32
|
+
const insert = () => editor.state.tr.insertText(char, from, to);
|
|
33
|
+
// handleTextInput runs *before* the character lands; when no rule claims it,
|
|
34
|
+
// ProseMirror falls through to inserting it normally. prosemirror-inputrules
|
|
35
|
+
// ignores the `deflt` thunk, so do that fall-through here.
|
|
36
|
+
const handled = editor.view.someProp('handleTextInput', (handler) =>
|
|
37
|
+
handler(editor.view, from, to, char, insert),
|
|
38
|
+
);
|
|
39
|
+
if (!handled) editor.view.dispatch(insert());
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
describe('blockquote', () => {
|
|
43
|
+
describe('parse normalization', () => {
|
|
44
|
+
it('collapses a redundantly nested blockquote', () => {
|
|
45
|
+
const editor = createEditor('<blockquote><blockquote><p>quote</p></blockquote></blockquote>');
|
|
46
|
+
const html = editor.getHTML();
|
|
47
|
+
|
|
48
|
+
expect(html).toBe('<blockquote><p>quote</p></blockquote>');
|
|
49
|
+
editor.destroy();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('collapses the reported markup down to a single quote level', () => {
|
|
53
|
+
const editor = createEditor(
|
|
54
|
+
'<blockquote><blockquote><h3>– Det skal ikke mye til</h3></blockquote></blockquote>',
|
|
55
|
+
);
|
|
56
|
+
const html = editor.getHTML();
|
|
57
|
+
|
|
58
|
+
expect(html.match(/<blockquote>/g)).toHaveLength(1);
|
|
59
|
+
editor.destroy();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('keeps a genuine quote-within-a-quote that has sibling content', () => {
|
|
63
|
+
const editor = createEditor(
|
|
64
|
+
'<blockquote><p>outer</p><blockquote><p>inner</p></blockquote></blockquote>',
|
|
65
|
+
);
|
|
66
|
+
const html = editor.getHTML();
|
|
67
|
+
|
|
68
|
+
expect(html.match(/<blockquote>/g)).toHaveLength(2);
|
|
69
|
+
expect(html).toContain('outer');
|
|
70
|
+
expect(html).toContain('inner');
|
|
71
|
+
editor.destroy();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('leaves a heading inside a quote alone (only the command demotes)', () => {
|
|
75
|
+
// Deliberate `<blockquote><h2>` pull quotes are reachable today by picking
|
|
76
|
+
// Quote and then H2, so parsing must not silently rewrite saved content.
|
|
77
|
+
const editor = createEditor('<blockquote><h2>big quote</h2></blockquote>');
|
|
78
|
+
|
|
79
|
+
expect(editor.getHTML()).toBe('<blockquote><h2>big quote</h2></blockquote>');
|
|
80
|
+
editor.destroy();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('Quote menu item', () => {
|
|
85
|
+
it('converts a heading instead of wrapping it', () => {
|
|
86
|
+
const editor = createEditor('<h3>– Det skal ikke mye til</h3>');
|
|
87
|
+
runMenuItem(editor, 'Quote');
|
|
88
|
+
|
|
89
|
+
const html = editor.getHTML();
|
|
90
|
+
expect(html).toContain('<blockquote>');
|
|
91
|
+
expect(html).not.toMatch(/<h[1-6][ >]/);
|
|
92
|
+
expect(html).toContain('– Det skal ikke mye til');
|
|
93
|
+
editor.destroy();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('does not stack quotes when applied twice', () => {
|
|
97
|
+
const editor = createEditor('<p>quote</p>');
|
|
98
|
+
runMenuItem(editor, 'Quote');
|
|
99
|
+
expect(editor.getHTML().match(/<blockquote>/g)).toHaveLength(1);
|
|
100
|
+
|
|
101
|
+
// Second use toggles back out rather than adding another wrapper.
|
|
102
|
+
runMenuItem(editor, 'Quote');
|
|
103
|
+
expect(editor.getHTML()).not.toContain('<blockquote>');
|
|
104
|
+
editor.destroy();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('setBlockquote is idempotent', () => {
|
|
108
|
+
const editor = createEditor('<p>quote</p>');
|
|
109
|
+
editor.chain().focus().setBlockquote().run();
|
|
110
|
+
editor.chain().focus().setBlockquote().run();
|
|
111
|
+
editor.chain().focus().setBlockquote().run();
|
|
112
|
+
|
|
113
|
+
expect(editor.getHTML().match(/<blockquote>/g)).toHaveLength(1);
|
|
114
|
+
editor.destroy();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('gives a way back out of a quote', () => {
|
|
118
|
+
const editor = createEditor('<blockquote><p>quote</p></blockquote>');
|
|
119
|
+
runMenuItem(editor, 'Quote');
|
|
120
|
+
|
|
121
|
+
expect(editor.getHTML()).not.toContain('<blockquote>');
|
|
122
|
+
expect(editor.getHTML()).toContain('quote');
|
|
123
|
+
editor.destroy();
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
describe('"> " input rule', () => {
|
|
128
|
+
it('demotes a heading rather than wrapping it', () => {
|
|
129
|
+
const editor = createEditor('<h3>heading</h3>');
|
|
130
|
+
editor.commands.setTextSelection(1);
|
|
131
|
+
typeChar(editor, '>');
|
|
132
|
+
typeChar(editor, ' ');
|
|
133
|
+
|
|
134
|
+
const html = editor.getHTML();
|
|
135
|
+
expect(html).toContain('<blockquote>');
|
|
136
|
+
expect(html).not.toMatch(/<h[1-6][ >]/);
|
|
137
|
+
expect(html).toContain('heading');
|
|
138
|
+
editor.destroy();
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('still quotes a paragraph', () => {
|
|
142
|
+
const editor = createEditor('<p>text</p>');
|
|
143
|
+
editor.commands.setTextSelection(1);
|
|
144
|
+
typeChar(editor, '>');
|
|
145
|
+
typeChar(editor, ' ');
|
|
146
|
+
|
|
147
|
+
expect(editor.getHTML()).toBe('<blockquote><p>text</p></blockquote>');
|
|
148
|
+
editor.destroy();
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
});
|