-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
833 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<template> | ||
<select v-model="$i18n.locale"> | ||
<option v-for="(lang, i) in $i18n.availableLocales" :key="i" :value="lang"> | ||
{{ lang }} | ||
</option> | ||
</select> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<template> | ||
<div v-if="modelValue" class="modal"> | ||
<fieldset ref="modalContent" class="modal-content"> | ||
<legend class="modal-title"> | ||
{{ title }} | ||
</legend> | ||
<slot /> | ||
</fieldset> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { onClickOutside } from '@vueuse/core'; | ||
import { ref } from 'vue'; | ||
defineProps<{ | ||
modelValue: boolean; | ||
title: string; | ||
}>(); | ||
const emit = defineEmits<{ | ||
(event: 'update:modelValue', modelValue: boolean): void; | ||
}>(); | ||
const modalContent = ref(); | ||
onClickOutside(modalContent, () => { | ||
emit('update:modelValue', false); | ||
}); | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@use '../../styles/colours' as *; | ||
.modal { | ||
position: absolute; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
top: 0; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
background-color: rgba(0, 0, 0, 0.75); | ||
z-index: 999; | ||
&-title { | ||
text-transform: uppercase; | ||
} | ||
&-content { | ||
background-color: $dark1; | ||
height: fit-content; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<template> | ||
<BaseModal | ||
:model-value="modelValue" | ||
@update:model-value="$emit('update:modelValue', $event)" | ||
:title="$t('messages.newPost.title')" | ||
> | ||
<BubbleMenu v-if="editor" :editor="editor" :tippy-options="tippyOptions"> | ||
<button | ||
@click="editor.chain().focus().toggleBold().run()" | ||
:class="{ 'is-active': editor.isActive('bold') }" | ||
> | ||
Bold | ||
</button> | ||
|
||
<button | ||
@click="editor.chain().focus().toggleCodeBlock().run()" | ||
:class="{ 'is-active': editor.isActive('codeBlock') }" | ||
> | ||
Code block | ||
</button> | ||
</BubbleMenu> | ||
|
||
<FloatingMenu v-if="editor" :editor="editor" :tippy-options="tippyOptions"> | ||
<button | ||
:class="{ 'is-active': editor.isActive('heading', { level: 1 }) }" | ||
@click="editor.chain().focus().toggleHeading({ level: 1 }).run()" | ||
> | ||
H1 | ||
</button> | ||
<button | ||
:class="{ 'is-active': editor.isActive('heading', { level: 2 }) }" | ||
@click="editor.chain().focus().toggleHeading({ level: 2 }).run()" | ||
> | ||
H2 | ||
</button> | ||
|
||
<button | ||
:class="{ 'is-active': editor.isActive('bulletList') }" | ||
@click="editor.chain().focus().toggleBulletList().run()" | ||
> | ||
Toggle list | ||
</button> | ||
</FloatingMenu> | ||
|
||
<EditorContent class="editor" :editor="editor" /> | ||
</BaseModal> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import StarterKit from '@tiptap/starter-kit'; | ||
import { | ||
useEditor, | ||
BubbleMenu, | ||
EditorContent, | ||
FloatingMenu, | ||
} from '@tiptap/vue-3'; | ||
import { reactive } from 'vue'; | ||
import BaseModal from './BaseModal.vue'; | ||
defineProps<{ | ||
modelValue: boolean; | ||
}>(); | ||
const editor = useEditor({ | ||
extensions: [StarterKit], | ||
}); | ||
const tippyOptions = reactive({ duration: 200 }); | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.editor { | ||
width: 500px; | ||
height: fit-content; | ||
max-width: 90vw; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.