plugins: new event menuZip #529

Massimo Melina committed Mar 24, 2024 at 18:33 UTC 327e536dca7cb866734684300d055d7d94463a2e
3 files changed +14 -4
dev-plugins.md
+10
@@ -239,8 +239,13 @@ Some frontend-events can return Html, which can be expressed in several ways
239 - as string, containing markup
240 - as DOM Nodes, as for document.createElement()
241 - as ReactElement
242 +- as array of ReactNode
243 - null, undefined, false and empty-string will just be discarded
244
245 +These events will receive a `def` property, with the default content that will be displayed if no callback return
246 +a valid output. You can decide to embed such default content inside your content.
247 +You can produce output for such events also by adding sections (with same name as the event) to file `custom.html`.
248 +
249 This is a list of available frontend-events, with respective object parameter and output.
250
251 - `additionalEntryDetails`
@@ -311,6 +316,9 @@ This is a list of available frontend-events, with respective object parameter an
316 - you receive an entry of the list, and optionally produce React Component for visualization.
317 - parameter `{ entry: Entry }` (refer above for Entry object)
318 - output `ReactComponent`
319 +- `menuZip`
320 + - parameter `{ def: ReactNode }`
321 + - output `Html`
322 - `userPanelAfterInfo`
323 - no parameter
324 - output `Html`
@@ -397,6 +405,8 @@ Eg: `HFS.t('myPlugin_filter_count', {n:filteredVariable}, "{n} filtered")`
405
406 ## API version history
407
408 +- 8.8 (v0.53.0)
409 + - new event: menuZip
410 - 8.72 (v0.52.0)
411 - HFS.toast
412 - HFS.misc functions
frontend/src/menu.ts
+3 -3
@@ -15,7 +15,7 @@ import { apiCall } from '@hfs/shared/api'
15 import { reloadList } from './useFetchList'
16 import { t, useI18N } from './i18n'
17 import { cut } from './clip'
18 -import { Btn, BtnProps } from './components'
18 +import { Btn, BtnProps, CustomCode } from './components'
19
20 export function MenuPanel() {
21 const { showFilter, remoteSearch, stopSearch, searchManuallyInterrupted, selected, props } = useSnapState()
@@ -87,7 +87,7 @@ export function MenuPanel() {
87 label: t`Options`,
88 onClick: showOptions
89 }),
90 - h(MenuLink, {
90 + h(CustomCode, { name: 'menuZip' }, h(MenuLink, {
91 id: 'zip-button',
92 icon: 'archive',
93 label: t`Zip`,
@@ -112,7 +112,7 @@ export function MenuPanel() {
112 }, t`Select some files`),
113 }
114 }
115 - }),
115 + })),
116 ),
117 remoteSearch && h('div', { id: 'searched' },
118 (stopSearch ? t`Searching` : t`Searched`) + ': ' + remoteSearch + prefix(' (', searchManuallyInterrupted && t`interrupted`, ')')),
src/const.ts
+1 -1
@@ -7,7 +7,7 @@ import { mkdirSync } from 'fs'
7 import { basename, dirname, join } from 'path'
8 export * from './cross-const'
9
10 -export const API_VERSION = 8.72
10 +export const API_VERSION = 8.8
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