How to use ParseRule as PasteRule?

Hi I have a rule to parse math expression from wikipedia which works fine i.e. it parse the expression to find the content and the node is correctly created (when I initializing the editor). How can I use this ParseRule to make it work with pasting? I.e I’d like to copy the code from wikipedia, paste it into my editor and as a results I’d like to get the node. How to do it properly in ProseMirror?

EDIT I wrote the following plugin for my purposes and I’m wondering whether shouldn’t it be a default behaviour? I.e. someone pastes a text, and it should be parsed using the schema and resulting content should be inserted to the editor content.

	handlePaste: (view, event) => {
					if (!event.clipboardData) {
						return false;

					// don’t create a new math block within math block
					if (this.editor.isActive( {
						return false;

					let text = event.clipboardData.getData("text/plain");
					if (!text) return false;

					let doc = createNodeFromContent(text, view.state.schema, {
						slice: true,

					if (
						doc.length === 1 &&
						(doc[0].type === "math_inline" || doc[0].type === "math_display")
					) {
						let { editor } = this;
						return true;

					return false;