mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-27 16:03:07 +00:00
add support for function values
This commit is contained in:
@@ -23,7 +23,7 @@ export const PATTERNS = {
|
||||
[SNIPPET_TYPE.INJECTOR] : ()=>new RegExp(`^\\!\\[(?:[a-zA-Z -]+)?\\]\\(.*\\).*{[a-zA-Z0-9:, "'-]+}$`),
|
||||
},
|
||||
field : {
|
||||
[FIELD_TYPE.TEXT] : (name)=>new RegExp(`[{,;](${name}):("[^},;"]*"|[^},;]*)`),
|
||||
[FIELD_TYPE.TEXT] : (name)=>new RegExp(`[{,;](${name}):([^};,"\\(]*\\((?!,)[^};"\\)]*\\)|"[^},;"]*"|[^},;]*)`),
|
||||
},
|
||||
collectStyles : new RegExp(`(?:([a-zA-Z-]+):(?!\\/))+`, 'g'),
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ const Text = createClass({
|
||||
const { code } = e;
|
||||
const { field } = this.props;
|
||||
const { value } = this.state;
|
||||
const match = value.match(NUMBER_PATTERN);
|
||||
const match = value?.match(NUMBER_PATTERN);
|
||||
if(code === 'ArrowDown') {
|
||||
if(match && match[3] && CSS.supports(field.name, value)) {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -63,7 +63,7 @@ module.exports = function(widgets, cm, setHints) {
|
||||
add(spec.mediaFeatures);
|
||||
}
|
||||
result = result.map((h)=>({ hint: h, type: HINT_TYPE.VALUE }))
|
||||
.filter((h)=>CSS.supports(field.name, h.hint));
|
||||
.filter((h)=>CSS.supports(field.name, h.hint) && h.hint.includes(value ?? ''));
|
||||
|
||||
const numberSuffix = word.slice(-4).replaceAll(/\d/g, '');
|
||||
if(token.type === 'number' && !UNITS.includes(numberSuffix)) {
|
||||
|
||||
Reference in New Issue
Block a user