when I use nodeView to render a node ,I cant copy full content that I selected,why? example code:
blockquote node
import Node from './Node';
import { NodeViewComponentFunc } from '@richSrc/types/node-view/base-node-view';
import BlockquoteNodeView from '@richSrc/node-views/BlockquoteNodeView';
import { Decoration, EditorView } from 'prosemirror-view';
import { Node as ProsemirrorNode } from 'prosemirror-model';
import BlockquoteBase from '@richSrc/components/node-view/Blockquote';
export default class Blockquote extends Node {
get name() {
return 'blockquote';
}
get schema() {
return {
content: 'block+',
parseDOM: [{ tag: 'blockquote' }],
toDOM: () => ['div', ['div', ['blockquote', 0]]]
};
}
component: NodeViewComponentFunc = props => {
return <BlockquoteBase {...props} readOnly={this.options.readOnly} />;
};
nodeView = (
node: ProsemirrorNode,
view: EditorView,
getPos: () => number,
decorations: Decoration[]
) => {
return new BlockquoteNodeView(this.component, {
editor: this.editor,
node,
view,
getPos,
decorations
});
};
};
import React from 'react';
import type { NodeViewComponentOptions } from '@richSrc/types/node-view/base-node-view';
**component**
const BlockquoteBase: React.FC<NodeViewComponentOptions> = props => {
return <div></div>;
};
export default BlockquoteBase;
import NodeViewBase from '../node-views/NodeViewBase';
import type { NodeViewComponentFunc } from '../types/node-view/base-node-view';
**NodeView:**
export default class ExpandBlockNodeView extends NodeViewBase {
contentDOM: HTMLSpanElement;
constructor(component: NodeViewComponentFunc, { editor, node, view, getPos, decorations }) {
super(component, { editor, node, view, getPos, decorations });
this.dom = document.createElement('span');
this.contentDOM = document.createElement('blockquote');
this.contentDOM.title = node.attrs.title;
this.renderElement(() => {
this.dom && this.dom.firstChild?.appendChild(this.contentDOM);
});
}
}
when I try to copy
222222222
3333333333
if I dont use component and nodeView,I get
“22222222
33333333”
if I use,I get “3”
help???