Skip to content

Commit 1415fc3

Browse files
authored
chore: code style (#33)
1 parent 6fed7ce commit 1415fc3

15 files changed

+101
-48
lines changed

.github/workflows/docker-publish.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,19 @@ name: Docker
22

33
on:
44
push:
5-
branches: [ "pro" ]
6-
tags: [ 'v*.*.*' ]
5+
branches: ["pro"]
6+
tags: ["v*.*.*"]
77
pull_request:
8-
branches: [ "pro" ]
8+
branches: ["pro"]
99

1010
env:
1111
# Use docker.io for Docker Hub if empty
1212
REGISTRY: ghcr.io
1313
# github.repository as <account>/<repo>
1414
IMAGE_NAME: ${{ github.repository }}
1515

16-
1716
jobs:
1817
build:
19-
2018
runs-on: ubuntu-latest
2119
permissions:
2220
contents: read
@@ -35,7 +33,7 @@ jobs:
3533
if: github.event_name != 'pull_request'
3634
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
3735
with:
38-
cosign-release: 'v2.2.4'
36+
cosign-release: "v2.2.4"
3937

4038
# Set up BuildKit Docker container builder to be able to build
4139
# multi-platform images and export cache

.husky/pre-commit

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm nano-staged

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />

package.json

+13-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
"dev": "vite",
77
"build": "vite build",
88
"serve": "vite preview",
9-
"next": "bumpp"
9+
"next": "bumpp",
10+
"fix": "prettier --write .",
11+
"prepare": "husky"
12+
},
13+
"nano-staged": {
14+
"*.{js,jsx,vue,ts,md,json,html}": [
15+
"prettier --write"
16+
]
1017
},
1118
"license": "MIT",
1219
"dependencies": {
@@ -24,12 +31,16 @@
2431
"vue": "^3.5.12"
2532
},
2633
"devDependencies": {
34+
"@barelyhuman/prettier-config": "^2.0.2",
2735
"@vitejs/plugin-vue": "^5.1.4",
2836
"@vue/compiler-sfc": "^3.5.12",
2937
"autoprefixer": "^10.4.20",
3038
"bumpp": "^9.7.1",
3139
"cssnano": "^7.0.6",
40+
"husky": "^9.1.7",
41+
"nano-staged": "^0.8.0",
3242
"postcss": "^8.4.47",
43+
"prettier": "^3.5.2",
3344
"tailwindcss": "^3.4.14",
3445
"terser": "^5.36.0",
3546
"vite": "^5.4.9"
@@ -40,4 +51,4 @@
4051
"dompurify": ">=2.5.0",
4152
"braces": ">=3.0.3"
4253
}
43-
}
54+
}

pnpm-lock.yaml

