Mentions légales du service

Skip to content
Snippets Groups Projects
Commit f8189ee5 authored by VIAUD Nathan's avatar VIAUD Nathan
Browse files

feat: adding text only wysiwyg

parent 1e17937d
No related branches found
No related tags found
1 merge request!129Resolve "Add text only wysiwyg"
Pipeline #965314 passed
...@@ -90,13 +90,14 @@ function showLabel(inputType: string) { ...@@ -90,13 +90,14 @@ function showLabel(inputType: string) {
@save-given-state="emit('saveGivenState', $event)" @save-given-state="emit('saveGivenState', $event)"
/> />
<HtmlInput <HtmlInput
v-if="input.type === 'html'" v-if="input.type === 'html' || input.type === 'html-text'"
:id="inputId" :id="inputId"
ref="htmlInput" ref="htmlInput"
:label="input.label" :label="input.label"
:placeholder="input.placeholder" :placeholder="input.placeholder"
:input-value="inputValue as string" :input-value="inputValue as string"
:inside-card="insideCard" :inside-card="insideCard"
:text-only="input.type === 'html-text'"
@input="emit('input', $event)" @input="emit('input', $event)"
@save-given-state="emit('saveGivenState', $event)" @save-given-state="emit('saveGivenState', $event)"
/> />
......
...@@ -11,6 +11,7 @@ const props = defineProps<{ ...@@ -11,6 +11,7 @@ const props = defineProps<{
inputValue: string; inputValue: string;
placeholder?: string; placeholder?: string;
insideCard?: boolean; insideCard?: boolean;
textOnly?: boolean;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
...@@ -43,8 +44,10 @@ watch( ...@@ -43,8 +44,10 @@ watch(
); );
const plugins = 'image link lists template code'; const plugins = 'image link lists template code';
const textPlugins = 'link lists code';
// noinspection SpellCheckingInspection // noinspection SpellCheckingInspection
const toolbar = 'bold italic alignleft aligncenter alignright link image bullist numlist outdent indent template code'; const toolbar = 'bold italic alignleft aligncenter alignright link image bullist numlist outdent indent template code';
const textToolbar = 'bold italic link bullist numlist';
const template = ` const template = `
<details style="border: 1px solid lightgray; border-radius: 4px; padding: .5em .5em 0 .5em"> <details style="border: 1px solid lightgray; border-radius: 4px; padding: .5em .5em 0 .5em">
...@@ -59,6 +62,8 @@ function init() { ...@@ -59,6 +62,8 @@ function init() {
} }
async function drop(event: DragEvent) { async function drop(event: DragEvent) {
if(props.textOnly) return;
const file = event.dataTransfer.files[0]; const file = event.dataTransfer.files[0];
if (!file) return; if (!file) return;
const url = await graphService.importFile(file.path); const url = await graphService.importFile(file.path);
...@@ -67,6 +72,8 @@ async function drop(event: DragEvent) { ...@@ -67,6 +72,8 @@ async function drop(event: DragEvent) {
} }
function handleFilePicker(callback: (url: string) => void) { function handleFilePicker(callback: (url: string) => void) {
if(props.textOnly) return;
const input = document.createElement('input'); const input = document.createElement('input');
input.type = 'file'; input.type = 'file';
document.body.appendChild(input); document.body.appendChild(input);
...@@ -141,9 +148,9 @@ const textOptions = { ...@@ -141,9 +148,9 @@ const textOptions = {
ref="editor" ref="editor"
v-model="content" v-model="content"
api-key="no-api-key" api-key="no-api-key"
:plugins="plugins" :plugins="textOnly ? textPlugins : plugins"
:toolbar="toolbar" :toolbar="textOnly ? textToolbar : toolbar"
:init="standardOptions" :init="textOnly ? textOptions : standardOptions"
@init="init" @init="init"
@drop.stop.prevent="drop" @drop.stop.prevent="drop"
@focus="onFocus" @focus="onFocus"
......
...@@ -181,7 +181,7 @@ export const epocForm: Form = { ...@@ -181,7 +181,7 @@ export const epocForm: Form = {
}, },
{ {
id: 'summary', id: 'summary',
type: 'textarea', type: 'html-text',
label: 'Présentation', label: 'Présentation',
value: '', value: '',
placeholder: "Saisissez une présentation de l'ePoc...", placeholder: "Saisissez une présentation de l'ePoc...",
...@@ -229,7 +229,7 @@ export const epocForm: Form = { ...@@ -229,7 +229,7 @@ export const epocForm: Form = {
}, },
{ {
id: 'description', id: 'description',
type: 'html', type: 'html-text',
label: 'Description', label: 'Description',
placeholder: 'Saisissez une description...', placeholder: 'Saisissez une description...',
value: '', value: '',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment