Unable to get the Piranha CMS manager edit page to work

  Kiến thức lập trình

I am working on adding blogging functionality to an existing site and thought that Piranha might be the way to go. I have added the following:

csproj

<ItemGroup>
  <PackageReference Include="Piranha" Version="9.1.0" />
  <PackageReference Include="Piranha.AttributeBuilder" Version="9.1.0" />
  <PackageReference Include="Piranha.Data.EF.SQLServer" Version="9.1.0" />
  <PackageReference Include="Piranha.Data.EF.SQLite" Version="9.1.0" />
  <PackageReference Include="Piranha.ImageSharp" Version="9.1.0" />
  <PackageReference Include="Piranha.Local.FileStorage" Version="9.1.0" />
  <PackageReference Include="Piranha.AspNetCore" Version="9.1.0" />
  <PackageReference Include="Piranha.AspNetCore.Identity.SQLServer" Version="9.1.0" />
  <PackageReference Include="Piranha.AspNetCore.Identity.SQLite" Version="9.1.0" />
  <PackageReference Include="Piranha.Manager" Version="9.1.0" />
  <PackageReference Include="Piranha.Manager.TinyMCE" Version="9.1.0" />
</ItemGroup>  

Startup.cs

services.AddPiranha(options =>
{
    options.AddRazorRuntimeCompilation = true;

    options.UseFileStorage(naming: Piranha.Local.FileStorageNaming.UniqueFolderNames);
    options.UseImageSharp();
    options.UseManager();
    options.UseTinyMCE();
    options.UseMemoryCache();


    options.UseEF<SQLiteDb>(db =>
        db.UseSqlite("Filename=./piranha.mvcweb.db"));
    options.UseIdentityWithSeed<IdentitySQLiteDb>(db =>
        db.UseSqlite("Filename=./piranha.mvcweb.db"));
});

...

App.Init(api);
App.CacheLevel = Piranha.Cache.CacheLevel.Full;

new ContentTypeBuilder(api)
    .AddAssembly(typeof(Startup).Assembly)
    .Build()
    .DeleteOrphans();

Seed.RunAsync(api).GetAwaiter().GetResult();

Piranha.Manager.Editor.EditorConfig.FromFile("editorconfig.json");

app.UsePiranha(options => {
    options.UseManager();
    options.UseTinyMCE();
    options.UseIdentity();
});

I have also copied all the Views, Models, config files, Controllers, and static assets from the sample MVC app project and included them.

When I run the program, it loads the sample home page, and when I go to /manager, it lets me log in using the default credentials. I can see that the default pages are created. When I try to edit a page however, the designer never loads. Instead, when I inspect the page in chrome I get an error saying:

"TypeError: Cannot read property 'filename' of undefined"

I have attached a screenshot showing what loads up to that point and where the error occurs. Any help getting to the root of this would be appreciated.

errorscreenshot

The filename property is most likely part of an image block or other media reference on the test page. My guess is that the media assets haven’t been created properly when you copied the data and the references on the page are corrupted.

Try creating a new page instead and see if the editor loads like it should, then delete the test pages and create your own content.

1

I was able to resolve this issue by removing a call to services.AddMvc() that I had in my Startup after services.AddPiranha(). It looks like AddPiranha does this for you and putting in AddMvc causes things to get messed up.

LEAVE A COMMENT