File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed
src/features/emails/components/EmailEditor Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable @typescript-eslint/ban-ts-comment */
2
2
//@ts -ignore
3
3
import Header from '@editorjs/header' ;
4
- //@ts -ignore
5
- import Paragraph from '@editorjs/paragraph' ;
6
4
import { Box , useTheme } from '@mui/material' ;
7
5
import EditorJS , {
8
6
EditorConfig ,
@@ -19,6 +17,7 @@ import messageIds from 'features/emails/l10n/messageIds';
19
17
import { useMessages } from 'core/i18n' ;
20
18
import { useNumericRouteParams } from 'core/hooks' ;
21
19
import variableToolFactory from './tools/inlineVariable' ;
20
+ import ParagraphWithSpanPaste from './tools/paragraphWithSpanPaste' ;
22
21
23
22
export type EmailEditorFrontendProps = {
24
23
apiRef : MutableRefObject < EditorJS | null > ;
@@ -110,7 +109,7 @@ const EmailEditorFrontend: FC<EmailEditorFrontendProps> = ({
110
109
} ,
111
110
} ,
112
111
paragraph : {
113
- class : Paragraph ,
112
+ class : ParagraphWithSpanPaste as unknown as ToolConstructable ,
114
113
} ,
115
114
variable : {
116
115
class : variableToolFactory ( messages . editor . tools . variable . title ( ) ) ,
Original file line number Diff line number Diff line change
1
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
2
+ //@ts -ignore
3
+ import Paragraph from '@editorjs/paragraph' ;
4
+ import { BlockTool , HTMLPasteEvent } from '@editorjs/editorjs' ;
5
+
6
+ //@ts -ignore
7
+ export default class ParagraphWithSpanPaste
8
+ extends Paragraph
9
+ implements BlockTool
10
+ {
11
+ onPaste ( event : HTMLPasteEvent ) {
12
+ const text = event . detail . data . textContent ;
13
+ event . detail . data = document . createElement ( 'div' ) ;
14
+ event . detail . data . textContent = text ;
15
+ return super . onPaste ( event ) ;
16
+ }
17
+
18
+ static get pasteConfig ( ) {
19
+ return {
20
+ tags : [ 'P' , 'SPAN' ] ,
21
+ } ;
22
+ }
23
+ }
You can’t perform that action at this time.
0 commit comments