@contentful/field-editor-markdown 2.4.4-canary.26 → 2.4.4-canary.30
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/dist/cjs/MarkdownEditor.js +15 -15
- package/dist/cjs/__fixtures__/asset/index.js +6 -6
- package/dist/cjs/__fixtures__/entry/index.js +5 -5
- package/dist/cjs/__fixtures__/fixtures.js +6 -6
- package/dist/cjs/__fixtures__/locale/index.js +4 -4
- package/dist/cjs/components/HeadingSelector.js +5 -5
- package/dist/cjs/components/InsertLinkSelector.js +9 -9
- package/dist/cjs/components/MarkdownBottomBar.js +14 -14
- package/dist/cjs/components/MarkdownConstraints.js +3 -3
- package/dist/cjs/components/MarkdownPreview.js +6 -6
- package/dist/cjs/components/MarkdownPreviewSkeleton.js +2 -2
- package/dist/cjs/components/MarkdownTabs.js +4 -4
- package/dist/cjs/components/MarkdownTextarea/MarkdownTextarea.js +2 -2
- package/dist/cjs/components/MarkdownToolbar.js +62 -62
- package/dist/cjs/components/MarkdownToolbar.spec.js +4 -4
- package/dist/cjs/dialogs/CheatsheetModalDialog.js +48 -48
- package/dist/cjs/dialogs/ConfirmInsertAssetModalDialog.js +8 -8
- package/dist/cjs/dialogs/EmdebExternalContentDialog.js +21 -21
- package/dist/cjs/dialogs/InsertLinkModalDialog.js +13 -13
- package/dist/cjs/dialogs/InsertTableModalDialog.js +10 -10
- package/dist/cjs/dialogs/SpecialCharacterModalDialog.js +13 -13
- package/dist/cjs/dialogs/ZenModeModalDialog.js +20 -20
- package/dist/cjs/dialogs/openMarkdownDialog.js +7 -7
- package/dist/cjs/dialogs/renderMarkdownDialog.js +8 -8
- package/dist/cjs/index.js +5 -5
- package/dist/cjs/types.js +3 -3
- package/dist/cjs/utils/insertAssetLinks.js +3 -3
- package/dist/cjs/utils/isValidUrl.js +3 -3
- package/dist/cjs/utils/linkOrganizer.js +7 -7
- package/dist/esm/MarkdownEditor.js +12 -12
- package/dist/esm/components/HeadingSelector.js +5 -5
- package/dist/esm/components/InsertLinkSelector.js +9 -9
- package/dist/esm/components/MarkdownBottomBar.js +10 -10
- package/dist/esm/components/MarkdownConstraints.js +3 -3
- package/dist/esm/components/MarkdownPreview.js +6 -6
- package/dist/esm/components/MarkdownPreviewSkeleton.js +2 -2
- package/dist/esm/components/MarkdownTabs.js +4 -4
- package/dist/esm/components/MarkdownTextarea/MarkdownTextarea.js +2 -2
- package/dist/esm/components/MarkdownToolbar.js +58 -58
- package/dist/esm/components/MarkdownToolbar.spec.js +4 -4
- package/dist/esm/dialogs/CheatsheetModalDialog.js +45 -45
- package/dist/esm/dialogs/ConfirmInsertAssetModalDialog.js +5 -5
- package/dist/esm/dialogs/EmdebExternalContentDialog.js +18 -18
- package/dist/esm/dialogs/InsertLinkModalDialog.js +10 -10
- package/dist/esm/dialogs/InsertTableModalDialog.js +7 -7
- package/dist/esm/dialogs/SpecialCharacterModalDialog.js +10 -10
- package/dist/esm/dialogs/ZenModeModalDialog.js +17 -17
- package/dist/esm/dialogs/openMarkdownDialog.js +7 -7
- package/dist/esm/dialogs/renderMarkdownDialog.js +8 -8
- package/dist/esm/types.js +3 -3
- package/package.json +5 -5
|
@@ -39,7 +39,7 @@ const styles = {
|
|
|
39
39
|
pointerEvents: 'none'
|
|
40
40
|
})
|
|
41
41
|
};
|
|
42
|
-
const ToolbarButton =
|
|
42
|
+
const ToolbarButton = React.forwardRef((props, ref)=>{
|
|
43
43
|
const { tooltip, onClick, children, className, variant = 'transparent', tooltipPlace = 'top', isDisabled = false, ...otherProps } = props;
|
|
44
44
|
const pointerTriggeredRef = React.useRef(false);
|
|
45
45
|
const handlePointerDown = React.useCallback((event)=>{
|
|
@@ -62,7 +62,7 @@ const ToolbarButton = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
|
62
62
|
}, [
|
|
63
63
|
onClick
|
|
64
64
|
]);
|
|
65
|
-
return
|
|
65
|
+
return React.createElement(IconButton, {
|
|
66
66
|
...otherProps,
|
|
67
67
|
ref: ref,
|
|
68
68
|
className: cx(styles.button, className),
|
|
@@ -85,178 +85,178 @@ const ToolbarButton = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
|
85
85
|
ToolbarButton.displayName = 'ToolbarButton';
|
|
86
86
|
function MainButtons(props) {
|
|
87
87
|
const tooltipPlace = props.mode === 'zen' ? 'bottom' : 'top';
|
|
88
|
-
return
|
|
88
|
+
return React.createElement(React.Fragment, null, React.createElement(HeadingSelector, {
|
|
89
89
|
onSelect: (heading)=>{
|
|
90
90
|
if (heading && props.actions.headings[heading]) {
|
|
91
91
|
props.actions.headings[heading]();
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
|
-
renderTrigger: ({ isOpen, onClick })
|
|
94
|
+
renderTrigger: ({ isOpen, onClick })=>React.createElement(ToolbarButton, {
|
|
95
95
|
isDisabled: props.disabled,
|
|
96
96
|
testId: "markdown-action-button-heading",
|
|
97
97
|
tooltip: "Headings",
|
|
98
98
|
tooltipPlace: tooltipPlace,
|
|
99
99
|
onClick: onClick,
|
|
100
100
|
"aria-expanded": isOpen
|
|
101
|
-
},
|
|
101
|
+
}, React.createElement(TextHIcon, {
|
|
102
102
|
"aria-label": "Headings",
|
|
103
103
|
className: styles.icon
|
|
104
104
|
}))
|
|
105
|
-
}),
|
|
105
|
+
}), React.createElement(ToolbarButton, {
|
|
106
106
|
isDisabled: props.disabled,
|
|
107
107
|
testId: "markdown-action-button-bold",
|
|
108
108
|
tooltip: "Bold",
|
|
109
109
|
tooltipPlace: tooltipPlace,
|
|
110
110
|
onClick: props.actions.simple.bold
|
|
111
|
-
},
|
|
111
|
+
}, React.createElement(TextBIcon, {
|
|
112
112
|
"aria-label": "Bold",
|
|
113
113
|
className: styles.icon
|
|
114
|
-
})),
|
|
114
|
+
})), React.createElement(ToolbarButton, {
|
|
115
115
|
isDisabled: props.disabled,
|
|
116
116
|
testId: "markdown-action-button-italic",
|
|
117
117
|
tooltip: "Italic",
|
|
118
118
|
tooltipPlace: tooltipPlace,
|
|
119
119
|
onClick: props.actions.simple.italic
|
|
120
|
-
},
|
|
120
|
+
}, React.createElement(TextItalicIcon, {
|
|
121
121
|
"aria-label": "Italic",
|
|
122
122
|
className: styles.icon
|
|
123
|
-
})),
|
|
123
|
+
})), React.createElement(ToolbarButton, {
|
|
124
124
|
isDisabled: props.disabled,
|
|
125
125
|
testId: "markdown-action-button-quote",
|
|
126
126
|
tooltip: "Quote",
|
|
127
127
|
tooltipPlace: tooltipPlace,
|
|
128
128
|
onClick: props.actions.simple.quote
|
|
129
|
-
},
|
|
129
|
+
}, React.createElement(QuotesIcon, {
|
|
130
130
|
"aria-label": "Quote",
|
|
131
131
|
className: styles.icon
|
|
132
|
-
})),
|
|
132
|
+
})), React.createElement(ToolbarButton, {
|
|
133
133
|
isDisabled: props.disabled,
|
|
134
134
|
testId: "markdown-action-button-ul",
|
|
135
135
|
tooltip: "Unordered list",
|
|
136
136
|
tooltipPlace: tooltipPlace,
|
|
137
137
|
onClick: props.actions.simple.ul
|
|
138
|
-
},
|
|
138
|
+
}, React.createElement(ListBulletsIcon, {
|
|
139
139
|
"aria-label": "Unordered list",
|
|
140
140
|
className: styles.icon
|
|
141
|
-
})),
|
|
141
|
+
})), React.createElement(ToolbarButton, {
|
|
142
142
|
isDisabled: props.disabled,
|
|
143
143
|
testId: "markdown-action-button-ol",
|
|
144
144
|
tooltip: "Ordered list",
|
|
145
145
|
tooltipPlace: tooltipPlace,
|
|
146
146
|
onClick: props.actions.simple.ol
|
|
147
|
-
},
|
|
147
|
+
}, React.createElement(ListNumbersIcon, {
|
|
148
148
|
"aria-label": "Ordered list",
|
|
149
149
|
className: styles.icon
|
|
150
|
-
})),
|
|
150
|
+
})), React.createElement(ToolbarButton, {
|
|
151
151
|
isDisabled: props.disabled,
|
|
152
152
|
testId: "markdown-action-button-link",
|
|
153
153
|
tooltip: "Link",
|
|
154
154
|
tooltipPlace: tooltipPlace,
|
|
155
155
|
onClick: props.actions.insertLink
|
|
156
|
-
},
|
|
156
|
+
}, React.createElement(LinkSimpleIcon, {
|
|
157
157
|
"aria-label": "Link",
|
|
158
158
|
className: styles.icon
|
|
159
159
|
})));
|
|
160
160
|
}
|
|
161
161
|
function AdditionalButtons(props) {
|
|
162
162
|
const tooltipPlace = props.mode === 'zen' ? 'bottom' : 'top';
|
|
163
|
-
return
|
|
163
|
+
return React.createElement(React.Fragment, null, React.createElement(ToolbarButton, {
|
|
164
164
|
isDisabled: props.disabled,
|
|
165
165
|
testId: "markdown-action-button-strike",
|
|
166
166
|
tooltip: "Strike out",
|
|
167
167
|
tooltipPlace: tooltipPlace,
|
|
168
168
|
onClick: props.actions.simple.strike
|
|
169
|
-
},
|
|
169
|
+
}, React.createElement(TextStrikethroughIcon, {
|
|
170
170
|
"aria-label": "Strike out",
|
|
171
171
|
className: styles.icon
|
|
172
|
-
})),
|
|
172
|
+
})), React.createElement(ToolbarButton, {
|
|
173
173
|
isDisabled: props.disabled,
|
|
174
174
|
testId: "markdown-action-button-code",
|
|
175
175
|
tooltip: "Code block",
|
|
176
176
|
tooltipPlace: tooltipPlace,
|
|
177
177
|
onClick: props.actions.simple.code
|
|
178
|
-
},
|
|
178
|
+
}, React.createElement(CodeSimpleIcon, {
|
|
179
179
|
"aria-label": "Code block",
|
|
180
180
|
className: styles.icon
|
|
181
|
-
})),
|
|
181
|
+
})), React.createElement(ToolbarButton, {
|
|
182
182
|
isDisabled: props.disabled,
|
|
183
183
|
testId: "markdown-action-button-hr",
|
|
184
184
|
tooltip: "Horizontal rule",
|
|
185
185
|
tooltipPlace: tooltipPlace,
|
|
186
186
|
onClick: props.actions.simple.hr
|
|
187
|
-
},
|
|
187
|
+
}, React.createElement(MinusIcon, {
|
|
188
188
|
"aria-label": "Horizontal rule",
|
|
189
189
|
className: styles.icon
|
|
190
|
-
})),
|
|
190
|
+
})), React.createElement(ToolbarButton, {
|
|
191
191
|
isDisabled: props.disabled,
|
|
192
192
|
testId: "markdown-action-button-indent",
|
|
193
193
|
tooltip: "Increase indentation",
|
|
194
194
|
tooltipPlace: tooltipPlace,
|
|
195
195
|
onClick: props.actions.simple.indent
|
|
196
|
-
},
|
|
196
|
+
}, React.createElement(TextIndentIcon, {
|
|
197
197
|
"aria-label": "Increase indentation",
|
|
198
198
|
className: styles.icon
|
|
199
|
-
})),
|
|
199
|
+
})), React.createElement(ToolbarButton, {
|
|
200
200
|
isDisabled: props.disabled,
|
|
201
201
|
testId: "markdown-action-button-dedent",
|
|
202
202
|
tooltip: "Decrease indentation",
|
|
203
203
|
tooltipPlace: tooltipPlace,
|
|
204
204
|
onClick: props.actions.simple.dedent
|
|
205
|
-
},
|
|
205
|
+
}, React.createElement(TextOutdentIcon, {
|
|
206
206
|
"aria-label": "Decrease indentation",
|
|
207
207
|
className: styles.icon
|
|
208
|
-
})),
|
|
208
|
+
})), React.createElement(ToolbarButton, {
|
|
209
209
|
isDisabled: props.disabled,
|
|
210
210
|
testId: "markdown-action-button-embed",
|
|
211
211
|
tooltip: "Embed external content",
|
|
212
212
|
tooltipPlace: tooltipPlace,
|
|
213
213
|
onClick: props.actions.embedExternalContent
|
|
214
|
-
},
|
|
214
|
+
}, React.createElement(CubesThreeIcon, {
|
|
215
215
|
"aria-label": "Embed external content",
|
|
216
216
|
className: styles.icon
|
|
217
|
-
})),
|
|
217
|
+
})), React.createElement(ToolbarButton, {
|
|
218
218
|
isDisabled: props.disabled,
|
|
219
219
|
testId: "markdown-action-button-table",
|
|
220
220
|
tooltip: "Insert table",
|
|
221
221
|
tooltipPlace: tooltipPlace,
|
|
222
222
|
onClick: props.actions.insertTable
|
|
223
|
-
},
|
|
223
|
+
}, React.createElement(TableIcon, {
|
|
224
224
|
"aria-label": "Insert table",
|
|
225
225
|
className: styles.icon
|
|
226
|
-
})),
|
|
226
|
+
})), React.createElement(ToolbarButton, {
|
|
227
227
|
isDisabled: props.disabled,
|
|
228
228
|
testId: "markdown-action-button-special",
|
|
229
229
|
tooltip: "Insert special character",
|
|
230
230
|
tooltipPlace: tooltipPlace,
|
|
231
231
|
onClick: props.actions.insertSpecialCharacter
|
|
232
|
-
},
|
|
232
|
+
}, React.createElement(CurrencyEurIcon, {
|
|
233
233
|
"aria-label": "Insert special character",
|
|
234
234
|
className: styles.icon
|
|
235
|
-
})),
|
|
235
|
+
})), React.createElement(ToolbarButton, {
|
|
236
236
|
isDisabled: props.disabled,
|
|
237
237
|
testId: "markdown-action-button-organizeLinks",
|
|
238
238
|
tooltip: "Organize links",
|
|
239
239
|
tooltipPlace: tooltipPlace,
|
|
240
240
|
onClick: props.actions.organizeLinks
|
|
241
|
-
},
|
|
241
|
+
}, React.createElement(TreeStructureIcon, {
|
|
242
242
|
"aria-label": "Organize links",
|
|
243
243
|
className: styles.icon
|
|
244
|
-
})),
|
|
244
|
+
})), React.createElement(ToolbarButton, {
|
|
245
245
|
isDisabled: props.disabled,
|
|
246
246
|
testId: "markdown-action-button-undo",
|
|
247
247
|
tooltip: "Undo",
|
|
248
248
|
tooltipPlace: tooltipPlace,
|
|
249
249
|
onClick: props.actions.history.undo
|
|
250
|
-
},
|
|
250
|
+
}, React.createElement(ArrowUUpLeftIcon, {
|
|
251
251
|
"aria-label": "Undo",
|
|
252
252
|
className: styles.icon
|
|
253
|
-
})),
|
|
253
|
+
})), React.createElement(ToolbarButton, {
|
|
254
254
|
isDisabled: props.disabled,
|
|
255
255
|
testId: "markdown-action-button-redo",
|
|
256
256
|
tooltip: "Redo",
|
|
257
257
|
tooltipPlace: tooltipPlace,
|
|
258
258
|
onClick: props.actions.history.redo
|
|
259
|
-
},
|
|
259
|
+
}, React.createElement(ArrowUUpRightIcon, {
|
|
260
260
|
"aria-label": "Redo",
|
|
261
261
|
className: styles.icon
|
|
262
262
|
})));
|
|
@@ -266,55 +266,55 @@ export function DefaultMarkdownToolbar(props) {
|
|
|
266
266
|
const toggleAdditionalActions = React.useCallback(()=>{
|
|
267
267
|
setShowAdditional((current)=>!current);
|
|
268
268
|
}, []);
|
|
269
|
-
return
|
|
269
|
+
return React.createElement("div", {
|
|
270
270
|
className: styles.root
|
|
271
|
-
},
|
|
271
|
+
}, React.createElement(Flex, {
|
|
272
272
|
justifyContent: "space-between",
|
|
273
273
|
flexWrap: "wrap"
|
|
274
|
-
},
|
|
274
|
+
}, React.createElement(Flex, {
|
|
275
275
|
flexWrap: "wrap"
|
|
276
|
-
},
|
|
276
|
+
}, React.createElement(MainButtons, props), React.createElement(ToolbarButton, {
|
|
277
277
|
isDisabled: props.disabled,
|
|
278
278
|
testId: "markdown-action-button-toggle-additional",
|
|
279
279
|
tooltip: showAdditional ? 'Hide additional actions' : 'More actions',
|
|
280
280
|
"aria-expanded": showAdditional,
|
|
281
281
|
onClick: toggleAdditionalActions
|
|
282
|
-
},
|
|
282
|
+
}, React.createElement(DotsThreeIcon, {
|
|
283
283
|
className: styles.icon
|
|
284
|
-
}))),
|
|
284
|
+
}))), React.createElement(Flex, null, React.createElement(InsertLinkSelector, {
|
|
285
285
|
disabled: props.disabled,
|
|
286
286
|
onSelectExisting: props.actions.linkExistingMedia,
|
|
287
287
|
onAddNew: props.actions.addNewMedia,
|
|
288
288
|
canAddNew: props.canUploadAssets
|
|
289
|
-
}),
|
|
289
|
+
}), React.createElement(ToolbarButton, {
|
|
290
290
|
isDisabled: props.disabled,
|
|
291
291
|
testId: "markdown-action-button-zen",
|
|
292
292
|
variant: "secondary",
|
|
293
293
|
onClick: props.actions.openZenMode,
|
|
294
294
|
className: styles.zenButton,
|
|
295
295
|
tooltip: "Expand"
|
|
296
|
-
},
|
|
296
|
+
}, React.createElement(ArrowsOutIcon, {
|
|
297
297
|
"aria-label": "Expand",
|
|
298
298
|
className: styles.icon
|
|
299
|
-
})))), showAdditional &&
|
|
299
|
+
})))), showAdditional && React.createElement(Flex, {
|
|
300
300
|
justifyContent: "space-between",
|
|
301
301
|
marginTop: "spacingXs"
|
|
302
|
-
},
|
|
302
|
+
}, React.createElement(Flex, null, React.createElement(AdditionalButtons, props))));
|
|
303
303
|
}
|
|
304
304
|
export function ZenMarkdownToolbar(props) {
|
|
305
|
-
return
|
|
305
|
+
return React.createElement("div", {
|
|
306
306
|
className: styles.root
|
|
307
|
-
},
|
|
307
|
+
}, React.createElement(Flex, {
|
|
308
308
|
justifyContent: "space-between",
|
|
309
309
|
alignItems: "flex-start"
|
|
310
|
-
},
|
|
310
|
+
}, React.createElement(Flex, {
|
|
311
311
|
flexWrap: "wrap"
|
|
312
|
-
},
|
|
312
|
+
}, React.createElement(MainButtons, props), React.createElement(AdditionalButtons, props)), React.createElement(Flex, null, React.createElement(InsertLinkSelector, {
|
|
313
313
|
disabled: props.disabled,
|
|
314
314
|
onSelectExisting: props.actions.linkExistingMedia,
|
|
315
315
|
onAddNew: props.actions.addNewMedia,
|
|
316
316
|
canAddNew: props.canUploadAssets
|
|
317
|
-
}),
|
|
317
|
+
}), React.createElement(IconButton, {
|
|
318
318
|
testId: "markdown-action-button-zen-close",
|
|
319
319
|
variant: "secondary",
|
|
320
320
|
size: "small",
|
|
@@ -322,17 +322,17 @@ export function ZenMarkdownToolbar(props) {
|
|
|
322
322
|
onClick: ()=>{
|
|
323
323
|
props.actions.closeZenMode();
|
|
324
324
|
},
|
|
325
|
-
icon:
|
|
325
|
+
icon: React.createElement(ArrowsOutIcon, {
|
|
326
326
|
"aria-label": "Collapse",
|
|
327
327
|
className: styles.icon
|
|
328
328
|
}),
|
|
329
329
|
"aria-label": "Collapse"
|
|
330
330
|
}))));
|
|
331
331
|
}
|
|
332
|
-
export const MarkdownToolbar =
|
|
332
|
+
export const MarkdownToolbar = React.memo((props)=>{
|
|
333
333
|
if (props.mode === 'zen') {
|
|
334
|
-
return
|
|
334
|
+
return React.createElement(ZenMarkdownToolbar, props);
|
|
335
335
|
}
|
|
336
|
-
return
|
|
336
|
+
return React.createElement(DefaultMarkdownToolbar, props);
|
|
337
337
|
});
|
|
338
338
|
MarkdownToolbar.displayName = 'MarkdownToolbar';
|
|
@@ -49,7 +49,7 @@ describe('MarkdownToolbar', ()=>{
|
|
|
49
49
|
});
|
|
50
50
|
it('opens the heading menu and calls the selected heading action', async ()=>{
|
|
51
51
|
const props = createProps();
|
|
52
|
-
render(
|
|
52
|
+
render(React.createElement(MarkdownToolbar, props));
|
|
53
53
|
await userEvent.click(screen.getByRole('button', {
|
|
54
54
|
name: 'Headings'
|
|
55
55
|
}));
|
|
@@ -60,7 +60,7 @@ describe('MarkdownToolbar', ()=>{
|
|
|
60
60
|
});
|
|
61
61
|
it('toggles additional actions and exposes the expanded state', async ()=>{
|
|
62
62
|
const props = createProps();
|
|
63
|
-
render(
|
|
63
|
+
render(React.createElement(MarkdownToolbar, props));
|
|
64
64
|
const toggle = screen.getByRole('button', {
|
|
65
65
|
name: 'More actions'
|
|
66
66
|
});
|
|
@@ -75,7 +75,7 @@ describe('MarkdownToolbar', ()=>{
|
|
|
75
75
|
});
|
|
76
76
|
it('triggers a toolbar action once per click', async ()=>{
|
|
77
77
|
const props = createProps();
|
|
78
|
-
render(
|
|
78
|
+
render(React.createElement(MarkdownToolbar, props));
|
|
79
79
|
await userEvent.click(screen.getByRole('button', {
|
|
80
80
|
name: 'Bold'
|
|
81
81
|
}));
|
|
@@ -83,7 +83,7 @@ describe('MarkdownToolbar', ()=>{
|
|
|
83
83
|
});
|
|
84
84
|
it('still supports keyboard-style activation', async ()=>{
|
|
85
85
|
const props = createProps();
|
|
86
|
-
render(
|
|
86
|
+
render(React.createElement(MarkdownToolbar, props));
|
|
87
87
|
const bold = screen.getByRole('button', {
|
|
88
88
|
name: 'Bold'
|
|
89
89
|
});
|
|
@@ -61,102 +61,102 @@ const styles = {
|
|
|
61
61
|
})
|
|
62
62
|
};
|
|
63
63
|
export const CheatsheetModalDialog = ()=>{
|
|
64
|
-
return
|
|
64
|
+
return React.createElement(ModalContent, {
|
|
65
65
|
testId: "markdown-cheatsheet-dialog-content"
|
|
66
|
-
},
|
|
66
|
+
}, React.createElement("div", {
|
|
67
67
|
className: styles.flexColumnContainer
|
|
68
|
-
},
|
|
68
|
+
}, React.createElement("div", {
|
|
69
69
|
className: cx(styles.flexColumn, styles.verticalDivider)
|
|
70
|
-
},
|
|
70
|
+
}, React.createElement("div", {
|
|
71
71
|
className: styles.helpItem
|
|
72
|
-
},
|
|
72
|
+
}, React.createElement(Heading, {
|
|
73
73
|
marginBottom: "none",
|
|
74
74
|
as: "h1",
|
|
75
75
|
className: cx(styles.preview, styles.h1)
|
|
76
|
-
}, "H1"),
|
|
76
|
+
}, "H1"), React.createElement("div", {
|
|
77
77
|
className: styles.markup
|
|
78
|
-
}, "# heading")),
|
|
78
|
+
}, "# heading")), React.createElement("div", {
|
|
79
79
|
className: styles.helpItem
|
|
80
|
-
},
|
|
80
|
+
}, React.createElement(Heading, {
|
|
81
81
|
marginBottom: "none",
|
|
82
82
|
as: "h2",
|
|
83
83
|
className: cx(styles.preview, styles.h2)
|
|
84
|
-
}, "H2"),
|
|
84
|
+
}, "H2"), React.createElement("div", {
|
|
85
85
|
className: styles.markup
|
|
86
|
-
}, "## heading")),
|
|
86
|
+
}, "## heading")), React.createElement("div", {
|
|
87
87
|
className: styles.helpItem
|
|
88
|
-
},
|
|
88
|
+
}, React.createElement(Heading, {
|
|
89
89
|
marginBottom: "none",
|
|
90
90
|
as: "h3",
|
|
91
91
|
className: cx(styles.preview, styles.h3)
|
|
92
|
-
}, "H3"),
|
|
92
|
+
}, "H3"), React.createElement("div", {
|
|
93
93
|
className: styles.markup
|
|
94
|
-
}, "### heading")),
|
|
94
|
+
}, "### heading")), React.createElement("div", {
|
|
95
95
|
className: styles.helpItem
|
|
96
|
-
},
|
|
96
|
+
}, React.createElement("strong", {
|
|
97
97
|
className: styles.preview
|
|
98
|
-
}, "bold"),
|
|
98
|
+
}, "bold"), React.createElement("div", {
|
|
99
99
|
className: styles.markup
|
|
100
|
-
}, "__text__")),
|
|
100
|
+
}, "__text__")), React.createElement("div", {
|
|
101
101
|
className: styles.helpItem
|
|
102
|
-
},
|
|
102
|
+
}, React.createElement("em", {
|
|
103
103
|
className: styles.preview
|
|
104
|
-
}, "italic"),
|
|
104
|
+
}, "italic"), React.createElement("div", {
|
|
105
105
|
className: styles.markup
|
|
106
|
-
}, "*text*")),
|
|
106
|
+
}, "*text*")), React.createElement("div", {
|
|
107
107
|
className: styles.helpItem
|
|
108
|
-
},
|
|
108
|
+
}, React.createElement("div", {
|
|
109
109
|
className: styles.preview
|
|
110
|
-
}, "strikethrough"),
|
|
110
|
+
}, "strikethrough"), React.createElement("div", {
|
|
111
111
|
className: styles.markup
|
|
112
|
-
}, "~~text~~")),
|
|
112
|
+
}, "~~text~~")), React.createElement("div", {
|
|
113
113
|
className: styles.helpItem
|
|
114
|
-
},
|
|
114
|
+
}, React.createElement(TextLink, {
|
|
115
115
|
as: "button",
|
|
116
116
|
className: styles.preview
|
|
117
|
-
}, "Link"),
|
|
117
|
+
}, "Link"), React.createElement("div", {
|
|
118
118
|
className: styles.markup
|
|
119
|
-
}, "[text](url)"))),
|
|
119
|
+
}, "[text](url)"))), React.createElement("div", {
|
|
120
120
|
className: styles.flexColumn
|
|
121
|
-
},
|
|
121
|
+
}, React.createElement("div", {
|
|
122
122
|
className: styles.helpItem
|
|
123
|
-
},
|
|
123
|
+
}, React.createElement("div", {
|
|
124
124
|
className: styles.preview
|
|
125
|
-
}, "Image"),
|
|
125
|
+
}, "Image"), React.createElement("div", {
|
|
126
126
|
className: styles.markup
|
|
127
|
-
}, "")),
|
|
127
|
+
}, "")), React.createElement("div", {
|
|
128
128
|
className: styles.helpItem
|
|
129
|
-
},
|
|
129
|
+
}, React.createElement("div", {
|
|
130
130
|
className: styles.preview
|
|
131
|
-
}, "Unordered list"),
|
|
131
|
+
}, "Unordered list"), React.createElement("div", {
|
|
132
132
|
className: styles.markup
|
|
133
|
-
}, "* list item")),
|
|
133
|
+
}, "* list item")), React.createElement("div", {
|
|
134
134
|
className: styles.helpItem
|
|
135
|
-
},
|
|
135
|
+
}, React.createElement("div", {
|
|
136
136
|
className: styles.preview
|
|
137
|
-
},
|
|
137
|
+
}, React.createElement("div", null, "Ordered list")), React.createElement("div", {
|
|
138
138
|
className: styles.markup
|
|
139
|
-
}, "1. list item")),
|
|
139
|
+
}, "1. list item")), React.createElement("div", {
|
|
140
140
|
className: styles.helpItem
|
|
141
|
-
},
|
|
141
|
+
}, React.createElement("div", {
|
|
142
142
|
className: styles.preview
|
|
143
|
-
},
|
|
143
|
+
}, React.createElement("div", null, "Blockquote")), React.createElement("div", {
|
|
144
144
|
className: styles.markup
|
|
145
|
-
}, "> quote")),
|
|
145
|
+
}, "> quote")), React.createElement("div", {
|
|
146
146
|
className: styles.helpItem
|
|
147
|
-
},
|
|
147
|
+
}, React.createElement("div", {
|
|
148
148
|
className: styles.preview
|
|
149
|
-
}, "code span"),
|
|
149
|
+
}, "code span"), React.createElement("div", {
|
|
150
150
|
className: styles.markup
|
|
151
|
-
}, "`code here`")),
|
|
151
|
+
}, "`code here`")), React.createElement("div", {
|
|
152
152
|
className: styles.helpItem
|
|
153
|
-
},
|
|
153
|
+
}, React.createElement("div", {
|
|
154
154
|
className: styles.preview
|
|
155
|
-
}, "code block"),
|
|
155
|
+
}, "code block"), React.createElement("div", {
|
|
156
156
|
className: styles.markup
|
|
157
|
-
}, "```code here```")))),
|
|
157
|
+
}, "```code here```")))), React.createElement("div", {
|
|
158
158
|
className: styles.flexRowContainer
|
|
159
|
-
},
|
|
159
|
+
}, React.createElement(TextLink, {
|
|
160
160
|
className: styles.helpLink,
|
|
161
161
|
href: "https://help.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax",
|
|
162
162
|
target: "_blank",
|
|
@@ -5,26 +5,26 @@ import { MarkdownDialogType } from '../types';
|
|
|
5
5
|
const THUMBNAIL_SIZE = 46;
|
|
6
6
|
export const ConfirmInsertAssetModalDialog = ({ onClose, assets, locale })=>{
|
|
7
7
|
const localesNumber = assets.length;
|
|
8
|
-
return
|
|
8
|
+
return React.createElement(React.Fragment, null, React.createElement(ModalContent, {
|
|
9
9
|
testId: "confirm-insert-asset"
|
|
10
|
-
},
|
|
10
|
+
}, React.createElement(Paragraph, null, localesNumber === 1 ? `Link asset with missing file for locale ${locale}` : `Link assets with missing files for locale ${locale}`), React.createElement(Paragraph, null, localesNumber === 1 ? 'Do you want to link to the file in its fallback locale?' : 'Do you want to link to the files in their fallback locales?'), React.createElement(EntityList, null, assets.map(({ title, description, thumbnailUrl, thumbnailAltText })=>{
|
|
11
11
|
const resolvedThumbnailUrl = entityHelpers.getResolvedImageUrl(thumbnailUrl, {
|
|
12
12
|
w: THUMBNAIL_SIZE,
|
|
13
13
|
h: THUMBNAIL_SIZE,
|
|
14
14
|
fit: 'thumb'
|
|
15
15
|
});
|
|
16
|
-
return
|
|
16
|
+
return React.createElement(EntityList.Item, {
|
|
17
17
|
key: thumbnailUrl,
|
|
18
18
|
title: title,
|
|
19
19
|
thumbnailUrl: resolvedThumbnailUrl,
|
|
20
20
|
thumbnailAltText: thumbnailAltText,
|
|
21
21
|
description: description
|
|
22
22
|
});
|
|
23
|
-
}))),
|
|
23
|
+
}))), React.createElement(ModalControls, null, React.createElement(Button, {
|
|
24
24
|
onClick: ()=>onClose(false),
|
|
25
25
|
variant: "secondary",
|
|
26
26
|
size: "small"
|
|
27
|
-
}, "Cancel"),
|
|
27
|
+
}, "Cancel"), React.createElement(Button, {
|
|
28
28
|
testId: "confirm-insert-asset",
|
|
29
29
|
onClick: ()=>onClose(true),
|
|
30
30
|
variant: "positive",
|
|
@@ -47,16 +47,16 @@ export const EmbedExternalContentModal = ({ onClose })=>{
|
|
|
47
47
|
}, [
|
|
48
48
|
mainInputRef
|
|
49
49
|
]);
|
|
50
|
-
return
|
|
50
|
+
return React.createElement(React.Fragment, null, React.createElement(ModalContent, {
|
|
51
51
|
testId: "embed-external-dialog"
|
|
52
|
-
},
|
|
52
|
+
}, React.createElement(Form, null, React.createElement(FormControl, {
|
|
53
53
|
id: "external-link-url-field",
|
|
54
54
|
isRequired: true,
|
|
55
55
|
isInvalid: !urlIsValid
|
|
56
|
-
},
|
|
56
|
+
}, React.createElement(FormControl.Label, null, $_i18n._({
|
|
57
57
|
id: "FieldEditors.Markdown.EmbedExternalContent.ContentURL",
|
|
58
58
|
message: "Content URL"
|
|
59
|
-
})),
|
|
59
|
+
})), React.createElement(TextInput, {
|
|
60
60
|
name: "external-link-url",
|
|
61
61
|
value: url,
|
|
62
62
|
onChange: (e)=>{
|
|
@@ -67,64 +67,64 @@ export const EmbedExternalContentModal = ({ onClose })=>{
|
|
|
67
67
|
testId: "external-link-url-field",
|
|
68
68
|
placeholder: "https://example.com",
|
|
69
69
|
ref: mainInputRef
|
|
70
|
-
}),
|
|
70
|
+
}), React.createElement(FormControl.HelpText, null, $_i18n._({
|
|
71
71
|
id: "FieldEditors.Markdown.EmbedExternalContent.ProtocolHelpText",
|
|
72
72
|
message: "Include protocol (e.g. https://"
|
|
73
|
-
})), !urlIsValid &&
|
|
73
|
+
})), !urlIsValid && React.createElement(FormControl.ValidationMessage, null, $_i18n._({
|
|
74
74
|
id: "FieldEditors.Markdown.EmbedExternalContent.URLInvalidMessage",
|
|
75
75
|
message: "URL is invalid"
|
|
76
|
-
}))),
|
|
76
|
+
}))), React.createElement(TextLink, {
|
|
77
77
|
href: "http://embed.ly/providers",
|
|
78
78
|
target: "_blank",
|
|
79
79
|
rel: "noopener noreferrer"
|
|
80
|
-
}, "Supported sources"),
|
|
80
|
+
}, "Supported sources"), React.createElement("div", {
|
|
81
81
|
className: styles.widthFiledGroup
|
|
82
|
-
},
|
|
82
|
+
}, React.createElement(FormControl, {
|
|
83
83
|
id: "embedded-content-width",
|
|
84
84
|
isRequired: true,
|
|
85
85
|
isInvalid: !isWidthValid(Number(width), selectedUnit)
|
|
86
|
-
},
|
|
86
|
+
}, React.createElement(FormControl.Label, null, "Width"), React.createElement(TextInput, {
|
|
87
87
|
value: width,
|
|
88
88
|
name: "embedded-content-width",
|
|
89
89
|
testId: "embedded-content-width",
|
|
90
90
|
type: "number",
|
|
91
91
|
width: "small",
|
|
92
92
|
onChange: (e)=>setWidth(e.target.value)
|
|
93
|
-
}), !isWidthValid(Number(width), selectedUnit) &&
|
|
93
|
+
}), !isWidthValid(Number(width), selectedUnit) && React.createElement(FormControl.ValidationMessage, null, "Should be equal or less then 100")), React.createElement("div", {
|
|
94
94
|
className: styles.radioButtonGroup
|
|
95
|
-
},
|
|
95
|
+
}, React.createElement(Radio, {
|
|
96
96
|
id: "unit-option-percent",
|
|
97
97
|
value: "percent",
|
|
98
98
|
isChecked: selectedUnit === 'percent',
|
|
99
99
|
onChange: ()=>setUnit('percent'),
|
|
100
100
|
className: styles.radioButton
|
|
101
|
-
}, "percent"),
|
|
101
|
+
}, "percent"), React.createElement(Radio, {
|
|
102
102
|
id: "unit-option-pixels",
|
|
103
103
|
value: "pixels",
|
|
104
104
|
isChecked: selectedUnit === 'px',
|
|
105
105
|
onChange: ()=>setUnit('px'),
|
|
106
106
|
className: styles.radioButton
|
|
107
|
-
}, "pixels"))),
|
|
107
|
+
}, "pixels"))), React.createElement(Checkbox, {
|
|
108
108
|
id: "attach-social-checkbox",
|
|
109
109
|
name: "attach-social-checkbox",
|
|
110
110
|
value: "Yes",
|
|
111
111
|
isChecked: attachSocial,
|
|
112
112
|
onChange: ()=>setAttachSocial(!attachSocial),
|
|
113
113
|
testId: "attach-social-checkbox"
|
|
114
|
-
}, "Attach social sharing links to this element"),
|
|
114
|
+
}, "Attach social sharing links to this element"), React.createElement(Text, {
|
|
115
115
|
as: "p",
|
|
116
116
|
fontColor: "gray500",
|
|
117
117
|
marginTop: "spacingXs"
|
|
118
|
-
}, "To enable this embedded content in your application make sure to add the ",
|
|
118
|
+
}, "To enable this embedded content in your application make sure to add the ", React.createElement(TextLink, {
|
|
119
119
|
href: "http://embed.ly/docs/products/cards",
|
|
120
120
|
target: "_blank",
|
|
121
121
|
rel: "noopener noreferrer"
|
|
122
|
-
}, "Embedly's platform.js"), " on your development environment"))),
|
|
122
|
+
}, "Embedly's platform.js"), " on your development environment"))), React.createElement(ModalControls, null, React.createElement(Button, {
|
|
123
123
|
testId: "emded-external-cancel",
|
|
124
124
|
onClick: ()=>onClose(false),
|
|
125
125
|
variant: "secondary",
|
|
126
126
|
size: "small"
|
|
127
|
-
}, "Cancel"),
|
|
127
|
+
}, "Cancel"), React.createElement(Button, {
|
|
128
128
|
testId: "embed-external-confirm",
|
|
129
129
|
onClick: ()=>onClose(makeEmbedlyLink({
|
|
130
130
|
url,
|