5htp-core 0.6.0 → 0.6.1
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/client/app/component.tsx +1 -0
- package/client/assets/css/colors.less +46 -25
- package/client/assets/css/components/button.less +14 -5
- package/client/assets/css/components/card.less +5 -10
- package/client/assets/css/components/mantine.less +6 -5
- package/client/assets/css/components/table.less +1 -1
- package/client/assets/css/text/icons.less +1 -1
- package/client/assets/css/text/text.less +4 -0
- package/client/assets/css/utils/borders.less +1 -1
- package/client/assets/css/utils/layouts.less +8 -5
- package/client/components/Button.tsx +20 -17
- package/client/components/Checkbox.tsx +6 -1
- package/client/components/ConnectedInput.tsx +34 -0
- package/client/components/DropDown.tsx +21 -4
- package/client/components/Input.tsx +2 -2
- package/client/components/Rte/Editor.tsx +23 -9
- package/client/components/Rte/ToolbarPlugin/ElementFormat.tsx +1 -1
- package/client/components/Rte/ToolbarPlugin/index.tsx +272 -183
- package/client/components/Rte/currentEditor.ts +31 -2
- package/client/components/Rte/index.tsx +3 -0
- package/client/components/Rte/plugins/FloatingTextFormatToolbarPlugin/index.tsx +4 -1
- package/client/components/Select.tsx +29 -16
- package/client/components/Table/index.tsx +27 -11
- package/client/components/containers/Popover/index.tsx +21 -4
- package/client/components/index.ts +4 -2
- package/client/services/router/index.tsx +7 -5
- package/common/errors/index.tsx +27 -3
- package/common/router/index.ts +4 -1
- package/common/utils/rte.ts +183 -0
- package/package.json +3 -2
- package/server/app/container/console/index.ts +62 -42
- package/server/app/container/index.ts +4 -0
- package/server/app/service/index.ts +4 -2
- package/server/services/auth/index.ts +28 -14
- package/server/services/auth/router/index.ts +1 -1
- package/server/services/auth/router/request.ts +4 -4
- package/server/services/email/index.ts +8 -51
- package/server/services/prisma/Facet.ts +118 -0
- package/server/services/prisma/index.ts +24 -0
- package/server/services/router/http/index.ts +0 -2
- package/server/services/router/index.ts +220 -86
- package/server/services/router/response/index.ts +0 -15
- package/server/utils/rte.ts +21 -132
- package/types/global/utils.d.ts +4 -22
- package/types/icons.d.ts +1 -1
- package/server/services/email/service.json +0 -6
- package/server/services/email/templates.ts +0 -49
- package/server/services/email/transporter.ts +0 -31
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
1
|
+
/*----------------------------------
|
|
2
|
+
- DEPENDANCES
|
|
3
|
+
----------------------------------*/
|
|
8
4
|
|
|
9
5
|
// Core
|
|
10
6
|
import Button from '@client/components/Button';
|
|
@@ -49,6 +45,7 @@ import {
|
|
|
49
45
|
} from '@lexical/utils';
|
|
50
46
|
import {
|
|
51
47
|
$createParagraphNode,
|
|
48
|
+
$createTextNode,
|
|
52
49
|
$getNodeByKey,
|
|
53
50
|
$getRoot,
|
|
54
51
|
$getSelection,
|
|
@@ -94,6 +91,48 @@ import { INSERT_PAGE_BREAK } from '../plugins/PageBreakPlugin';
|
|
|
94
91
|
import { InsertPollDialog } from '../plugins/PollPlugin';
|
|
95
92
|
import { InsertTableDialog } from '../plugins/TablePlugin';
|
|
96
93
|
|
|
94
|
+
/*----------------------------------
|
|
95
|
+
- TYPES
|
|
96
|
+
----------------------------------*/
|
|
97
|
+
export type TToolbarDisplay = {
|
|
98
|
+
// Default to true
|
|
99
|
+
blocks?: boolean,
|
|
100
|
+
formatting?: boolean | {
|
|
101
|
+
bold?: boolean,
|
|
102
|
+
italic?: boolean,
|
|
103
|
+
underline?: boolean,
|
|
104
|
+
code?: boolean,
|
|
105
|
+
link?: boolean,
|
|
106
|
+
},
|
|
107
|
+
styles?: boolean | {
|
|
108
|
+
strikethrough?: boolean,
|
|
109
|
+
subscript?: boolean,
|
|
110
|
+
superscript?: boolean,
|
|
111
|
+
clear?: boolean,
|
|
112
|
+
},
|
|
113
|
+
insert?: boolean | {
|
|
114
|
+
horizontalRule?: boolean,
|
|
115
|
+
pageBreak?: boolean,
|
|
116
|
+
code?: boolean,
|
|
117
|
+
image?: boolean,
|
|
118
|
+
inlineImage?: boolean,
|
|
119
|
+
table?: boolean,
|
|
120
|
+
list?: boolean,
|
|
121
|
+
poll?: boolean,
|
|
122
|
+
columns?: boolean,
|
|
123
|
+
stickyNote?: boolean,
|
|
124
|
+
collapsibleContainer?: boolean,
|
|
125
|
+
},
|
|
126
|
+
alignment?: boolean,
|
|
127
|
+
custom?: (
|
|
128
|
+
editor: LexicalEditor,
|
|
129
|
+
getSelection: typeof $getSelection
|
|
130
|
+
) => React.JSX.Element,
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/*----------------------------------
|
|
134
|
+
- UTILS
|
|
135
|
+
----------------------------------*/
|
|
97
136
|
function getCodeLanguageOptions(): [string, string][] {
|
|
98
137
|
const options: [string, string][] = [];
|
|
99
138
|
|
|
@@ -116,16 +155,18 @@ function dropDownActiveClass(active: boolean) {
|
|
|
116
155
|
}
|
|
117
156
|
}
|
|
118
157
|
|
|
119
|
-
|
|
120
|
-
|
|
121
158
|
function Divider(): React.JSX.Element {
|
|
122
159
|
return <div className="divider" />;
|
|
123
160
|
}
|
|
124
161
|
|
|
162
|
+
/*----------------------------------
|
|
163
|
+
- COMPONENT
|
|
164
|
+
----------------------------------*/
|
|
125
165
|
export default function ToolbarPlugin({
|
|
126
|
-
setIsLinkEditMode,
|
|
166
|
+
setIsLinkEditMode, display
|
|
127
167
|
}: {
|
|
128
168
|
setIsLinkEditMode: Dispatch<boolean>;
|
|
169
|
+
display?: TToolbarDisplay
|
|
129
170
|
}): React.JSX.Element {
|
|
130
171
|
|
|
131
172
|
const { modal } = useContext();
|
|
@@ -474,7 +515,7 @@ export default function ToolbarPlugin({
|
|
|
474
515
|
const canViewerSeeInsertCodeButton = !isImageCaption;
|
|
475
516
|
|
|
476
517
|
return (
|
|
477
|
-
<div className="row menu al-left" style={{
|
|
518
|
+
<div className="row menu al-left pdb-05" style={{
|
|
478
519
|
position: 'sticky',
|
|
479
520
|
top: 0,
|
|
480
521
|
background: 'white',
|
|
@@ -497,7 +538,13 @@ export default function ToolbarPlugin({
|
|
|
497
538
|
|
|
498
539
|
<Divider /> */}
|
|
499
540
|
|
|
500
|
-
{
|
|
541
|
+
{display?.custom && display?.custom(editor, $getSelection)}
|
|
542
|
+
|
|
543
|
+
{(
|
|
544
|
+
blockTypeNames.includes(blockType)
|
|
545
|
+
&&
|
|
546
|
+
display?.blocks
|
|
547
|
+
) && activeEditor === editor && (
|
|
501
548
|
<>
|
|
502
549
|
<BlockFormatDropDown
|
|
503
550
|
disabled={!isEditable}
|
|
@@ -526,74 +573,78 @@ export default function ToolbarPlugin({
|
|
|
526
573
|
))}
|
|
527
574
|
</div>
|
|
528
575
|
</DropDown>
|
|
529
|
-
) : (
|
|
576
|
+
) : display?.formatting !== false && (
|
|
530
577
|
<>
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
}}
|
|
552
|
-
active={isUnderline}
|
|
553
|
-
title={IS_APPLE ? 'Underline (⌘U)' : 'Underline (Ctrl+U)'}
|
|
554
|
-
/>
|
|
578
|
+
{display?.formatting === true || display?.formatting?.bold !== false && (
|
|
579
|
+
<Button icon="bold" size="s"
|
|
580
|
+
disabled={!isEditable}
|
|
581
|
+
onClick={() => {
|
|
582
|
+
activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, 'bold');
|
|
583
|
+
}}
|
|
584
|
+
active={isBold}
|
|
585
|
+
title={IS_APPLE ? 'Bold (⌘B)' : 'Bold (Ctrl+B)'}
|
|
586
|
+
/>
|
|
587
|
+
)}
|
|
588
|
+
{display?.formatting === true || display?.formatting?.italic !== false && (
|
|
589
|
+
<Button icon="italic" size="s"
|
|
590
|
+
disabled={!isEditable}
|
|
591
|
+
onClick={() => {
|
|
592
|
+
activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, 'italic');
|
|
593
|
+
}}
|
|
594
|
+
active={isItalic}
|
|
595
|
+
title={IS_APPLE ? 'Italic (⌘I)' : 'Italic (Ctrl+I)'}
|
|
596
|
+
/>
|
|
597
|
+
)}
|
|
555
598
|
|
|
556
|
-
{
|
|
557
|
-
<Button icon="
|
|
599
|
+
{display?.formatting === true || display?.formatting?.underline !== false && (
|
|
600
|
+
<Button icon="underline" size="s"
|
|
558
601
|
disabled={!isEditable}
|
|
559
602
|
onClick={() => {
|
|
560
|
-
activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, '
|
|
603
|
+
activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, 'underline');
|
|
561
604
|
}}
|
|
562
|
-
active={
|
|
563
|
-
title=
|
|
605
|
+
active={isUnderline}
|
|
606
|
+
title={IS_APPLE ? 'Underline (⌘U)' : 'Underline (Ctrl+U)'}
|
|
564
607
|
/>
|
|
565
608
|
)}
|
|
566
|
-
<Button icon="link" size="s"
|
|
567
|
-
disabled={!isEditable}
|
|
568
|
-
onClick={insertLink}
|
|
569
|
-
active={isLink}
|
|
570
|
-
title="Insert link"
|
|
571
|
-
/>
|
|
572
609
|
|
|
573
|
-
{
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
disabled={!isEditable}
|
|
584
|
-
buttonClassName="toolbar-item color-picker"
|
|
585
|
-
buttonAriaLabel="Formatting background color"
|
|
586
|
-
buttonIconClassName="icon bg-color"
|
|
587
|
-
color={bgColor}
|
|
588
|
-
onChange={onBgColorSelect}
|
|
589
|
-
title="bg color"
|
|
590
|
-
/> */}
|
|
591
|
-
|
|
592
|
-
<DropDown popover={{ tag: 'li' }} icon="font" size="s"
|
|
593
|
-
disabled={!isEditable}
|
|
594
|
-
hint="Formatting options for additional text styles"
|
|
595
|
-
>
|
|
610
|
+
{display?.formatting === true || display?.formatting?.link !== false && (
|
|
611
|
+
<Button icon="link" size="s"
|
|
612
|
+
disabled={!isEditable}
|
|
613
|
+
onClick={insertLink}
|
|
614
|
+
active={isLink}
|
|
615
|
+
title="Insert link"
|
|
616
|
+
/>
|
|
617
|
+
)}
|
|
618
|
+
</>
|
|
619
|
+
)}
|
|
596
620
|
|
|
621
|
+
|
|
622
|
+
{/* <DropdownColorPicker
|
|
623
|
+
disabled={!isEditable}
|
|
624
|
+
buttonClassName="toolbar-item color-picker"
|
|
625
|
+
buttonAriaLabel="Formatting text color"
|
|
626
|
+
buttonIconClassName="icon font-color"
|
|
627
|
+
color={fontColor}
|
|
628
|
+
onChange={onFontColorSelect}
|
|
629
|
+
title="text color"
|
|
630
|
+
/>
|
|
631
|
+
<DropdownColorPicker
|
|
632
|
+
disabled={!isEditable}
|
|
633
|
+
buttonClassName="toolbar-item color-picker"
|
|
634
|
+
buttonAriaLabel="Formatting background color"
|
|
635
|
+
buttonIconClassName="icon bg-color"
|
|
636
|
+
color={bgColor}
|
|
637
|
+
onChange={onBgColorSelect}
|
|
638
|
+
title="bg color"
|
|
639
|
+
/> */}
|
|
640
|
+
|
|
641
|
+
{display?.styles !== false && (
|
|
642
|
+
<DropDown popover={{ tag: 'li' }} icon="font" size="s"
|
|
643
|
+
disabled={!isEditable}
|
|
644
|
+
hint="Formatting options for additional text styles"
|
|
645
|
+
>
|
|
646
|
+
|
|
647
|
+
{display?.styles === true || display?.styles?.strikethrough !== false && (
|
|
597
648
|
<Button icon="strikethrough" size="s"
|
|
598
649
|
onClick={() => {
|
|
599
650
|
activeEditor.dispatchCommand( FORMAT_TEXT_COMMAND, 'strikethrough');
|
|
@@ -603,7 +654,9 @@ export default function ToolbarPlugin({
|
|
|
603
654
|
>
|
|
604
655
|
Strikethrough
|
|
605
656
|
</Button>
|
|
657
|
+
)}
|
|
606
658
|
|
|
659
|
+
{display?.styles === true || display?.styles?.subscript !== false && (
|
|
607
660
|
<Button icon="subscript" size="s"
|
|
608
661
|
onClick={() => {
|
|
609
662
|
activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, 'subscript');
|
|
@@ -613,7 +666,9 @@ export default function ToolbarPlugin({
|
|
|
613
666
|
>
|
|
614
667
|
Subscript
|
|
615
668
|
</Button>
|
|
669
|
+
)}
|
|
616
670
|
|
|
671
|
+
{display?.styles === true || display?.styles?.superscript !== false && (
|
|
617
672
|
<Button icon="superscript" size="s"
|
|
618
673
|
onClick={() => {
|
|
619
674
|
activeEditor.dispatchCommand(
|
|
@@ -625,137 +680,171 @@ export default function ToolbarPlugin({
|
|
|
625
680
|
title="Format text with a superscript">
|
|
626
681
|
Superscript
|
|
627
682
|
</Button>
|
|
683
|
+
)}
|
|
628
684
|
|
|
685
|
+
{display?.styles === true || display?.styles?.clear !== false && (
|
|
629
686
|
<Button icon="empty-set" size="s"
|
|
630
687
|
onClick={clearFormatting}
|
|
631
688
|
title="Clear all text formatting">
|
|
632
689
|
Clear Formatting
|
|
633
690
|
</Button>
|
|
691
|
+
)}
|
|
634
692
|
|
|
635
|
-
|
|
693
|
+
</DropDown>
|
|
694
|
+
)}
|
|
636
695
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
696
|
+
{(canViewerSeeInsertDropdown && display?.insert !== false) && (
|
|
697
|
+
<>
|
|
698
|
+
<DropDown popover={{ tag: 'li' }}
|
|
699
|
+
disabled={!isEditable}
|
|
700
|
+
size="s"
|
|
701
|
+
icon="plus-circle"
|
|
702
|
+
hint="Insert specialized editor node"
|
|
703
|
+
>
|
|
704
|
+
|
|
705
|
+
{display?.insert === true || display?.insert?.horizontalRule !== false && (
|
|
706
|
+
<Button icon="horizontal-rule" size="s" onClick={() => {
|
|
707
|
+
activeEditor.dispatchCommand( INSERT_HORIZONTAL_RULE_COMMAND, undefined, );
|
|
708
|
+
}}>
|
|
709
|
+
Horizontal Rule
|
|
710
|
+
</Button>
|
|
711
|
+
)}
|
|
712
|
+
|
|
713
|
+
{display?.insert === true || display?.insert?.pageBreak !== false && (
|
|
714
|
+
<Button icon="page-break" size="s" onClick={() => {
|
|
715
|
+
activeEditor.dispatchCommand(INSERT_PAGE_BREAK, undefined);
|
|
716
|
+
}}>
|
|
717
|
+
Page Break
|
|
718
|
+
</Button>
|
|
719
|
+
)}
|
|
720
|
+
|
|
721
|
+
{(canViewerSeeInsertCodeButton && (display?.insert === true || display?.insert?.code !== false)) && (
|
|
722
|
+
<Button icon="code" size="s"
|
|
641
723
|
disabled={!isEditable}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
724
|
+
onClick={() => {
|
|
725
|
+
activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, 'code');
|
|
726
|
+
}}
|
|
727
|
+
active={isCode}
|
|
728
|
+
title="Insert code block"
|
|
729
|
+
/>
|
|
730
|
+
)}
|
|
731
|
+
|
|
732
|
+
{display?.insert === true || display?.insert?.image !== false && (
|
|
733
|
+
<Button icon="image" size="s" onClick={() => {
|
|
734
|
+
modal.show('Insert Image', InsertImageDialog, { editor: activeEditor });
|
|
735
|
+
}}>
|
|
736
|
+
Image
|
|
737
|
+
</Button>
|
|
738
|
+
)}
|
|
646
739
|
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
|
|
740
|
+
{display?.insert === true || display?.insert?.inlineImage !== false && (
|
|
741
|
+
<Button icon="image" size="s" onClick={() => {
|
|
742
|
+
modal.show('Insert Inline Image', InsertInlineImageDialog, { editor: activeEditor });
|
|
743
|
+
}}>
|
|
744
|
+
Inline Image
|
|
745
|
+
</Button>
|
|
746
|
+
)}
|
|
652
747
|
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
748
|
+
{/* <Button
|
|
749
|
+
onClick={() => {
|
|
750
|
+
activeEditor.dispatchCommand(
|
|
751
|
+
INSERT_EXCALIDRAW_COMMAND,
|
|
752
|
+
undefined,
|
|
753
|
+
);
|
|
754
|
+
}}
|
|
755
|
+
className="item">
|
|
756
|
+
<i className="icon diagram-2" />
|
|
757
|
+
<span className="text">Excalidraw</span>
|
|
758
|
+
</Button> */}
|
|
759
|
+
|
|
760
|
+
{display?.insert === true || display?.insert?.table !== false && (
|
|
761
|
+
<Button icon="table" size="s" onClick={() => {
|
|
762
|
+
modal.show('Insert Table', InsertTableDialog, { editor: activeEditor });
|
|
763
|
+
}}>
|
|
764
|
+
Table
|
|
765
|
+
</Button>
|
|
766
|
+
)}
|
|
658
767
|
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
|
|
768
|
+
{display?.insert === true || display?.insert?.poll !== false && (
|
|
769
|
+
<Button icon="poll" size="s" onClick={() => {
|
|
770
|
+
modal.show('Insert Poll', InsertPollDialog, { editor: activeEditor });
|
|
771
|
+
}}>
|
|
772
|
+
Poll
|
|
773
|
+
</Button>
|
|
774
|
+
)}
|
|
664
775
|
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
onClick={() => {
|
|
673
|
-
activeEditor.dispatchCommand(
|
|
674
|
-
INSERT_EXCALIDRAW_COMMAND,
|
|
675
|
-
undefined,
|
|
676
|
-
);
|
|
677
|
-
}}
|
|
678
|
-
className="item">
|
|
679
|
-
<i className="icon diagram-2" />
|
|
680
|
-
<span className="text">Excalidraw</span>
|
|
681
|
-
</Button> */}
|
|
682
|
-
|
|
683
|
-
<Button icon="table" size="s" onClick={() => {
|
|
684
|
-
modal.show('Insert Table', InsertTableDialog, { editor: activeEditor });
|
|
685
|
-
}}>
|
|
686
|
-
Table
|
|
687
|
-
</Button>
|
|
776
|
+
{display?.insert === true || display?.insert?.columns !== false && (
|
|
777
|
+
<Button icon="columns" size="s" onClick={() => {
|
|
778
|
+
modal.show('Insert Columns Layout', InsertLayoutDialog, { editor: activeEditor });
|
|
779
|
+
}} >
|
|
780
|
+
Columns Layout
|
|
781
|
+
</Button>
|
|
782
|
+
)}
|
|
688
783
|
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
<Button icon="sticky-note" size="s" onClick={() => {
|
|
716
|
-
editor.update(() => {
|
|
717
|
-
const root = $getRoot();
|
|
718
|
-
const stickyNode = $createStickyNode(0, 0);
|
|
719
|
-
root.append(stickyNode);
|
|
720
|
-
});
|
|
721
|
-
}}>
|
|
722
|
-
Sticky Note
|
|
723
|
-
</Button>
|
|
784
|
+
{/* <Button
|
|
785
|
+
onClick={() => {
|
|
786
|
+
modal.show('Insert Equation', (onClose) => (
|
|
787
|
+
<InsertEquationDialog
|
|
788
|
+
activeEditor={activeEditor}
|
|
789
|
+
onClose={onClose}
|
|
790
|
+
/>
|
|
791
|
+
));
|
|
792
|
+
}}
|
|
793
|
+
className="item">
|
|
794
|
+
<i className="icon equation" />
|
|
795
|
+
<span className="text">Equation</span>
|
|
796
|
+
</Button> */}
|
|
797
|
+
|
|
798
|
+
{display?.insert === true || display?.insert?.stickyNote !== false && (
|
|
799
|
+
<Button icon="sticky-note" size="s" onClick={() => {
|
|
800
|
+
editor.update(() => {
|
|
801
|
+
const root = $getRoot();
|
|
802
|
+
const stickyNode = $createStickyNode(0, 0);
|
|
803
|
+
root.append(stickyNode);
|
|
804
|
+
});
|
|
805
|
+
}}>
|
|
806
|
+
Sticky Note
|
|
807
|
+
</Button>
|
|
808
|
+
)}
|
|
724
809
|
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
810
|
+
{display?.insert === true || display?.insert?.collapsibleContainer !== false && (
|
|
811
|
+
<Button icon="caret-right" size="s" onClick={() => {
|
|
812
|
+
editor.dispatchCommand(
|
|
813
|
+
INSERT_COLLAPSIBLE_COMMAND,
|
|
814
|
+
undefined,
|
|
815
|
+
);
|
|
816
|
+
}}>
|
|
817
|
+
Collapsible container
|
|
818
|
+
</Button>
|
|
819
|
+
)}
|
|
820
|
+
|
|
821
|
+
{/*EmbedConfigs.map((embedConfig) => (
|
|
822
|
+
<Button
|
|
823
|
+
key={embedConfig.type}
|
|
824
|
+
onClick={() => {
|
|
825
|
+
activeEditor.dispatchCommand(
|
|
826
|
+
INSERT_EMBED_COMMAND,
|
|
827
|
+
embedConfig.type,
|
|
729
828
|
);
|
|
730
829
|
}}>
|
|
731
|
-
|
|
732
|
-
</
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
key={embedConfig.type}
|
|
737
|
-
onClick={() => {
|
|
738
|
-
activeEditor.dispatchCommand(
|
|
739
|
-
INSERT_EMBED_COMMAND,
|
|
740
|
-
embedConfig.type,
|
|
741
|
-
);
|
|
742
|
-
}}>
|
|
743
|
-
{embedConfig.icon}
|
|
744
|
-
<span className="text">{embedConfig.contentName}</span>
|
|
745
|
-
</Button>
|
|
746
|
-
))*/}
|
|
747
|
-
</DropDown>
|
|
748
|
-
</>
|
|
749
|
-
)}
|
|
830
|
+
{embedConfig.icon}
|
|
831
|
+
<span className="text">{embedConfig.contentName}</span>
|
|
832
|
+
</Button>
|
|
833
|
+
))*/}
|
|
834
|
+
</DropDown>
|
|
750
835
|
</>
|
|
751
836
|
)}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
837
|
+
|
|
838
|
+
{display?.alignment !== false && <>
|
|
839
|
+
<Divider />
|
|
840
|
+
<ElementFormatDropdown
|
|
841
|
+
disabled={!isEditable}
|
|
842
|
+
value={elementFormat}
|
|
843
|
+
editor={activeEditor}
|
|
844
|
+
isRTL={isRTL}
|
|
845
|
+
/>
|
|
846
|
+
</>}
|
|
847
|
+
|
|
759
848
|
</div>
|
|
760
849
|
);
|
|
761
850
|
}
|
|
@@ -3,7 +3,16 @@ import { $generateHtmlFromNodes } from '@lexical/html';
|
|
|
3
3
|
import editorNodes from '@common/data/rte/nodes';
|
|
4
4
|
import ExampleTheme from '@client/components/Rte/themes/PlaygroundEditorTheme';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import {
|
|
7
|
+
default as RteUtils,
|
|
8
|
+
LexicalNode,
|
|
9
|
+
LexicalState,
|
|
10
|
+
TRenderOptions,
|
|
11
|
+
TContentAssets
|
|
12
|
+
} from '@common/utils/rte';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class RichEditorUtils extends RteUtils {
|
|
7
16
|
|
|
8
17
|
public active: {
|
|
9
18
|
title: string,
|
|
@@ -12,7 +21,7 @@ class RichEditorUtils {
|
|
|
12
21
|
|
|
13
22
|
private virtualEditor: LexicalEditor | null = null;
|
|
14
23
|
|
|
15
|
-
public async jsonToHtml( value: {} ): Promise<string | null> {
|
|
24
|
+
public async jsonToHtml( value: LexicalState, options: TRenderOptions = {} ): Promise<string | null> {
|
|
16
25
|
|
|
17
26
|
if (!this.virtualEditor) {
|
|
18
27
|
// Create a headless Lexical editor instance
|
|
@@ -37,6 +46,26 @@ class RichEditorUtils {
|
|
|
37
46
|
return html;
|
|
38
47
|
}
|
|
39
48
|
|
|
49
|
+
protected async processContent(
|
|
50
|
+
node: LexicalNode,
|
|
51
|
+
parent: LexicalNode | null,
|
|
52
|
+
callback: (node: LexicalNode, parent: LexicalNode | null) => Promise<LexicalNode>
|
|
53
|
+
): Promise<LexicalNode> {
|
|
54
|
+
return node;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
protected async transformNode( node: LexicalNode, parent: LexicalNode | null, assets: TContentAssets, options: TRenderOptions ): Promise<LexicalNode> {
|
|
58
|
+
return node;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
protected async deleteUnusedFile(
|
|
62
|
+
node: LexicalNode,
|
|
63
|
+
assets: TContentAssets,
|
|
64
|
+
options: NonNullable<TRenderOptions["attachements"]>
|
|
65
|
+
): Promise<LexicalNode> {
|
|
66
|
+
return node;
|
|
67
|
+
}
|
|
68
|
+
|
|
40
69
|
}
|
|
41
70
|
|
|
42
71
|
export default new RichEditorUtils();
|
|
@@ -7,6 +7,7 @@ import React from 'react';
|
|
|
7
7
|
|
|
8
8
|
// Core libs
|
|
9
9
|
import { useInput, InputBaseProps, InputWrapper } from '../utils';
|
|
10
|
+
import type { TToolbarDisplay } from './ToolbarPlugin';
|
|
10
11
|
|
|
11
12
|
// Special componets
|
|
12
13
|
import type TEditor from './Editor';
|
|
@@ -19,6 +20,8 @@ import './style.less';
|
|
|
19
20
|
export type Props = {
|
|
20
21
|
preview?: boolean,
|
|
21
22
|
title: string,
|
|
23
|
+
toolbar?: TToolbarDisplay,
|
|
24
|
+
decorateText?: boolean
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
/*----------------------------------
|
|
@@ -180,7 +180,10 @@ function TextFormatFloatingToolbar({
|
|
|
180
180
|
}, [editor, $updateTextFormatFloatingToolbar]);
|
|
181
181
|
|
|
182
182
|
return (
|
|
183
|
-
<div ref={popupCharStylesEditorRef} className="floating-text-format-popup card
|
|
183
|
+
<div ref={popupCharStylesEditorRef} className="floating-text-format-popup card pdv-0 pdh-05 row menu" style={{
|
|
184
|
+
borderRadius: '2rem',
|
|
185
|
+
height: '4rem'
|
|
186
|
+
}}>
|
|
184
187
|
{editor.isEditable() && (
|
|
185
188
|
<>
|
|
186
189
|
<Button size="s" icon="bold" active={isBold} onClick={() => {
|