@squiz/formatted-text-editor 1.21.1-alpha.3 → 1.21.1-alpha.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/demo/App.tsx +45 -10
- package/demo/index.scss +11 -10
- package/jest.config.ts +0 -2
- package/lib/Editor/Editor.d.ts +1 -0
- package/lib/Editor/Editor.js +45 -7
- package/lib/Editor/EditorContext.d.ts +10 -0
- package/lib/Editor/EditorContext.js +15 -0
- package/lib/EditorToolbar/FloatingToolbar.d.ts +1 -0
- package/lib/EditorToolbar/FloatingToolbar.js +11 -5
- package/lib/EditorToolbar/Toolbar.d.ts +1 -0
- package/lib/EditorToolbar/Toolbar.js +3 -1
- package/lib/EditorToolbar/Tools/Bold/BoldButton.d.ts +1 -0
- package/lib/EditorToolbar/Tools/Bold/BoldButton.js +2 -2
- package/lib/EditorToolbar/Tools/Image/Form/ImageForm.d.ts +17 -0
- package/lib/EditorToolbar/Tools/Image/Form/ImageForm.js +82 -0
- package/lib/EditorToolbar/Tools/Image/ImageButton.d.ts +6 -0
- package/lib/EditorToolbar/Tools/Image/ImageButton.js +77 -0
- package/lib/EditorToolbar/Tools/Image/ImageModal.d.ts +9 -0
- package/lib/EditorToolbar/Tools/Image/ImageModal.js +16 -0
- package/lib/EditorToolbar/Tools/Italic/ItalicButton.d.ts +1 -0
- package/lib/EditorToolbar/Tools/Italic/ItalicButton.js +2 -2
- package/lib/EditorToolbar/Tools/Link/Form/LinkForm.d.ts +14 -5
- package/lib/EditorToolbar/Tools/Link/Form/LinkForm.js +67 -15
- package/lib/EditorToolbar/Tools/Link/LinkButton.d.ts +1 -0
- package/lib/EditorToolbar/Tools/Link/LinkButton.js +22 -14
- package/lib/EditorToolbar/Tools/Link/LinkModal.d.ts +1 -0
- package/lib/EditorToolbar/Tools/Link/LinkModal.js +12 -5
- package/lib/EditorToolbar/Tools/Link/RemoveLinkButton.d.ts +1 -0
- package/lib/EditorToolbar/Tools/Link/RemoveLinkButton.js +2 -9
- package/lib/EditorToolbar/Tools/Redo/RedoButton.d.ts +1 -0
- package/lib/EditorToolbar/Tools/Redo/RedoButton.js +2 -2
- package/lib/EditorToolbar/Tools/TextAlign/CenterAlign/CenterAlignButton.d.ts +1 -0
- package/lib/EditorToolbar/Tools/TextAlign/CenterAlign/CenterAlignButton.js +2 -2
- package/lib/EditorToolbar/Tools/TextAlign/JustifyAlign/JustifyAlignButton.d.ts +1 -0
- package/lib/EditorToolbar/Tools/TextAlign/JustifyAlign/JustifyAlignButton.js +2 -2
- package/lib/EditorToolbar/Tools/TextAlign/LeftAlign/LeftAlignButton.d.ts +1 -0
- package/lib/EditorToolbar/Tools/TextAlign/LeftAlign/LeftAlignButton.js +2 -2
- package/lib/EditorToolbar/Tools/TextAlign/RightAlign/RightAlignButton.d.ts +1 -0
- package/lib/EditorToolbar/Tools/TextAlign/RightAlign/RightAlignButton.js +2 -2
- package/lib/EditorToolbar/Tools/TextAlign/TextAlignButtons.d.ts +1 -0
- package/lib/EditorToolbar/Tools/TextType/Heading/HeadingButton.d.ts +1 -0
- package/lib/EditorToolbar/Tools/TextType/Paragraph/ParagraphButton.d.ts +1 -0
- package/lib/EditorToolbar/Tools/TextType/Preformatted/PreformattedButton.d.ts +1 -0
- package/lib/EditorToolbar/Tools/TextType/TextTypeDropdown.d.ts +1 -0
- package/lib/EditorToolbar/Tools/Underline/UnderlineButton.d.ts +1 -0
- package/lib/EditorToolbar/Tools/Underline/UnderlineButton.js +2 -2
- package/lib/EditorToolbar/Tools/Undo/UndoButton.d.ts +1 -0
- package/lib/EditorToolbar/Tools/Undo/UndoButton.js +2 -2
- package/lib/Extensions/CommandsExtension/CommandsExtension.d.ts +20 -0
- package/lib/Extensions/CommandsExtension/CommandsExtension.js +52 -0
- package/lib/Extensions/Extensions.d.ts +7 -4
- package/lib/Extensions/Extensions.js +32 -19
- package/lib/Extensions/ImageExtension/ImageExtension.d.ts +10 -0
- package/lib/Extensions/ImageExtension/ImageExtension.js +92 -0
- package/lib/Extensions/LinkExtension/AssetLinkExtension.d.ts +26 -0
- package/lib/Extensions/LinkExtension/AssetLinkExtension.js +102 -0
- package/lib/Extensions/LinkExtension/LinkExtension.d.ts +21 -12
- package/lib/Extensions/LinkExtension/LinkExtension.js +63 -65
- package/lib/Extensions/LinkExtension/common.d.ts +7 -0
- package/lib/Extensions/LinkExtension/common.js +14 -0
- package/lib/Extensions/PreformattedExtension/PreformattedExtension.d.ts +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/useExpandedSelection.d.ts +23 -0
- package/lib/hooks/useExpandedSelection.js +37 -0
- package/lib/index.css +159 -74
- package/lib/index.d.ts +5 -2
- package/lib/index.js +9 -3
- package/lib/types.d.ts +3 -0
- package/lib/types.js +2 -0
- package/lib/ui/Button/Button.d.ts +11 -0
- package/lib/ui/{ToolbarButton/ToolbarButton.js → Button/Button.js} +6 -3
- package/lib/ui/Fields/Input/Input.d.ts +5 -0
- package/lib/ui/{Inputs/Text/TextInput.js → Fields/Input/Input.js} +10 -5
- package/lib/ui/{Inputs → Fields}/Select/Select.d.ts +1 -0
- package/lib/ui/Modal/Modal.js +5 -3
- package/lib/ui/ToolbarDropdown/ToolbarDropdown.d.ts +1 -0
- package/lib/ui/ToolbarDropdownButton/ToolbarDropdownButton.d.ts +1 -0
- package/lib/utils/converters/remirrorNodeToSquizNode/remirrorNodeToSquizNode.d.ts +9 -0
- package/lib/utils/converters/remirrorNodeToSquizNode/remirrorNodeToSquizNode.js +165 -0
- package/lib/utils/converters/squizNodeToRemirrorNode/squizNodeToRemirrorNode.d.ts +9 -0
- package/lib/utils/converters/squizNodeToRemirrorNode/squizNodeToRemirrorNode.js +129 -0
- package/lib/utils/undefinedIfEmpty.d.ts +1 -0
- package/lib/utils/undefinedIfEmpty.js +7 -0
- package/package.json +11 -4
- package/src/Editor/Editor.spec.tsx +78 -18
- package/src/Editor/Editor.tsx +28 -9
- package/src/Editor/EditorContext.spec.tsx +26 -0
- package/src/Editor/EditorContext.ts +19 -0
- package/src/Editor/_editor.scss +20 -51
- package/src/EditorToolbar/FloatingToolbar.spec.tsx +2 -3
- package/src/EditorToolbar/FloatingToolbar.tsx +15 -6
- package/src/EditorToolbar/Toolbar.tsx +2 -0
- package/src/EditorToolbar/Tools/Bold/BoldButton.spec.tsx +1 -1
- package/src/EditorToolbar/Tools/Bold/BoldButton.tsx +2 -2
- package/src/EditorToolbar/Tools/Image/Form/ImageForm.spec.tsx +77 -0
- package/src/EditorToolbar/Tools/Image/Form/ImageForm.tsx +90 -0
- package/src/EditorToolbar/Tools/Image/ImageButton.spec.tsx +135 -0
- package/src/EditorToolbar/Tools/Image/ImageButton.tsx +72 -0
- package/src/EditorToolbar/Tools/Image/ImageModal.spec.tsx +83 -0
- package/src/EditorToolbar/Tools/Image/ImageModal.tsx +24 -0
- package/src/EditorToolbar/Tools/Italic/ItalicButton.spec.tsx +1 -1
- package/src/EditorToolbar/Tools/Italic/ItalicButton.tsx +2 -2
- package/src/EditorToolbar/Tools/Link/Form/LinkForm.spec.tsx +37 -9
- package/src/EditorToolbar/Tools/Link/Form/LinkForm.tsx +97 -27
- package/src/EditorToolbar/Tools/Link/LinkButton.spec.tsx +104 -26
- package/src/EditorToolbar/Tools/Link/LinkButton.tsx +30 -21
- package/src/EditorToolbar/Tools/Link/LinkModal.tsx +13 -6
- package/src/EditorToolbar/Tools/Link/RemoveLinkButton.spec.tsx +26 -26
- package/src/EditorToolbar/Tools/Link/RemoveLinkButton.tsx +4 -12
- package/src/EditorToolbar/Tools/Redo/RedoButton.tsx +2 -2
- package/src/EditorToolbar/Tools/TextAlign/CenterAlign/CenterAlignButton.tsx +2 -2
- package/src/EditorToolbar/Tools/TextAlign/JustifyAlign/JustifyAlignButton.tsx +2 -2
- package/src/EditorToolbar/Tools/TextAlign/LeftAlign/LeftAlignButton.tsx +2 -2
- package/src/EditorToolbar/Tools/TextAlign/RightAlign/RightAlignButton.tsx +2 -2
- package/src/EditorToolbar/Tools/Underline/Underline.spec.tsx +1 -1
- package/src/EditorToolbar/Tools/Underline/UnderlineButton.tsx +2 -2
- package/src/EditorToolbar/Tools/Undo/UndoButton.spec.tsx +22 -1
- package/src/EditorToolbar/Tools/Undo/UndoButton.tsx +2 -2
- package/src/EditorToolbar/_floating-toolbar.scss +5 -0
- package/src/EditorToolbar/_toolbar.scss +11 -5
- package/src/Extensions/CommandsExtension/CommandsExtension.ts +54 -0
- package/src/Extensions/Extensions.ts +32 -17
- package/src/Extensions/ImageExtension/ImageExtension.ts +112 -0
- package/src/Extensions/LinkExtension/AssetLinkExtension.spec.ts +104 -0
- package/src/Extensions/LinkExtension/AssetLinkExtension.ts +128 -0
- package/src/Extensions/LinkExtension/LinkExtension.spec.ts +68 -0
- package/src/Extensions/LinkExtension/LinkExtension.ts +88 -82
- package/src/Extensions/LinkExtension/common.ts +10 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useExpandedSelection.ts +44 -0
- package/src/index.scss +2 -2
- package/src/index.ts +5 -2
- package/src/types.ts +5 -0
- package/src/ui/Button/Button.spec.tsx +44 -0
- package/src/ui/Button/Button.tsx +29 -0
- package/src/ui/{_buttons.scss → Button/_button.scss} +19 -1
- package/src/ui/{Inputs/Text/TextInput.spec.tsx → Fields/Input/Input.spec.tsx} +8 -8
- package/src/ui/Fields/Input/Input.tsx +34 -0
- package/src/ui/Modal/Modal.spec.tsx +15 -0
- package/src/ui/Modal/Modal.tsx +8 -4
- package/src/ui/ToolbarDropdown/_toolbar-dropdown.scss +1 -1
- package/src/ui/_forms.scss +14 -0
- package/src/ui/_typography.scss +46 -0
- package/src/utils/converters/mocks/squizNodeJson.mock.ts +252 -0
- package/src/utils/converters/remirrorNodeToSquizNode/remirrorNodeToSquizNode.spec.ts +480 -0
- package/src/utils/converters/remirrorNodeToSquizNode/remirrorNodeToSquizNode.ts +202 -0
- package/src/utils/converters/squizNodeToRemirrorNode/squizNodeToRemirrorNode.spec.ts +329 -0
- package/src/utils/converters/squizNodeToRemirrorNode/squizNodeToRemirrorNode.ts +151 -0
- package/src/utils/undefinedIfEmpty.spec.ts +12 -0
- package/src/utils/undefinedIfEmpty.ts +3 -0
- package/tailwind.config.cjs +3 -0
- package/tests/renderWithEditor.tsx +28 -15
- package/tsconfig.json +1 -1
- package/lib/FormattedTextEditor.d.ts +0 -2
- package/lib/FormattedTextEditor.js +0 -7
- package/lib/ui/Inputs/Text/TextInput.d.ts +0 -4
- package/lib/ui/ToolbarButton/ToolbarButton.d.ts +0 -10
- package/src/Editor/Editor.mock.tsx +0 -43
- package/src/FormattedTextEditor.spec.tsx +0 -10
- package/src/FormattedTextEditor.tsx +0 -3
- package/src/ui/Inputs/Text/TextInput.tsx +0 -20
- package/src/ui/ToolbarButton/ToolbarButton.tsx +0 -26
- package/src/ui/ToolbarButton/_toolbar-button.scss +0 -17
- /package/lib/ui/{Inputs → Fields}/Select/Select.js +0 -0
- /package/src/ui/{Inputs → Fields}/Select/Select.spec.tsx +0 -0
- /package/src/ui/{Inputs → Fields}/Select/Select.tsx +0 -0
- /package/tests/{select.tsx → select.ts} +0 -0
package/lib/index.css
CHANGED
@@ -376,6 +376,10 @@
|
|
376
376
|
.squiz-fte-scope .z-40 {
|
377
377
|
z-index: 40 !important;
|
378
378
|
}
|
379
|
+
.squiz-fte-scope .mx-1 {
|
380
|
+
margin-left: 0.25rem !important;
|
381
|
+
margin-right: 0.25rem !important;
|
382
|
+
}
|
379
383
|
.squiz-fte-scope .mx-auto {
|
380
384
|
margin-left: auto !important;
|
381
385
|
margin-right: auto !important;
|
@@ -437,6 +441,12 @@
|
|
437
441
|
-moz-user-select: none !important;
|
438
442
|
user-select: none !important;
|
439
443
|
}
|
444
|
+
.squiz-fte-scope .flex-row {
|
445
|
+
flex-direction: row !important;
|
446
|
+
}
|
447
|
+
.squiz-fte-scope .items-end {
|
448
|
+
align-items: flex-end !important;
|
449
|
+
}
|
440
450
|
.squiz-fte-scope .items-center {
|
441
451
|
align-items: center !important;
|
442
452
|
}
|
@@ -566,6 +576,47 @@
|
|
566
576
|
--tw-blur: blur(8px) !important;
|
567
577
|
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow) !important;
|
568
578
|
}
|
579
|
+
.squiz-fte-scope a {
|
580
|
+
--tw-text-opacity: 1;
|
581
|
+
color: rgb(7 116 210 / var(--tw-text-opacity));
|
582
|
+
text-decoration: underline;
|
583
|
+
}
|
584
|
+
.squiz-fte-scope h1 {
|
585
|
+
font-size: 1.625rem;
|
586
|
+
font-weight: 600;
|
587
|
+
letter-spacing: -0.2px;
|
588
|
+
line-height: 2rem;
|
589
|
+
}
|
590
|
+
.squiz-fte-scope h2 {
|
591
|
+
font-size: 1.25rem;
|
592
|
+
font-weight: 600;
|
593
|
+
letter-spacing: -0.5px;
|
594
|
+
line-height: 1.5rem;
|
595
|
+
}
|
596
|
+
.squiz-fte-scope h3 {
|
597
|
+
font-size: 1.125rem;
|
598
|
+
font-weight: 600;
|
599
|
+
letter-spacing: -0.2px;
|
600
|
+
line-height: 1.375rem;
|
601
|
+
}
|
602
|
+
.squiz-fte-scope h4 {
|
603
|
+
font-size: 1rem;
|
604
|
+
font-weight: 700;
|
605
|
+
letter-spacing: -0.2px;
|
606
|
+
line-height: 1.25rem;
|
607
|
+
}
|
608
|
+
.squiz-fte-scope h5 {
|
609
|
+
font-size: 1rem;
|
610
|
+
font-weight: 600;
|
611
|
+
letter-spacing: -0.2px;
|
612
|
+
line-height: 1.25rem;
|
613
|
+
}
|
614
|
+
.squiz-fte-scope h6 {
|
615
|
+
font-size: 0.875rem;
|
616
|
+
font-weight: 600;
|
617
|
+
letter-spacing: -0.2px;
|
618
|
+
line-height: 1.25rem;
|
619
|
+
}
|
569
620
|
.squiz-fte-scope .squiz-fte-form-group {
|
570
621
|
display: flex;
|
571
622
|
flex-direction: column;
|
@@ -611,33 +662,23 @@
|
|
611
662
|
.squiz-fte-scope .squiz-fte-form-control:active {
|
612
663
|
box-shadow: none;
|
613
664
|
}
|
614
|
-
.squiz-fte-scope .squiz-fte-
|
615
|
-
border-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
display: flex;
|
622
|
-
align-items: center;
|
623
|
-
text-align: center;
|
624
|
-
white-space: nowrap;
|
625
|
-
vertical-align: middle;
|
626
|
-
touch-action: manipulation;
|
627
|
-
cursor: pointer;
|
628
|
-
background-image: none;
|
629
|
-
border: 1px solid transparent;
|
630
|
-
padding: 6px 12px;
|
665
|
+
.squiz-fte-scope .squiz-fte-invalid-form-field .squiz-fte-form-control {
|
666
|
+
--tw-border-opacity: 1;
|
667
|
+
border-color: rgb(215 35 33 / var(--tw-border-opacity));
|
668
|
+
background-repeat: no-repeat;
|
669
|
+
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjQiIHdpZHRoPSIyNCI+PHJlY3Qgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0ibm9uZSIvPjxnIGNsYXNzPSJjdXJyZW50TGF5ZXIiPjxwYXRoIGQ9Ik00LjQ3IDIxaDE1LjA2YzEuNTQgMCAyLjUtMS42NyAxLjczLTNMMTMuNzMgNC45OWMtLjc3LTEuMzMtMi42OS0xLjMzLTMuNDYgMEwyLjc0IDE4Yy0uNzcgMS4zMy4xOSAzIDEuNzMgM3pNMTIgMTRjLS41NSAwLTEtLjQ1LTEtMXYtMmMwLS41NS40NS0xIDEtMXMxIC40NSAxIDF2MmMwIC41NS0uNDUgMS0xIDF6bTEgNGgtMnYtMmgydjJ6IiBjbGFzcz0ic2VsZWN0ZWQiIGZpbGw9IiNkNzIzMjEiLz48L2c+PC9zdmc+);
|
670
|
+
background-position: top 0.25rem right 0.25rem;
|
671
|
+
background-size: 1.5rem;
|
631
672
|
}
|
632
|
-
.squiz-fte-scope .squiz-fte-
|
633
|
-
|
634
|
-
|
635
|
-
|
673
|
+
.squiz-fte-scope .squiz-fte-form-error {
|
674
|
+
--tw-text-opacity: 1;
|
675
|
+
color: rgb(215 35 33 / var(--tw-text-opacity));
|
676
|
+
font-size: 13px;
|
677
|
+
line-height: 1.23;
|
678
|
+
padding-top: 0.25rem;
|
636
679
|
}
|
637
680
|
.squiz-fte-scope .formatted-text-editor {
|
638
681
|
font-family: "Open Sans" !important;
|
639
|
-
}
|
640
|
-
.squiz-fte-scope .formatted-text-editor.editor-wrapper {
|
641
682
|
border-radius: 4px;
|
642
683
|
border-width: 2px;
|
643
684
|
border-style: solid;
|
@@ -649,7 +690,7 @@
|
|
649
690
|
.squiz-fte-scope .formatted-text-editor .remirror-editor-wrapper {
|
650
691
|
padding-top: 0px;
|
651
692
|
--tw-text-opacity: 1;
|
652
|
-
color: rgb(
|
693
|
+
color: rgb(61 61 61 / var(--tw-text-opacity));
|
653
694
|
}
|
654
695
|
.squiz-fte-scope .formatted-text-editor .remirror-editor {
|
655
696
|
border-bottom-right-radius: 4px;
|
@@ -663,7 +704,8 @@
|
|
663
704
|
var(--tw-ring-offset-shadow, 0 0 #0000),
|
664
705
|
var(--tw-ring-shadow, 0 0 #0000),
|
665
706
|
var(--tw-shadow);
|
666
|
-
|
707
|
+
overflow: auto;
|
708
|
+
min-height: 15vh;
|
667
709
|
}
|
668
710
|
.squiz-fte-scope .formatted-text-editor .remirror-editor:active,
|
669
711
|
.squiz-fte-scope .formatted-text-editor .remirror-editor:focus {
|
@@ -672,6 +714,14 @@
|
|
672
714
|
.squiz-fte-scope .formatted-text-editor .remirror-editor p {
|
673
715
|
display: block;
|
674
716
|
}
|
717
|
+
.squiz-fte-scope .formatted-text-editor--is-disabled .remirror-editor {
|
718
|
+
cursor: not-allowed;
|
719
|
+
--tw-bg-opacity: 1;
|
720
|
+
background-color: rgb(224 224 224 / var(--tw-bg-opacity));
|
721
|
+
}
|
722
|
+
.squiz-fte-scope .formatted-text-editor--is-disabled .remirror-is-empty:first-of-type::before {
|
723
|
+
display: none;
|
724
|
+
}
|
675
725
|
.squiz-fte-scope .formatted-text-editor .remirror-is-empty:first-of-type::before {
|
676
726
|
position: absolute;
|
677
727
|
pointer-events: none;
|
@@ -681,48 +731,17 @@
|
|
681
731
|
--tw-text-opacity: 1;
|
682
732
|
color: rgb(148 148 148 / var(--tw-text-opacity));
|
683
733
|
}
|
684
|
-
.squiz-fte-scope
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
.squiz-fte-scope .remirror-theme h1 {
|
690
|
-
font-size: 1.625rem;
|
691
|
-
font-weight: 600;
|
692
|
-
letter-spacing: -0.2px;
|
693
|
-
line-height: 2rem;
|
694
|
-
}
|
695
|
-
.squiz-fte-scope .remirror-theme h2 {
|
696
|
-
font-size: 1.25rem;
|
697
|
-
font-weight: 600;
|
698
|
-
letter-spacing: -0.5px;
|
699
|
-
line-height: 1.5rem;
|
700
|
-
}
|
701
|
-
.squiz-fte-scope .remirror-theme h3 {
|
702
|
-
font-size: 1.125rem;
|
703
|
-
font-weight: 600;
|
704
|
-
letter-spacing: -0.2px;
|
705
|
-
line-height: 1.375rem;
|
706
|
-
}
|
707
|
-
.squiz-fte-scope .remirror-theme h4 {
|
708
|
-
font-size: 1rem;
|
709
|
-
font-weight: 700;
|
710
|
-
letter-spacing: -0.2px;
|
711
|
-
line-height: 1.25rem;
|
712
|
-
}
|
713
|
-
.squiz-fte-scope .remirror-theme h5 {
|
714
|
-
font-size: 1rem;
|
715
|
-
font-weight: 600;
|
716
|
-
letter-spacing: -0.2px;
|
717
|
-
line-height: 1.25rem;
|
734
|
+
.squiz-fte-scope .formatted-text-editor .ProseMirror-selectednode {
|
735
|
+
border-width: 2px;
|
736
|
+
border-style: solid;
|
737
|
+
--tw-border-opacity: 1;
|
738
|
+
border-color: rgb(7 116 210 / var(--tw-border-opacity));
|
718
739
|
}
|
719
|
-
.squiz-fte-scope .
|
720
|
-
|
721
|
-
font-weight: 600;
|
722
|
-
letter-spacing: -0.2px;
|
723
|
-
line-height: 1.25rem;
|
740
|
+
.squiz-fte-scope .formatted-text-editor img {
|
741
|
+
display: inline;
|
724
742
|
}
|
725
|
-
.squiz-fte-scope .editor-toolbar
|
743
|
+
.squiz-fte-scope .editor-toolbar,
|
744
|
+
.squiz-fte-scope__floating-popover {
|
726
745
|
border-bottom-width: 2px;
|
727
746
|
border-style: solid;
|
728
747
|
--tw-border-opacity: 1;
|
@@ -733,10 +752,12 @@
|
|
733
752
|
display: flex;
|
734
753
|
justify-items: center;
|
735
754
|
}
|
736
|
-
.squiz-fte-scope .editor-toolbar > *:not(:first-child, .editor-divider)
|
755
|
+
.squiz-fte-scope .editor-toolbar > *:not(:first-child, .editor-divider),
|
756
|
+
.squiz-fte-scope .squiz-fte-scope__floating-popover > *:not(:first-child, .editor-divider) {
|
737
757
|
margin: 0 0 0 2px;
|
738
758
|
}
|
739
|
-
.squiz-fte-scope .editor-divider
|
759
|
+
.squiz-fte-scope .editor-toolbar .editor-divider,
|
760
|
+
.squiz-fte-scope .squiz-fte-scope__floating-popover .editor-divider {
|
740
761
|
margin-top: -0.25rem;
|
741
762
|
margin-bottom: -0.25rem;
|
742
763
|
margin-left: 0.25rem;
|
@@ -745,6 +766,14 @@
|
|
745
766
|
margin-right: 2px;
|
746
767
|
height: auto;
|
747
768
|
}
|
769
|
+
.squiz-fte-scope .editor-toolbar .squiz-fte-btn,
|
770
|
+
.squiz-fte-scope .squiz-fte-scope__floating-popover .squiz-fte-btn {
|
771
|
+
padding: 0.25rem;
|
772
|
+
}
|
773
|
+
.squiz-fte-scope .editor-toolbar .squiz-fte-btn ~ .squiz-fte-btn,
|
774
|
+
.squiz-fte-scope .squiz-fte-scope__floating-popover .squiz-fte-btn ~ .squiz-fte-btn {
|
775
|
+
margin-left: 2px;
|
776
|
+
}
|
748
777
|
.squiz-fte-scope__floating-popover {
|
749
778
|
display: flex;
|
750
779
|
border-radius: 6px;
|
@@ -761,22 +790,49 @@
|
|
761
790
|
var(--tw-ring-shadow, 0 0 #0000),
|
762
791
|
var(--tw-shadow);
|
763
792
|
}
|
764
|
-
.squiz-fte-scope .
|
793
|
+
.squiz-fte-scope .squiz-fte-scope__floating-popover .editor-divider {
|
794
|
+
margin-top: 0px;
|
795
|
+
margin-bottom: 0px;
|
796
|
+
}
|
797
|
+
.squiz-fte-scope .squiz-fte-btn {
|
798
|
+
border-radius: 4px;
|
765
799
|
--tw-bg-opacity: 1;
|
766
800
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
767
|
-
|
801
|
+
font-weight: 400;
|
768
802
|
--tw-text-opacity: 1;
|
769
803
|
color: rgb(112 112 112 / var(--tw-text-opacity));
|
804
|
+
transition-property: all;
|
805
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
806
|
+
transition-duration: 150ms;
|
807
|
+
transition-timing-function: linear;
|
808
|
+
display: flex;
|
809
|
+
align-items: center;
|
810
|
+
text-align: center;
|
811
|
+
white-space: nowrap;
|
812
|
+
vertical-align: middle;
|
813
|
+
touch-action: manipulation;
|
814
|
+
cursor: pointer;
|
815
|
+
background-image: none;
|
816
|
+
border: 1px solid transparent;
|
817
|
+
padding: 6px 12px;
|
818
|
+
}
|
819
|
+
.squiz-fte-scope .squiz-fte-btn--is-icon {
|
820
|
+
padding: 6px;
|
770
821
|
}
|
771
|
-
.squiz-fte-scope .
|
822
|
+
.squiz-fte-scope .squiz-fte-btn ~ .squiz-fte-btn {
|
772
823
|
margin-left: 2px;
|
773
824
|
}
|
774
|
-
.squiz-fte-scope .
|
775
|
-
.squiz-fte-scope .
|
825
|
+
.squiz-fte-scope .squiz-fte-btn.disabled,
|
826
|
+
.squiz-fte-scope .squiz-fte-btn[disabled] {
|
827
|
+
cursor: not-allowed;
|
828
|
+
opacity: 0.5;
|
829
|
+
}
|
830
|
+
.squiz-fte-scope .squiz-fte-btn:hover,
|
831
|
+
.squiz-fte-scope .squiz-fte-btn:focus {
|
776
832
|
background-color: rgba(0, 0, 0, 0.04);
|
777
833
|
}
|
778
|
-
.squiz-fte-scope .
|
779
|
-
.squiz-fte-scope .
|
834
|
+
.squiz-fte-scope .squiz-fte-btn--is-active,
|
835
|
+
.squiz-fte-scope .squiz-fte-btn:active {
|
780
836
|
--tw-bg-opacity: 1;
|
781
837
|
background-color: rgb(230 241 250 / var(--tw-bg-opacity));
|
782
838
|
--tw-text-opacity: 1;
|
@@ -785,6 +841,7 @@
|
|
785
841
|
.squiz-fte-scope .toolbar-dropdown__button {
|
786
842
|
display: flex;
|
787
843
|
align-items: center;
|
844
|
+
border-radius: 4px;
|
788
845
|
font-family:
|
789
846
|
Open Sans,
|
790
847
|
Arial,
|
@@ -899,8 +956,23 @@
|
|
899
956
|
}
|
900
957
|
.squiz-fte-scope .squiz-fte-modal-footer__button {
|
901
958
|
font-size: 0.875rem;
|
959
|
+
font-weight: 700;
|
960
|
+
}
|
961
|
+
.squiz-fte-scope .editor-toolbar .squiz-fte-modal-footer__button,
|
962
|
+
.squiz-fte-scope .squiz-fte-scope__floating-popover .squiz-fte-modal-footer__button {
|
963
|
+
padding: 0.25rem;
|
964
|
+
}
|
965
|
+
.squiz-fte-scope .editor-toolbar .squiz-fte-modal-footer__button ~ .squiz-fte-btn,
|
966
|
+
.squiz-fte-scope .squiz-fte-scope__floating-popover .squiz-fte-modal-footer__button ~ .squiz-fte-btn {
|
967
|
+
margin-left: 2px;
|
968
|
+
}
|
969
|
+
.squiz-fte-scope .squiz-fte-modal-footer__button {
|
902
970
|
border-radius: 4px;
|
971
|
+
--tw-bg-opacity: 1;
|
972
|
+
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
903
973
|
font-weight: 400;
|
974
|
+
--tw-text-opacity: 1;
|
975
|
+
color: rgb(112 112 112 / var(--tw-text-opacity));
|
904
976
|
transition-property: all;
|
905
977
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
906
978
|
transition-duration: 150ms;
|
@@ -916,11 +988,24 @@
|
|
916
988
|
border: 1px solid transparent;
|
917
989
|
padding: 6px 12px;
|
918
990
|
}
|
991
|
+
.squiz-fte-scope .squiz-fte-modal-footer__button ~ .squiz-fte-btn {
|
992
|
+
margin-left: 2px;
|
993
|
+
}
|
919
994
|
.squiz-fte-scope .squiz-fte-modal-footer__button.disabled,
|
920
995
|
.squiz-fte-scope .squiz-fte-modal-footer__button[disabled] {
|
921
996
|
cursor: not-allowed;
|
922
997
|
opacity: 0.5;
|
923
998
|
}
|
999
|
+
.squiz-fte-scope .squiz-fte-modal-footer__button:hover,
|
1000
|
+
.squiz-fte-scope .squiz-fte-modal-footer__button:focus {
|
1001
|
+
background-color: rgba(0, 0, 0, 0.04);
|
1002
|
+
}
|
1003
|
+
.squiz-fte-scope .squiz-fte-modal-footer__button:active {
|
1004
|
+
--tw-bg-opacity: 1;
|
1005
|
+
background-color: rgb(230 241 250 / var(--tw-bg-opacity));
|
1006
|
+
--tw-text-opacity: 1;
|
1007
|
+
color: rgb(7 116 210 / var(--tw-text-opacity));
|
1008
|
+
}
|
924
1009
|
.squiz-fte-scope .hover\:bg-blue-400:hover {
|
925
1010
|
--tw-bg-opacity: 1 !important;
|
926
1011
|
background-color: rgb(4 73 133 / var(--tw-bg-opacity)) !important;
|
package/lib/index.d.ts
CHANGED
@@ -1,2 +1,5 @@
|
|
1
|
-
import
|
2
|
-
|
1
|
+
import Editor from './Editor/Editor';
|
2
|
+
import { EditorContext } from './Editor/EditorContext';
|
3
|
+
import { remirrorNodeToSquizNode } from './utils/converters/remirrorNodeToSquizNode/remirrorNodeToSquizNode';
|
4
|
+
import { squizNodeToRemirrorNode } from './utils/converters/squizNodeToRemirrorNode/squizNodeToRemirrorNode';
|
5
|
+
export { Editor, EditorContext, remirrorNodeToSquizNode, squizNodeToRemirrorNode };
|
package/lib/index.js
CHANGED
@@ -3,6 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.
|
7
|
-
const
|
8
|
-
exports.
|
6
|
+
exports.squizNodeToRemirrorNode = exports.remirrorNodeToSquizNode = exports.EditorContext = exports.Editor = void 0;
|
7
|
+
const Editor_1 = __importDefault(require("./Editor/Editor"));
|
8
|
+
exports.Editor = Editor_1.default;
|
9
|
+
const EditorContext_1 = require("./Editor/EditorContext");
|
10
|
+
Object.defineProperty(exports, "EditorContext", { enumerable: true, get: function () { return EditorContext_1.EditorContext; } });
|
11
|
+
const remirrorNodeToSquizNode_1 = require("./utils/converters/remirrorNodeToSquizNode/remirrorNodeToSquizNode");
|
12
|
+
Object.defineProperty(exports, "remirrorNodeToSquizNode", { enumerable: true, get: function () { return remirrorNodeToSquizNode_1.remirrorNodeToSquizNode; } });
|
13
|
+
const squizNodeToRemirrorNode_1 = require("./utils/converters/squizNodeToRemirrorNode/squizNodeToRemirrorNode");
|
14
|
+
Object.defineProperty(exports, "squizNodeToRemirrorNode", { enumerable: true, get: function () { return squizNodeToRemirrorNode_1.squizNodeToRemirrorNode; } });
|
package/lib/types.d.ts
ADDED
package/lib/types.js
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
import { ReactElement } from 'react';
|
2
|
+
type ButtonProps = {
|
3
|
+
handleOnClick: () => void;
|
4
|
+
isDisabled?: boolean;
|
5
|
+
isActive: boolean;
|
6
|
+
label: string;
|
7
|
+
text?: string;
|
8
|
+
icon?: ReactElement;
|
9
|
+
};
|
10
|
+
declare const Button: ({ handleOnClick, isDisabled, isActive, label, text, icon }: ButtonProps) => JSX.Element;
|
11
|
+
export default Button;
|
@@ -4,7 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const react_1 = __importDefault(require("react"));
|
7
|
-
const
|
8
|
-
|
7
|
+
const clsx_1 = __importDefault(require("clsx"));
|
8
|
+
const Button = ({ handleOnClick, isDisabled, isActive, label, text, icon }) => {
|
9
|
+
return (react_1.default.createElement("button", { "aria-label": label, title: label, type: "button", onClick: handleOnClick, disabled: isDisabled, className: (0, clsx_1.default)('squiz-fte-btn', isActive && 'squiz-fte-btn--is-active', icon && ' squiz-fte-btn--is-icon') },
|
10
|
+
text && react_1.default.createElement("span", null, text),
|
11
|
+
icon && icon));
|
9
12
|
};
|
10
|
-
exports.default =
|
13
|
+
exports.default = Button;
|
@@ -22,12 +22,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
22
|
__setModuleDefault(result, mod);
|
23
23
|
return result;
|
24
24
|
};
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
+
};
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.
|
29
|
+
exports.Input = void 0;
|
27
30
|
const react_1 = __importStar(require("react"));
|
28
|
-
const
|
29
|
-
|
31
|
+
const clsx_1 = __importDefault(require("clsx"));
|
32
|
+
const InputInternal = ({ name, label, type = 'text', error, ...rest }, ref) => {
|
33
|
+
return (react_1.default.createElement("div", { className: (0, clsx_1.default)(error && 'squiz-fte-invalid-form-field') },
|
30
34
|
label && (react_1.default.createElement("label", { htmlFor: name, className: "squiz-fte-form-label" }, label)),
|
31
|
-
react_1.default.createElement("input", { ref: ref, id: name, name: name, type: "
|
35
|
+
react_1.default.createElement("input", { ref: ref, id: name, name: name, type: type, "aria-invalid": !!error, className: "squiz-fte-form-control", ...rest }),
|
36
|
+
error && react_1.default.createElement("div", { className: "squiz-fte-form-error" }, error)));
|
32
37
|
};
|
33
|
-
exports.
|
38
|
+
exports.Input = (0, react_1.forwardRef)(InputInternal);
|
package/lib/ui/Modal/Modal.js
CHANGED
@@ -30,7 +30,9 @@ const react_1 = __importStar(require("react"));
|
|
30
30
|
const react_dom_1 = require("react-dom");
|
31
31
|
const CloseRounded_1 = __importDefault(require("@mui/icons-material/CloseRounded"));
|
32
32
|
const base_1 = require("@mui/base");
|
33
|
+
const clsx_1 = __importDefault(require("clsx"));
|
33
34
|
const Modal = ({ children, title, onCancel, onSubmit, className }, ref) => {
|
35
|
+
const content = (0, react_1.useRef)(null);
|
34
36
|
const container = (0, react_1.useMemo)(() => {
|
35
37
|
const element = document.createElement('div');
|
36
38
|
element.classList.add('squiz-fte-scope');
|
@@ -51,7 +53,7 @@ const Modal = ({ children, title, onCancel, onSubmit, className }, ref) => {
|
|
51
53
|
}, []);
|
52
54
|
// add/remove the modal container from the DOM and focus on the first input
|
53
55
|
(0, react_1.useEffect)(() => {
|
54
|
-
const firstInput =
|
56
|
+
const firstInput = content.current?.querySelector('input:not([type=hidden]), button');
|
55
57
|
document.body.appendChild(container);
|
56
58
|
firstInput?.focus();
|
57
59
|
return () => {
|
@@ -60,14 +62,14 @@ const Modal = ({ children, title, onCancel, onSubmit, className }, ref) => {
|
|
60
62
|
}, [container]);
|
61
63
|
return (0, react_dom_1.createPortal)(react_1.default.createElement(react_1.default.Fragment, null,
|
62
64
|
react_1.default.createElement(base_1.FocusTrap, { open: true },
|
63
|
-
react_1.default.createElement("div", { ref: ref, className:
|
65
|
+
react_1.default.createElement("div", { ref: ref, className: (0, clsx_1.default)('squiz-fte-modal-wrapper', className), tabIndex: -1 },
|
64
66
|
react_1.default.createElement("div", { className: "w-modal-sm my-6 mx-auto" },
|
65
67
|
react_1.default.createElement("div", { className: "squiz-fte-modal" },
|
66
68
|
react_1.default.createElement("div", { className: "squiz-fte-modal-header p-6 pb-2" },
|
67
69
|
react_1.default.createElement("h2", { className: "font-semibold text-gray-900 text-heading-2" }, title),
|
68
70
|
react_1.default.createElement("button", { type: "button", className: "ml-auto -mr-3 -mt-3 bg-transparent border-0 text-gray-600 font-semibold outline-none focus:outline-none hover:text-color-gray-800", onClick: onCancel, "aria-label": "Close" },
|
69
71
|
react_1.default.createElement(CloseRounded_1.default, null))),
|
70
|
-
react_1.default.createElement("div", { className: "squiz-fte-modal-content" }, children),
|
72
|
+
react_1.default.createElement("div", { className: "squiz-fte-modal-content", ref: content }, children),
|
71
73
|
react_1.default.createElement("div", { className: "squiz-fte-modal-footer p-6 pt-3" },
|
72
74
|
react_1.default.createElement("button", { className: "squiz-fte-modal-footer__button bg-gray-200 text-gray-700 mr-2 hover:bg-gray-300", type: "button", onClick: onCancel, "aria-label": "Cancel" }, "Cancel"),
|
73
75
|
onSubmit && (react_1.default.createElement("button", { className: "squiz-fte-modal-footer__button bg-blue-300 text-white hover:bg-blue-400", type: "button", onClick: onSubmit, "aria-label": "Apply" }, "Apply"))))))),
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { ProsemirrorNode } from 'remirror';
|
2
|
+
import { FORMATTED_TEXT_MODELS as FormattedTextModels } from '@squiz/dx-json-schema-lib';
|
3
|
+
export declare const resolveNodeTag: (node: ProsemirrorNode) => string;
|
4
|
+
/**
|
5
|
+
* Converts Remirror node JSON structure to Squiz component JSON structure.
|
6
|
+
* @param {ProsemirrorNode} node Remirror node to convert to component.
|
7
|
+
* @returns {FormattedText} The converted Squiz component JSON.
|
8
|
+
*/
|
9
|
+
export declare const remirrorNodeToSquizNode: (node: ProsemirrorNode) => FormattedTextModels.v1.FormattedText;
|