diff --git a/app/components/SimpleEditor/ContainerEditor.js b/app/components/SimpleEditor/ContainerEditor.js index a848babcc4fca0625d5c88493e7fb79f1d21215f..7dc30b34cc35918073d74617d6acd4293beb72d0 100644 --- a/app/components/SimpleEditor/ContainerEditor.js +++ b/app/components/SimpleEditor/ContainerEditor.js @@ -4,14 +4,12 @@ import { // deleteCharacter, // deleteSelection, keys as keyboardKeys, - Surface, uuid } from 'substance' class ContainerEditor extends SubstanceContainerEditor { render ($$) { - // TODO -- call with super - var el = Surface.prototype.render.call(this, $$) + let el = super.render($$) var doc = this.getDocument() var containerId = this.getContainerId() @@ -29,9 +27,9 @@ class ContainerEditor extends SubstanceContainerEditor { // if it IS empty, handle in didMount if (!this.isEmpty()) { - containerNode.getNodes().forEach(function (node) { - el.append(this._renderNode($$, node).ref(node.id)) - }.bind(this)) + // containerNode.getNodes().forEach(function (node) { + // el.append(this._renderNode($$, node).ref(node.id)) + // }.bind(this)) } // open for editing @@ -44,21 +42,21 @@ class ContainerEditor extends SubstanceContainerEditor { return el } - + // didMount () { super.didMount() if (this.isEmpty()) this.createText() - this.focus() - - if (this.isReadOnlyMode()) { - const documentSession = this.getDocumentSession() - documentSession.on('didUpdate', this.disableToolbar, this) - - this.addTargetToLinks() - } + this.focus() // TODO notworking + + // if (this.isReadOnlyMode()) { + // const documentSession = this.getDocumentSession() + // documentSession.on('didUpdate', this.disableToolbar, this) + // + // this.addTargetToLinks() + // } } - + // onTextInput (event) { if (!this.props.trackChanges) return super.onTextInput(event) @@ -159,7 +157,7 @@ class ContainerEditor extends SubstanceContainerEditor { createText () { var newSel - this.transaction(function (tx) { + this.editorSession.transaction(function (tx) { var container = tx.get(this.props.containerId) var textType = tx.getSchema().getDefaultTextType() @@ -180,7 +178,7 @@ class ContainerEditor extends SubstanceContainerEditor { }.bind(this)) this.rerender() - this.setSelection(newSel) + this.editorSession.setSelection(newSel) } // only runs if editor is in read-only mode diff --git a/app/components/SimpleEditor/Editor.js b/app/components/SimpleEditor/Editor.js index 96b8e05fec87f1f9a20de1ecd28cebbbd30ec09f..a44b839e0ff067e6e09daabf7a32fc0300b8ea8f 100644 --- a/app/components/SimpleEditor/Editor.js +++ b/app/components/SimpleEditor/Editor.js @@ -41,8 +41,8 @@ class Editor extends ProseEditor { willUpdateState () {} didMount () { - this.documentSession.on('didUpdate', this.documentSessionUpdated, this) - this.documentSession.on('fileUploadTrigger', this.handleUpload, this) + // this.documentSession.on('didUpdate', this.documentSessionUpdated, this) + // this.documentSession.on('fileUploadTrigger', this.handleUpload, this) this.extendState({ editorReady: true }) }