Commit 3c9b78ee authored by chris's avatar chris

add menus through configurator

parent 4285c9b9
......@@ -10,8 +10,8 @@ import {
//setup
import MainNode from './setup/MainNode'
import MainConverter from './setup/MainConverter'
import toolPanels from './setup/ToolPanels'
import defaultToolPanels from './setup/defaultToolPanels'
import ucpToolPanels from './setup/ucpToolPanels'
// My Elements
import BibliographyEntryPackage from './elements/bibliographyEntry/BibliographyEntryPackage'
import PersistencePackage from './elements/persistence/PersistencePackage'
......@@ -71,7 +71,8 @@ const config = {
noBaseStyles: options.noBaseStyles,
})
config.import(toolPanels)
config.import(defaultToolPanels)
config.import(ucpToolPanels)
// Packages
config.import(TablePackage)
......
export default {
configure: config => {
name: 'toolPanels',
config.addToolPanel('side-toolbar', [
{
name: 'text-display',
type: 'tool-group',
showDisabled: true,
style: 'descriptive',
commandGroups: ['text-display'],
},
{
name: 'text-types',
type: 'tool-group',
showDisabled: true,
style: 'descriptive',
commandGroups: ['text-types'],
},
])
config.addToolPanel('toolbar', [
{
name: 'undo-redo',
type: 'tool-group',
showDisabled: true,
style: 'minimal',
commandGroups: ['undo-redo'],
},
{
name: 'persistence',
type: 'tool-group',
showDisabled: true,
style: 'minimal',
commandGroups: ['persistence'],
},
{
name: 'change-case',
type: 'tool-group',
showDisabled: true,
style: 'minimal',
commandGroups: ['change-case'],
},
{
name: 'annotations',
type: 'tool-group',
showDisabled: true,
style: 'minimal',
commandGroups: ['annotations'],
},
{
name: 'note',
type: 'tool-group',
showDisabled: true,
style: 'minimal',
commandGroups: ['note'],
},
{
name: 'list',
type: 'tool-group',
showDisabled: true,
style: 'minimal',
commandGroups: ['list'],
},
{
name: 'diacritics-tool',
type: 'tool-group',
showDisabled: true,
style: 'minimal',
commandGroups: ['diacritics-tool'],
},
{
name: 'find-and-replace-tool',
type: 'tool-group',
showDisabled: true,
style: 'minimal',
commandGroups: ['find-and-replace-tool'],
},
{
name: 'highlighter',
type: 'tool-group',
showDisabled: true,
style: 'minimal',
commandGroups: ['highlighter'],
},
{
name: 'ornament',
type: 'tool-group',
showDisabled: true,
style: 'minimal',
commandGroups: ['ornament'],
},
{
name: 'spell-check-toggle',
type: 'tool-group',
showDisabled: true,
style: 'minimal',
commandGroups: ['spell-check-toggle'],
},
{
name: 'insert-script',
type: 'tool-group',
showDisabled: true,
style: 'minimal',
commandGroups: ['insert-script'],
},
{
name: 'full-screen-control',
type: 'tool-group',
showDisabled: true,
style: 'minimal',
commandGroups: ['full-screen-control'],
},
{
name: 'shortcuts-modal',
type: 'tool-group',
showDisabled: true,
style: 'minimal',
commandGroups: ['shortcuts-modal'],
},
{
name: 'track-change-controls',
type: 'tool-group',
showDisabled: true,
style: 'minimal',
commandGroups: ['track-change-controls'],
},
{
name: 'table',
type: 'tool-group',
showDisabled: true,
style: 'minimal',
commandGroups: ['table'],
},
// {
// name: 'quote-marks',
// type: 'tool-group',
// showDisabled: true,
// style: 'minimal',
// commandGroups: ['text-macros'],
// },
])
config.addToolPanel('main-overlay', [
{
name: 'comment',
type: 'tool-prompt',
showDisabled: false,
commandGroups: ['comment'],
},
{
name: 'prompt',
type: 'tool-prompt',
showDisabled: false,
commandGroups: ['prompt'],
},
{
name: 'spell-check',
type: 'tool-prompt',
showDisabled: false,
commandGroups: ['spell-check'],
},
{
name: 'caption',
type: 'tool-prompt',
showDisabled: false,
commandGroups: ['caption'],
},
])
},
}
......@@ -3,13 +3,13 @@ import { Component, Toolbar } from 'substance'
class SideToolbar extends Component {
render($$) {
const { configurator } = this.props
const menu = configurator.menus[1]
const wrapper = $$('div').addClass('sidenav')
const sideNav = $$('div')
.addClass('se-toolbar-wrapper')
.append(
$$(Toolbar, {
toolPanel: configurator.getToolPanel('side-toolbar'),
toolPanel: configurator.getToolPanel(menu),
}),
)
return wrapper.append(sideNav)
......
......@@ -17,7 +17,7 @@ class Toolbar extends Component {
.addClass('view-mode')
.append('Read-Only')
: ''
const menu = configurator.menus[0]
return $$('div')
.addClass('se-toolbar-wrapper')
.append(
......@@ -25,7 +25,7 @@ class Toolbar extends Component {
commandStates,
trackChanges,
trackChangesView,
toolPanel: configurator.getToolPanel('toolbar'),
toolPanel: configurator.getToolPanel(menu),
}),
// .ref('toolbar')
)
......
......@@ -113,14 +113,14 @@ class Wax extends React.Component {
user,
autoSave,
mode,
tools,
menus,
theme,
} = this.props
this.configurator = new Configurator().import(config)
this.configurator.addImporter('html', Importer)
const editorSession = this.createSession(content)
this.configurator.menus = ['topDefault', 'sideDefault']
const onClose = this.onClose
// TODO -- make this configurable
......@@ -145,7 +145,6 @@ class Wax extends React.Component {
user,
mode,
autoSave: false,
tools,
theme: 'editoria',
},
el,
......
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