+41
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/editor-rich.vue

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<template>
2-
<div name="" ref="texteditor" autofocus="true" class="flex-1 w-full code-editor" id="editor"></div>
2+
<div
3+
name=""
4+
ref="texteditor"
5+
autofocus="true"
6+
class="flex-1 w-full code-editor"
7+
id="editor"
8+
></div>
39
</template>
410
<script>
511
import "quill/dist/quill.bubble.css";
@@ -47,9 +53,9 @@ export default {
4753
try {
4854
ops = JSON.parse(props.opsState);
4955
} catch (err) {
50-
// Migration change to move from
51-
// storing markdown to quill delta
52-
// if a syntax error is found, try converting it
56+
// Migration change to move from
57+
// storing markdown to quill delta
58+
// if a syntax error is found, try converting it
5359
if (err instanceof SyntaxError) {
5460
ops = converter.convert(props.opsState);
5561
}

src/components/menu.vue

+2-3
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,14 @@ defineProps({
3030
});
3131
3232
const onClickOutside = () => {
33-
state.dropdownOpen = false
33+
state.dropdownOpen = false;
3434
};
3535
3636
const vClickOutside = {
3737
mounted: (el, binding, vnode) => {
3838
el.clickOutsideEvent = function (event) {
39-
4039
if (!(el == event.target || el.contains(event.target))) {
41-
binding.value(event)
40+
binding.value(event);
4241
}
4342
};
4443
document.addEventListener("click", el.clickOutsideEvent);

src/components/preview.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ defineProps({
1111
<style scoped>
1212
.markdown-preview {
1313
font-family: "IBM Plex Sans", sans-serif;
14-
margin:0 auto;
14+
margin: 0 auto;
1515
width: 100%;
16-
padding:10px;
16+
padding: 10px;
1717
display: flex;
1818
flex-direction: column;
1919
justify-content: space-between;

src/components/settings-modal.vue

+6-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ const props = defineProps(["onClose"]);
7676
min-width: 50%;
7777
display: flex;
7878
flex-direction: column;
79-
transition: transform 0.3s ease, opacity 0.3s ease;
79+
transition:
80+
transform 0.3s ease,
81+
opacity 0.3s ease;
8082
}
8183
8284
.modal-content .modal-header {
@@ -159,11 +161,11 @@ input[type="checkbox"] {
159161
background: var(--text);
160162
}
161163
162-
.checkbox-container .checkbox-label {
164+
.checkbox-container .checkbox-label {
163165
margin-left: 2rem;
164166
}
165167
166-
input[type="checkbox"]:checked ~ .checkbox > .checkbox-overlay{
167-
opacity:1
168+
input[type="checkbox"]:checked ~ .checkbox > .checkbox-overlay {
169+
opacity: 1;
168170
}
169171
</style>

src/components/toolbar.vue

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<template>
2-
<div class="toolbar">
3-
<slot />
4-
</div>
2+
<div class="toolbar">
3+
<slot />
4+
</div>
55
</template>
6-

src/lib/copy.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
export async function copy (text) {
1+
export async function copy(text) {
22
if (!navigator.clipboard) {
3-
return _copyDeprecated(text)
3+
return _copyDeprecated(text);
44
}
5-
await navigator.clipboard.writeText(text)
5+
await navigator.clipboard.writeText(text);
66
}
77

8-
function _copyDeprecated (text) {
9-
const copyTextarea = document.createElement('textarea')
10-
copyTextarea.style.position = 'fixed'
11-
copyTextarea.style.opacity = '0'
12-
copyTextarea.textContent = text
8+
function _copyDeprecated(text) {
9+
const copyTextarea = document.createElement("textarea");
10+
copyTextarea.style.position = "fixed";
11+
copyTextarea.style.opacity = "0";
12+
copyTextarea.textContent = text;
1313

14-
document.body.appendChild(copyTextarea)
15-
copyTextarea.select()
16-
document.execCommand('copy')
17-
document.body.removeChild(copyTextarea)
14+
document.body.appendChild(copyTextarea);
15+
copyTextarea.select();
16+
document.execCommand("copy");
17+
document.body.removeChild(copyTextarea);
1818
}

src/lib/quill/delta-md.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const deltaToMarkdown = (delta) => {
2929
? d.insert
3030
: d.insert && d.insert.value
3131
? d.insert.value
32-
: ""
32+
: "",
3333
)
3434
.join("");
3535
return `<pre data-language="${data.op.attributes["code-block"]}"><code>${codeContent}</code></pre>`;

src/pages/Home.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ watch(
133133
() => {
134134
state.code = getDefaultCode();
135135
state.opsFromStorage = getFromStorage();
136-
}
136+
},
137137
);
138138
139139
onMounted(() => {

src/styles/index.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,6 @@ a {
167167
background: var(--surface);
168168
padding: 4px 8px;
169169
color: var(--text);
170-
border:0px;
171-
border-radius:4px;
170+
border: 0px;
171+
border-radius: 4px;
172172
}

vite.config.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@ export default defineConfig({
1010
output: {
1111
manualChunks: {
1212
highlightjs: ["highlight.js"],
13-
quill: [
14-
"quill",
15-
"quilljs-markdown",
16-
"md-to-quill-delta",
17-
],
18-
vendor:["html2pdf.js"]
13+
quill: ["quill", "quilljs-markdown", "md-to-quill-delta"],
14+
vendor: ["html2pdf.js"],
1915
},
2016
},
2117
},

0 commit comments

Comments
 (0)