Skip to content

chore: code style #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -2,21 +2,19 @@ name: Docker

on:
push:
branches: [ "pro" ]
tags: [ 'v*.*.*' ]
branches: ["pro"]
tags: ["v*.*.*"]
pull_request:
branches: [ "pro" ]
branches: ["pro"]

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


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
@@ -35,7 +33,7 @@ jobs:
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
with:
cosign-release: 'v2.2.4'
cosign-release: "v2.2.4"

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm nano-staged
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -6,7 +6,14 @@
"dev": "vite",
"build": "vite build",
"serve": "vite preview",
"next": "bumpp"
"next": "bumpp",
"fix": "prettier --write .",
"prepare": "husky"
},
"nano-staged": {
"*.{js,jsx,vue,ts,md,json,html}": [
"prettier --write"
]
},
"license": "MIT",
"dependencies": {
@@ -24,12 +31,16 @@
"vue": "^3.5.12"
},
"devDependencies": {
"@barelyhuman/prettier-config": "^2.0.2",
"@vitejs/plugin-vue": "^5.1.4",
"@vue/compiler-sfc": "^3.5.12",
"autoprefixer": "^10.4.20",
"bumpp": "^9.7.1",
"cssnano": "^7.0.6",
"husky": "^9.1.7",
"nano-staged": "^0.8.0",
"postcss": "^8.4.47",
"prettier": "^3.5.2",
"tailwindcss": "^3.4.14",
"terser": "^5.36.0",
"vite": "^5.4.9"
@@ -40,4 +51,4 @@
"dompurify": ">=2.5.0",
"braces": ">=3.0.3"
}
}
}
41 changes: 41 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions src/components/editor-rich.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<template>
<div name="" ref="texteditor" autofocus="true" class="flex-1 w-full code-editor" id="editor"></div>
<div
name=""
ref="texteditor"
autofocus="true"
class="flex-1 w-full code-editor"
id="editor"
></div>
</template>
<script>
import "quill/dist/quill.bubble.css";
@@ -47,9 +53,9 @@ export default {
try {
ops = JSON.parse(props.opsState);
} catch (err) {
// Migration change to move from
// storing markdown to quill delta
// if a syntax error is found, try converting it
// Migration change to move from
// storing markdown to quill delta
// if a syntax error is found, try converting it
if (err instanceof SyntaxError) {
ops = converter.convert(props.opsState);
}
5 changes: 2 additions & 3 deletions src/components/menu.vue
Original file line number Diff line number Diff line change
@@ -30,15 +30,14 @@ defineProps({
});

const onClickOutside = () => {
state.dropdownOpen = false
state.dropdownOpen = false;
};

const vClickOutside = {
mounted: (el, binding, vnode) => {
el.clickOutsideEvent = function (event) {

if (!(el == event.target || el.contains(event.target))) {
binding.value(event)
binding.value(event);
}
};
document.addEventListener("click", el.clickOutsideEvent);
4 changes: 2 additions & 2 deletions src/components/preview.vue
Original file line number Diff line number Diff line change
@@ -11,9 +11,9 @@ defineProps({
<style scoped>
.markdown-preview {
font-family: "IBM Plex Sans", sans-serif;
margin:0 auto;
margin: 0 auto;
width: 100%;
padding:10px;
padding: 10px;
display: flex;
flex-direction: column;
justify-content: space-between;
10 changes: 6 additions & 4 deletions src/components/settings-modal.vue
Original file line number Diff line number Diff line change
@@ -76,7 +76,9 @@ const props = defineProps(["onClose"]);
min-width: 50%;
display: flex;
flex-direction: column;
transition: transform 0.3s ease, opacity 0.3s ease;
transition:
transform 0.3s ease,
opacity 0.3s ease;
}

.modal-content .modal-header {
@@ -159,11 +161,11 @@ input[type="checkbox"] {
background: var(--text);
}

.checkbox-container .checkbox-label {
.checkbox-container .checkbox-label {
margin-left: 2rem;
}

input[type="checkbox"]:checked ~ .checkbox > .checkbox-overlay{
opacity:1
input[type="checkbox"]:checked ~ .checkbox > .checkbox-overlay {
opacity: 1;
}
</style>
7 changes: 3 additions & 4 deletions src/components/toolbar.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<div class="toolbar">
<slot />
</div>
<div class="toolbar">
<slot />
</div>
</template>

24 changes: 12 additions & 12 deletions src/lib/copy.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
export async function copy (text) {
export async function copy(text) {
if (!navigator.clipboard) {
return _copyDeprecated(text)
return _copyDeprecated(text);
}
await navigator.clipboard.writeText(text)
await navigator.clipboard.writeText(text);
}

function _copyDeprecated (text) {
const copyTextarea = document.createElement('textarea')
copyTextarea.style.position = 'fixed'
copyTextarea.style.opacity = '0'
copyTextarea.textContent = text
function _copyDeprecated(text) {
const copyTextarea = document.createElement("textarea");
copyTextarea.style.position = "fixed";
copyTextarea.style.opacity = "0";
copyTextarea.textContent = text;

document.body.appendChild(copyTextarea)
copyTextarea.select()
document.execCommand('copy')
document.body.removeChild(copyTextarea)
document.body.appendChild(copyTextarea);
copyTextarea.select();
document.execCommand("copy");
document.body.removeChild(copyTextarea);
}
2 changes: 1 addition & 1 deletion src/lib/quill/delta-md.js
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ export const deltaToMarkdown = (delta) => {
? d.insert
: d.insert && d.insert.value
? d.insert.value
: ""
: "",
)
.join("");
return `<pre data-language="${data.op.attributes["code-block"]}"><code>${codeContent}</code></pre>`;
2 changes: 1 addition & 1 deletion src/pages/Home.vue
Original file line number Diff line number Diff line change
@@ -133,7 +133,7 @@ watch(
() => {
state.code = getDefaultCode();
state.opsFromStorage = getFromStorage();
}
},
);

onMounted(() => {
4 changes: 2 additions & 2 deletions src/styles/index.css
Original file line number Diff line number Diff line change
@@ -167,6 +167,6 @@ a {
background: var(--surface);
padding: 4px 8px;
color: var(--text);
border:0px;
border-radius:4px;
border: 0px;
border-radius: 4px;
}
8 changes: 2 additions & 6 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -10,12 +10,8 @@ export default defineConfig({
output: {
manualChunks: {
highlightjs: ["highlight.js"],
quill: [
"quill",
"quilljs-markdown",
"md-to-quill-delta",
],
vendor:["html2pdf.js"]
quill: ["quill", "quilljs-markdown", "md-to-quill-delta"],
vendor: ["html2pdf.js"],
},
},
},