add basic implementation for node views
This commit is contained in:
@@ -75,8 +75,6 @@ declare module './Editor' {
|
||||
@magicMethods
|
||||
export class Editor extends EventEmitter {
|
||||
|
||||
public renderer!: any
|
||||
|
||||
private proxy!: Editor
|
||||
|
||||
private commandManager!: CommandManager
|
||||
@@ -256,7 +254,6 @@ export class Editor extends EventEmitter {
|
||||
* Creates a ProseMirror view.
|
||||
*/
|
||||
private createView() {
|
||||
console.log('CREATE VIEW')
|
||||
this.view = new EditorView(this.options.element, {
|
||||
state: EditorState.create({
|
||||
doc: this.createDocument(this.options.content),
|
||||
@@ -266,10 +263,16 @@ export class Editor extends EventEmitter {
|
||||
],
|
||||
}),
|
||||
dispatchTransaction: this.dispatchTransaction.bind(this),
|
||||
})
|
||||
|
||||
// `editor.view` is not yet available at this time.
|
||||
// Therefore we will add all node views directly afterwards.
|
||||
this.view.setProps({
|
||||
nodeViews: this.extensionManager.nodeViews,
|
||||
})
|
||||
|
||||
// store editor in dom element for better testing
|
||||
// Let’s store the editor instance in the DOM element.
|
||||
// So we’ll have access to it for tests.
|
||||
const dom = this.view.dom as HTMLElement
|
||||
dom.editor = this.proxy
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user