Skip to content

Commit 0b7f57d

Browse files
committed
update spellcheck UI
1 parent db18c32 commit 0b7f57d

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"@vueuse/core": "7.6.2",
1313
"file-saver": "^2.0.5",
1414
"pinia": "2.0.11",
15-
"quill-focus": "^1.1.2",
1615
"quill-to-pdf": "^1.0.7",
1716
"quill-to-word": "^1.3.0",
1817
"vue": "3.2.31"

pnpm-lock.yaml

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

src/components/Content.vue

+11-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const themeColor = ref(0)
1616
const shortcutModal = ref(false)
1717
const exportModal_1 = ref(false)
1818
const exportModal_2 = ref(false)
19-
const spellcheck = ref(true)
2019
const exitModal = ref(false)
2120
const showOptions = ref(false)
2221
const message = useMessage()
@@ -53,6 +52,15 @@ const changeAlwaysTop = () => {
5352
appWindow.setAlwaysOnTop(store.alwaysTop)
5453
}
5554
55+
const changeSpellcheck = () => {
56+
store.spellcheck = !store.spellcheck
57+
if (store.spellcheck) {
58+
message.success("Spellcheck is enabled")
59+
} else {
60+
message.warning("Spellcheck is disabled")
61+
}
62+
}
63+
5664
const export2PDF = async () => {
5765
try {
5866
if (checkContent()) {
@@ -112,7 +120,7 @@ await shortcutRegister()
112120
@settingsClicked="settings = false"
113121
@exportPDF="exportModal_1 = true"
114122
@exportWord="exportModal_2 = true"
115-
@changeSpellcheck="spellcheck = !spellcheck"
123+
@changeSpellcheck="changeSpellcheck()"
116124
/>
117125
<div :class="{ 'dark': store.theme === 'dark' }">
118126
<div v-show="settings" class="absolute z-10 w-8/10 h-20px bottom-100px transform translate-x-5vh">
@@ -142,7 +150,7 @@ await shortcutRegister()
142150
name="content"
143151
id="content"
144152
toolbar="#toolbar"
145-
:spellcheck="spellcheck"
153+
:spellcheck="store.spellcheck"
146154
v-model:content="store.content.ops"
147155
/>
148156
</div>

src/components/Toolbar.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script lang="ts" setup>
22
import { Quill } from '@vueup/vue-quill'
3+
import { mainStore } from '../store'
34
5+
const store = mainStore()
46
const sizes: any = {
57
"Normal": '16px',
68
"Medium": '18.667px',
@@ -12,7 +14,6 @@ let Size = Quill.import('attributors/style/size')
1214
Size.whitelist = Object.values(sizes)
1315
Quill.register(Size, true)
1416
15-
const spellcheck = ref(true)
1617
const toolbar = ref<any>(null)
1718
const emit = defineEmits([
1819
"settingsClicked",
@@ -70,7 +71,7 @@ onMounted(() => {
7071
<button class="ql-video"></button>
7172
<button class="ql-link"></button>
7273
<button class="ql-clean"></button>
73-
<button><i-mdi:spellcheck @click="emit('changeSpellcheck'); spellcheck = !spellcheck" :class="{ 'text-red-600': !spellcheck, 'text-green-700': spellcheck }"></i-mdi:spellcheck></button>
74+
<button><i-mdi:spellcheck @click="emit('changeSpellcheck')" :class="{ 'text-red-600': !store.spellcheck, 'text-green-700': store.spellcheck }"></i-mdi:spellcheck></button>
7475
<button><i-mdi:file-pdf @click="emit('exportPDF')"></i-mdi:file-pdf></button>
7576
<button><i-grommet-icons:document-word @click="emit('exportWord')"></i-grommet-icons:document-word></button>
7677
</div>

src/store.ts

+1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ export const mainStore = defineStore('mainStore', {
1313
theme: useLocalStorage('theme', 'dark'),
1414
exportName: useLocalStorage('exportName', 'export'),
1515
alwaysTop: useLocalStorage('alwaysTop', false),
16+
spellcheck: useLocalStorage('spellcheck', true)
1617
})
1718
})

0 commit comments

Comments
 (0)