如何在 sitecore 体验编辑器中启用 "Designing" 复选框?

How do you enable the "Designing" tick box in sitecore Experience Editor?

我正在查看 Personalisation of components 的 sitecore 文档。几乎第一步是:

In the Experience Editor, click the View tab and in the Enable group, select Designing to enable the design functionality.

查看我的体验编辑器,虽然它是灰色且不可点击的:

我以管理员身份登录,应该拥有对此项目的完全编辑权限。我已经通过 sitecore 文档和论坛搜索了这个问题,但我看不到任何可以做到这一点或任何修复的东西。谁能建议?我猜 XML 配置中有一些魔法符文需要更新,但这似乎是 "undocumented feature"...

我的网站是这样配置的:

<site name="siteName" 
            virtualFolder="/" 
            physicalFolder="/" 
            rootPath="/sitecore/content" 
            startItem="/start-item" 
            database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" 
            registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" 
            enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" 
            enableAnalytics="true"
            cacheRenderingParameters="true" renderingParametersCacheSize="10MB" 
            itemwebapi.mode="Off" itemwebapi.access="ReadOnly" itemwebapi.allowanonymousaccess="false"/>

我正在使用 sitecore 8

如果您的用户具有管理员权限,则可以在 3 种情况下禁用该复选框:

  1. 页面被标记为 read only - 转到内容编辑器并检查 Appearance 部分。应该有 Read only 复选框。
  2. 您在体验编辑器中,但处于预览模式。检查体验编辑器中的功能区 - 第一部分应该是 Mode。确保选择 Edit 选项。
  3. 您的用户已为该项目的 Write 设置 Deny 访问权限。

根据我的记忆,在某些 Sitecore 版本中 Designing 也会在其他用户锁定项目时被禁用,但它不应该再像 Sitecore 8 中那样了。无论如何,您可能需要检查页面是否未锁定。

还是不行?尝试使用下面的代码。现在应该一直启用复选框。取消注释原始代码并调试以查看为什么它没有为您的用户启用:

namespace MyAssembly.Namespace
{
  [Serializable]
  public class ToggleDesignCapability : Sitecore.Shell.Applications.WebEdit.Commands.ToggleDesignCapability
  {
    public override CommandState QueryState(CommandContext context)
    {
      return CommandState.Enabled;

      /*
          //Original QueryState code - remove return statement above and uncomment to debug

          CommandState commandState = base.QueryState(context);
          Item obj = context.Items.Length > 0 ? context.Items[0] : (Item) null;
          if (obj != null && (commandState == CommandState.Enabled || commandState == CommandState.Down) && !WebEditCommand.CanDesignItem(obj))
            return CommandState.Disabled;
          return commandState;
      */
    }
  }
}

并将 App_config/Include/Sitecore.ExperienceEditor.config 中的原始命令类型替换为 webedit:toggledesigncapability 命令:

  <command name="webedit:toggledesigncapability" type="MyAssembly.Namespace.ToggleDesignCapability, MyAssembly" />

经过大量实验(感谢@Marek 的帮助),我注意到 ToggleDesignCapability 命令从未被命中。

我在 SC forums

上看到了这个答案

I ran into the same issue when working through an upgrade from 7.5 to 8 Update 2. I started doing a compare of my web.config to a stock 8 update 2 config, and noticed that the "website" site entry was missing. One would think that it wouldn't be necessary, but when I added it back, the issue was resolved. Here is the line to check for:

<site name="website" virtualFolder="/" physicalFolder="/" 
rootPath="/sitecore/content" startItem="/home" database="web" domain="extranet" 
allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" 
viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" 
enablePreview="true" enableWebEdit="true" enableDebugger="true" 
disableClientData="false" cacheRenderingParameters="true" 
renderingParametersCacheSize="10MB" />

我已将其关闭,因为我已经按照配置设置了一个站点,请参阅我的问题。不过,我错过的(以及论坛答案中未解释的内容)是您 必须明确拥有一个名为 website 的站点。如果您有一个名为其他名称的站点 这不起作用。我们在现有站点配置下面添加了以上内容,即:

<site name="siteName" 
            virtualFolder="/" 
            physicalFolder="/" 
            rootPath="/sitecore/content" 
            startItem="/start-item" 
            database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" 
            registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" 
            enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" 
            enableAnalytics="true"
            cacheRenderingParameters="true" renderingParametersCacheSize="10MB" 
            itemwebapi.mode="Off" itemwebapi.access="ReadOnly" itemwebapi.allowanonymousaccess="false"/>

<site name="website" virtualFolder="/" physicalFolder="/" 
    rootPath="/sitecore/content" startItem="/home" database="web" domain="extranet" 
    allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" 
    viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" 
    enablePreview="true" enableWebEdit="true" enableDebugger="true" 
    disableClientData="false" cacheRenderingParameters="true" 
    renderingParametersCacheSize="10MB" />

按钮现在已按预期启用。