-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from NDLA-H5P/feature/h5p-widget-interface
- Loading branch information
Showing
6 changed files
with
122 additions
and
64 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
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,38 @@ | ||
import { H5P } from "../../H5P/H5P.util"; | ||
import { H5PField } from "./H5PField"; | ||
import { H5PForm } from "./H5PForm"; | ||
import { H5PSetValue } from "./H5PSetValue"; | ||
|
||
export class H5PWidget< | ||
Field extends H5PField, | ||
Params, | ||
> extends H5P.EventDispatcher { | ||
public field: Field; | ||
|
||
protected parent: H5PForm; | ||
|
||
protected params: Params | undefined; | ||
|
||
protected setValue: H5PSetValue<Params>; | ||
|
||
protected wrapper: HTMLElement; | ||
|
||
constructor( | ||
parent: H5PForm, | ||
field: Field, | ||
params: Params | undefined, | ||
setValue: H5PSetValue<Params>, | ||
) { | ||
super(); | ||
this.wrapper = H5PWidget.createWrapperElement(); | ||
|
||
this.parent = parent; | ||
this.field = field; | ||
this.params = params; | ||
this.setValue = setValue; | ||
} | ||
|
||
private static createWrapperElement(): HTMLDivElement { | ||
return document.createElement("div"); | ||
} | ||
} |
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,5 @@ | ||
export interface IH5PWidget { | ||
appendTo($container: JQuery<HTMLElement>): void; | ||
validate(): boolean; | ||
remove(): void; | ||
} |
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 |
---|---|---|
|
@@ -2,5 +2,4 @@ export type PickerTagType = { | |
id: string; | ||
name: string; | ||
color: string; | ||
isActive: boolean; | ||
}; |
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