diff --git a/CHANGELOG.md b/CHANGELOG.md
index 943b3ede..9eba264b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,8 @@
- advanced syntaxes
- added `IMPORT{file}` syntax to allow loading external files in properties
+- editor
+ - add fullscreen mode for properties with code editor enabled
## 1.13.2
diff --git a/src/client/ui/ui-inspector-field.js b/src/client/ui/ui-inspector-field.js
index 351bfd5e..bb65bec1 100644
--- a/src/client/ui/ui-inspector-field.js
+++ b/src/client/ui/ui-inspector-field.js
@@ -187,6 +187,7 @@ class UiInspectorField extends UiWidget {
editor.selection.setRange({start:0,end:0})
editor.gotoLine(0)
editor.removeAllListeners('focus')
+ editor.setOptions({maxLines: 30})
editor.dirty = false
editor.on('focus', ()=>{
this.parent.focusedInput = input
@@ -244,10 +245,38 @@ class UiInspectorField extends UiWidget {
editor.resize()
})
- var help = this.container.appendChild(html`
${locales('editor_ace_help')}
`)
+ var help = this.container.appendChild(html`${locales('editor_ace_help')}
`)
help.addEventListener('fast-click', (e)=>{
this.aceHelp(editor)
})
+
+ var closeKey = (e)=>{
+ if (e.keyCode !== 27) return
+ this.container.classList.remove('fullscreen')
+ editor.setOptions({maxLines: 30})
+ document.removeEventListener('keydown', closeKey)
+ this.container.removeEventListener('fast-click', closeClick)
+ }
+ var closeClick = (e)=>{
+ if (e.target === this.container) {
+ closeKey({keyCode: 27})
+ }
+ }
+ var fullscreen = this.container.appendChild(html`${raw(icon('expand'))}
`)
+ fullscreen.addEventListener('fast-click', (e)=>{
+ var fs = this.container.classList.toggle('fullscreen')
+ editor.setOptions({maxLines: fs ? 0 : 30})
+ window.dispatchEvent(new Event('resize'))
+ this.label.style.setProperty('--prefix', fs ? this.widget.getProp('id') + '.' : '')
+ if (fs) {
+ editor.focus()
+ document.addEventListener('keydown', closeKey)
+ this.container.addEventListener('fast-click', closeClick)
+ } else {
+ document.removeEventListener('keydown', closeKey)
+ this.container.removeEventListener('fast-click', closeClick)
+ }
+ })
}
@@ -286,6 +315,7 @@ class UiInspectorField extends UiWidget {
Command |
+ | Ctrl-Enter | save |
${keybindings.map(k=>html`| ${k.key} | ${k.command} |
`)}
diff --git a/src/scss/ui/inspector.scss b/src/scss/ui/inspector.scss
index d8082b2d..48283374 100644
--- a/src/scss/ui/inspector.scss
+++ b/src/scss/ui/inspector.scss
@@ -3,6 +3,9 @@ $field-height: 24rem;
$padding: 8rem;
$radius: 3rem;
+osc-panel-container.right osc-panel-inner {
+ contain: initial
+}
#osc-inspector {
--widget-padding: -1rem;
@@ -63,16 +66,51 @@ osc-inspector-field {
}
.btn {
position: absolute;
- right:3rem;
top:3rem;
background: var(--color-ui-button);
line-height: $field-height - 6;
- border-top-right-radius: inherit;
box-shadow: 0 0 1rem 0 var(--color-background)
}
+ .fullscreen {
+ right:3rem;
+ width: 24rem;
+ padding-left: 0;
+ padding-right: 0;
+ border-top-right-radius: inherit;
+ }
+ .help {
+ right:30rem;
+ }
&:after {
content:none;
}
+
+ &.fullscreen {
+ position: fixed;
+ width:auto;
+ height: auto;
+ top:0;
+ left:0;
+ right:0;
+ bottom:0;
+ padding: 50rem;
+ margin: 0;
+ z-index: 99;
+ background: rgba(black, 0.3);
+ > label:before {
+ content: var(--prefix);
+ }
+ .btn {
+ margin-top: 50rem;
+ margin-right: 50rem;
+ &.fullscreen {
+ color: var(--color-accent);
+ }
+ }
+ .ace_editor {
+ height: 100%!important;
+ }
+ }
}
.ace_editor {
min-height: $field-height;
diff --git a/src/scss/ui/workspaces.scss b/src/scss/ui/workspaces.scss
index 2946f5ff..54c5e94a 100644
--- a/src/scss/ui/workspaces.scss
+++ b/src/scss/ui/workspaces.scss
@@ -352,6 +352,7 @@ osc-panel-content {
#main {
flex: 1;
min-height: 40rem;
+ contain: strict;
}
#osc-greeting-header {