-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement extension point for copy embed (#880)
* implement an extension point to modify wire preview content * fix lint * add documentation on registering extensions * make extensions work without having to modify webpack.config.js from root repo * include newsroom_custom_js only if it is defined * allow app.tsx; expose gettext and button * add article argument to prepareWirePreview * import app internally * fix test * refactor body html * fix docs --------- Co-authored-by: Tomas Kikutis <[email protected]>
- Loading branch information
1 parent
829df87
commit cb37e8e
Showing
16 changed files
with
216 additions
and
187 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// dummy app fallback |
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 |
---|---|---|
@@ -1,6 +1,38 @@ | ||
import {isTouchDevice} from 'utils'; | ||
import {gettext, isTouchDevice} from 'utils'; | ||
import 'primereact/resources/primereact.min.css'; | ||
import {Button} from './ui/components/Button'; | ||
import {IArticle} from 'interfaces'; | ||
|
||
if (isTouchDevice()) { | ||
document.documentElement.classList.add('no-touch'); | ||
} | ||
|
||
interface IExtensions { | ||
prepareWirePreview?(content: HTMLElement, item: IArticle): HTMLElement; | ||
} | ||
|
||
export const extensions: IExtensions = {}; | ||
|
||
export function registerExtensions(extensionsToRegister: IExtensions) { | ||
Object.assign(extensions, extensionsToRegister); | ||
} | ||
|
||
interface IExposedForExtensions { | ||
ui: { | ||
Button: typeof Button, | ||
}; | ||
locale: { | ||
gettext: typeof gettext, | ||
}; | ||
} | ||
|
||
export const exposed: IExposedForExtensions = { | ||
ui: { | ||
Button, | ||
}, | ||
locale: { | ||
gettext, | ||
}, | ||
}; | ||
|
||
import 'app'; |
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.