Skip to content

Commit 89c87e5

Browse files
committed
Fix logo
1 parent bc13b10 commit 89c87e5

File tree

4 files changed

+29
-16
lines changed

4 files changed

+29
-16
lines changed

appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<name>Sendent</name>
55
<summary lang="en">Sendent allows you to securely exchange files and emails</summary>
66
<description lang="en">Sendent now securely exchanges files and emails, integrating with both Microsoft Outlook and Microsoft Teams. This enhanced capability allows users to seamlessly conduct their work, not only within their preferred email environment but also within the collaborative framework of Microsoft Teams. Whether sharing privacy-sensitive documents, content, or handling attachments that exceed standard email size constraints, Sendent ensures a streamlined and secure communication experience. All files are directed to your Nextcloud instance, empowering you to control and manage access permissions effectively.</description>
7-
<version>4.0.1</version>
7+
<version>4.0.3</version>
88
<licence>agpl</licence>
99
<author mail="support@sendent.com" homepage="https://www.sendent.com">Sendent B.V.</author>
1010
<namespace>Sendent</namespace>

src/components/settings/SettingTextarea.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,17 @@
4040

4141
<script setup lang="ts">
4242
import { ref, toRef } from 'vue'
43+
import { storeToRefs } from 'pinia'
4344
import { useTinyMce } from '../../composables/useTinyMce'
45+
import { useDependenciesStore } from '../../stores/dependencies'
4446
4547
const props = defineProps<{
4648
modelValue: string
4749
disabled: boolean
4850
}>()
4951
52+
const { themingLogoUrl } = storeToRefs(useDependenciesStore())
53+
5054
const emit = defineEmits<{
5155
(e: 'save', content: string): void
5256
(e: 'reset'): void
@@ -59,6 +63,7 @@ useTinyMce({
5963
elementRef: editorRef,
6064
value: toRef(props, 'modelValue'),
6165
disabled: toRef(props, 'disabled'),
66+
logoUrl: themingLogoUrl,
6267
onSave(content: string) {
6368
emit('save', content)
6469
},

src/composables/useTinyMce.ts

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,10 @@ import 'tinymce/plugins/preview'
3838
import 'tinymce/plugins/table'
3939

4040
import { onMounted, onBeforeUnmount, watch, type Ref } from 'vue'
41-
import { generateUrl } from '@nextcloud/router'
4241
import type { Editor } from 'tinymce'
4342

44-
/** NC theming logo URL used to preview cid:logo.png@logo in the editor */
45-
const CID_LOGO = 'cid:logo.png@logo'
46-
const NC_LOGO_URL = generateUrl('/apps/theming/image/logoheader')
43+
/** Placeholder used in email templates for the organisation logo */
44+
const LOGO_PLACEHOLDER = '{LOGO}'
4745

4846
const TEMPLATE_VARIABLES = [
4947
'{URL}',
@@ -61,25 +59,24 @@ const TEMPLATE_VARIABLES = [
6159
]
6260

6361
/**
64-
* Replace cid: logo with NC theming URL for preview
65-
* @param html
62+
* Replace {LOGO} placeholder with the theming logo URL for WYSIWYG preview
6663
*/
67-
function toPreview(html: string): string {
68-
return html.replaceAll(CID_LOGO, NC_LOGO_URL)
64+
function toPreview(html: string, logoUrl: string): string {
65+
return html.replaceAll(LOGO_PLACEHOLDER, logoUrl)
6966
}
7067

7168
/**
72-
* Restore cid: logo reference for saving
73-
* @param html
69+
* Restore {LOGO} placeholder before persisting
7470
*/
75-
function toStorage(html: string): string {
76-
return html.replaceAll(NC_LOGO_URL, CID_LOGO)
71+
function toStorage(html: string, logoUrl: string): string {
72+
return html.replaceAll(logoUrl, LOGO_PLACEHOLDER)
7773
}
7874

7975
interface TinyMceOptions {
8076
elementRef: Ref<HTMLElement | null>
8177
value: Ref<string>
8278
disabled: Ref<boolean>
79+
logoUrl: Ref<string>
8380
onSave: (content: string) => void
8481
}
8582

@@ -129,12 +126,12 @@ export function useTinyMce(options: TinyMceOptions) {
129126

130127
// Sync initial content once editor is ready
131128
ed.on('init', () => {
132-
ed.setContent(toPreview(options.value.value || ''))
129+
ed.setContent(toPreview(options.value.value || '', options.logoUrl.value))
133130
})
134131

135132
// Emit changes on blur (not every keystroke)
136133
ed.on('blur', () => {
137-
const content = toStorage(ed.getContent())
134+
const content = toStorage(ed.getContent(), options.logoUrl.value)
138135
if (content !== options.value.value) {
139136
options.onSave(content)
140137
}
@@ -145,7 +142,7 @@ export function useTinyMce(options: TinyMceOptions) {
145142

146143
// Watch for external value changes (e.g. group switch)
147144
watch(options.value, (newVal) => {
148-
const preview = toPreview(newVal || '')
145+
const preview = toPreview(newVal || '', options.logoUrl.value)
149146
if (editor && editor.getContent() !== preview) {
150147
editor.setContent(preview)
151148
}

src/stores/dependencies.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
*/
2121
import { defineStore } from 'pinia'
2222
import { ref } from 'vue'
23+
import { generateUrl } from '@nextcloud/router'
2324
import { fetchCapabilities } from '../services/capabilitiesApi'
2425

2526
export interface AppDependency {
@@ -48,6 +49,7 @@ export const useDependenciesStore = defineStore('dependencies', () => {
4849
const requiredApps = ref<AppDependency[]>([])
4950
const recommendedApps = ref<AppDependency[]>([])
5051
const loading = ref(false)
52+
const themingLogoUrl = ref(generateUrl('/apps/theming/image/logoheader'))
5153

5254
/** Check which required/recommended apps are installed */
5355
async function checkDependencies() {
@@ -67,6 +69,14 @@ export const useDependenciesStore = defineStore('dependencies', () => {
6769
installed: capKeys.includes(app.id),
6870
required: false,
6971
}))
72+
73+
// Extract versioned logo URL from theming capabilities
74+
const theming = capabilities.theming as Record<string, unknown> | undefined
75+
if (theming && typeof theming.logoheader === 'string') {
76+
themingLogoUrl.value = theming.logoheader
77+
} else if (theming && typeof theming.logo === 'string') {
78+
themingLogoUrl.value = theming.logo
79+
}
7080
} catch {
7181
requiredApps.value = REQUIRED_APPS.map(app => ({
7282
...app,
@@ -87,6 +97,7 @@ export const useDependenciesStore = defineStore('dependencies', () => {
8797
requiredApps,
8898
recommendedApps,
8999
loading,
100+
themingLogoUrl,
90101
checkDependencies,
91102
}
92103
})

0 commit comments

Comments
 (0)