Skip to content

Commit

Permalink
Reset browser-based spellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
MWedl committed Dec 14, 2023
1 parent ba78dfa commit 55f6e0a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 54 deletions.
46 changes: 0 additions & 46 deletions api/src/reportcreator_api/api_utils/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,49 +128,3 @@ def validate_aes_key(self, value):
except ValueError:
raise serializers.ValidationError('Invalid base64 encoding')


# TODO: spellcheck adaptions
# * [x] update languagetool
# * [x] picky mode + advanced config
# * [x] spellcheck API: use picky mode + config
# * [ ] frontend
# * [ ] in community: reset spellcheckEnabled to false on navigation
# * [x] rework spellcheck enabled
# * [x] localSettings.spellcheckEnabled
# * [x] MarkdownFieldContent
# * [x] MarkdownTextFieldContent
# * [x] MarkdownPage
# * [x] MarkdownToolbar
# * [x] pass spellcheckEnabled as props + event update:spellcheckEnabled
# * [x] section
# * [x] finding
# * [x] project note
# * [x] personal notes
# * [x] template
# * [x] preview data
# * [x] layout editor
# * [x] report fields
# * [x] finding fields
# * [x] rework markdownEditorMode
# * [x] localSettings.markdownEditorMode
# * [x] MarkdownFieldContent
# * [x] MarkdownPage
# * [x] MarkdownToolbar
# * [x] pass markdownEditorMode as props + event update:markdownEditorMode
# * [x] section
# * [x] finding
# * [x] project note
# * [x] personal notes
# * [x] template
# * [x] preview data
# * [x] layout editor
# * [x] report fields
# * [x] finding fields
# * [x] template history
# * [x] section history
# * [x] finding history
# * [x] project note history

# * [x] docs: new languagetool env variables
# * [x] markdown images: add "{width=100%}""

16 changes: 12 additions & 4 deletions frontend/src/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

<script setup lang="ts">
const route = useRoute();
useHeadExtended({
titleTemplate: title => rootTitleTemplate(title, route),
});
const auth = useAuth();
const localSettings = useLocalSettings();
const apiSettings = useApiSettings();
useHeadExtended({
titleTemplate: title => rootTitleTemplate(title, route),
});
const colorSchemeQueryList = window.matchMedia('(prefers-color-scheme: dark)');
const systemThemeIsDark = ref<boolean>(colorSchemeQueryList.matches);
colorSchemeQueryList.addEventListener('change', (event) => {
Expand All @@ -40,4 +40,12 @@ const theme = computed(() => {
return baseTheme;
}
});
const router = useRouter();
watch(router.currentRoute, () => {
// Reset browser-based spellcheck on navigation
if (!apiSettings.settings?.features.spellcheck) {
localSettings.setAllSpellcheckSettings(false);
}
})
</script>
6 changes: 3 additions & 3 deletions frontend/src/components/Markdown/Toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
<markdown-toolbar-button
v-if="apiSettings.isProfessionalLicense"
@click="toggleSpellcheck"
title="Spellcheck"
title="Spell check"
icon="mdi-spellcheck"
:disabled="props.disabled || !spellcheckSupported"
:active="spellcheckEnabled"
/>
<markdown-toolbar-button
v-else
@click="toggleSpellcheck"
:title="'Spellcheck'"
:title="'Spell check (basic)'"
icon="mdi-spellcheck"
:dot="!spellcheckSupported ? undefined : (spellcheckEnabled ? 'warning' : 'error')"
:disabled="props.disabled || !spellcheckSupported"
Expand Down Expand Up @@ -95,7 +95,7 @@ function toggleSpellcheck() {
const newVal = !props.spellcheckEnabled;
emit('update:spellcheckEnabled', newVal);
if (newVal && !apiSettings.isProfessionalLicense) {
warningToast('Basic spellcheck enabled. Upgrade to Professional for advanced options.');
warningToast('Basic spell check enabled. Upgrade to SysReptor Professional for advanced options.');
}
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Markdown/ToolbarButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</v-badge>
<v-icon v-else size="small" :icon="props.icon" />

<s-tooltip v-if="props.title" :text="props.title" />
<s-tooltip v-if="props.title" activator="parent" location="top" :text="props.title" />
</s-btn-icon>
</template>

Expand Down

0 comments on commit 55f6e0a

Please sign in to comment.