Skip to content

Commit

Permalink
when clicking on esc button it doesnt remove container padding fix
Browse files Browse the repository at this point in the history
  • Loading branch information
maliknajjar committed Jul 28, 2024
1 parent 714d061 commit 9cfaf94
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "guifier",
"version": "1.0.26",
"version": "1.0.27",
"type": "module",
"license": "MIT",
"description": "An interactive front-end toolkit simplifying JSON, YAML, TOML, and XML data. Visualize, edit, convert formats, and perform real-time data manipulations. Empower your data-driven apps with user-friendly data processing and interactive visualization.",
Expand Down
10 changes: 9 additions & 1 deletion src/guifier/fields/containers/Container/Container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ export abstract class Container extends Field {
fullScreenContainer.append(fullScreenButton)
fullScreenContainer.append(fullScreenExitButton)

const mainContainer = document.querySelector(this.params.elementSelector) as HTMLElement
fullScreenContainer.addEventListener('click', () => {
const mainContainer = document.querySelector(this.params.elementSelector) as HTMLElement
if (fullScreenButton.getAttribute('style') !== null) {
// when its not full screen
fullScreenExitButton.setAttribute('style', 'display: none')
Expand All @@ -310,6 +310,14 @@ export abstract class Container extends Field {
}
})

document.addEventListener('fullscreenchange', () => {
if (document.fullscreenElement === null) {
fullScreenExitButton.setAttribute('style', 'display: none')
fullScreenButton.removeAttribute('style')
mainContainer.removeAttribute('style')
}
})

return fullScreenContainer
}
}

0 comments on commit 9cfaf94

Please sign in to comment.