ui: code editor help modal, revert checkboxes margin change
This commit is contained in:
parent
1bed4962e4
commit
a697eb659d
10 changed files with 97 additions and 12 deletions
|
|
@ -34,6 +34,9 @@ module.exports = {
|
|||
editor_fragment_export: 'Export',
|
||||
editor_fragment_import: 'Import',
|
||||
|
||||
editor_ace_help: 'Help',
|
||||
editor_ace_help_title: 'Code editor keyboard shortcuts',
|
||||
|
||||
// loadings
|
||||
loading_upload: 'Uploading file...',
|
||||
loading_newclient: 'New client connecting...',
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ module.exports = {
|
|||
editor_fragment_export: 'Exporter',
|
||||
editor_fragment_import: 'Importer',
|
||||
|
||||
editor_ace_help: 'Aide',
|
||||
editor_ace_help_title: 'Raccourcis claviers de l\'éditeur',
|
||||
|
||||
// loadings
|
||||
loading_upload: 'Téléversement...',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
var UiWidget = require('./ui-widget'),
|
||||
UiModal = require('./ui-modal'),
|
||||
{categories} = require('../widgets/'),
|
||||
locales = require('../locales'),
|
||||
html = require('nanohtml'),
|
||||
raw = require('nanohtml/raw'),
|
||||
{icon} = require('../ui/utils'),
|
||||
|
|
@ -18,7 +20,9 @@ function createEditor(name, language) {
|
|||
editor.setOption('autoScrollEditorIntoView', true)
|
||||
editor.setOption('maxLines', 40)
|
||||
editor.$blockScrolling = Infinity
|
||||
editor.commands.bindKeys({'ctrl-l':null, 'ctrl-f': null,'cmd-l':null, 'cmd-f': null})
|
||||
editor.commands.bindKeys({
|
||||
'ctrl-l': null, 'ctrl-f': null, 'ctrl-h': null, 'ctrl-,': null,
|
||||
})
|
||||
editor.renderer.setScrollMargin(4, 4, 0, 4)
|
||||
editor.element = el
|
||||
editor.element.classList.add('ace_dark')
|
||||
|
|
@ -229,11 +233,65 @@ class UiInspectorField extends UiWidget {
|
|||
editor.getSession().getUndoManager().reset()
|
||||
editor.resize()
|
||||
})
|
||||
|
||||
var help = this.container.appendChild(html`<div class="btn">${locales('editor_ace_help')}</div>`)
|
||||
help.addEventListener('fast-click', (e)=>{
|
||||
this.aceHelp(editor)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
aceHelp(editor) {
|
||||
|
||||
var keybindings = [];
|
||||
var commandMap = {};
|
||||
editor.keyBinding.$handlers.forEach(function(handler) {
|
||||
var ckb = handler.commandKeyBinding;
|
||||
for (var i in ckb) {
|
||||
var key = i.replace(/(^|-)\w/g, function(x) { return x.toUpperCase(); });
|
||||
var commands = ckb[i];
|
||||
if (!Array.isArray(commands))
|
||||
commands = [commands];
|
||||
commands.forEach(function(command) {
|
||||
if (typeof command != "string")
|
||||
command = command.name;
|
||||
if (commandMap[command]) {
|
||||
commandMap[command].key += "|" + key;
|
||||
} else {
|
||||
commandMap[command] = {key: key, command: command};
|
||||
keybindings.push(commandMap[command]);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var modal = new UiModal({closable: true, title: html`<span class="editor-help-title">${locales('editor_ace_help_title')}</span>`, html: true, content: html`
|
||||
<div class="inspector-help">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Shortcut</th>
|
||||
<th>Command</th>
|
||||
</tr>
|
||||
</thead>
|
||||
${
|
||||
keybindings.map(k=>html`<tr><td><span class="kbd">${k.key}</span></td><td>${k.command}</td></tr>`)
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
`})
|
||||
|
||||
|
||||
this.parent.helpModalOpened = true
|
||||
modal.on('close', ()=>{
|
||||
this.parent.helpModalOpened = false
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
module.exports = UiInspectorField
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ $font-menu: sans-serif;
|
|||
|
||||
--color-background: #21252b;
|
||||
--color-ui-background: #2c313a;
|
||||
--color-ui-background-active: #272c34;
|
||||
--color-ui-background-secondary: #272c34;
|
||||
--color-ui-button: #{$nord1};
|
||||
--color-accent: #6db5fd;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
:root {
|
||||
--color-background: #{$nord0};
|
||||
--color-ui-background: #{$nord2};
|
||||
--color-ui-background-active: #{$nord1};
|
||||
--color-ui-background-secondary: #{$nord1};
|
||||
--color-ui-button: #{$nord3};
|
||||
--color-accent: #{$nord8};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
:root {
|
||||
--color-background: #404040;
|
||||
--color-ui-background: #505050;
|
||||
--color-ui-background-active: #4A4A4A;
|
||||
--color-ui-background-secondary: #4A4A4A;
|
||||
--color-ui-button: #606060;
|
||||
--color-accent: #d98533;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ osc-inspector-field {
|
|||
line-height: $field-height;
|
||||
height: $field-height;
|
||||
cursor: pointer;
|
||||
background: var(--color-ui-background-active);
|
||||
background: var(--color-ui-background-secondary);
|
||||
border:1rem solid var(--color-background);
|
||||
border-right: none;
|
||||
}
|
||||
|
|
@ -47,6 +47,15 @@ osc-inspector-field {
|
|||
border:1rem solid var(--color-background);
|
||||
border-bottom : none;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
}
|
||||
.btn {
|
||||
position: absolute;
|
||||
right:3rem;
|
||||
top:3rem;
|
||||
background: var(--color-ui-button);
|
||||
line-height: $field-height - 6;
|
||||
|
||||
}
|
||||
&:after {
|
||||
content:none;
|
||||
|
|
@ -114,7 +123,7 @@ osc-inspector-field .ace_editor {
|
|||
--scrollbar-size: 8rem;
|
||||
|
||||
.ace_gutter {
|
||||
background: var(--color-ui-background-active);
|
||||
background: var(--color-ui-background-secondary);
|
||||
color: #6a6f7a;
|
||||
border-right: 1rem solid var(--color-background);
|
||||
z-index: 10;
|
||||
|
|
@ -347,7 +356,7 @@ osc-inspector-category {
|
|||
height: 100%;
|
||||
left:-($padding);
|
||||
right:-($padding);
|
||||
background: var(--color-ui-background-active);
|
||||
background: var(--color-ui-background-secondary);
|
||||
border-top:1rem solid var(--color-background);
|
||||
border-bottom:1rem solid var(--color-background);
|
||||
z-index: -1;
|
||||
|
|
@ -401,7 +410,7 @@ osc-inspector-category {
|
|||
|
||||
osc-inspector-checkbox {
|
||||
|
||||
--widget-padding: 0;
|
||||
--widget-padding: 1rem;
|
||||
--color-fill: var(--color-ui-button);
|
||||
--alpha-fill: 1;
|
||||
|
||||
|
|
@ -510,7 +519,7 @@ osc-inspector-color {
|
|||
|
||||
--color-fill: var(--color-picker-value);
|
||||
--alpha-fill: 1;
|
||||
--widget-padding: 1rem;
|
||||
--widget-padding: 2rem;
|
||||
@include pseudo-fill();
|
||||
&:after {
|
||||
border: 1rem solid var(--color-ui-button);
|
||||
|
|
@ -614,4 +623,17 @@ osc-inspector-color {
|
|||
padding-top: 10rem;
|
||||
|
||||
}
|
||||
|
||||
.kbd {
|
||||
background: var(--color-ui-button);
|
||||
padding: 4rem;
|
||||
display: inline-block;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
thead tr {
|
||||
text-align: left;
|
||||
font-weight: 500;
|
||||
height: 30rem;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ osc-settings-field {
|
|||
label {
|
||||
width: 100rem;
|
||||
// text-align: right;
|
||||
background: rgba(black, 0.05);
|
||||
background: var(--color-ui-background-secondary);
|
||||
border:1rem solid var(--color-background);
|
||||
border-right: none;
|
||||
// margin-right: 8rem;
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@
|
|||
padding: 0 $padding;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
background: var(--color-ui-background-active);
|
||||
background: var(--color-ui-background-secondary);
|
||||
border-bottom: 1rem solid var(--color-background);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@
|
|||
|
||||
&.on {
|
||||
z-index: 1;overflow: visible;
|
||||
background: var(--color-ui-background-active);
|
||||
background: var(--color-ui-background-secondary);
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue