SaaS CMS has officially launched! Learn more now.

jacob.nielsen@valtech.dk
Jul 7, 2011
  3078
(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
A day in the life of an Optimizely Developer - London Meetup 2024

Hello and welcome to another instalment of A Day In The Life Of An Optimizely Developer. Last night (11th July 2024) I was excited to have attended...

Graham Carr | Jul 16, 2024

Creating Custom Actors for Optimizely Forms

Optimizely Forms is a powerful tool for creating web forms for various purposes such as registrations, job applications, surveys, etc. By default,...

Nahid | Jul 16, 2024

Optimizely SaaS CMS Concepts and Terminologies

Whether you're a new user of Optimizely CMS or a veteran who have been through the evolution of it, the SaaS CMS is bringing some new concepts and...

Patrick Lam | Jul 15, 2024

How to have a link plugin with extra link id attribute in TinyMce

Introduce Optimizely CMS Editing is using TinyMce for editing rich-text content. We need to use this control a lot in CMS site for kind of WYSWYG...

Binh Nguyen Thi | Jul 13, 2024