@webiny/lexical-editor 6.0.0-alpha.5 → 6.0.0-rc.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/README.md +6 -12
- package/commands/index.d.ts +5 -5
- package/commands/index.js +5 -5
- package/commands/index.js.map +1 -1
- package/components/Editor/EnsureHeadingTagPlugin.js +1 -1
- package/components/Editor/EnsureHeadingTagPlugin.js.map +1 -1
- package/components/Editor/RichTextEditor.d.ts +11 -6
- package/components/Editor/RichTextEditor.js +22 -16
- package/components/Editor/RichTextEditor.js.map +1 -1
- package/components/Editor/normalizeInputValue.d.ts +1 -1
- package/components/Editor/normalizeInputValue.js.map +1 -1
- package/components/LexicalEditorConfig/LexicalEditorConfig.d.ts +14 -16
- package/components/LexicalEditorConfig/LexicalEditorConfig.js +20 -58
- package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -1
- package/components/LexicalHtmlRenderer.d.ts +3 -6
- package/components/LexicalHtmlRenderer.js +12 -17
- package/components/LexicalHtmlRenderer.js.map +1 -1
- package/components/Toolbar/StaticToolbar.css +416 -0
- package/components/Toolbar/StaticToolbar.d.ts +1 -1
- package/components/Toolbar/StaticToolbar.js +2 -2
- package/components/Toolbar/StaticToolbar.js.map +1 -1
- package/components/ToolbarActions/BoldAction.js +2 -2
- package/components/ToolbarActions/BoldAction.js.map +1 -1
- package/components/ToolbarActions/BulletListAction.js +5 -6
- package/components/ToolbarActions/BulletListAction.js.map +1 -1
- package/components/ToolbarActions/CodeHighlightAction.js +2 -2
- package/components/ToolbarActions/CodeHighlightAction.js.map +1 -1
- package/components/ToolbarActions/FontColorAction.js +4 -4
- package/components/ToolbarActions/FontColorAction.js.map +1 -1
- package/components/ToolbarActions/ImageAction.js +3 -3
- package/components/ToolbarActions/ImageAction.js.map +1 -1
- package/components/ToolbarActions/ItalicAction.js +2 -2
- package/components/ToolbarActions/ItalicAction.js.map +1 -1
- package/components/ToolbarActions/LinkAction.js +3 -3
- package/components/ToolbarActions/LinkAction.js.map +1 -1
- package/components/ToolbarActions/NumberedListAction.js +7 -11
- package/components/ToolbarActions/NumberedListAction.js.map +1 -1
- package/components/ToolbarActions/QuoteAction.js +6 -6
- package/components/ToolbarActions/QuoteAction.js.map +1 -1
- package/components/ToolbarActions/TextAlignmentAction.js +4 -4
- package/components/ToolbarActions/TextAlignmentAction.js.map +1 -1
- package/components/ToolbarActions/TypographyAction.js +14 -11
- package/components/ToolbarActions/TypographyAction.js.map +1 -1
- package/components/ToolbarActions/UnderlineAction.js +1 -1
- package/components/ToolbarActions/UnderlineAction.js.map +1 -1
- package/context/RichTextEditorContext.d.ts +5 -6
- package/context/RichTextEditorContext.js +17 -4
- package/context/RichTextEditorContext.js.map +1 -1
- package/context/TypographyActionContext.d.ts +1 -1
- package/context/TypographyActionContext.js.map +1 -1
- package/exports/admin/lexical.d.ts +15 -0
- package/exports/admin/lexical.js +23 -0
- package/exports/admin/lexical.js.map +1 -0
- package/hooks/index.d.ts +7 -8
- package/hooks/index.js +7 -8
- package/hooks/index.js.map +1 -1
- package/hooks/useCurrentElement.js +2 -3
- package/hooks/useCurrentElement.js.map +1 -1
- package/hooks/useCurrentSelection.js +4 -4
- package/hooks/useCurrentSelection.js.map +1 -1
- package/hooks/useFontColorPicker.d.ts +1 -1
- package/hooks/useFontColorPicker.js +1 -1
- package/hooks/useFontColorPicker.js.map +1 -1
- package/hooks/useRichTextEditor.d.ts +1 -1
- package/hooks/useRichTextEditor.js +1 -1
- package/hooks/useRichTextEditor.js.map +1 -1
- package/hooks/useTextAlignmentAction.d.ts +1 -1
- package/hooks/useTextAlignmentAction.js +1 -1
- package/hooks/useTextAlignmentAction.js.map +1 -1
- package/hooks/useTypographyAction.d.ts +1 -1
- package/hooks/useTypographyAction.js +1 -1
- package/hooks/useTypographyAction.js.map +1 -1
- package/index.d.ts +33 -37
- package/index.js +33 -37
- package/index.js.map +1 -1
- package/package.json +18 -22
- package/plugins/BlurEventPlugin/BlurEventPlugin.d.ts +1 -1
- package/plugins/BlurEventPlugin/BlurEventPlugin.js +1 -1
- package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -1
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js +1 -1
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -1
- package/plugins/CodeHighlightPlugin/index.d.ts +1 -1
- package/plugins/CodeHighlightPlugin/index.js +1 -1
- package/plugins/CodeHighlightPlugin/index.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.d.ts +4 -10
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js +15 -145
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.d.ts +2 -3
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js +10 -11
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.css +1 -136
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.d.ts +5 -6
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +3 -7
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/index.d.ts +1 -1
- package/plugins/FloatingLinkEditorPlugin/index.js +1 -1
- package/plugins/FloatingLinkEditorPlugin/index.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/types.d.ts +10 -0
- package/plugins/FloatingLinkEditorPlugin/types.js +3 -0
- package/plugins/FloatingLinkEditorPlugin/types.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.d.ts +8 -0
- package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.js +128 -0
- package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.js.map +1 -0
- package/plugins/FontColorPlugin/FontColorPlugin.js +2 -2
- package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -1
- package/plugins/FontColorPlugin/applyColorToSelection.js +1 -1
- package/plugins/FontColorPlugin/applyColorToSelection.js.map +1 -1
- package/plugins/ImagesPlugin/ImagesPlugin.d.ts +1 -2
- package/plugins/ImagesPlugin/ImagesPlugin.js +5 -8
- package/plugins/ImagesPlugin/ImagesPlugin.js.map +1 -1
- package/plugins/LinkPlugin/LinkPlugin.js +2 -3
- package/plugins/LinkPlugin/LinkPlugin.js.map +1 -1
- package/plugins/ListPLugin/ListPlugin.js +45 -3
- package/plugins/ListPLugin/ListPlugin.js.map +1 -1
- package/plugins/QuoteNodePlugin/QuoteNodePlugin.js +12 -4
- package/plugins/QuoteNodePlugin/QuoteNodePlugin.js.map +1 -1
- package/plugins/StateHandlingPlugin.d.ts +1 -1
- package/plugins/StateHandlingPlugin.js +6 -6
- package/plugins/StateHandlingPlugin.js.map +1 -1
- package/plugins/TypographyPlugin/TypographyPlugin.js +2 -2
- package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -1
- package/types.d.ts +3 -3
- package/types.js +1 -1
- package/types.js.map +1 -1
- package/ui/ContentEditable.d.ts +0 -1
- package/ui/Divider.d.ts +0 -1
- package/ui/DropDown.js +4 -3
- package/ui/DropDown.js.map +1 -1
- package/ui/ImageResizer.d.ts +0 -1
- package/ui/ImageResizer.js.map +1 -1
- package/ui/LinkPreview.d.ts +0 -1
- package/ui/TextInput.d.ts +0 -1
- package/utils/files.d.ts +6 -6
- package/utils/files.js +3 -13
- package/utils/files.js.map +1 -1
- package/utils/insertImage.d.ts +1 -1
- package/utils/insertImage.js.map +1 -1
- package/utils/isValidLexicalData.d.ts +2 -2
- package/utils/isValidLexicalData.js.map +1 -1
- package/utils/rect.d.ts +1 -1
- package/utils/rect.js +1 -1
- package/utils/rect.js.map +1 -1
- package/utils/sanitizeUrl.js +1 -1
- package/utils/sanitizeUrl.js.map +1 -1
- package/utils/setFloatingElemPosition.d.ts +1 -1
- package/utils/setFloatingElemPosition.js +23 -21
- package/utils/setFloatingElemPosition.js.map +1 -1
- package/components/Editor/HeadingEditor.d.ts +0 -7
- package/components/Editor/HeadingEditor.js +0 -22
- package/components/Editor/HeadingEditor.js.map +0 -1
- package/components/Editor/ParagraphEditor.d.ts +0 -7
- package/components/Editor/ParagraphEditor.js +0 -22
- package/components/Editor/ParagraphEditor.js.map +0 -1
- package/components/Toolbar/Toolbar.css +0 -643
- package/components/Toolbar/Toolbar.d.ts +0 -6
- package/components/Toolbar/Toolbar.js +0 -148
- package/components/Toolbar/Toolbar.js.map +0 -1
- package/components/ToolbarActions/FontSizeAction.d.ts +0 -14
- package/components/ToolbarActions/FontSizeAction.js +0 -91
- package/components/ToolbarActions/FontSizeAction.js.map +0 -1
- package/hooks/useList.d.ts +0 -2
- package/hooks/useList.js +0 -50
- package/hooks/useList.js.map +0 -1
- package/hooks/useQuote.d.ts +0 -2
- package/hooks/useQuote.js +0 -17
- package/hooks/useQuote.js.map +0 -1
- package/plugins/FloatingLinkEditorPlugin/LinkEditForm.d.ts +0 -8
- package/plugins/FloatingLinkEditorPlugin/LinkEditForm.js +0 -104
- package/plugins/FloatingLinkEditorPlugin/LinkEditForm.js.map +0 -1
- package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.d.ts +0 -9
- package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.js +0 -34
- package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.js.map +0 -1
|
@@ -258,3 +258,419 @@
|
|
|
258
258
|
.static-toolbar button.item.dropdown-item-active i {
|
|
259
259
|
opacity: 1;
|
|
260
260
|
}
|
|
261
|
+
|
|
262
|
+
i.bold {
|
|
263
|
+
background-image: url("../../images/icons/type-bold.svg");
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
i.italic {
|
|
267
|
+
background-image: url("../../images/icons/type-italic.svg");
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
i.code {
|
|
271
|
+
background-image: url("../../images/icons/code.svg");
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
i.underline {
|
|
275
|
+
background-image: url("../../images/icons/type-underline.svg");
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
i.strikethrough {
|
|
279
|
+
background-image: url("../../images/icons/type-strikethrough.svg");
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
i.link {
|
|
283
|
+
background-image: url("../../images/icons/link.svg");
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
i.quote {
|
|
287
|
+
background-image: url("../../images/icons/chat-square-quote.svg");
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.icon.left-align,
|
|
291
|
+
i.left-align {
|
|
292
|
+
background-image: url("../../images/icons/text-left.svg");
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
i.center-align {
|
|
296
|
+
background-image: url("../../images/icons/text-center.svg");
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
i.right-align {
|
|
300
|
+
background-image: url("../../images/icons/text-right.svg");
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
i.indent {
|
|
304
|
+
background-image: url("../../images/icons/indent.svg");
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
i.outdent {
|
|
308
|
+
background-image: url("../../images/icons/outdent.svg");
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
i.justify-align {
|
|
312
|
+
background-image: url("../../images/icons/justify.svg");
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
i.chevron-down {
|
|
316
|
+
background-color: transparent;
|
|
317
|
+
background-size: contain;
|
|
318
|
+
display: inline-block;
|
|
319
|
+
height: 8px;
|
|
320
|
+
width: 8px;
|
|
321
|
+
background-image: url("../../images/icons/chevron-down.svg");
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
i.insert-image,
|
|
325
|
+
.icon.insert-image {
|
|
326
|
+
background-color: transparent;
|
|
327
|
+
background-size: contain;
|
|
328
|
+
display: inline-block;
|
|
329
|
+
height: 8px;
|
|
330
|
+
width: 8px;
|
|
331
|
+
background-image: url("../../images/icons/insert-image.svg");
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.icon.bullet-list,
|
|
335
|
+
.icon.bullet {
|
|
336
|
+
background-image: url("../../images/icons/list-ul.svg");
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.icon.numbered-list,
|
|
340
|
+
.icon.number {
|
|
341
|
+
background-image: url("../../images/icons/list-ol.svg");
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
i.font-color,
|
|
345
|
+
.icon.font-color {
|
|
346
|
+
background-image: url("../../images/icons/font-color.svg");
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.link-editor .button.active,
|
|
350
|
+
.toolbar .button.active {
|
|
351
|
+
background-color: rgb(223, 232, 250);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.toolbar .divider {
|
|
355
|
+
width: 1px;
|
|
356
|
+
background-color: #eee;
|
|
357
|
+
margin: 0 4px;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.lexical-dropdown-container {
|
|
361
|
+
position: absolute;
|
|
362
|
+
bottom: -5px;
|
|
363
|
+
left: 0;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.lexical-dropdown {
|
|
367
|
+
z-index: 10;
|
|
368
|
+
display: block;
|
|
369
|
+
position: fixed;
|
|
370
|
+
box-shadow:
|
|
371
|
+
0 12px 28px 0 rgba(0, 0, 0, 0.2),
|
|
372
|
+
0 2px 4px 0 rgba(0, 0, 0, 0.1),
|
|
373
|
+
inset 0 0 0 1px rgba(255, 255, 255, 0.5);
|
|
374
|
+
border-radius: 8px;
|
|
375
|
+
min-height: 40px;
|
|
376
|
+
background-color: #fff;
|
|
377
|
+
max-height: 250px;
|
|
378
|
+
overflow: hidden;
|
|
379
|
+
overflow-y: auto;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.lexical-dropdown.no-scroll {
|
|
383
|
+
max-height: inherit;
|
|
384
|
+
overflow: auto;
|
|
385
|
+
overflow-y: auto;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.lexical-dropdown .item {
|
|
389
|
+
margin: 0 8px 0 8px;
|
|
390
|
+
padding: 8px;
|
|
391
|
+
color: #050505;
|
|
392
|
+
cursor: pointer;
|
|
393
|
+
line-height: 16px;
|
|
394
|
+
font-size: 15px;
|
|
395
|
+
display: flex;
|
|
396
|
+
align-content: center;
|
|
397
|
+
flex-direction: row;
|
|
398
|
+
flex-shrink: 0;
|
|
399
|
+
justify-content: space-between;
|
|
400
|
+
background-color: #fff;
|
|
401
|
+
border-radius: 8px;
|
|
402
|
+
border: 0;
|
|
403
|
+
max-width: 250px;
|
|
404
|
+
min-width: 100px;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.lexical-dropdown .item.fontsize-item,
|
|
408
|
+
.lexical-dropdown .item.fontsize-item .text {
|
|
409
|
+
min-width: unset;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.lexical-dropdown .item .active {
|
|
413
|
+
display: flex;
|
|
414
|
+
width: 20px;
|
|
415
|
+
height: 20px;
|
|
416
|
+
background-size: contain;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.lexical-dropdown .item:first-child {
|
|
420
|
+
margin-top: 8px;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.lexical-dropdown .item:last-child {
|
|
424
|
+
margin-bottom: 8px;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.lexical-dropdown .item:hover {
|
|
428
|
+
background-color: #eee;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.lexical-dropdown .item .text {
|
|
432
|
+
display: flex;
|
|
433
|
+
line-height: 20px;
|
|
434
|
+
flex-grow: 1;
|
|
435
|
+
min-width: 150px;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.lexical-dropdown .item .icon {
|
|
439
|
+
display: flex;
|
|
440
|
+
width: 20px;
|
|
441
|
+
height: 20px;
|
|
442
|
+
user-select: none;
|
|
443
|
+
margin-right: 12px;
|
|
444
|
+
line-height: 16px;
|
|
445
|
+
background-size: contain;
|
|
446
|
+
background-position: center;
|
|
447
|
+
background-repeat: no-repeat;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.lexical-dropdown .divider {
|
|
451
|
+
width: auto;
|
|
452
|
+
background-color: #eee;
|
|
453
|
+
margin: 4px 8px;
|
|
454
|
+
height: 1px;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
@media screen and (max-width: 1100px) {
|
|
458
|
+
.dropdown-button-text {
|
|
459
|
+
display: none !important;
|
|
460
|
+
}
|
|
461
|
+
.font-size .dropdown-button-text {
|
|
462
|
+
display: flex !important;
|
|
463
|
+
}
|
|
464
|
+
.code-language .dropdown-button-text {
|
|
465
|
+
display: flex !important;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
button.item i {
|
|
470
|
+
opacity: 0.6;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
button.item.dropdown-item-active {
|
|
474
|
+
background-color: rgba(223, 232, 250, 0.3);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
button.item.dropdown-item-active i {
|
|
478
|
+
opacity: 1;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.editor-shell span.editor-image {
|
|
482
|
+
cursor: default;
|
|
483
|
+
display: inline-block;
|
|
484
|
+
position: relative;
|
|
485
|
+
user-select: none;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.editor-shell .editor-image img {
|
|
489
|
+
max-width: 100%;
|
|
490
|
+
cursor: default;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.editor-shell .editor-image img.focused {
|
|
494
|
+
outline: 2px solid rgb(60, 132, 244);
|
|
495
|
+
user-select: none;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.editor-shell .editor-image img.focused.draggable {
|
|
499
|
+
cursor: grab;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.editor-shell .editor-image img.focused.draggable:active {
|
|
503
|
+
cursor: grabbing;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.editor-shell .editor-image .image-caption-container .tree-view-output {
|
|
507
|
+
margin: 0;
|
|
508
|
+
border-radius: 0;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.editor-shell .editor-image .image-caption-container {
|
|
512
|
+
display: block;
|
|
513
|
+
position: absolute;
|
|
514
|
+
bottom: 4px;
|
|
515
|
+
left: 0;
|
|
516
|
+
right: 0;
|
|
517
|
+
padding: 0;
|
|
518
|
+
margin: 0;
|
|
519
|
+
border-top: 1px solid #fff;
|
|
520
|
+
background-color: #ffffffe6;
|
|
521
|
+
min-width: 100px;
|
|
522
|
+
color: #000;
|
|
523
|
+
overflow: hidden;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.editor-shell .editor-image .image-caption-button {
|
|
527
|
+
display: block;
|
|
528
|
+
position: absolute;
|
|
529
|
+
bottom: 20px;
|
|
530
|
+
left: 0;
|
|
531
|
+
right: 0;
|
|
532
|
+
width: 30%;
|
|
533
|
+
padding: 10px;
|
|
534
|
+
margin: 0 auto;
|
|
535
|
+
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
536
|
+
border-radius: 5px;
|
|
537
|
+
background-color: #00000080;
|
|
538
|
+
min-width: 100px;
|
|
539
|
+
color: #fff;
|
|
540
|
+
cursor: pointer;
|
|
541
|
+
user-select: none;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
.editor-shell .editor-image .image-caption-button:hover {
|
|
545
|
+
background-color: #3c84f480;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.editor-shell .editor-image .image-resizer {
|
|
549
|
+
display: block;
|
|
550
|
+
width: 7px;
|
|
551
|
+
height: 7px;
|
|
552
|
+
position: absolute;
|
|
553
|
+
background-color: #3c84f4;
|
|
554
|
+
border: 1px solid #fff;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.editor-shell .editor-image .image-resizer.image-resizer-n {
|
|
558
|
+
top: -6px;
|
|
559
|
+
left: 48%;
|
|
560
|
+
cursor: n-resize;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.editor-shell .editor-image .image-resizer.image-resizer-ne {
|
|
564
|
+
top: -6px;
|
|
565
|
+
right: -6px;
|
|
566
|
+
cursor: ne-resize;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
.editor-shell .editor-image .image-resizer.image-resizer-e {
|
|
570
|
+
bottom: 48%;
|
|
571
|
+
right: -6px;
|
|
572
|
+
cursor: e-resize;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
.editor-shell .editor-image .image-resizer.image-resizer-se {
|
|
576
|
+
bottom: -2px;
|
|
577
|
+
right: -6px;
|
|
578
|
+
cursor: nwse-resize;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.editor-shell .editor-image .image-resizer.image-resizer-s {
|
|
582
|
+
bottom: -2px;
|
|
583
|
+
left: 48%;
|
|
584
|
+
cursor: s-resize;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.editor-shell .editor-image .image-resizer.image-resizer-sw {
|
|
588
|
+
bottom: -2px;
|
|
589
|
+
left: -6px;
|
|
590
|
+
cursor: sw-resize;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.editor-shell .editor-image .image-resizer.image-resizer-w {
|
|
594
|
+
bottom: 48%;
|
|
595
|
+
left: -6px;
|
|
596
|
+
cursor: w-resize;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.editor-shell .editor-image .image-resizer.image-resizer-nw {
|
|
600
|
+
top: -6px;
|
|
601
|
+
left: -6px;
|
|
602
|
+
cursor: nw-resize;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.editor-shell span.inline-editor-image {
|
|
606
|
+
cursor: default;
|
|
607
|
+
display: inline-block;
|
|
608
|
+
position: relative;
|
|
609
|
+
z-index: 1;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
.editor-shell .inline-editor-image img {
|
|
613
|
+
max-width: 100%;
|
|
614
|
+
cursor: default;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
.editor-shell .inline-editor-image img.focused {
|
|
618
|
+
outline: 2px solid rgb(60, 132, 244);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.editor-shell .inline-editor-image img.focused.draggable {
|
|
622
|
+
cursor: grab;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.editor-shell .inline-editor-image img.focused.draggable:active {
|
|
626
|
+
cursor: grabbing;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.editor-shell .inline-editor-image .image-caption-container .tree-view-output {
|
|
630
|
+
margin: 0;
|
|
631
|
+
border-radius: 0;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
.editor-shell .inline-editor-image.position-full {
|
|
635
|
+
margin: 1em 0;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
.editor-shell .inline-editor-image.position-left {
|
|
639
|
+
float: left;
|
|
640
|
+
width: 50%;
|
|
641
|
+
margin: 1em 1em 0 0;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
.editor-shell .inline-editor-image.position-right {
|
|
645
|
+
float: right;
|
|
646
|
+
width: 50%;
|
|
647
|
+
margin: 1em 0 0 1em;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
.editor-shell .inline-editor-image .image-edit-button {
|
|
651
|
+
display: block;
|
|
652
|
+
position: absolute;
|
|
653
|
+
top: 12px;
|
|
654
|
+
right: 12px;
|
|
655
|
+
padding: 6px 8px;
|
|
656
|
+
margin: 0 auto;
|
|
657
|
+
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
658
|
+
border-radius: 5px;
|
|
659
|
+
background-color: #00000080;
|
|
660
|
+
min-width: 60px;
|
|
661
|
+
color: #fff;
|
|
662
|
+
cursor: pointer;
|
|
663
|
+
user-select: none;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
.editor-shell .inline-editor-image .image-edit-button:hover {
|
|
667
|
+
background-color: #3c84f480;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
.editor-shell .inline-editor-image .image-caption-container {
|
|
671
|
+
display: block;
|
|
672
|
+
background-color: #f4f4f4;
|
|
673
|
+
min-width: 100%;
|
|
674
|
+
color: #000;
|
|
675
|
+
overflow: hidden;
|
|
676
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { Fragment } from "react";
|
|
2
2
|
import "./StaticToolbar.css";
|
|
3
|
-
import { useLexicalEditorConfig } from "../LexicalEditorConfig/LexicalEditorConfig";
|
|
4
|
-
import { useRichTextEditor } from "../../hooks";
|
|
3
|
+
import { useLexicalEditorConfig } from "../LexicalEditorConfig/LexicalEditorConfig.js";
|
|
4
|
+
import { useRichTextEditor } from "../../hooks/index.js";
|
|
5
5
|
export const StaticToolbar = ({
|
|
6
6
|
className
|
|
7
7
|
}) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Fragment","useLexicalEditorConfig","useRichTextEditor","StaticToolbar","className","toolbarElements","editor","createElement","isEditable","map","action","key","name","element"],"sources":["StaticToolbar.tsx"],"sourcesContent":["import React, { Fragment } from \"react\";\nimport \"./StaticToolbar.css\";\nimport { useLexicalEditorConfig } from \"~/components/LexicalEditorConfig/LexicalEditorConfig\";\nimport { useRichTextEditor } from \"~/hooks\";\n\nexport const StaticToolbar = ({ className }: { className?: string }) => {\n const { toolbarElements } = useLexicalEditorConfig();\n const { editor } = useRichTextEditor();\n\n return (\n <div className={className ?? \"static-toolbar\"} data-role={\"toolbar\"}>\n {editor.isEditable() && (\n <>\n {toolbarElements.map(action => (\n <Fragment key={action.name}>{action.element}</Fragment>\n ))}\n </>\n )}\n </div>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC;AACA,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,aAAa,GAAGA,CAAC;EAAEC;AAAkC,CAAC,KAAK;EACpE,MAAM;IAAEC;EAAgB,CAAC,GAAGJ,sBAAsB,CAAC,CAAC;EACpD,MAAM;IAAEK;EAAO,CAAC,GAAGJ,iBAAiB,CAAC,CAAC;EAEtC,oBACIH,KAAA,CAAAQ,aAAA;IAAKH,SAAS,EAAEA,SAAS,IAAI,gBAAiB;IAAC,aAAW;EAAU,GAC/DE,MAAM,CAACE,UAAU,CAAC,CAAC,iBAChBT,KAAA,CAAAQ,aAAA,CAAAR,KAAA,CAAAC,QAAA,QACKK,eAAe,CAACI,GAAG,CAACC,MAAM,iBACvBX,KAAA,CAAAQ,aAAA,CAACP,QAAQ;IAACW,GAAG,EAAED,MAAM,CAACE;EAAK,GAAEF,MAAM,CAACG,OAAkB,CACzD,CACH,CAEL,CAAC;AAEd,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","Fragment","useLexicalEditorConfig","useRichTextEditor","StaticToolbar","className","toolbarElements","editor","createElement","isEditable","map","action","key","name","element"],"sources":["StaticToolbar.tsx"],"sourcesContent":["import React, { Fragment } from \"react\";\nimport \"./StaticToolbar.css\";\nimport { useLexicalEditorConfig } from \"~/components/LexicalEditorConfig/LexicalEditorConfig.js\";\nimport { useRichTextEditor } from \"~/hooks/index.js\";\n\nexport const StaticToolbar = ({ className }: { className?: string }) => {\n const { toolbarElements } = useLexicalEditorConfig();\n const { editor } = useRichTextEditor();\n\n return (\n <div className={className ?? \"static-toolbar\"} data-role={\"toolbar\"}>\n {editor.isEditable() && (\n <>\n {toolbarElements.map(action => (\n <Fragment key={action.name}>{action.element}</Fragment>\n ))}\n </>\n )}\n </div>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC;AACA,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,aAAa,GAAGA,CAAC;EAAEC;AAAkC,CAAC,KAAK;EACpE,MAAM;IAAEC;EAAgB,CAAC,GAAGJ,sBAAsB,CAAC,CAAC;EACpD,MAAM;IAAEK;EAAO,CAAC,GAAGJ,iBAAiB,CAAC,CAAC;EAEtC,oBACIH,KAAA,CAAAQ,aAAA;IAAKH,SAAS,EAAEA,SAAS,IAAI,gBAAiB;IAAC,aAAW;EAAU,GAC/DE,MAAM,CAACE,UAAU,CAAC,CAAC,iBAChBT,KAAA,CAAAQ,aAAA,CAAAR,KAAA,CAAAC,QAAA,QACKK,eAAe,CAACI,GAAG,CAACC,MAAM,iBACvBX,KAAA,CAAAQ,aAAA,CAACP,QAAQ;IAACW,GAAG,EAAED,MAAM,CAACE;EAAK,GAAEF,MAAM,CAACG,OAAkB,CACzD,CACH,CAEL,CAAC;AAEd,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FORMAT_TEXT_COMMAND } from "lexical";
|
|
3
|
-
import { useCurrentSelection } from "../../hooks/useCurrentSelection";
|
|
4
|
-
import { useRichTextEditor } from "../../hooks";
|
|
3
|
+
import { useCurrentSelection } from "../../hooks/useCurrentSelection.js";
|
|
4
|
+
import { useRichTextEditor } from "../../hooks/index.js";
|
|
5
5
|
export const BoldAction = () => {
|
|
6
6
|
const {
|
|
7
7
|
editor
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","FORMAT_TEXT_COMMAND","useCurrentSelection","useRichTextEditor","BoldAction","editor","rangeSelection","isBoldSelected","hasFormat","handleClick","dispatchCommand","createElement","onClick","className"],"sources":["BoldAction.tsx"],"sourcesContent":["import React from \"react\";\nimport { FORMAT_TEXT_COMMAND } from \"lexical\";\nimport { useCurrentSelection } from \"~/hooks/useCurrentSelection\";\nimport { useRichTextEditor } from \"~/hooks\";\n\nexport const BoldAction = () => {\n const { editor } = useRichTextEditor();\n const { rangeSelection } = useCurrentSelection();\n const isBoldSelected = rangeSelection ? rangeSelection.hasFormat(\"bold\") : false;\n\n const handleClick = () => {\n editor.dispatchCommand(FORMAT_TEXT_COMMAND, \"bold\");\n };\n\n return (\n <button\n onClick={handleClick}\n className={\"popup-item spaced \" + (isBoldSelected ? \"active\" : \"\")}\n aria-label=\"Format text as bold\"\n >\n <i className=\"format bold\" />\n </button>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,mBAAmB,QAAQ,SAAS;AAC7C,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,UAAU,GAAGA,CAAA,KAAM;EAC5B,MAAM;IAAEC;EAAO,CAAC,GAAGF,iBAAiB,CAAC,CAAC;EACtC,MAAM;IAAEG;EAAe,CAAC,GAAGJ,mBAAmB,CAAC,CAAC;EAChD,MAAMK,cAAc,GAAGD,cAAc,GAAGA,cAAc,CAACE,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK;EAEhF,MAAMC,WAAW,GAAGA,CAAA,KAAM;IACtBJ,MAAM,CAACK,eAAe,CAACT,mBAAmB,EAAE,MAAM,CAAC;EACvD,CAAC;EAED,oBACID,KAAA,CAAAW,aAAA;IACIC,OAAO,EAAEH,WAAY;IACrBI,SAAS,EAAE,oBAAoB,IAAIN,cAAc,GAAG,QAAQ,GAAG,EAAE,CAAE;IACnE,cAAW;EAAqB,gBAEhCP,KAAA,CAAAW,aAAA;IAAGE,SAAS,EAAC;EAAa,CAAE,CACxB,CAAC;AAEjB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","FORMAT_TEXT_COMMAND","useCurrentSelection","useRichTextEditor","BoldAction","editor","rangeSelection","isBoldSelected","hasFormat","handleClick","dispatchCommand","createElement","onClick","className"],"sources":["BoldAction.tsx"],"sourcesContent":["import React from \"react\";\nimport { FORMAT_TEXT_COMMAND } from \"lexical\";\nimport { useCurrentSelection } from \"~/hooks/useCurrentSelection.js\";\nimport { useRichTextEditor } from \"~/hooks/index.js\";\n\nexport const BoldAction = () => {\n const { editor } = useRichTextEditor();\n const { rangeSelection } = useCurrentSelection();\n const isBoldSelected = rangeSelection ? rangeSelection.hasFormat(\"bold\") : false;\n\n const handleClick = () => {\n editor.dispatchCommand(FORMAT_TEXT_COMMAND, \"bold\");\n };\n\n return (\n <button\n onClick={handleClick}\n className={\"popup-item spaced \" + (isBoldSelected ? \"active\" : \"\")}\n aria-label=\"Format text as bold\"\n >\n <i className=\"format bold\" />\n </button>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,mBAAmB,QAAQ,SAAS;AAC7C,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,UAAU,GAAGA,CAAA,KAAM;EAC5B,MAAM;IAAEC;EAAO,CAAC,GAAGF,iBAAiB,CAAC,CAAC;EACtC,MAAM;IAAEG;EAAe,CAAC,GAAGJ,mBAAmB,CAAC,CAAC;EAChD,MAAMK,cAAc,GAAGD,cAAc,GAAGA,cAAc,CAACE,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK;EAEhF,MAAMC,WAAW,GAAGA,CAAA,KAAM;IACtBJ,MAAM,CAACK,eAAe,CAACT,mBAAmB,EAAE,MAAM,CAAC;EACvD,CAAC;EAED,oBACID,KAAA,CAAAW,aAAA;IACIC,OAAO,EAAEH,WAAY;IACrBI,SAAS,EAAE,oBAAoB,IAAIN,cAAc,GAAG,QAAQ,GAAG,EAAE,CAAE;IACnE,cAAW;EAAqB,gBAEhCP,KAAA,CAAAW,aAAA;IAAGE,SAAS,EAAC;EAAa,CAAE,CACxB,CAAC;AAEjB,CAAC","ignoreList":[]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { INSERT_UNORDERED_LIST_COMMAND, REMOVE_LIST_COMMAND } from "../../commands";
|
|
3
|
-
import { useRichTextEditor } from "../../hooks/useRichTextEditor";
|
|
4
|
-
import { findTypographyStyleByHtmlTag } from "@webiny/lexical-theme";
|
|
2
|
+
import { INSERT_UNORDERED_LIST_COMMAND, REMOVE_LIST_COMMAND } from "../../commands/index.js";
|
|
3
|
+
import { useRichTextEditor } from "../../hooks/useRichTextEditor.js";
|
|
5
4
|
import { $isListNode } from "@webiny/lexical-nodes";
|
|
6
|
-
import { useCurrentElement } from "../../hooks/useCurrentElement";
|
|
5
|
+
import { useCurrentElement } from "../../hooks/useCurrentElement.js";
|
|
7
6
|
export const BulletListAction = () => {
|
|
8
7
|
const {
|
|
9
8
|
editor
|
|
@@ -12,13 +11,13 @@ export const BulletListAction = () => {
|
|
|
12
11
|
element
|
|
13
12
|
} = useCurrentElement();
|
|
14
13
|
const {
|
|
15
|
-
|
|
14
|
+
theme
|
|
16
15
|
} = useRichTextEditor();
|
|
17
16
|
const isList = $isListNode(element);
|
|
18
17
|
const isBullet = isList && element.getListType() === "bullet";
|
|
19
18
|
const formatBulletList = () => {
|
|
20
19
|
if (!isBullet) {
|
|
21
|
-
const styleId =
|
|
20
|
+
const styleId = theme.getTypographyByTag("ul")?.id;
|
|
22
21
|
|
|
23
22
|
// will update the active state in the useEffect
|
|
24
23
|
editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","INSERT_UNORDERED_LIST_COMMAND","REMOVE_LIST_COMMAND","useRichTextEditor","
|
|
1
|
+
{"version":3,"names":["React","INSERT_UNORDERED_LIST_COMMAND","REMOVE_LIST_COMMAND","useRichTextEditor","$isListNode","useCurrentElement","BulletListAction","editor","element","theme","isList","isBullet","getListType","formatBulletList","styleId","getTypographyByTag","id","dispatchCommand","themeStyleId","undefined","createElement","onClick","className"],"sources":["BulletListAction.tsx"],"sourcesContent":["import React from \"react\";\nimport { INSERT_UNORDERED_LIST_COMMAND, REMOVE_LIST_COMMAND } from \"~/commands/index.js\";\nimport { useRichTextEditor } from \"~/hooks/useRichTextEditor.js\";\nimport type { ListNode } from \"@webiny/lexical-nodes\";\nimport { $isListNode } from \"@webiny/lexical-nodes\";\nimport { useCurrentElement } from \"~/hooks/useCurrentElement.js\";\n\nexport const BulletListAction = () => {\n const { editor } = useRichTextEditor();\n const { element } = useCurrentElement();\n const { theme } = useRichTextEditor();\n const isList = $isListNode(element);\n\n const isBullet = isList && (element as ListNode).getListType() === \"bullet\";\n\n const formatBulletList = () => {\n if (!isBullet) {\n const styleId = theme.getTypographyByTag(\"ul\")?.id;\n\n // will update the active state in the useEffect\n editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, { themeStyleId: styleId });\n } else {\n editor.dispatchCommand(REMOVE_LIST_COMMAND, undefined);\n }\n };\n\n return (\n <button\n onClick={() => formatBulletList()}\n className={\"popup-item spaced \" + (isBullet ? \"active\" : \"\")}\n aria-label=\"Format text as bullet list\"\n >\n <i className=\"icon bullet-list\" />\n </button>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,6BAA6B,EAAEC,mBAAmB;AAC3D,SAASC,iBAAiB;AAE1B,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EAClC,MAAM;IAAEC;EAAO,CAAC,GAAGJ,iBAAiB,CAAC,CAAC;EACtC,MAAM;IAAEK;EAAQ,CAAC,GAAGH,iBAAiB,CAAC,CAAC;EACvC,MAAM;IAAEI;EAAM,CAAC,GAAGN,iBAAiB,CAAC,CAAC;EACrC,MAAMO,MAAM,GAAGN,WAAW,CAACI,OAAO,CAAC;EAEnC,MAAMG,QAAQ,GAAGD,MAAM,IAAKF,OAAO,CAAcI,WAAW,CAAC,CAAC,KAAK,QAAQ;EAE3E,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;IAC3B,IAAI,CAACF,QAAQ,EAAE;MACX,MAAMG,OAAO,GAAGL,KAAK,CAACM,kBAAkB,CAAC,IAAI,CAAC,EAAEC,EAAE;;MAElD;MACAT,MAAM,CAACU,eAAe,CAAChB,6BAA6B,EAAE;QAAEiB,YAAY,EAAEJ;MAAQ,CAAC,CAAC;IACpF,CAAC,MAAM;MACHP,MAAM,CAACU,eAAe,CAACf,mBAAmB,EAAEiB,SAAS,CAAC;IAC1D;EACJ,CAAC;EAED,oBACInB,KAAA,CAAAoB,aAAA;IACIC,OAAO,EAAEA,CAAA,KAAMR,gBAAgB,CAAC,CAAE;IAClCS,SAAS,EAAE,oBAAoB,IAAIX,QAAQ,GAAG,QAAQ,GAAG,EAAE,CAAE;IAC7D,cAAW;EAA4B,gBAEvCX,KAAA,CAAAoB,aAAA;IAAGE,SAAS,EAAC;EAAkB,CAAE,CAC7B,CAAC;AAEjB,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FORMAT_TEXT_COMMAND } from "lexical";
|
|
3
|
-
import { useCurrentSelection } from "../../hooks/useCurrentSelection";
|
|
4
|
-
import { useRichTextEditor } from "../../hooks";
|
|
3
|
+
import { useCurrentSelection } from "../../hooks/useCurrentSelection.js";
|
|
4
|
+
import { useRichTextEditor } from "../../hooks/index.js";
|
|
5
5
|
export const CodeHighlightAction = () => {
|
|
6
6
|
const {
|
|
7
7
|
editor
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","FORMAT_TEXT_COMMAND","useCurrentSelection","useRichTextEditor","CodeHighlightAction","editor","rangeSelection","isCodeSelected","hasFormat","handleClick","dispatchCommand","createElement","onClick","className"],"sources":["CodeHighlightAction.tsx"],"sourcesContent":["import React from \"react\";\nimport { FORMAT_TEXT_COMMAND } from \"lexical\";\nimport { useCurrentSelection } from \"~/hooks/useCurrentSelection\";\nimport { useRichTextEditor } from \"~/hooks\";\n\nexport const CodeHighlightAction = () => {\n const { editor } = useRichTextEditor();\n const { rangeSelection } = useCurrentSelection();\n const isCodeSelected = rangeSelection ? rangeSelection.hasFormat(\"code\") : false;\n\n const handleClick = () => {\n editor.dispatchCommand(FORMAT_TEXT_COMMAND, \"code\");\n };\n\n return (\n <button\n onClick={handleClick}\n className={\"popup-item spaced \" + (isCodeSelected ? \"active\" : \"\")}\n aria-label=\"Text code highlight\"\n >\n <i className=\"format code\" />\n </button>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,mBAAmB,QAAQ,SAAS;AAC7C,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACrC,MAAM;IAAEC;EAAO,CAAC,GAAGF,iBAAiB,CAAC,CAAC;EACtC,MAAM;IAAEG;EAAe,CAAC,GAAGJ,mBAAmB,CAAC,CAAC;EAChD,MAAMK,cAAc,GAAGD,cAAc,GAAGA,cAAc,CAACE,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK;EAEhF,MAAMC,WAAW,GAAGA,CAAA,KAAM;IACtBJ,MAAM,CAACK,eAAe,CAACT,mBAAmB,EAAE,MAAM,CAAC;EACvD,CAAC;EAED,oBACID,KAAA,CAAAW,aAAA;IACIC,OAAO,EAAEH,WAAY;IACrBI,SAAS,EAAE,oBAAoB,IAAIN,cAAc,GAAG,QAAQ,GAAG,EAAE,CAAE;IACnE,cAAW;EAAqB,gBAEhCP,KAAA,CAAAW,aAAA;IAAGE,SAAS,EAAC;EAAa,CAAE,CACxB,CAAC;AAEjB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","FORMAT_TEXT_COMMAND","useCurrentSelection","useRichTextEditor","CodeHighlightAction","editor","rangeSelection","isCodeSelected","hasFormat","handleClick","dispatchCommand","createElement","onClick","className"],"sources":["CodeHighlightAction.tsx"],"sourcesContent":["import React from \"react\";\nimport { FORMAT_TEXT_COMMAND } from \"lexical\";\nimport { useCurrentSelection } from \"~/hooks/useCurrentSelection.js\";\nimport { useRichTextEditor } from \"~/hooks/index.js\";\n\nexport const CodeHighlightAction = () => {\n const { editor } = useRichTextEditor();\n const { rangeSelection } = useCurrentSelection();\n const isCodeSelected = rangeSelection ? rangeSelection.hasFormat(\"code\") : false;\n\n const handleClick = () => {\n editor.dispatchCommand(FORMAT_TEXT_COMMAND, \"code\");\n };\n\n return (\n <button\n onClick={handleClick}\n className={\"popup-item spaced \" + (isCodeSelected ? \"active\" : \"\")}\n aria-label=\"Text code highlight\"\n >\n <i className=\"format code\" />\n </button>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,mBAAmB,QAAQ,SAAS;AAC7C,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACrC,MAAM;IAAEC;EAAO,CAAC,GAAGF,iBAAiB,CAAC,CAAC;EACtC,MAAM;IAAEG;EAAe,CAAC,GAAGJ,mBAAmB,CAAC,CAAC;EAChD,MAAMK,cAAc,GAAGD,cAAc,GAAGA,cAAc,CAACE,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK;EAEhF,MAAMC,WAAW,GAAGA,CAAA,KAAM;IACtBJ,MAAM,CAACK,eAAe,CAACT,mBAAmB,EAAE,MAAM,CAAC;EACvD,CAAC;EAED,oBACID,KAAA,CAAAW,aAAA;IACIC,OAAO,EAAEH,WAAY;IACrBI,SAAS,EAAE,oBAAoB,IAAIN,cAAc,GAAG,QAAQ,GAAG,EAAE,CAAE;IACnE,cAAW;EAAqB,gBAEhCP,KAAA,CAAAW,aAAA;IAAGE,SAAS,EAAC;EAAa,CAAE,CACxB,CAAC;AAEjB,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo } from "react";
|
|
2
2
|
import { Compose, makeDecoratable } from "@webiny/react-composition";
|
|
3
|
-
import { FontColorActionContext } from "../../context/FontColorActionContext";
|
|
3
|
+
import { FontColorActionContext } from "../../context/FontColorActionContext.js";
|
|
4
4
|
import { $isFontColorNode, ADD_FONT_COLOR_COMMAND, ThemeColorValue } from "@webiny/lexical-nodes";
|
|
5
|
-
import { getSelectedNode } from "../../utils/getSelectedNode";
|
|
6
|
-
import { useDeriveValueFromSelection } from "../../hooks/useCurrentSelection";
|
|
7
|
-
import { useRichTextEditor } from "../../hooks";
|
|
5
|
+
import { getSelectedNode } from "../../utils/getSelectedNode.js";
|
|
6
|
+
import { useDeriveValueFromSelection } from "../../hooks/useCurrentSelection.js";
|
|
7
|
+
import { useRichTextEditor } from "../../hooks/index.js";
|
|
8
8
|
export const FontColorPicker = makeDecoratable("FontColorPicker", () => {
|
|
9
9
|
useEffect(() => {
|
|
10
10
|
console.log("Default FontColorPicker, please add your own component");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useEffect","useMemo","Compose","makeDecoratable","FontColorActionContext","$isFontColorNode","ADD_FONT_COLOR_COMMAND","ThemeColorValue","getSelectedNode","useDeriveValueFromSelection","useRichTextEditor","FontColorPicker","console","log","FontActionColorPicker","element","createElement","component","with","FontColorAction","editor","fontColor","rangeSelection","node","getColorStyle","color","onFontColorSelect","colorValue","themeColorName","dispatchCommand","context","value","applyColor","Provider","ColorPicker"],"sources":["FontColorAction.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo } from \"react\";\nimport type { LexicalCommand } from \"lexical\";\nimport { Compose, makeDecoratable } from \"@webiny/react-composition\";\nimport { FontColorActionContext } from \"~/context/FontColorActionContext\";\nimport type { FontColorPayload } from \"@webiny/lexical-nodes\";\nimport { $isFontColorNode, ADD_FONT_COLOR_COMMAND, ThemeColorValue } from \"@webiny/lexical-nodes\";\nimport { getSelectedNode } from \"~/utils/getSelectedNode\";\nimport { useDeriveValueFromSelection } from \"~/hooks/useCurrentSelection\";\nimport { useRichTextEditor } from \"~/hooks\";\n\nexport const FontColorPicker = makeDecoratable(\"FontColorPicker\", (): JSX.Element | null => {\n useEffect(() => {\n console.log(\"Default FontColorPicker, please add your own component\");\n }, []);\n return null;\n});\n\ninterface FontActionColorPicker {\n element: JSX.Element;\n}\n\nconst FontActionColorPicker = ({ element }: FontActionColorPicker): JSX.Element => {\n return <Compose component={FontColorPicker} with={() => () => element} />;\n};\n\nexport type FontColorAction = React.ComponentType<unknown> & {\n ColorPicker: typeof FontActionColorPicker;\n};\n\nexport const FontColorAction: FontColorAction = () => {\n const { editor } = useRichTextEditor();\n const fontColor = useDeriveValueFromSelection(({ rangeSelection }) => {\n if (!rangeSelection) {\n return \"#000\";\n }\n\n const node = getSelectedNode(rangeSelection);\n return $isFontColorNode(node) ? node.getColorStyle().color : \"#000\";\n });\n\n const onFontColorSelect = useCallback(\n (colorValue: string, themeColorName: string | undefined) => {\n editor.dispatchCommand<LexicalCommand<FontColorPayload>>(ADD_FONT_COLOR_COMMAND, {\n color: new ThemeColorValue(colorValue, themeColorName)\n });\n },\n []\n );\n\n const context = useMemo(\n () => ({\n value: fontColor,\n applyColor: onFontColorSelect\n }),\n [onFontColorSelect, fontColor]\n );\n\n return (\n <FontColorActionContext.Provider value={context}>\n <FontColorPicker />\n </FontColorActionContext.Provider>\n );\n};\n\nFontColorAction.ColorPicker = FontActionColorPicker;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAE9D,SAASC,OAAO,EAAEC,eAAe,QAAQ,2BAA2B;AACpE,SAASC,sBAAsB;AAE/B,SAASC,gBAAgB,EAAEC,sBAAsB,EAAEC,eAAe,QAAQ,uBAAuB;AACjG,SAASC,eAAe;AACxB,SAASC,2BAA2B;AACpC,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,eAAe,GAAGR,eAAe,CAAC,iBAAiB,EAAE,MAA0B;EACxFH,SAAS,CAAC,MAAM;IACZY,OAAO,CAACC,GAAG,CAAC,wDAAwD,CAAC;EACzE,CAAC,EAAE,EAAE,CAAC;EACN,OAAO,IAAI;AACf,CAAC,CAAC;AAMF,MAAMC,qBAAqB,GAAGA,CAAC;EAAEC;AAA+B,CAAC,KAAkB;EAC/E,oBAAOjB,KAAA,CAAAkB,aAAA,CAACd,OAAO;IAACe,SAAS,EAAEN,eAAgB;IAACO,IAAI,EAAEA,CAAA,KAAM,MAAMH;EAAQ,CAAE,CAAC;AAC7E,CAAC;AAMD,OAAO,MAAMI,eAAgC,GAAGA,CAAA,KAAM;EAClD,MAAM;IAAEC;EAAO,CAAC,GAAGV,iBAAiB,CAAC,CAAC;EACtC,MAAMW,SAAS,GAAGZ,2BAA2B,CAAC,CAAC;IAAEa;EAAe,CAAC,KAAK;IAClE,IAAI,CAACA,cAAc,EAAE;MACjB,OAAO,MAAM;IACjB;IAEA,MAAMC,IAAI,GAAGf,eAAe,CAACc,cAAc,CAAC;IAC5C,OAAOjB,gBAAgB,CAACkB,IAAI,CAAC,GAAGA,IAAI,CAACC,aAAa,CAAC,CAAC,CAACC,KAAK,GAAG,MAAM;EACvE,CAAC,CAAC;EAEF,MAAMC,iBAAiB,GAAG3B,WAAW,CACjC,CAAC4B,UAAkB,EAAEC,cAAkC,KAAK;IACxDR,MAAM,CAACS,eAAe,CAAmCvB,sBAAsB,EAAE;MAC7EmB,KAAK,EAAE,IAAIlB,eAAe,CAACoB,UAAU,EAAEC,cAAc;IACzD,CAAC,CAAC;EACN,CAAC,EACD,EACJ,CAAC;EAED,MAAME,OAAO,GAAG7B,OAAO,CACnB,OAAO;IACH8B,KAAK,EAAEV,SAAS;IAChBW,UAAU,EAAEN;EAChB,CAAC,CAAC,EACF,CAACA,iBAAiB,EAAEL,SAAS,CACjC,CAAC;EAED,oBACIvB,KAAA,CAAAkB,aAAA,CAACZ,sBAAsB,CAAC6B,QAAQ;IAACF,KAAK,EAAED;EAAQ,gBAC5ChC,KAAA,CAAAkB,aAAA,CAACL,eAAe,MAAE,CACW,CAAC;AAE1C,CAAC;AAEDQ,eAAe,CAACe,WAAW,GAAGpB,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useMemo","Compose","makeDecoratable","FontColorActionContext","$isFontColorNode","ADD_FONT_COLOR_COMMAND","ThemeColorValue","getSelectedNode","useDeriveValueFromSelection","useRichTextEditor","FontColorPicker","console","log","FontActionColorPicker","element","createElement","component","with","FontColorAction","editor","fontColor","rangeSelection","node","getColorStyle","color","onFontColorSelect","colorValue","themeColorName","dispatchCommand","context","value","applyColor","Provider","ColorPicker"],"sources":["FontColorAction.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo } from \"react\";\nimport type { LexicalCommand } from \"lexical\";\nimport { Compose, makeDecoratable } from \"@webiny/react-composition\";\nimport { FontColorActionContext } from \"~/context/FontColorActionContext.js\";\nimport type { FontColorPayload } from \"@webiny/lexical-nodes\";\nimport { $isFontColorNode, ADD_FONT_COLOR_COMMAND, ThemeColorValue } from \"@webiny/lexical-nodes\";\nimport { getSelectedNode } from \"~/utils/getSelectedNode.js\";\nimport { useDeriveValueFromSelection } from \"~/hooks/useCurrentSelection.js\";\nimport { useRichTextEditor } from \"~/hooks/index.js\";\n\nexport const FontColorPicker = makeDecoratable(\"FontColorPicker\", (): JSX.Element | null => {\n useEffect(() => {\n console.log(\"Default FontColorPicker, please add your own component\");\n }, []);\n return null;\n});\n\ninterface FontActionColorPicker {\n element: JSX.Element;\n}\n\nconst FontActionColorPicker = ({ element }: FontActionColorPicker): JSX.Element => {\n return <Compose component={FontColorPicker} with={() => () => element} />;\n};\n\nexport type FontColorAction = React.ComponentType<unknown> & {\n ColorPicker: typeof FontActionColorPicker;\n};\n\nexport const FontColorAction: FontColorAction = () => {\n const { editor } = useRichTextEditor();\n const fontColor = useDeriveValueFromSelection(({ rangeSelection }) => {\n if (!rangeSelection) {\n return \"#000\";\n }\n\n const node = getSelectedNode(rangeSelection);\n return $isFontColorNode(node) ? node.getColorStyle().color : \"#000\";\n });\n\n const onFontColorSelect = useCallback(\n (colorValue: string, themeColorName: string | undefined) => {\n editor.dispatchCommand<LexicalCommand<FontColorPayload>>(ADD_FONT_COLOR_COMMAND, {\n color: new ThemeColorValue(colorValue, themeColorName)\n });\n },\n []\n );\n\n const context = useMemo(\n () => ({\n value: fontColor,\n applyColor: onFontColorSelect\n }),\n [onFontColorSelect, fontColor]\n );\n\n return (\n <FontColorActionContext.Provider value={context}>\n <FontColorPicker />\n </FontColorActionContext.Provider>\n );\n};\n\nFontColorAction.ColorPicker = FontActionColorPicker;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAE9D,SAASC,OAAO,EAAEC,eAAe,QAAQ,2BAA2B;AACpE,SAASC,sBAAsB;AAE/B,SAASC,gBAAgB,EAAEC,sBAAsB,EAAEC,eAAe,QAAQ,uBAAuB;AACjG,SAASC,eAAe;AACxB,SAASC,2BAA2B;AACpC,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,eAAe,GAAGR,eAAe,CAAC,iBAAiB,EAAE,MAA0B;EACxFH,SAAS,CAAC,MAAM;IACZY,OAAO,CAACC,GAAG,CAAC,wDAAwD,CAAC;EACzE,CAAC,EAAE,EAAE,CAAC;EACN,OAAO,IAAI;AACf,CAAC,CAAC;AAMF,MAAMC,qBAAqB,GAAGA,CAAC;EAAEC;AAA+B,CAAC,KAAkB;EAC/E,oBAAOjB,KAAA,CAAAkB,aAAA,CAACd,OAAO;IAACe,SAAS,EAAEN,eAAgB;IAACO,IAAI,EAAEA,CAAA,KAAM,MAAMH;EAAQ,CAAE,CAAC;AAC7E,CAAC;AAMD,OAAO,MAAMI,eAAgC,GAAGA,CAAA,KAAM;EAClD,MAAM;IAAEC;EAAO,CAAC,GAAGV,iBAAiB,CAAC,CAAC;EACtC,MAAMW,SAAS,GAAGZ,2BAA2B,CAAC,CAAC;IAAEa;EAAe,CAAC,KAAK;IAClE,IAAI,CAACA,cAAc,EAAE;MACjB,OAAO,MAAM;IACjB;IAEA,MAAMC,IAAI,GAAGf,eAAe,CAACc,cAAc,CAAC;IAC5C,OAAOjB,gBAAgB,CAACkB,IAAI,CAAC,GAAGA,IAAI,CAACC,aAAa,CAAC,CAAC,CAACC,KAAK,GAAG,MAAM;EACvE,CAAC,CAAC;EAEF,MAAMC,iBAAiB,GAAG3B,WAAW,CACjC,CAAC4B,UAAkB,EAAEC,cAAkC,KAAK;IACxDR,MAAM,CAACS,eAAe,CAAmCvB,sBAAsB,EAAE;MAC7EmB,KAAK,EAAE,IAAIlB,eAAe,CAACoB,UAAU,EAAEC,cAAc;IACzD,CAAC,CAAC;EACN,CAAC,EACD,EACJ,CAAC;EAED,MAAME,OAAO,GAAG7B,OAAO,CACnB,OAAO;IACH8B,KAAK,EAAEV,SAAS;IAChBW,UAAU,EAAEN;EAChB,CAAC,CAAC,EACF,CAACA,iBAAiB,EAAEL,SAAS,CACjC,CAAC;EAED,oBACIvB,KAAA,CAAAkB,aAAA,CAACZ,sBAAsB,CAAC6B,QAAQ;IAACF,KAAK,EAAED;EAAQ,gBAC5ChC,KAAA,CAAAkB,aAAA,CAACL,eAAe,MAAE,CACW,CAAC;AAE1C,CAAC;AAEDQ,eAAe,CAACe,WAAW,GAAGpB,qBAAqB","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
|
-
import { useRichTextEditor } from "../../hooks/useRichTextEditor";
|
|
3
|
-
import { fileToImagePayload } from "../../utils/files";
|
|
4
|
-
import { INSERT_IMAGE_COMMAND } from "../../commands";
|
|
2
|
+
import { useRichTextEditor } from "../../hooks/useRichTextEditor.js";
|
|
3
|
+
import { fileToImagePayload } from "../../utils/files.js";
|
|
4
|
+
import { INSERT_IMAGE_COMMAND } from "../../commands/index.js";
|
|
5
5
|
export const ImageAction = () => {
|
|
6
6
|
const {
|
|
7
7
|
editor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useState","useRichTextEditor","fileToImagePayload","INSERT_IMAGE_COMMAND","ImageAction","editor","toolbarActionPlugins","imageActionPlugin","setImageActionPlugin","length","actionPlugin","find","action","targetAction","handleClick","plugin","cb","data","imagePayload","dispatchCommand","createElement","onClick","className"],"sources":["ImageAction.tsx"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\nimport type { LexicalCommand } from \"lexical\";\nimport { useRichTextEditor } from \"~/hooks/useRichTextEditor\";\nimport type { FileManagerFileItem } from \"~/utils/files\";\nimport { fileToImagePayload } from \"~/utils/files\";\nimport type { ImagePayload } from \"~/commands\";\nimport { INSERT_IMAGE_COMMAND } from \"~/commands\";\nimport type { ToolbarActionPlugin } from \"~/types\";\n\nexport const ImageAction = () => {\n const { editor, toolbarActionPlugins } = useRichTextEditor();\n const [imageActionPlugin, setImageActionPlugin] = useState<ToolbarActionPlugin | undefined>();\n\n useEffect(() => {\n if (!!toolbarActionPlugins?.length) {\n const actionPlugin = toolbarActionPlugins.find(\n action => action.targetAction === \"image-action\"\n );\n setImageActionPlugin(actionPlugin);\n }\n }, [toolbarActionPlugins]);\n\n const handleClick = () => {\n if (typeof imageActionPlugin?.plugin === \"function\") {\n const cb = (data: FileManagerFileItem) => {\n const imagePayload = fileToImagePayload(data);\n if (imagePayload) {\n editor.dispatchCommand<LexicalCommand<ImagePayload>>(\n INSERT_IMAGE_COMMAND,\n imagePayload\n );\n }\n };\n imageActionPlugin.plugin(cb);\n }\n };\n\n return (\n <button onClick={() => handleClick()} className={\"popup-item\"} aria-label=\"Insert image\">\n <i className=\"icon insert-image\" />\n </button>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAElD,SAASC,iBAAiB;AAE1B,SAASC,kBAAkB;AAE3B,SAASC,oBAAoB;AAG7B,OAAO,MAAMC,WAAW,GAAGA,CAAA,KAAM;EAC7B,MAAM;IAAEC,MAAM;IAAEC;EAAqB,CAAC,GAAGL,iBAAiB,CAAC,CAAC;EAC5D,MAAM,CAACM,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGR,QAAQ,CAAkC,CAAC;EAE7FD,SAAS,CAAC,MAAM;IACZ,IAAI,CAAC,CAACO,oBAAoB,EAAEG,MAAM,EAAE;MAChC,MAAMC,YAAY,GAAGJ,oBAAoB,CAACK,IAAI,CAC1CC,MAAM,IAAIA,MAAM,CAACC,YAAY,KAAK,cACtC,CAAC;MACDL,oBAAoB,CAACE,YAAY,CAAC;IACtC;EACJ,CAAC,EAAE,CAACJ,oBAAoB,CAAC,CAAC;EAE1B,MAAMQ,WAAW,GAAGA,CAAA,KAAM;IACtB,IAAI,OAAOP,iBAAiB,EAAEQ,MAAM,KAAK,UAAU,EAAE;MACjD,MAAMC,EAAE,GAAIC,IAAyB,IAAK;QACtC,MAAMC,YAAY,GAAGhB,kBAAkB,CAACe,IAAI,CAAC;QAC7C,IAAIC,YAAY,EAAE;UACdb,MAAM,CAACc,eAAe,CAClBhB,oBAAoB,EACpBe,YACJ,CAAC;QACL;MACJ,CAAC;MACDX,iBAAiB,CAACQ,MAAM,CAACC,EAAE,CAAC;IAChC;EACJ,CAAC;EAED,oBACIlB,KAAA,CAAAsB,aAAA;IAAQC,OAAO,EAAEA,CAAA,KAAMP,WAAW,CAAC,CAAE;IAACQ,SAAS,EAAE,YAAa;IAAC,cAAW;EAAc,gBACpFxB,KAAA,CAAAsB,aAAA;IAAGE,SAAS,EAAC;EAAmB,CAAE,CAC9B,CAAC;AAEjB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useEffect","useState","useRichTextEditor","fileToImagePayload","INSERT_IMAGE_COMMAND","ImageAction","editor","toolbarActionPlugins","imageActionPlugin","setImageActionPlugin","length","actionPlugin","find","action","targetAction","handleClick","plugin","cb","data","imagePayload","dispatchCommand","createElement","onClick","className"],"sources":["ImageAction.tsx"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\nimport type { LexicalCommand } from \"lexical\";\nimport { useRichTextEditor } from \"~/hooks/useRichTextEditor.js\";\nimport type { FileManagerFileItem } from \"~/utils/files.js\";\nimport { fileToImagePayload } from \"~/utils/files.js\";\nimport type { ImagePayload } from \"~/commands/index.js\";\nimport { INSERT_IMAGE_COMMAND } from \"~/commands/index.js\";\nimport type { ToolbarActionPlugin } from \"~/types.js\";\n\nexport const ImageAction = () => {\n const { editor, toolbarActionPlugins } = useRichTextEditor();\n const [imageActionPlugin, setImageActionPlugin] = useState<ToolbarActionPlugin | undefined>();\n\n useEffect(() => {\n if (!!toolbarActionPlugins?.length) {\n const actionPlugin = toolbarActionPlugins.find(\n action => action.targetAction === \"image-action\"\n );\n setImageActionPlugin(actionPlugin);\n }\n }, [toolbarActionPlugins]);\n\n const handleClick = () => {\n if (typeof imageActionPlugin?.plugin === \"function\") {\n const cb = (data: FileManagerFileItem) => {\n const imagePayload = fileToImagePayload(data);\n if (imagePayload) {\n editor.dispatchCommand<LexicalCommand<ImagePayload>>(\n INSERT_IMAGE_COMMAND,\n imagePayload\n );\n }\n };\n imageActionPlugin.plugin(cb);\n }\n };\n\n return (\n <button onClick={() => handleClick()} className={\"popup-item\"} aria-label=\"Insert image\">\n <i className=\"icon insert-image\" />\n </button>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAElD,SAASC,iBAAiB;AAE1B,SAASC,kBAAkB;AAE3B,SAASC,oBAAoB;AAG7B,OAAO,MAAMC,WAAW,GAAGA,CAAA,KAAM;EAC7B,MAAM;IAAEC,MAAM;IAAEC;EAAqB,CAAC,GAAGL,iBAAiB,CAAC,CAAC;EAC5D,MAAM,CAACM,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGR,QAAQ,CAAkC,CAAC;EAE7FD,SAAS,CAAC,MAAM;IACZ,IAAI,CAAC,CAACO,oBAAoB,EAAEG,MAAM,EAAE;MAChC,MAAMC,YAAY,GAAGJ,oBAAoB,CAACK,IAAI,CAC1CC,MAAM,IAAIA,MAAM,CAACC,YAAY,KAAK,cACtC,CAAC;MACDL,oBAAoB,CAACE,YAAY,CAAC;IACtC;EACJ,CAAC,EAAE,CAACJ,oBAAoB,CAAC,CAAC;EAE1B,MAAMQ,WAAW,GAAGA,CAAA,KAAM;IACtB,IAAI,OAAOP,iBAAiB,EAAEQ,MAAM,KAAK,UAAU,EAAE;MACjD,MAAMC,EAAE,GAAIC,IAAyB,IAAK;QACtC,MAAMC,YAAY,GAAGhB,kBAAkB,CAACe,IAAI,CAAC;QAC7C,IAAIC,YAAY,EAAE;UACdb,MAAM,CAACc,eAAe,CAClBhB,oBAAoB,EACpBe,YACJ,CAAC;QACL;MACJ,CAAC;MACDX,iBAAiB,CAACQ,MAAM,CAACC,EAAE,CAAC;IAChC;EACJ,CAAC;EAED,oBACIlB,KAAA,CAAAsB,aAAA;IAAQC,OAAO,EAAEA,CAAA,KAAMP,WAAW,CAAC,CAAE;IAACQ,SAAS,EAAE,YAAa;IAAC,cAAW;EAAc,gBACpFxB,KAAA,CAAAsB,aAAA;IAAGE,SAAS,EAAC;EAAmB,CAAE,CAC9B,CAAC;AAEjB,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FORMAT_TEXT_COMMAND } from "lexical";
|
|
3
|
-
import { useCurrentSelection } from "../../hooks/useCurrentSelection";
|
|
4
|
-
import { useRichTextEditor } from "../../hooks";
|
|
3
|
+
import { useCurrentSelection } from "../../hooks/useCurrentSelection.js";
|
|
4
|
+
import { useRichTextEditor } from "../../hooks/index.js";
|
|
5
5
|
export const ItalicAction = () => {
|
|
6
6
|
const {
|
|
7
7
|
editor
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","FORMAT_TEXT_COMMAND","useCurrentSelection","useRichTextEditor","ItalicAction","editor","rangeSelection","isItalicSelected","hasFormat","handleClick","dispatchCommand","createElement","onClick","className"],"sources":["ItalicAction.tsx"],"sourcesContent":["import React from \"react\";\nimport { FORMAT_TEXT_COMMAND } from \"lexical\";\nimport { useCurrentSelection } from \"~/hooks/useCurrentSelection\";\nimport { useRichTextEditor } from \"~/hooks\";\n\nexport const ItalicAction = () => {\n const { editor } = useRichTextEditor();\n const { rangeSelection } = useCurrentSelection();\n const isItalicSelected = rangeSelection ? rangeSelection.hasFormat(\"italic\") : false;\n\n const handleClick = () => {\n editor.dispatchCommand(FORMAT_TEXT_COMMAND, \"italic\");\n };\n\n return (\n <button\n onClick={handleClick}\n className={\"popup-item spaced \" + (isItalicSelected ? \"active\" : \"\")}\n aria-label=\"Format text as italic\"\n >\n <i className=\"format italic\" />\n </button>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,mBAAmB,QAAQ,SAAS;AAC7C,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM;IAAEC;EAAO,CAAC,GAAGF,iBAAiB,CAAC,CAAC;EACtC,MAAM;IAAEG;EAAe,CAAC,GAAGJ,mBAAmB,CAAC,CAAC;EAChD,MAAMK,gBAAgB,GAAGD,cAAc,GAAGA,cAAc,CAACE,SAAS,CAAC,QAAQ,CAAC,GAAG,KAAK;EAEpF,MAAMC,WAAW,GAAGA,CAAA,KAAM;IACtBJ,MAAM,CAACK,eAAe,CAACT,mBAAmB,EAAE,QAAQ,CAAC;EACzD,CAAC;EAED,oBACID,KAAA,CAAAW,aAAA;IACIC,OAAO,EAAEH,WAAY;IACrBI,SAAS,EAAE,oBAAoB,IAAIN,gBAAgB,GAAG,QAAQ,GAAG,EAAE,CAAE;IACrE,cAAW;EAAuB,gBAElCP,KAAA,CAAAW,aAAA;IAAGE,SAAS,EAAC;EAAe,CAAE,CAC1B,CAAC;AAEjB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","FORMAT_TEXT_COMMAND","useCurrentSelection","useRichTextEditor","ItalicAction","editor","rangeSelection","isItalicSelected","hasFormat","handleClick","dispatchCommand","createElement","onClick","className"],"sources":["ItalicAction.tsx"],"sourcesContent":["import React from \"react\";\nimport { FORMAT_TEXT_COMMAND } from \"lexical\";\nimport { useCurrentSelection } from \"~/hooks/useCurrentSelection.js\";\nimport { useRichTextEditor } from \"~/hooks/index.js\";\n\nexport const ItalicAction = () => {\n const { editor } = useRichTextEditor();\n const { rangeSelection } = useCurrentSelection();\n const isItalicSelected = rangeSelection ? rangeSelection.hasFormat(\"italic\") : false;\n\n const handleClick = () => {\n editor.dispatchCommand(FORMAT_TEXT_COMMAND, \"italic\");\n };\n\n return (\n <button\n onClick={handleClick}\n className={\"popup-item spaced \" + (isItalicSelected ? \"active\" : \"\")}\n aria-label=\"Format text as italic\"\n >\n <i className=\"format italic\" />\n </button>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,mBAAmB,QAAQ,SAAS;AAC7C,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM;IAAEC;EAAO,CAAC,GAAGF,iBAAiB,CAAC,CAAC;EACtC,MAAM;IAAEG;EAAe,CAAC,GAAGJ,mBAAmB,CAAC,CAAC;EAChD,MAAMK,gBAAgB,GAAGD,cAAc,GAAGA,cAAc,CAACE,SAAS,CAAC,QAAQ,CAAC,GAAG,KAAK;EAEpF,MAAMC,WAAW,GAAGA,CAAA,KAAM;IACtBJ,MAAM,CAACK,eAAe,CAACT,mBAAmB,EAAE,QAAQ,CAAC;EACzD,CAAC;EAED,oBACID,KAAA,CAAAW,aAAA;IACIC,OAAO,EAAEH,WAAY;IACrBI,SAAS,EAAE,oBAAoB,IAAIN,gBAAgB,GAAG,QAAQ,GAAG,EAAE,CAAE;IACrE,cAAW;EAAuB,gBAElCP,KAAA,CAAAW,aAAA;IAAGE,SAAS,EAAC;EAAe,CAAE,CAC1B,CAAC;AAEjB,CAAC","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
2
|
import { $isLinkNode, TOGGLE_LINK_COMMAND } from "@webiny/lexical-nodes";
|
|
3
|
-
import { getNodeFromSelection } from "../../hooks/useCurrentElement";
|
|
4
|
-
import { useDeriveValueFromSelection } from "../../hooks/useCurrentSelection";
|
|
5
|
-
import { useRichTextEditor } from "../../hooks";
|
|
3
|
+
import { getNodeFromSelection } from "../../hooks/useCurrentElement.js";
|
|
4
|
+
import { useDeriveValueFromSelection } from "../../hooks/useCurrentSelection.js";
|
|
5
|
+
import { useRichTextEditor } from "../../hooks/index.js";
|
|
6
6
|
export const LinkAction = () => {
|
|
7
7
|
const {
|
|
8
8
|
editor
|