MOBILE-3320 siteplugins: Fix issue when opening new plugin page

main
Dani Palou 2021-06-07 12:52:44 +02:00
parent 684de1214c
commit a6a2d24a57
4 changed files with 13 additions and 6 deletions

View File

@ -117,7 +117,7 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck {
// eslint-disable-next-line @angular-eslint/no-conflicting-lifecycle
async ngOnChanges(changes: Record<string, SimpleChange>): Promise<void> {
// Only compile if text/javascript has changed or the forceCompile flag has been set to true.
if (this.text && (changes.text || changes.javascript ||
if (this.text !== undefined && (changes.text || changes.javascript ||
(changes.forceCompile && CoreUtils.isTrueOrOne(this.forceCompile)))) {
// Create a new component and a new module.

View File

@ -681,14 +681,14 @@ export class CoreCourseHelperProvider {
throw new CoreError(Translate.instant('core.filenotfound'));
}
if (!CoreFileHelper.isOpenableInApp(module.contents[0])) {
const mainFile = files[0];
if (!CoreFileHelper.isOpenableInApp(mainFile)) {
await CoreFileHelper.showConfirmOpenUnsupportedFile();
}
const site = await CoreSites.getSite(siteId);
const mainFile = files[0];
// Check if the file should be opened in browser.
if (CoreFileHelper.shouldOpenInBrowser(mainFile)) {
return this.openModuleFileInBrowser(mainFile.fileurl, site, module, courseId, component, componentId, files);

View File

@ -46,7 +46,7 @@ export class CoreSitePluginsMainMenuHomeHandler extends CoreSitePluginsBaseHandl
return {
title: this.title,
class: this.handlerSchema.displaydata?.class,
page: `siteplugins/${this.plugin.component}/${this.handlerSchema.method}/0`,
page: `siteplugins/homecontent/${this.plugin.component}/${this.handlerSchema.method}`,
pageParams: {
title: this.title,
initResult: this.initResult,

View File

@ -28,6 +28,13 @@ const routes: Routes = [
},
];
const homeRoutes: Routes = [
{
path: 'siteplugins/homecontent/:component/:method',
loadChildren: () => import('./pages/plugin-page/plugin-page.module').then( m => m.CoreSitePluginsPluginPageModule),
},
];
const courseIndexRoutes: Routes = [
{
path: 'siteplugins/:handlerUniqueName',
@ -47,7 +54,7 @@ const moduleRoutes: Routes = [
imports: [
CoreMainMenuTabRoutingModule.forChild(moduleRoutes.concat(routes)),
CoreCourseIndexRoutingModule.forChild({ children: courseIndexRoutes }),
CoreMainMenuHomeRoutingModule.forChild({ children: routes }),
CoreMainMenuHomeRoutingModule.forChild({ children: homeRoutes }),
CoreSitePluginsComponentsModule,
],
providers: [