Inline node rendered as `div`

I have a footnote nodes which is an inline node. This is also an atom node and its content (block+) is rendered as a tooltip. The thing is that in my toDOM method I have to render it as a div because I have to save its content (which in editor is rendered as tooltip). Then before I render the HTML on my website I replace the output dom (div) by tooltip. Unfortunately when I then want to convert it back to editor node, the div cannot be incldued in p tag hence its moved to new line. Here is my code:

// Render HTML 
  renderHTML({ HTMLAttributes, node }) {
    let attrs = mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
      class: 'mw-footnote',

    const number = getNodeNumber(node, this.editor!, undefined, true);

    let content: DOMOutputSpec[] = [
      // Number
          'data-type': `${}-number`,
          contentEditable: false,
      // Content
      ['div', { 'data-type': `${}-content`, class: 'hidden' }, 0],

    return ['div', attrs, ...content];
// Replace `div` by `tooltip`

      if (domNode.attribs['data-type'] === 'footnote') {
        let number = domNode.firstChild as Element;
        let content = domNode.lastChild as Element;
        let attribs = { ...content.attribs };
        attribs['class'] = attribs['class'].replace('hidden', '');

        return (
            <TooltipTrigger asChild>
              <div {...attributesToProps(domNode.attribs)}>
                {domToReact(number.children as DOMNode[], options)}
                <div {...attributesToProps(content.attribs)}>
                  {domToReact(content.children as DOMNode[], options)}
            <TooltipContent {...attributesToProps(attribs)}>
              {domToReact(content.children as DOMNode[], options)}

For now it seems that the only way is to save content HTML as attribute instead of trying to save it as a dom element, are there any other alternatives?