Commit 125945db authored by chris's avatar chris

files

parent 12b22514
import { Command, documentHelpers } from 'substance'
class ChangeCaseCommand extends Command {
getCommandState(params) {
let newState = {
active: false,
disabled: false,
}
const selection = params.editorSession.getSelection()
const highlightings = documentHelpers.getPropertyAnnotationsForSelection(
params.editorSession.getDocument(),
params.editorSession.getSelection(),
{ type: 'highlighter' },
)
if (!selection.isCollapsed()) {
console.log('hereee?')
newState.disabled = true
}
if (params.surface) {
const editorProps = params.surface.context.editor.props
if (editorProps.editing === 'selection') newState.disabled = true
}
return newState
}
execute(params) {
return true
}
}
export default ChangeCaseCommand
import { platform } from 'substance'
import WaxAnnotationCommand from '../../commands/WaxAnnotationCommand'
import ChangeCaseTool from './ChangeCaseTool'
import ChangeCaseCommand from './ChangeCaseCommand'
export default {
name: 'change-case',
configure: config => {
config.addCommand('change-case', ChangeCaseCommand, {
commandGroup: 'change-case',
})
config.addTool('change-case', ChangeCaseTool)
config.addIcon('change-case', { fontawesome: 'fa-code' })
// config.addLabel('change-case', {
// en: 'uppercase',
// })
// let controllerKey = 'ctrl'
// if (platform.isMac) controllerKey = 'cmd'
//
// config.addKeyboardShortcut(`${controllerKey}+d`, {
// command: 'code',
// })
},
}
import { Tool, FontAwesomeIcon as Icon, documentHelpers } from 'substance'
class ChangeCaseTool extends Tool {
constructor(...args) {
super(...args)
this.DropDownOptions = [
{ name: 'Upper case', code: '#fdf47D' },
{ name: 'Lower case', code: '#befdc4' },
{ name: 'blue', code: '#c5fff9' },
]
console.log('fjfjffjfjfjfj')
}
}
export default ChangeCaseTool
import { Command } from 'substance'
class UpperCaseCommand extends Command {}
export default UpperCaseCommand
Markdown is supported
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