-
Notifications
You must be signed in to change notification settings - Fork 79
Open

Description
Issue details
Following this example I can get ProseMirror to work fine in Light DOM, but not in Shadow DOM. Here is my code (my HTML file does nothing but embed a test-element
):
import {LitElement, html, css} from 'lit-element';
import { EditorState } from "prosemirror-state";
import { EditorView } from "prosemirror-view";
import { Schema, DOMParser } from "prosemirror-model";
import { schema } from "prosemirror-schema-basic";
import { addListNodes } from "prosemirror-schema-list";
import { exampleSetup } from "prosemirror-example-setup";
customElements.define('test-element', class extends LitElement {
static get styles() {
return [css`
@import 'https://prosemirror.net/css/editor.css';
`];
}
render() {
return html`
<div id="editor"></div>
`;
}
firstUpdated() {
// Mix the nodes from prosemirror-schema-list into the basic schema to
// create a schema with list support.
const mySchema = new Schema({
nodes: addListNodes(schema.spec.nodes, "paragraph block*", "block"),
marks: schema.spec.marks
})
window.view = new EditorView(this.shadowRoot.querySelector("#editor"), {
state: EditorState.create({
doc: DOMParser.fromSchema(mySchema).parse(this.shadowRoot.querySelector("#editor")),
plugins: exampleSetup({schema: mySchema})
})
})
}
});
This is an example of how it looks:
ProseMirror version
I installed them from NPM, which got the following versions:
"prosemirror-example-setup": "^1.1.2",
"prosemirror-model": "^1.13.3",
"prosemirror-schema-basic": "^1.1.2",
"prosemirror-schema-list": "^1.1.4",
"prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.18.0"
Affected platforms
- Firefox
Metadata
Metadata
Assignees
Labels
No labels