File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed
Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -208,19 +208,20 @@ export default class ToolbarController extends BasicObject {
208208 const attributeName = getAttributeName ( dialogElement )
209209 const input = getInputForDialog ( dialogElement , attributeName )
210210
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+ }
220219 }
220+ this . delegate ?. toolbarDidUpdateAttribute ( attributeName , input . value )
221+ return this . hideDialog ( )
221222 }
222223
223- safeAttribute ( input ) {
224+ isSafeAttribute ( input ) {
224225 if ( input . hasAttribute ( "data-trix-validate-href" ) ) {
225226 return DOMPurify . isValidAttribute ( "a" , "href" , input . value )
226227 } else {
You can’t perform that action at this time.
0 commit comments