diff --git a/dashboard/src/components/ApplinkDialog.vue b/dashboard/src/components/ApplinkDialog.vue index 5c81d066d..a9f514e02 100644 --- a/dashboard/src/components/ApplinkDialog.vue +++ b/dashboard/src/components/ApplinkDialog.vue @@ -193,7 +193,7 @@ defineExpose({
- +
diff --git a/dashboard/src/components/ImagePicker.vue b/dashboard/src/components/ImagePicker.vue index 4f5bed59c..364f5339a 100644 --- a/dashboard/src/components/ImagePicker.vue +++ b/dashboard/src/components/ImagePicker.vue @@ -6,6 +6,8 @@ import { Button } from '@cloudron/pankow'; const fileInput = useTemplateRef('fileInput'); const props = defineProps({ + // in simple mode, you get just an upload button. useful for dialogs which do not save/unset immediately + mode: { type: String, default: 'editable', required: true }, src: { type: String, required: true }, fallbackSrc: { type: String, required: true }, size: { type: String, required: true }, @@ -17,6 +19,8 @@ const props = defineProps({ unsetHandler: { type: Function, required: false }, }); +const emit = defineEmits(['changed']); + const image = useTemplateRef('image'); const internalSrc = ref(''); const isChanged = ref(false); @@ -53,7 +57,7 @@ function dataURLtoFile(dataURL, filename) { } async function onSave() { - if (typeof props.saveHandler !== 'function') return console.error('saveHandler must be a function in ImagePicker'); + if (typeof props.saveHandler !== 'function') return; busy.value = true; @@ -73,7 +77,7 @@ function onEdit() { } async function onUnset() { - if (typeof props.unsetHandler !== 'function') return console.error('unsetHandler must be a function in ImagePicker'); + if (typeof props.unsetHandler !== 'function') return; busy.value = true; @@ -86,6 +90,9 @@ async function onUnset() { } function onChanged(event) { + const file = event.target.files[0]; + if (!file) return; + const fr = new FileReader(); fr.onload = function () { const image = new Image(); @@ -135,6 +142,7 @@ function onChanged(event) { internalSrc.value = canvas.toDataURL('image/png'); isChanged.value = true; + emit('changed', file); // <— notify parent }; image.src = fr.result; @@ -155,14 +163,23 @@ function onError() {
-
-
-
-
+ + + +
diff --git a/dashboard/src/components/UserDialog.vue b/dashboard/src/components/UserDialog.vue index a45a0d301..e54fb00f5 100644 --- a/dashboard/src/components/UserDialog.vue +++ b/dashboard/src/components/UserDialog.vue @@ -239,7 +239,7 @@ defineExpose({
- +
diff --git a/dashboard/src/components/app/Display.vue b/dashboard/src/components/app/Display.vue index 5865df5f0..37040a608 100644 --- a/dashboard/src/components/app/Display.vue +++ b/dashboard/src/components/app/Display.vue @@ -97,7 +97,7 @@ onMounted(() => {
- +
diff --git a/dashboard/src/views/AppearanceView.vue b/dashboard/src/views/AppearanceView.vue index a0e698af2..fa2ef468d 100644 --- a/dashboard/src/views/AppearanceView.vue +++ b/dashboard/src/views/AppearanceView.vue @@ -92,12 +92,12 @@ onMounted(async () => {
- +
- +
diff --git a/dashboard/src/views/ProfileView.vue b/dashboard/src/views/ProfileView.vue index 718fcc75a..364f2e51a 100644 --- a/dashboard/src/views/ProfileView.vue +++ b/dashboard/src/views/ProfileView.vue @@ -212,7 +212,7 @@ onMounted(async () => {
- +