diff --git a/src/features/forms/components/inputs/GenericInput.vue b/src/features/forms/components/inputs/GenericInput.vue index 7f06bf152ebf7a6d7c0fd8880b7edfc83732cf5b..72ec6565669c2de23cca9d632720bec22c42ff80 100644 --- a/src/features/forms/components/inputs/GenericInput.vue +++ b/src/features/forms/components/inputs/GenericInput.vue @@ -90,13 +90,14 @@ function showLabel(inputType: string) { @save-given-state="emit('saveGivenState', $event)" /> <HtmlInput - v-if="input.type === 'html'" + v-if="input.type === 'html' || input.type === 'html-text'" :id="inputId" ref="htmlInput" :label="input.label" :placeholder="input.placeholder" :input-value="inputValue as string" :inside-card="insideCard" + :text-only="input.type === 'html-text'" @input="emit('input', $event)" @save-given-state="emit('saveGivenState', $event)" /> diff --git a/src/features/forms/components/inputs/HtmlInput.vue b/src/features/forms/components/inputs/HtmlInput.vue index d21988b00082f876e81b7986e573fa5e67224794..87b2b23a2896d3a56960c0a441a33a22f787090e 100644 --- a/src/features/forms/components/inputs/HtmlInput.vue +++ b/src/features/forms/components/inputs/HtmlInput.vue @@ -11,6 +11,7 @@ const props = defineProps<{ inputValue: string; placeholder?: string; insideCard?: boolean; + textOnly?: boolean; }>(); const emit = defineEmits<{ @@ -43,8 +44,10 @@ watch( ); const plugins = 'image link lists template code'; +const textPlugins = 'link lists code'; // noinspection SpellCheckingInspection const toolbar = 'bold italic alignleft aligncenter alignright link image bullist numlist outdent indent template code'; +const textToolbar = 'bold italic link bullist numlist'; const template = ` <details style="border: 1px solid lightgray; border-radius: 4px; padding: .5em .5em 0 .5em"> @@ -59,6 +62,8 @@ function init() { } async function drop(event: DragEvent) { + if(props.textOnly) return; + const file = event.dataTransfer.files[0]; if (!file) return; const url = await graphService.importFile(file.path); @@ -67,6 +72,8 @@ async function drop(event: DragEvent) { } function handleFilePicker(callback: (url: string) => void) { + if(props.textOnly) return; + const input = document.createElement('input'); input.type = 'file'; document.body.appendChild(input); @@ -141,9 +148,9 @@ const textOptions = { ref="editor" v-model="content" api-key="no-api-key" - :plugins="plugins" - :toolbar="toolbar" - :init="standardOptions" + :plugins="textOnly ? textPlugins : plugins" + :toolbar="textOnly ? textToolbar : toolbar" + :init="textOnly ? textOptions : standardOptions" @init="init" @drop.stop.prevent="drop" @focus="onFocus" diff --git a/src/shared/data/forms/nodeForm.data.ts b/src/shared/data/forms/nodeForm.data.ts index c1fdf3c1f43e0a9006fc505d69b60f1f4be9cadf..1c5ab85f753ee059cd334d5ab5fff604a32781c4 100644 --- a/src/shared/data/forms/nodeForm.data.ts +++ b/src/shared/data/forms/nodeForm.data.ts @@ -181,7 +181,7 @@ export const epocForm: Form = { }, { id: 'summary', - type: 'textarea', + type: 'html-text', label: 'Présentation', value: '', placeholder: "Saisissez une présentation de l'ePoc...", @@ -229,7 +229,7 @@ export const epocForm: Form = { }, { id: 'description', - type: 'html', + type: 'html-text', label: 'Description', placeholder: 'Saisissez une description...', value: '',