Remove "framework"
This commit is contained in:
parent
b45bdb18a0
commit
dc86d30eb2
72 changed files with 359 additions and 333 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { html } from '../../framework/model/misc';
|
||||
import cancel from '../../static/icons/cancel.svg';
|
||||
|
||||
import './image-viewer.scss';
|
||||
import { html } from '../../types/html';
|
||||
|
||||
export const generate = (): html => `
|
||||
<section id="image-viewer">
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
import { PageElement } from '../../framework/page-element';
|
||||
import { PageElement } from '../page-element';
|
||||
|
||||
import { generate } from './image-viewer.html';
|
||||
import { createElement } from '../../framework/helper/create-element';
|
||||
import { OnLoadEvent } from '../../framework/events/concrete-events/on-load-event';
|
||||
import { OptionalEvent } from '../../framework/events/optional-event';
|
||||
import { createElement } from '../../helper/create-element';
|
||||
import { OnLoadEvent } from '../../events/concrete-events/on-load-event';
|
||||
import { OptionalEvent } from '../../events/optional-event';
|
||||
|
||||
export class PageImageViewer extends PageElement {
|
||||
public constructor() {
|
||||
super(createElement(generate()));
|
||||
this.element.onclick = () => PageImageViewer.hide(this.element);
|
||||
this.htmlRoot.onclick = () => PageImageViewer.hide(this.htmlRoot);
|
||||
}
|
||||
|
||||
public handleOnLoadEvent(event: OnLoadEvent): OptionalEvent {
|
||||
|
|
@ -17,7 +17,7 @@ export class PageImageViewer extends PageElement {
|
|||
const media = Array.prototype.slice.call(document.querySelectorAll('img'));
|
||||
|
||||
media
|
||||
.filter((e: HTMLElement) => e.parentElement !== this.element)
|
||||
.filter((e: HTMLElement) => e.parentElement !== this.htmlRoot)
|
||||
.forEach((e: HTMLImageElement) => (e.onclick = this.handleClick.bind(this)));
|
||||
return super.handleOnLoadEvent(event);
|
||||
}
|
||||
|
|
@ -29,12 +29,12 @@ export class PageImageViewer extends PageElement {
|
|||
const element: HTMLImageElement = new Image();
|
||||
element.src = (event.target as HTMLImageElement).src;
|
||||
container.appendChild(element);
|
||||
PageImageViewer.show(this.element);
|
||||
PageImageViewer.show(this.htmlRoot);
|
||||
}
|
||||
|
||||
private handleKeydown(event: KeyboardEvent) {
|
||||
if (event.key === 'Escape') {
|
||||
PageImageViewer.hide(this.element);
|
||||
PageImageViewer.hide(this.htmlRoot);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue