@@ -115,17 +115,22 @@ The list size must be between the min and the max width value.
115
115
</template>
116
116
117
117
<script>
118
- import NcAppDetailsToggle from './NcAppDetailsToggle.vue'
119
- import { useIsMobile } from '../../composables/useIsMobile/index.js'
120
-
121
118
import { getBuilder } from '@nextcloud/browser-storage'
122
119
import { emit } from '@nextcloud/event-bus'
120
+ import { loadState } from '@nextcloud/initial-state'
123
121
import { useSwipe } from '@vueuse/core'
124
122
import { Splitpanes, Pane } from 'splitpanes'
123
+ import { useIsMobile } from '../../composables/useIsMobile/index.js'
124
+ import { t } from '../../l10n.js'
125
+
126
+ import NcAppDetailsToggle from './NcAppDetailsToggle.vue'
125
127
126
128
import 'splitpanes/dist/splitpanes.css'
127
129
128
130
const browserStorage = getBuilder('nextcloud').persist().build()
131
+ const { name: productName } = loadState('theming', 'data', { name: 'Nextcloud' })
132
+ const activeApp = loadState('core', 'active-app', appName)
133
+ const localizedAppName = loadState('core', 'apps', {})[activeApp]?.name ?? appName
129
134
130
135
/**
131
136
* App content container to be used for the main content of your app
@@ -202,6 +207,17 @@ export default {
202
207
type: String,
203
208
default: null,
204
209
},
210
+
211
+ /**
212
+ * Allow setting the page's `<title>`
213
+ *
214
+ * If a page heading is set it defaults to `{pageHeading} - {appName} - {productName}` e.g. `Favorites - Files - Nextcloud`.
215
+ * If both `pageTitle` and `pageHeading` are unset the initial `<title>` will not be changed.
216
+ */
217
+ pageTitle: {
218
+ type: String,
219
+ default: null,
220
+ },
205
221
},
206
222
207
223
emits: [
@@ -268,6 +284,24 @@ export default {
268
284
},
269
285
}
270
286
},
287
+
288
+ realPageTitle() {
289
+ if (this.pageTitle) {
290
+ return this.pageTitle
291
+ }
292
+ if (this.pageHeading) {
293
+ return t('{view} - {app} - {product}', { view: this.pageHeading, app: localizedAppName, product: productName })
294
+ }
295
+ return null
296
+ },
297
+ },
298
+
299
+ watch: {
300
+ realPageTitle() {
301
+ if (this.realPageTitle !== null) {
302
+ window.document.title = this.realPageTitle
303
+ }
304
+ },
271
305
},
272
306
273
307
updated() {
0 commit comments