prosemirror-math icon indicating copy to clipboard operation
prosemirror-math copied to clipboard

Usage with TipTap: `Error: inner view should not exist!`

Open coderinblack08 opened this issue 1 year ago • 2 comments

I've been trying to integrate TipTap with prosemirror-math. However, whenever I enter "editing mode" via mouse-click or arrow-keys, Error: inner view should not exist! popups. Here's the custom node I'm using (derived from #27):

/* eslint-disable */
import { Node, mergeAttributes } from "@tiptap/core";

import { inputRules } from "prosemirror-inputrules";

import {
  makeInlineMathInputRule,
  REGEX_INLINE_MATH_DOLLARS,
  mathSelectPlugin,
  mathPlugin,
} from "@benrbray/prosemirror-math";

export const Math = Node.create({
  name: "math_inline",
  group: "inline math",
  content: "text*", // important!
  inline: true, // important!
  atom: true, // important!
  code: true,

  parseHTML() {
    return [
      {
        tag: "math-inline", // important!
      },
    ];
  },

  renderHTML({ HTMLAttributes }) {
    return [
      "math-inline",
      mergeAttributes({ class: "math-node" }, HTMLAttributes),
      0,
    ];
  },

  addProseMirrorPlugins() {
    const inputRulePlugin = inputRules({
      rules: [makeInlineMathInputRule(REGEX_INLINE_MATH_DOLLARS, this.type)],
    });

    return [mathPlugin, inputRulePlugin, mathSelectPlugin];
  },
});

Expected Behavior

The extension to work :)

{
  "@tiptap/react": "^2.0.0-beta.114", 
  "@benrbray/prosemirror-math": "^0.2.2",
}

Current Behavior

https://user-images.githubusercontent.com/41022901/180571958-65061f3a-0ddb-46c2-8205-a97587ed9438.mov

coderinblack08 avatar Jul 22 '22 21:07 coderinblack08

I have encountered the same issue with the same version (for both tiptap and prosemirror-math). I will leave a comment here if I could find a solution.

lilingxi01 avatar Aug 02 '22 00:08 lilingxi01

@coderinblack08 @lilingxi01 did you folks find any solution for this?

jibin2706 avatar Feb 21 '24 09:02 jibin2706