File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ const createDialog = ({
16
16
const dialog = document . createElement ( "dialog" ) ;
17
17
18
18
dialog . style . maxWidth = "960px" ;
19
+ // Make be not able to click inner
20
+ dialog . style . padding = "0" ;
19
21
dialog . style . top = "32px" ;
20
22
dialog . style . width = "calc(100% - 64px)" ;
21
23
@@ -32,11 +34,22 @@ const createDialog = ({
32
34
data,
33
35
} ) ;
34
36
37
+ const handleDialogClick = ( event : MouseEvent ) => {
38
+ if ( ! ( event . target instanceof Node ) || ! event . target . isEqualNode ( dialog ) ) {
39
+ return ;
40
+ }
41
+
42
+ dialog . close ( ) ;
43
+ } ;
44
+
45
+ dialog . addEventListener ( "click" , handleDialogClick ) ;
46
+
35
47
const handleDialogClose = async ( ) => {
36
48
const editorJSData = await editorJS . save ( ) ;
37
49
38
50
editorJS . destroy ( ) ;
39
51
52
+ dialog . removeEventListener ( "click" , handleDialogClick ) ;
40
53
dialog . removeEventListener ( "close" , handleDialogClose ) ;
41
54
dialog . remove ( ) ;
42
55
You can’t perform that action at this time.
0 commit comments