mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 11:43:22 +02:00
Implementend first draft of article edition page
This commit is contained in:
@@ -4,14 +4,14 @@ import Navbar from './components/Navbar.vue';
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="container">
|
<div class="app-container">
|
||||||
<Navbar v-if="useRoute().name !== 'login'"></Navbar>
|
<Navbar v-if="useRoute().name !== 'login'"></Navbar>
|
||||||
<RouterView />
|
<RouterView />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.container {
|
.app-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import Editor from '@tinymce/tinymce-vue';
|
|
||||||
import { ref, type Ref } from 'vue';
|
|
||||||
|
|
||||||
const emits = defineEmits(['dataSaved', 'abort'])
|
|
||||||
const props = defineProps<{
|
|
||||||
data?: string
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const defaultData = `<h1>Bienvenue</h1><p>Vous êtes en mode <em>édition</em> d'article.</p><p>Celui-ci semble encore neuf ! Supprimez ces lignes et laissez libre cours à votre imagination :)</p><p>Pour plus d'infos, rendez-vous sur la <a title="Attention, rickroll incoming" href="https:/www.youtube.com/watch?v=dQw4w9WgXcQ" target="_blank" rel="noopener">page d'aide</a>.</p>`
|
|
||||||
const editorData: Ref<string> = ref(props.data ?? defaultData)
|
|
||||||
|
|
||||||
function abort() {
|
|
||||||
emits('abort')
|
|
||||||
}
|
|
||||||
|
|
||||||
function saveContent() {
|
|
||||||
emits('dataSaved', editorData)
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="container">
|
|
||||||
<div id="editor">
|
|
||||||
<Editor tinymce-script-src="src/assets/tinymce/tinymce.min.js"
|
|
||||||
:init="{ promotion: false, language: 'fr_FR', resize: false, height: '100%' }"
|
|
||||||
:plugins="['link', 'codesample']"
|
|
||||||
toolbar="undo redo | styles | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | outdent indent | codesample link"
|
|
||||||
v-model="editorData">
|
|
||||||
</Editor>
|
|
||||||
</div>
|
|
||||||
<aside class="buttons">
|
|
||||||
<button @click="saveContent()" class="button-primary">Enregistrer</button>
|
|
||||||
<button @click="abort()" class="button-secondary">Annuler</button>
|
|
||||||
</aside>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.container {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#editor {
|
|
||||||
padding-top: 16px;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tox-tinymce {
|
|
||||||
border-radius: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.buttons {
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: right;
|
|
||||||
align-content: center;
|
|
||||||
gap: 16px;
|
|
||||||
|
|
||||||
width: fit-content;
|
|
||||||
padding: 32px 16px;
|
|
||||||
|
|
||||||
box-shadow: #0002 0 10px 10px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -5,6 +5,7 @@ import Debug from '@/views/Debug.vue'
|
|||||||
import Login from '@/views/Login.vue'
|
import Login from '@/views/Login.vue'
|
||||||
import Home from '@/views/Home.vue'
|
import Home from '@/views/Home.vue'
|
||||||
import Articles from '@/views/Articles.vue'
|
import Articles from '@/views/Articles.vue'
|
||||||
|
import Edition from '@/views/Edition.vue'
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(import.meta.env.BASE_URL),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
@@ -41,6 +42,14 @@ const router = createRouter({
|
|||||||
title: 'GohCMS - Articles'
|
title: 'GohCMS - Articles'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/articles/edit/:articleID',
|
||||||
|
name: 'edition',
|
||||||
|
component: Edition,
|
||||||
|
meta: {
|
||||||
|
title: 'GohCMS - Edition'
|
||||||
|
}
|
||||||
|
},
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Editor from '@/components/Editor.vue';
|
|
||||||
import { useAuthStore } from '@/stores/AuthStore';
|
import { useAuthStore } from '@/stores/AuthStore';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
@@ -24,10 +23,7 @@ function ping() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="editor">
|
<div class="inputs-group">
|
||||||
<Editor :show-default-data="true"></Editor>
|
|
||||||
</div>
|
|
||||||
<!-- <div class="inputs-group">
|
|
||||||
<div>
|
<div>
|
||||||
<input type="text" placeholder="article ID" v-model="articleID">
|
<input type="text" placeholder="article ID" v-model="articleID">
|
||||||
<button class="button-primary" @click="getArticles(articleID)">get article</button>
|
<button class="button-primary" @click="getArticles(articleID)">get article</button>
|
||||||
@@ -35,7 +31,7 @@ function ping() {
|
|||||||
</div>
|
</div>
|
||||||
<div class="buttons-group">
|
<div class="buttons-group">
|
||||||
<button class="button-primary" @click="ping()">ping</button>
|
<button class="button-primary" @click="ping()">ping</button>
|
||||||
</div> -->
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import Editor from '@tinymce/tinymce-vue';
|
||||||
|
import { ref, type Ref } from 'vue';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
import tinymceScriptSrc from '@/assets/tinymce/tinymce.min.js?url'
|
||||||
|
|
||||||
|
const articleID = useRoute().params.articleID
|
||||||
|
const defaultData = `<h1>Bienvenue</h1><p>Vous êtes en mode <em>édition</em> d'article.</p><p>Celui-ci semble encore neuf ! Supprimez ces lignes et laissez libre cours à votre imagination :)</p><p>Pour plus d'infos, rendez-vous sur la <a title="Attention, rickroll incoming" href="https:/www.youtube.com/watch?v=dQw4w9WgXcQ" target="_blank" rel="noopener">page d'aide</a>.</p>`
|
||||||
|
const editorData: Ref<string> = ref(defaultData)
|
||||||
|
|
||||||
|
console.log(articleID)
|
||||||
|
|
||||||
|
function abort() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveContent() {
|
||||||
|
console.log(editorData.value)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="container">
|
||||||
|
<div id="editor">
|
||||||
|
<Editor :tinymce-script-src="tinymceScriptSrc"
|
||||||
|
:init="{ promotion: false, language: 'fr_FR', resize: false, height: '100%' }"
|
||||||
|
:plugins="['link', 'codesample']"
|
||||||
|
toolbar="undo redo | styles | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | outdent indent | codesample link"
|
||||||
|
v-model="editorData">
|
||||||
|
</Editor>
|
||||||
|
</div>
|
||||||
|
<aside class="buttons">
|
||||||
|
<button @click="saveContent()" class="button-primary">Enregistrer</button>
|
||||||
|
<button @click="abort()" class="button-secondary">Annuler</button>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
#editor {
|
||||||
|
padding-top: 16px;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tox-tinymce {
|
||||||
|
border-radius: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttons {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: right;
|
||||||
|
align-content: center;
|
||||||
|
gap: 16px;
|
||||||
|
|
||||||
|
width: fit-content;
|
||||||
|
padding: 32px 16px;
|
||||||
|
|
||||||
|
box-shadow: #0002 0 0 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user