Skip to content
Snippets Groups Projects
Commit bb47b71a authored by Yannis Barlas's avatar Yannis Barlas
Browse files

Merge branch 'track-button-disabled' into 'staging'

fix when track changes is enabled and when it is not

See merge request !2
parents a25a91df 7ded44a8
No related branches found
No related tags found
No related merge requests found
...@@ -224,8 +224,16 @@ class ContainerEditor extends SubstanceContainerEditor { ...@@ -224,8 +224,16 @@ class ContainerEditor extends SubstanceContainerEditor {
disableToolbar () { disableToolbar () {
const commandStates = this.getCommandStates() const commandStates = this.getCommandStates()
const allowed = [
'comment',
'redo',
'save',
'track-change-enable',
'track-change-toggle-view',
'undo'
]
each(keys(commandStates), key => { each(keys(commandStates), key => {
const allowed = ['comment', 'save', 'undo', 'redo', 'track-change-toggle-view']
if (!includes(allowed, key)) commandStates[key].disabled = true if (!includes(allowed, key)) commandStates[key].disabled = true
}) })
} }
......
import {Command} from 'substance' import { Command } from 'substance'
class TrackChangeControlCommand extends Command { class TrackChangeControlCommand extends Command {
getCommandState (params) { getCommandState (params) {
let newState = { const newState = {
disabled: false, disabled: false,
active: false active: false
} }
......
import { Tool } from 'substance' import { Tool } from 'substance'
class TrackChangeControlTool extends Tool { class TrackChangeControlTool extends Tool {
constructor (parent, props, config) {
super(parent, props, config)
this.disabled = false
}
getClassNames () { getClassNames () {
return 'sm-target-track-change-enable' return 'sm-target-track-change-enable'
} }
willReceiveProps (props) {
if (!this.canAct()) this.disabled = true
}
renderButton ($$) { renderButton ($$) {
const el = super.renderButton($$) const el = super.renderButton($$)
let trackChangesMode = this.isTrackChangesOn() const trackChangesMode = this.isTrackChangesOn()
if (trackChangesMode === true) el.addClass('track-changes-active') if (trackChangesMode === true) el.addClass('track-changes-active')
if (!this.canAct()) el.attr('disabled', 'true') if (!this.canAct()) el.attr('disabled', 'true')
......
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