Skip to content

Commit

Permalink
remove file from DOM using hook after deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
jrowah committed Jan 13, 2025
1 parent c38d651 commit 983eb5e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ import { CampaignSettingsDialogHook } from "./hooks/campaign-settings-dialog"
import CampaignStatsChartHook from "./hooks/campaign-stats-chart"
import * as ContactsTable from "./hooks/contacts-table"
import * as DateTimeHooks from "./hooks/date-time"
import { FileManager } from "./hooks/file_manager"
import { RememberUnsaved } from "./hooks/remember-unsaved"

const Hooks = {
...DateTimeHooks,
...CampaignEditLiveHooks,
...ContactsTable,
FileManager,
RememberUnsaved,
CampaignSettingsDialogHook,
CampaignStatsChartHook
Expand Down
9 changes: 9 additions & 0 deletions assets/js/hooks/file_manager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const FileManager = {
mounted() {
this.handleEvent("remove_file", ({ id }) => {
document.getElementById(id)?.remove();
});
},
};

export { FileManager };

0 comments on commit 983eb5e

Please sign in to comment.