|
110 | 110 | </div> |
111 | 111 | <div class="flex flex-col sm:flex-row"> |
112 | 112 | <div class="w-full max-w-md sm:mr-8"> |
113 | | - <FormRow v-model="editable.settings.theme" :disabled="!editTemplate && !editable.policy.theme" type="select" :options="themes"> |
| 113 | + <FormRow v-model="editable.settings.theme" :disabled="!editTemplate && !editable.policy.theme" type="uneditable" :options="themeOptions" wrapper-class="max-w-sm"> |
114 | 114 | Editor Theme |
115 | 115 | <template #append><ChangeIndicator :value="editable.changed.settings.theme" /></template> |
| 116 | + <template #description>Choose a standard FlowFuse theme or enter the name of a loaded custom theme</template> |
| 117 | + <template #input> |
| 118 | + <ff-combobox |
| 119 | + v-model="editable.settings.theme" |
| 120 | + :options="themeOptions" |
| 121 | + :disabled="!editTemplate && !editable.policy.theme" |
| 122 | + :hasCustomValue="true" |
| 123 | + data-el="theme-dropdown" |
| 124 | + /> |
| 125 | + </template> |
116 | 126 | </FormRow> |
117 | 127 | </div> |
118 | 128 | <LockSetting v-model="editable.policy.theme" class="flex justify-end flex-col" :editTemplate="editTemplate" :changed="editable.changed.policy.theme" /> |
@@ -231,7 +241,7 @@ export default { |
231 | 241 | data () { |
232 | 242 | return { |
233 | 243 | timezones: timezonesData.timezones, |
234 | | - themes: [ |
| 244 | + defaultThemes: [ |
235 | 245 | { label: 'FlowFuse Light', value: 'forge-light' }, |
236 | 246 | { label: 'FlowFuse Dark', value: 'forge-dark' } |
237 | 247 | ] // FUTURE: Get from theme plugins |
@@ -278,6 +288,14 @@ export default { |
278 | 288 | return true |
279 | 289 | } |
280 | 290 | return SemVer.satisfies(SemVer.coerce(launcherVersion), '>=2.12.0') |
| 291 | + }, |
| 292 | + themeOptions () { |
| 293 | + if (this.modelValue?.settings?.theme && !this.defaultThemes.map(th => th.value).includes(this.modelValue.settings.theme)) { |
| 294 | + // set the custom theme as one of the available options |
| 295 | + return [...this.defaultThemes, { label: this.modelValue.settings.theme, value: this.modelValue.settings.theme }] |
| 296 | + } |
| 297 | +
|
| 298 | + return this.defaultThemes |
281 | 299 | } |
282 | 300 | } |
283 | 301 | } |
|
0 commit comments