Skip to content
Snippets Groups Projects
Commit e5e33651 authored by john's avatar john
Browse files

fix: disable notes from toolbar in read only mode

parent 3789fe67
No related branches found
No related tags found
No related merge requests found
......@@ -48,10 +48,12 @@ class ContainerEditor extends SubstanceContainerEditor {
}
didMount () {
// TODO -- replace with super
Surface.prototype.didMount.apply(this, arguments)
this.container.on('nodes:changed', this.onContainerChange, this)
if (this.isEmpty()) this.createText()
if (this.isEmpty()) this.createText()
if (this.isReadOnlyMode()) this.addTargetToLinks()
}
......
import { isUndefined } from 'lodash'
import { AnnotationTool } from 'substance'
class NoteTool extends AnnotationTool {}
class NoteTool extends AnnotationTool {
renderButton ($$) {
const el = super.renderButton($$)
const readOnly = this.isSurfaceReadOnly()
if (!isUndefined(readOnly)) el.attr('disabled', 'true')
return el
}
getSurface () {
const surfaceManager = this.context.surfaceManager
const containerId = this.context.controller.props.containerId
return surfaceManager.getSurface(containerId)
}
isSurfaceReadOnly () {
const surface = this.getSurface()
if (!surface) return
return surface.isReadOnlyMode()
}
}
NoteTool.type = 'note'
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment