Merge branch 'pure'

This commit is contained in:
Martin Hermant 2018-10-10 13:54:34 +02:00
commit 9b017657da
No known key found for this signature in database
GPG key ID: FA123D713AB2A87C
6 changed files with 25 additions and 15 deletions

View file

@ -10,6 +10,8 @@
- properties categories can now be folded
- added keyboard shortcut `F2` for editing the label quickly
- added keyboard shortcut `mod + s` for saving the session
- use `backspace` instead of `delete` for deleting widgets on MacOs
- added keyboard shortcut `mod + e` for enabling / disabling the editor
## 0.37.4

View file

@ -55,13 +55,21 @@ When holding the `ctrl` key (or `command` on Mac), multiple widgets can be selec
## Keyboard shortcuts
The following shortcuts are always available:
| Shortcut | Description |
|---|---|
| `mod + e` | enable/disable editor |
| `mod + s` | save session as... |
The following shortcuts are available only when the editor is enabled:
| Shortcut | Description |
|---|---|
| `f2` | edit selected widget's label |
| `mod + z` | undo |
| `mod + y / mod + shift + z` | redo |
| `delete` | delete selected widgets |
| `delete` (`backspace` on Mac) | delete selected widgets |
| `mod + c` | copy selected widgets |
| `mod + x` | cut selected widgets |
| `mod + v` | paste clipboard in selected widget |

View file

@ -29,7 +29,7 @@ module.exports = function editField(editor, widget, propName, defaultValue){
return field
}
input = DOM.create(`<select class="input no-keybinding"/>`)
input = DOM.create('<select class="input no-keybinding"/>')
var innerHTML = ''
for (let category in widgetCategories) {

View file

@ -1,11 +1,11 @@
var {widgets} = require('../widgets/'),
{Popup} = require('../ui/utils'),
editField = require('./edit-field'),
{updateWidget, incrementWidget} = require('./data-workers'),
keyboardJS = require('keyboardjs'),
diff = require('deep-diff'),
widgetManager = require('../managers/widgets'),
{deepCopy} = require('../utils'),
macOs = (navigator.platform || '').match('Mac'),
sessionManager
const HISTORY_SIZE = 50
@ -88,7 +88,7 @@ var Editor = class Editor {
if (e.target.classList.contains('no-keybinding')) return
this.pasteWidget(this.mousePosition.x, this.mousePosition.y, true)
})
keyboardJS.bind(['delete','backspace'], (e)=>{
keyboardJS.bind(macOs ? 'backspace' : 'delete', (e)=>{
if (e.target.classList.contains('no-keybinding')) return
this.deleteWidget()
})
@ -137,8 +137,11 @@ var Editor = class Editor {
keyboardJS.bind('mod + e', (e)=>{
e.preventDefault()
if(EDITING){editor.disable()}
else{editor.enable()}
if (this.enabled) {
this.disable()
} else {
this.enable()
}
})
@ -287,10 +290,7 @@ var Editor = class Editor {
this.form.appendChild(DOM.create(`
<div class="separator">
${this.selectedWidgets.length > 1 ?
'<span class="accent">Multiple Widgets</span>' :
'<span>Widget</span>'
}
${this.selectedWidgets.length > 1 ? '<span class="accent">Multiple Widgets</span>' : '<span>Widget</span>' }
</div>
`))
@ -312,7 +312,7 @@ var Editor = class Editor {
if (propName.indexOf('_') === 0 && propName !== '_props') {
if (category) this.form.appendChild(category)
category = DOM.create(`<div class="category ${this.foldedCategories.indexOf(props[propName]) > -1 ? "folded" : ""}"></div>`)
category = DOM.create(`<div class="category ${this.foldedCategories.indexOf(props[propName]) > -1 ? 'folded' : ''}"></div>`)
field = DOM.create(`<div class="separator" data-name="${props[propName]}"><span>${props[propName]}</span></div>`)
@ -443,7 +443,7 @@ var Editor = class Editor {
var index = this.selectedWidgets.map((w)=>DOM.index(w.container)).sort((a,b)=>{return b-a}),
data = this.selectedWidgets.map((w)=>w.props),
type = this.selectedWidgets[0].props.type == 'tab' ? 'tab' : 'widget',
parent = editor.selectedWidgets[0].parent
parent = this.selectedWidgets[0].parent
if (type !== 'widget') return
@ -470,7 +470,7 @@ var Editor = class Editor {
var data = this.selectedWidgets.map((w)=>w.props)
var pastedData = JSON.parse(editor.clipboard),
var pastedData = JSON.parse(this.clipboard),
minTop = Infinity,
minLeft = Infinity

View file

@ -6,7 +6,7 @@ var targets = {},
function pointerDownHandler(event) {
if (event.capturedByEditor || event.touchPunch) return
if (event.capturedByEditor || event.touchPunch) return
if (!event.multitouch) {
for (var i in targets) {

View file

@ -432,7 +432,7 @@ class Widget extends EventEmitter {
if (!this.oscReceivers[address]) {
this.oscReceivers[address] = new OscReceiver(resolvedAddress, value, this, propName)
if (oscReceiverState[address]) {
if (oscReceiverState[address]) {
this.oscReceivers[address].value = oscReceiverState[address]
delete oscReceiverState[address]
}