@@ -11,12 +11,13 @@ import {
11
11
__experimentalHStack as HStack ,
12
12
__experimentalVStack as VStack ,
13
13
} from '@wordpress/components' ;
14
+ import { useDispatch } from '@wordpress/data' ;
15
+ import { store as noticesStore } from '@wordpress/notices' ;
14
16
15
17
/**
16
18
* Internal dependencies
17
19
*/
18
20
import { AdminContext } from '../index' ;
19
- import { addNotification } from '../../lib/helper' ;
20
21
import EditorPreview from './components/editor-preview' ;
21
22
import Filter from './components/filter' ;
22
23
import Controls from './components/controls' ;
@@ -42,6 +43,7 @@ export default function EditorConfig() {
42
43
const [ editorMode , setEditorMode ] = useState ( 'basic' ) ;
43
44
const [ searchQuery , setSearchQuery ] = useState ( '' ) ;
44
45
const [ fontWeights , setFontWeights ] = useState ( [ 300 ] ) ;
46
+ const { createNotice, createSuccessNotice } = useDispatch ( noticesStore ) ;
45
47
46
48
// Update editor config.
47
49
const onUpdateOptions = ( ) => {
@@ -56,7 +58,9 @@ export default function EditorConfig() {
56
58
} ,
57
59
} ) . then ( ( response ) => {
58
60
setTimeout ( ( ) => {
59
- addNotification ( response . message , response . success ? 'success' : 'danger' ) ;
61
+ createNotice ( response . success ? 'success' : 'error' , response . message , {
62
+ type : 'snackbar' ,
63
+ } ) ;
60
64
setIsWaiting ( false ) ;
61
65
} , 600 ) ;
62
66
} ) ;
@@ -75,10 +79,9 @@ export default function EditorConfig() {
75
79
setEditorOptions ( response . editorOptions ) ;
76
80
77
81
setTimeout ( ( ) => {
78
- addNotification (
79
- __ ( 'Settings have been reset.' , 'custom-html-block-extension' ) ,
80
- 'success'
81
- ) ;
82
+ createSuccessNotice ( __ ( 'Settings have been reset.' , 'custom-html-block-extension' ) , {
83
+ type : 'snackbar' ,
84
+ } ) ;
82
85
setIsWaiting ( false ) ;
83
86
} , 600 ) ;
84
87
} ) ;
0 commit comments