plugins: config.helperText now supports basic md formatting
Massimo Melina committed
Oct 5, 2024 at 14:24 UTC
94c6083f8f48ce43976402b166efae5ffa9ff27c
3 files changed
+8
-5
admin/src/InstalledPlugins.ts
+5
-3
@@ -5,7 +5,7 @@ import { createElement as h, Fragment, useEffect } from 'react'
5
import { Box, Link } from '@mui/material'
6
import { DataTable, DataTableColumn } from './DataTable'
7
import { Delete, Error as ErrorIcon, FormatPaint as ThemeIcon, PlayCircle, Settings, StopCircle, Upgrade } from '@mui/icons-material'
8
-import { HTTP_FAILED_DEPENDENCY, newObj, prefix, with_, xlate } from './misc'
8
+import { HTTP_FAILED_DEPENDENCY, md, newObj, prefix, with_, xlate } from './misc'
9
import { alertDialog, confirmDialog, formDialog, toast } from './dialog'
10
import _ from 'lodash'
11
import { Account } from './AccountsPage'
@@ -163,7 +163,9 @@ function makeFields(config: any) {
163
return Object.entries(config).map(([k,o]: [string,any]) => {
164
if (!_.isPlainObject(o))
165
return o
166
- let { type, defaultValue, fields, frontend, ...rest } = o
166
+ let { type, defaultValue, fields, frontend, helperText, ...rest } = o
167
+ if (helperText)
168
+ helperText = md(helperText, { html: false })
169
const comp = (type2comp as any)[type] as Field<any> | undefined
170
if (comp === ArrayField) {
171
rest.valuesForAdd = newObj(fields, x => x.defaultValue)
@@ -171,7 +173,7 @@ function makeFields(config: any) {
173
}
174
if (defaultValue !== undefined && type === 'boolean')
175
rest.placeholder = `Default value is ${JSON.stringify(defaultValue)}`
174
- return { k, comp, fields, ...rest }
176
+ return { k, comp, fields, helperText, ...rest }
177
})
178
}
179
dev-plugins.md
+2
-1
@@ -658,7 +658,7 @@ If you want to override a text regardless of the language, use the special langu
658
659
## API version history
660
661
-- 9.2 (v0.54.0)
661
+- 9.3 (v0.54.0)
662
- frontend event: showPlay
663
- api.addBlock
664
- api.misc
@@ -669,6 +669,7 @@ If you want to override a text regardless of the language, use the special langu
669
- HFS.userBelongsTo
670
- HFS.DirEntry
671
- frontend event: appendMenuBar
672
+ - config.helperText: basic md formatting
673
- 8.891 (v0.53.0)
674
- api.openDb
675
- frontend event: menuZip
src/const.ts
+1
-1
@@ -7,7 +7,7 @@ import _ from 'lodash'
7
import { basename, dirname, join } from 'path'
8
export * from './cross-const'
9
10
-export const API_VERSION = 9.2
10
+export const API_VERSION = 9.3
11
export const COMPATIBLE_API_VERSION = 1 // while changes in the api are not breaking, this number stays the same, otherwise it is made equal to API_VERSION
12
export const HFS_REPO = 'rejetto/hfs'
13