Custom writer mark, open custom link dialog

I am trying to do a similar thing:

In order to create inline Buttons in a writer field I want to add a custom mark. The goal for me is to have a mark wich adds a span element with a class around the selected text. Following the Docs this works fine.

The problem is that I need two different Marks (Filter A / Filter B). If I create two custom marks wich both create a span (with different classes), all marked text ends up being the first mark in the plugin. I guess this has to do with the priority definition of the parseDOM (Discussed here: Classes added by Custom Nodes are stripped out of the Writer field when refreshing the page/ProseMirror re-rendering the Writer · Issue #6587 · getkirby/kirby · GitHub).

So my idea for a solution is to create a custom mark wich creates a span but let me select a class name in a Popup. Similar to the link mark.

I found a similar topic but so far without a solution: Custom marks with pop-up

Any hints wich part of the custom mark creates the popup, any directions? I am quite new to custom marks.