javascript – Add custom classes for blocks in editor based on custom attributes

I have been able to add additional classes to the core/heading block using blocks.getSaveContent.extraProps filter, however, this only adds the class on the frontend, I would also like that custom class to be applied to the block element in the editor as followed.

enter image description here

I know i can use the blocks.getBlockDefaultClassName filter but dont know if I could do that based on custom attributes assigned to the block. Any help here would be much appreciated.