editor: code editor for css/html

This commit is contained in:
jean-emmanuel 2022-02-26 08:45:26 +01:00
parent 4dde0834cf
commit 97fccdc7f5
4 changed files with 15 additions and 10 deletions

View file

@ -7,7 +7,9 @@ var UiModal = require('./ui-modal'),
ScriptVm = require('../widgets/scripts/script-vm'),
scriptGlobals = ScriptVm.globals,
editors = {}, editorModes = {
javascript: require('brace/mode/javascript')
javascript: require('brace/mode/javascript'),
css: require('brace/mode/css'),
html: require('brace/mode/html'),
},
codeEditorModKey = (navigator.platform || '').match('Mac') ? 'Cmd' : 'Ctrl'

View file

@ -84,7 +84,7 @@ class Widget extends EventEmitter {
alphaFillOn: {type: 'number', value: 'auto', help: 'Fill color opacity (on).'},
lineWidth: {type: 'number', value: 'auto', help: 'Stroke width.'},
padding: {type: 'number', value: 'auto', help: 'Inner spacing.'},
html: {type: 'string', value: '', help: [
html: {type: 'string', value: '', editor: 'html', syntaxChecker: false, help: [
'Custom html content to be inserted in the widget (before the widget\'s content). Elements are all unstyled by default, `css` should be used to customize their appearance.',
'The code is automatically wrapped in <div class="html"></div>',
'Allowed HTML tags:',
@ -95,7 +95,7 @@ class Widget extends EventEmitter {
'  <*>: class, style, title, name',
'  <img>: src, width, height',
]},
css: {type: 'string', value: '', help: [
css: {type: 'string', value: '', editor: 'css', syntaxChecker: false, help: [
'CSS rules. See <a href="https://openstagecontrol.ammd.net/docs/customization/css-tips/">documentation</a>.',
'Some style-related properties can be set or read from css using css variables:',
...Class.cssVariables.map(x=>'- `' + x.css + '`: `' + x.js + '`')

View file

@ -73,13 +73,7 @@ class PatchBay extends Container(Canvas) {
static defaults() {
return super.defaults().extend({
style: {
css: {type: 'string', value: '', help: [
'The inputs/ouputs width can be adjusted by using the `.nodes` selector:',
'`.nodes { width: 25% }`',
]}
},
var defaults = super.defaults().extend({
class_specific: {
inputs: {type: 'array|object', value: ['input_1', 'input_2'], help: [
'- `Array` of input names : `[\'input_1\', \'input_2\']`',
@ -94,6 +88,12 @@ class PatchBay extends Container(Canvas) {
}
})
defaults.style.css.help.concat(
'The inputs/ouputs width can be adjusted by using the `.nodes` selector:',
'`.nodes { width: 25% }`',
)
return defaults
}
static normalizeArrayObject(obj) {