Skip to content

Commit

Permalink
fix: load script on init step
Browse files Browse the repository at this point in the history
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Aug 27, 2024
1 parent 3fe05c7 commit 2ef0273
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/Listeners/LoadAdditionalScriptsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
class LoadAdditionalScriptsListener implements IEventListener {
public function handle(Event $event): void {
\OCP\Util::addInitScript('groupfolders', 'groupfolders-init');
\OCP\Util::addScript('groupfolders', 'groupfolders-files');
\OCP\Util::addScript('groupfolders', 'groupfolders-main');
}
}
8 changes: 4 additions & 4 deletions src/actions/openGroupfolderAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
import { translate as t } from '@nextcloud/l10n'
import type { Node } from '@nextcloud/files'

import { registerFileAction, FileAction, DefaultType } from '@nextcloud/files'
import { FileAction, DefaultType } from '@nextcloud/files'
import { translate as t } from '@nextcloud/l10n'

registerFileAction(new FileAction({
export const action = new FileAction({
id: 'open-group-folders',
displayName: () => t('files', 'Open group folder'),
iconSvgInline: () => '',
Expand All @@ -44,4 +44,4 @@ registerFileAction(new FileAction({
default: DefaultType.DEFAULT,
// Before openFolderAction
order: -1000,
}))
})
7 changes: 5 additions & 2 deletions src/main.ts β†’ src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
*/
/* eslint-disable */
import { translate as t } from '@nextcloud/l10n'
import { View, getNavigation } from '@nextcloud/files'
import { View, getNavigation, registerFileAction } from '@nextcloud/files'
import FolderSvg from '@mdi/svg/svg/folder-account.svg?raw'

import { getContents } from './services/groupfolders'
import './actions/openGroupfolderAction'
import { action as openGroupfolderAction} from './actions/openGroupfolderAction'

declare global {
interface Window {
Expand All @@ -34,6 +35,8 @@ declare global {
const appName: string
}

registerFileAction(openGroupfolderAction)

const Navigation = getNavigation()
Navigation.register(new View({
id: appName,
Expand Down
18 changes: 10 additions & 8 deletions webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ const path = require('path')
const webpackConfig = require('@nextcloud/webpack-vue-config')
const webpackRules = require('@nextcloud/webpack-vue-config/rules')

webpackConfig.entry.main = path.resolve(path.join('src', 'main.ts'))
webpackConfig.entry.settings = [
'whatwg-fetch',
'./src/settings/index.tsx',
]
webpackConfig.entry.files = [
'./src/files.js',
]
webpackConfig.entry = {
init: path.resolve(path.join('src', 'init.ts')),
files: [
'./src/files.js',
],
settings: [
'whatwg-fetch',
'./src/settings/index.tsx',
],
}

webpackConfig.resolve.extensions = [...webpackConfig.resolve.extensions, '.jsx', '.ts', '.tsx']

Expand Down

0 comments on commit 2ef0273

Please sign in to comment.