Slatejs – Set type as inline

I’ve got a question regarding Slatejs.

I’m trying to implement an option to set a text to a type “url” and display this type as hyperlink.

This works fine, but actually the complete line is being marked as type “url” and not only the selected text. I want the selected text marked as type “url” and to be added inline.
This is my current code to mark the selected text as type “url”

function onFormatTextUrlButtonClick(editor) {
    const isActive = isTypeActive(editor,'url')
    Transforms.setNodes(
        editor,
        { 
            type: isActive ? 'paragraph' : 'url',
            url: isActive ? undefined : Editor.string(editor, editor.selection)
        },
        { 
            match: n => Editor.isBlock(editor, n)
        }
    );
}

I’m sure it is no big issue, but I can’t figure it out actually. Many thanks for any hint in advance!