November Happy Hour will be moved to Thursday December 5th.

jacob.nielsen@valtech.dk
Jul 7, 2011
  3136
(0 votes)

On-page edit with Composer

If you are using Composer, you might have noticed that you have lost the ability to edit properties on your Composer page, since Composer seems to override or at least hide the “On-page edit” option from the context menu.

However, enabling “On-page edit” again is luckily pretty straightforward:

private void AddPageOnEditToContextMenu()
{
    if (!CurrentPage.ACL.QueryDistinctAccess(EPiServer.Security.AccessLevel.Edit))
        return;

    RightClickMenuItem dopeItem = ContextMenu.CreateMenuItem("On-page edit", null, "EPi.ope.onEdit()", "true",
                                                             "/App_Themes/Default/Images/Tools/dark/Edit.gif",
                                                             RightClickMode.View);
    dopeItem.EnabledScript = "!EPi.ope.isEditing()";
    ContextMenu.Menu.Add("DOPE item", dopeItem);
}

Call this method in the beginning of the OnInit-event on your Composer template, and you should have the ability to edit your pagetype properties directly on your page again.

Jul 07, 2011

Comments

tym.lawrence@netcat.com.au
tym.lawrence@netcat.com.au Sep 18, 2012 09:47 AM

Hi Jacob,

Thanks for this post. one question: is this a global setting or can you set it so that certain page types will have "On Page Edit", while other page types show "Composer - Edit on Page" ?

Tym

jacob.nielsen@valtech.dk
jacob.nielsen@valtech.dk Sep 18, 2012 11:01 AM

You have to add this to the OnInit event of your Composer template (.aspx), so it's not a global setting. You can however simply create a base class for your Composer templates and call the method above in the OnInit event of that.

Also, this doesn't remove the "Composer - Edit on Page" option, it simply adds a "On Page Edit" option. If you want to remove the "Composer - Edit on Page" option you're probably better off not creating a Composer template, or you can try removing the option from the ContextMenu - see http://sdk.episerver.com/library/cms6.1/html/AllMembers_T_EPiServer_Web_PageExtensions_ContextMenu.htm.

Please login to comment.
Latest blogs
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog