🎨 feat(project): enhance project support form with image upload and validation features.

🗃️ refactor(project): rename project support route for clarity and consistency.
🗑️ chore(project): implement delete confirmation for project proposals in the index view.
🔧 fix(editor): adjust initialization delay for SimpleMDE editor to improve responsiveness.
📸 fix(media): update fallback image URL in ProjectProposal model for better asset management.
This commit is contained in:
fsociety
2024-10-24 18:05:37 +02:00
parent 6db38d08f5
commit ef1d0fdf17
5 changed files with 184 additions and 53 deletions

View File

@@ -1,55 +1,43 @@
@props(['model'])
<div
wire:ignore
x-data="{
value: $wire.entangle('{{ $model }}'),
init() {
let editor = new EasyMDE({
element: this.$refs.editor,
lineNumbers: true,
uploadImage: false,
spellChecker: false,
{{-- imageMaxSize: 1024 * 1024 * 10,--}}
{{-- imageUploadFunction: (file, onSuccess, onError) => {--}}
{{-- @this.upload('images', file, (uploadedFilename) => {--}}
{{-- const currentImage = @this.get('currentImage');--}}
{{-- const temporaryUrls = @this.get('temporaryUrls');--}}
{{-- onSuccess(temporaryUrls[currentImage]);--}}
{{-- @this.set('currentImage', currentImage + 1)--}}
{{-- }, () => {--}}
{{-- // Error callback.--}}
{{-- }, (event) => {--}}
{{-- // Progress callback.--}}
{{-- // event.detail.progress contains a number between 1 and 100 as the upload progresses.--}}
{{-- })--}}
{{-- },--}}
showIcons: [
'heading',
'heading-smaller',
'heading-bigger',
'heading-1',
'heading-2',
'heading-3',
'code',
'table',
'quote',
'strikethrough',
'unordered-list',
'ordered-list',
'clean-block',
'horizontal-rule',
'undo',
'redo',
//'upload-image',
],
})
this.$nextTick(() => {
setTimeout(() => {
let editor = new EasyMDE({
element: this.$refs.editor,
lineNumbers: true,
uploadImage: false,
spellChecker: false,
showIcons: [
'heading',
'heading-smaller',
'heading-bigger',
'heading-1',
'heading-2',
'heading-3',
'code',
'table',
'quote',
'strikethrough',
'unordered-list',
'ordered-list',
'clean-block',
'horizontal-rule',
'undo',
'redo',
//'upload-image',
],
});
editor.value(this.value)
editor.value(this.value);
editor.codemirror.on('change', () => {
this.value = editor.value()
})
editor.codemirror.on('change', () => {
this.value = editor.value();
});
}, 100); // Adjust the delay as needed
});
},
}"
class="w-full"