Skip to content

Commit

Permalink
fix: pinia persist migration + add articles check details list
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Sep 17, 2024
1 parent 2d39696 commit 9a241a2
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 14 deletions.
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
font-weight: 500;
font-size: 18px;
color: #FFF;
font-family: "Roboto", "-apple-system", "Helvetica Neue", Helvetica, Arial, sans-serif;
-webkit-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased;
line-height: 1.5;
z-index: 2000000000;
}
</style>
Expand Down
17 changes: 10 additions & 7 deletions quasar.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import { configure } from 'quasar/wrappers'
import { readFileSync } from 'node:fs'
import { mergeConfig } from 'vite'

export default configure((/* ctx */) => {
const curYear = new Date().getFullYear()
Expand Down Expand Up @@ -72,16 +73,18 @@ export default configure((/* ctx */) => {
// distDir

extendViteConf (viteConf) {
viteConf.build.chunkSizeWarningLimit = 9999999
viteConf.build.rollupOptions = {
output: {
manualChunks: (id) => {
if (id.includes('.css') || id.includes('.scss') || id.includes('.sass')) {
return 'app'
viteConf.build = mergeConfig(viteConf.build, {
chunkSizeWarningLimit: 9999999,
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes('.css') || id.includes('.scss') || id.includes('.sass')) {
return 'app'
}
}
}
}
}
})
// viteConf.build.rollupOptions = {
// external: ['monaco-editor'],
// output: {
Expand Down
1 change: 1 addition & 0 deletions src-electron/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export default {
minimizable: false,
maximizable: false,
fullscreenable: false,
closable: true,
title: 'Login',
darkTheme: true,
backgroundColor: '#000'
Expand Down
4 changes: 3 additions & 1 deletion src-electron/electron-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ function createWindow () {
if (process.env.DEBUGGING) {
// if on DEV or Production with debug enabled
mainWindow.webContents.openDevTools({
activate: false
activate: false,
mode: 'detach',
title: 'DraftForge DevTools'
})
setTimeout(() => {
mainWindow.moveTop()
Expand Down
6 changes: 4 additions & 2 deletions src/components/DrawerChecks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ const valChecks = [
// METHODS
function articlesCheck (silent) {
const warnings = checkArticles(modelStore[docsStore.activeDocument.id].getValue())
if (warnings < 1) {
const results = checkArticles(modelStore[docsStore.activeDocument.id].getValue())
if (results.count < 1) {
editorStore.setValidationCheckState('articles', 1)
editorStore.setValidationCheckDetails('articles', [])
if (!silent) {
$q.notify({
message: 'Looks good!',
Expand All @@ -124,6 +125,7 @@ function articlesCheck (silent) {
}
} else {
editorStore.setValidationCheckState('articles', -2)
editorStore.setValidationCheckDetails('articles', results.details)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/stores/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,6 @@ export const useDocsStore = defineStore('docs', {
}
},
persist: {
paths: []
pick: []
}
})
2 changes: 1 addition & 1 deletion src/stores/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const useEditorStore = defineStore('editor', {
}
},
persist: {
paths: [
pick: [
'animationEffects',
'confirmExit',
'cursorBlinking',
Expand Down
2 changes: 1 addition & 1 deletion src/stores/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ export const useUserStore = defineStore('user', {
},
actions: { },
persist: {
paths: []
pick: []
}
})
57 changes: 56 additions & 1 deletion src/tools/articles.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { decorationsStore } from 'src/stores/models'
import { sortBy } from 'lodash-es'

export function checkArticles (text) {
const partARgx = /(?<!(?:[aA]ppendix|[cC]onnection|[lL]ink|[nN]ode|Operator)) (?!(?:[aA] (?:AAA|Europe|[oO]ne|U[A-Z]|U-label|[uU]biquitous|[uU]nicast|[uU]nicode|[uU]nidir|[uU]nif|[uU]nion|[uU]nique|[uU]nit|[uU]nivers|[uU]sable|[uU]sability|[uU]sage|[uU]se|[uU]tility)|a uCDN|A and))[aA] [aeiouAEIOU]/g
Expand All @@ -9,6 +10,7 @@ export function checkArticles (text) {
const textLines = text.split('\n')

const decorations = []
const details = []
for (const [lineIdx, line] of textLines.entries()) {
for (const match of line.matchAll(partARgx)) {
decorations.push({
Expand All @@ -29,6 +31,16 @@ export function checkArticles (text) {
endColumn: match.index + match[0].length
}
})
details.push({
key: crypto.randomUUID(),
message: `Bad indefinite article: ${match[0]}`,
range: {
startLineNumber: lineIdx + 1,
startColumn: match.index + 2,
endLineNumber: lineIdx + 1,
endColumn: match.index + match[0].length
}
})
}
for (const match of line.matchAll(partARRgx)) {
decorations.push({
Expand All @@ -49,6 +61,16 @@ export function checkArticles (text) {
endColumn: match.index + 1 + match[0].length
}
})
details.push({
key: crypto.randomUUID(),
message: `Bad indefinite article: ${match[0]}`,
range: {
startLineNumber: lineIdx + 1,
startColumn: match.index + 2,
endLineNumber: lineIdx + 1,
endColumn: match.index + match[0].length
}
})
}
for (const match of line.matchAll(partBRgx)) {
decorations.push({
Expand All @@ -69,6 +91,16 @@ export function checkArticles (text) {
endColumn: match.index + 1 + match[0].length
}
})
details.push({
key: crypto.randomUUID(),
message: `Bad indefinite article: ${match[0]}`,
range: {
startLineNumber: lineIdx + 1,
startColumn: match.index + 2,
endLineNumber: lineIdx + 1,
endColumn: match.index + match[0].length
}
})
}
for (const match of line.matchAll(partCRgx)) {
decorations.push({
Expand All @@ -89,6 +121,16 @@ export function checkArticles (text) {
endColumn: match.index + 1 + match[0].length
}
})
details.push({
key: crypto.randomUUID(),
message: `Bad indefinite article: ${match[0]}`,
range: {
startLineNumber: lineIdx + 1,
startColumn: match.index + 2,
endLineNumber: lineIdx + 1,
endColumn: match.index + match[0].length
}
})
}
for (const match of line.matchAll(partCLFRgx)) {
decorations.push({
Expand All @@ -109,10 +151,23 @@ export function checkArticles (text) {
endColumn: match.index + match[0].length
}
})
details.push({
key: crypto.randomUUID(),
message: `Bad indefinite article: ${match[0]}`,
range: {
startLineNumber: lineIdx + 1,
startColumn: match.index + 2,
endLineNumber: lineIdx + 1,
endColumn: match.index + match[0].length
}
})
}
}

decorationsStore.get('articles').set(decorations)

return decorations.length
return {
count: decorations.length,
details: sortBy(details, d => d.range.startLineNumber)
}
}

0 comments on commit 9a241a2

Please sign in to comment.