0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-06-22 04:58:40 +00:00

lint client

This commit is contained in:
Víctor Losada Hernández
2026-05-18 16:21:57 +02:00
parent 4a565b929b
commit 15db3c9f66
3 changed files with 30 additions and 33 deletions
@@ -86,8 +86,8 @@ export function tokenizeCustomMarkdown(text) {
if(/\~/.test(lineText)) { if(/\~/.test(lineText)) {
const strikethroughRegex = /~(?!\s)(.+?)(?<!\s)~/g; const strikethroughRegex = /~(?!\s)(.+?)(?<!\s)~/g;
let match = strikethroughRegex.exec(lineText); const match = strikethroughRegex.exec(lineText);
let type = customTags.strikethrough; const type = customTags.strikethrough;
if(match) { if(match) {
tokens.push({ tokens.push({
@@ -37,11 +37,9 @@ const wrapSelection = (prefix, suffix) => (view) => {
let text; let text;
if(from === to) { text = prefix + suffix } if(from === to) { text = prefix + suffix; } else if(selected.startsWith(prefix) && selected.endsWith(suffix)) {
else if(selected.startsWith(prefix) && selected.endsWith(suffix)) {
text = selected.slice(prefix.length, -suffix.length); text = selected.slice(prefix.length, -suffix.length);
} } else {text = `${prefix}${selected}${suffix}`;}
else {text = `${prefix}${selected}${suffix}`}
changes.push({ from, to, insert: text }); changes.push({ from, to, insert: text });
} }
@@ -30,8 +30,7 @@ import cm5Themes from 'codemirror-5-themes';
const themes = { default: defaultCM5Theme, ...cm5Themes, darkbrewery }; const themes = { default: defaultCM5Theme, ...cm5Themes, darkbrewery };
const themeNames = Object.entries(themes) const themeNames = Object.entries(themes)
.filter(([name, value]) => .filter(([name, value])=>Array.isArray(value) &&
Array.isArray(value) &&
!name.endsWith('Init') && !name.endsWith('Init') &&
!name.endsWith('Style') !name.endsWith('Style')
) )
@@ -40,7 +39,7 @@ const themeNames = Object.entries(themes)
const EditorThemes = [ const EditorThemes = [
'default', 'default',
...themeNames ...themeNames
.filter(name => name !== 'default') .filter((name)=>name !== 'default')
.sort((a, b)=>a.localeCompare(b)) .sort((a, b)=>a.localeCompare(b))
]; ];