editor: fullscreen button
This commit is contained in:
parent
ce86c41531
commit
b496383413
4 changed files with 74 additions and 3 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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`<div class="btn">${locales('editor_ace_help')}</div>`)
|
||||
var help = this.container.appendChild(html`<div class="btn help">${locales('editor_ace_help')}</div>`)
|
||||
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`<div class="btn fullscreen">${raw(icon('expand'))}</div>`)
|
||||
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 {
|
|||
<th>Command</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr><td><span class="kbd">Ctrl-Enter</span></td><td>save</td></tr>
|
||||
${keybindings.map(k=>html`<tr><td><span class="kbd">${k.key}</span></td><td>${k.command}</td></tr>`)}
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -352,6 +352,7 @@ osc-panel-content {
|
|||
#main {
|
||||
flex: 1;
|
||||
min-height: 40rem;
|
||||
contain: strict;
|
||||
}
|
||||
|
||||
#osc-greeting-header {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue