Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Dispatch a custom event on file tree change
Browse files Browse the repository at this point in the history
This custom event (`save-file-tree`) is used by our editor to save the
state of open folders in opfs.
  • Loading branch information
siddhantk232 authored and amitu committed Sep 4, 2024
1 parent 8363611 commit 3e3e8a4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/editor/editor-bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion components/editor/editor-bundle.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions components/editor/panels/package/package-content.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ function show_package_content({folders, files, ftd_root}) {
let context_menu_path = new ftd2.FastnTik("", ftd_root, CONTEXT_MENU_PATH).get();
let modified_files = new ftd2.FastnTik([], ftd_root, MODIFIED_FILES).get();
let only_modified_files = new ftd2.FastnTik(false, ftd_root, ONLY_MODIFIED_FILES).get();

// saves open file state on every render
window.dispatchEvent(new CustomEvent("ide-event", {detail: {name: "save-file-tree", data: folder.get()}}));

return preact.h(
show_folder, {
folder, hide_name: true, level: 0,
Expand Down

0 comments on commit 3e3e8a4

Please sign in to comment.