-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve pipelines watcher feat: lightbox for images feat: add watch feat: fix links, support diagrams in images and pipelines Pipelines support mmd and dot Links now show .Page.Title in the link text if available Remove figure, h, svg shortcodes, we can just use ![]() now fix: switch to d3 zoomable closes #1087 Co-authored-by: Oli Evans <oli@tableflip.io>
- Loading branch information
1 parent
2355bec
commit df1c7d1
Showing
76 changed files
with
422 additions
and
5,229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ public/ | |
.DS_Store | ||
yarn.lock | ||
node_modules | ||
resources | ||
resources | ||
static/_gen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import zoomable from 'd3-zoomable'; | ||
|
||
function lightbox () { | ||
const transitionSpeedInMilliseconds = 250; | ||
|
||
// template | ||
const fragment = new DocumentFragment() | ||
const container = document.createElement('div') | ||
container.classList.add('lightbox-container') | ||
|
||
const zoom = document.createElement('div') | ||
zoom.classList.add('lightbox-zoom') | ||
|
||
const img = document.createElement('img') | ||
img.src = '' | ||
img.classList.add('lightbox-image') | ||
|
||
container.appendChild(zoom) | ||
zoom.appendChild(img) | ||
fragment.appendChild(container) | ||
document.body.appendChild(fragment) | ||
|
||
// init zoomable in the template | ||
const myZoom = zoomable() | ||
myZoom(container).htmlEl(zoom) | ||
|
||
// hook events | ||
const elements = document.querySelectorAll('.zoomable img') | ||
elements.forEach((element) => { | ||
element.addEventListener('click', () => { | ||
handleElementClick(element); | ||
}); | ||
}); | ||
container.addEventListener('click', hideLightbox); | ||
window.addEventListener('keyup', (event) => { | ||
if (event.key === 'Escape') { | ||
hideLightbox(); | ||
} | ||
}); | ||
|
||
function handleElementClick(htmlElement) { | ||
img.attributes['src'].value = htmlElement.attributes['src'].value; | ||
if (!isVisible()) { | ||
container.classList.remove('hidden'); | ||
container.classList.add('visible'); | ||
document.body.classList.add('lightbox-body-scroll-stop') | ||
} | ||
} | ||
|
||
function hideLightbox() { | ||
if (isVisible()) { | ||
container.classList.add('hidden'); | ||
|
||
setTimeout(() => { | ||
container.classList.remove('visible'); | ||
container.classList.remove('hidden'); | ||
document.body.classList.remove('lightbox-body-scroll-stop') | ||
img.attributes['src'].value = ''; | ||
myZoom.zoomReset() | ||
}, transitionSpeedInMilliseconds); | ||
} | ||
} | ||
|
||
function isVisible() { | ||
return container.classList.contains('visible'); | ||
} | ||
} | ||
|
||
export { | ||
lightbox | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.