@@ -208,19 +208,20 @@ export default class ToolbarController extends BasicObject {
208
208
const attributeName = getAttributeName ( dialogElement )
209
209
const input = getInputForDialog ( dialogElement , attributeName )
210
210
211
- input . willValidate && input . setCustomValidity ( "" )
212
- if ( input . willValidate && ! input . checkValidity ( ) || ! this . safeAttribute ( input ) ) {
213
- input . setCustomValidity ( "Invalid value" )
214
- input . setAttribute ( "data-trix-validate" , "" )
215
- input . classList . add ( "trix-validate" )
216
- return input . focus ( )
217
- } else {
218
- this . delegate ?. toolbarDidUpdateAttribute ( attributeName , input . value )
219
- return this . hideDialog ( )
211
+ if ( input . willValidate ) {
212
+ input . setCustomValidity ( "" )
213
+ if ( ! input . checkValidity ( ) || ! this . isSafeAttribute ( input ) ) {
214
+ input . setCustomValidity ( "Invalid value" )
215
+ input . setAttribute ( "data-trix-validate" , "" )
216
+ input . classList . add ( "trix-validate" )
217
+ return input . focus ( )
218
+ }
220
219
}
220
+ this . delegate ?. toolbarDidUpdateAttribute ( attributeName , input . value )
221
+ return this . hideDialog ( )
221
222
}
222
223
223
- safeAttribute ( input ) {
224
+ isSafeAttribute ( input ) {
224
225
if ( input . hasAttribute ( "data-trix-validate-href" ) ) {
225
226
return DOMPurify . isValidAttribute ( "a" , "href" , input . value )
226
227
} else {
0 commit comments