diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6ca448e6..c13d09fb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,9 @@
- bug fixes
- editor: prevent accessing non-editable widgets with right arrow
+- widgets
+ - add `lock` property to all widgets
+
## 1.14.6
- bug fixes
diff --git a/resources/docs/docs/remote-control.md b/resources/docs/docs/remote-control.md
index bec57fd4..1184f3a6 100644
--- a/resources/docs/docs/remote-control.md
+++ b/resources/docs/docs/remote-control.md
@@ -11,7 +11,7 @@ When osc messages are received, the default behavior is to update the value of a
#### `/EDIT id properties options`
-Apply a set of options to an existing widget by replacing the old ones with the new ones.
+Apply a set of options to an existing widget by replacing the old ones with the new ones. This ignores the widget's `lock` property.
- `id`: `string`, widget's `id`
diff --git a/resources/docs/docs/user-interface/editor.md b/resources/docs/docs/user-interface/editor.md
index 406ee1a2..551efb66 100644
--- a/resources/docs/docs/user-interface/editor.md
+++ b/resources/docs/docs/user-interface/editor.md
@@ -42,6 +42,8 @@ Selected widget's properties are displayed and can be modified in the inspector.
Some properties (for example `onValue`) have a special code editor with syntax hilighting and many keyboard shortcuts (available by clicking on the "Help" button). In this properties, pressing `enter` will not submit pending changes and instead insert a new line at the cursor position (as you would expect in a regular editor). To submit pending changes, press ++ctrl+enter++ (or ++cmd+enter== on Mac) or click outside the editor.
+Widgets can be locked for edition by enabling their `lock` property. When locked, a widget can't be modified by the editor but it remains possible to delete it or to move it from a container to another in the project tree.
+
## Project tree
@@ -49,6 +51,8 @@ The project tree displays the whole widget structure of the session. Widgets can
The "Filter" input allows filtering displayed widgets by their `id`. It's also possible to only display a single type of widget by typing `type:fader` for example.
+Invisible widgets are displayed with a lower opacity and their name in italic. Locked widgets are displayed with a lock icon after their name.
+
## Widget resizing / dragging
Selected widget can be resized using its south, south-east and east handles. It can be dragged with its north-west handle (holding ++alt++ extends this handle to the widget's size to ease dragging). If the widget's position/size was written in percents, the editor will try to keep using percents.
diff --git a/src/client/editor/index.js b/src/client/editor/index.js
index aa6807a5..d4573521 100644
--- a/src/client/editor/index.js
+++ b/src/client/editor/index.js
@@ -33,6 +33,11 @@ class Editor {
newWidgets = [],
error = false
+ if (this.selectedWidgets.some(w=>w.getProp('lock')) && propName !== 'lock') {
+ this.select(this.selectedWidgets)
+ return
+ }
+
for (var w of this.selectedWidgets) {
let previousValue = w.props[propName]
@@ -557,6 +562,16 @@ class Editor {
}
+ var parent = this.selectedWidgets[0].parent,
+ parentLock = false
+ while (parent !== widgetManager) {
+ if (parent.getProp('lock')) {
+ this.selectedWidgets = [parent]
+ parentLock = true
+ }
+ parent = parent.parent
+ }
+
if (options.fromLasso && !options.lassoEnd) return
this.unselect()
@@ -818,6 +833,11 @@ class Editor {
if (!this.selectedWidgets.length) return
+ if (this.selectedWidgets.some(w=>w.getProp('lock'))) {
+ this.createSelectionBlock()
+ return
+ }
+
var newWidgets = [],
area = this.widgetDragResize,
changedProps = []
@@ -891,6 +911,11 @@ class Editor {
if (!this.selectedWidgets.length) return
+ if (this.selectedWidgets.some(w=>w.getProp('lock'))) {
+ this.createSelectionBlock()
+ return
+ }
+
var newWidgets = []
for (var w of this.selectedWidgets) {
diff --git a/src/client/ui/ui-inspector-field.js b/src/client/ui/ui-inspector-field.js
index ede99252..70c92b1d 100644
--- a/src/client/ui/ui-inspector-field.js
+++ b/src/client/ui/ui-inspector-field.js
@@ -17,7 +17,7 @@ class UiInspectorField extends UiWidget {
this.default = options.default
this.tabIndex = options.tabIndex
- this.container = html`