在 Sitecore 的内容编辑器中自定义快速信息部分

Customising the Quick Info Section in the Content Editor of Sitecore

是否可以自定义内容编辑器中的快速信息部分以显示有关项目的附加信息? 谢谢

我认为这会很棘手。如果您查看 Sitecore.Shell.Applications.ContentManager.Editor(在 Sitecore.Client.dll 中),您会看到有一个 RenderQuickInfo 方法。 HTML 被手动拼凑在一起,并作为文字控件添加到 EditorFormatter 对象中。所有涉及的 类 都紧密集成到应用程序中 - 没有易于识别的自定义点。

有一些管道与内容编辑器的呈现相关联,

  • renderContentEditor
  • getContentEditorFields
  • getContentEditorSkin

但我认为这些不会提供简单的方法。

总的来说,我一直认为如果 Sitecore 没有使应用程序的一部分易于定制,那么他们可能是故意的。

一个选项可能是更多 js 方法。整个内容编辑器都在 dom 中,尽管是嵌套的。它略有不同,但突出了概念 (http://blog.boro2g.co.uk/ever-edited-sitecore-web-db-mistake/)。

我建议如果你愤怒地使用下面的例子,你可以使 xpath 更好 - 这只是从 chrome 开发工具中偷来的。

例如:将以下脚本粘贴到 content manager.aspx 文件中,您可以访问某些元素:

<script type="text/javascript">     
    window.onload=function(){ 
        var text = getElementByXpath('//*[@id="EditorPanel"]/table/tbody/tr/td/table/tbody/tr[2]/td[1]');
        if (text) {
            text.innerText = "hi";
        } else {                
        }
    };        
    function getElementByXpath(path) {
        return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
    }
</script>    

然后允许您更新文本(见屏幕截图): quickinfo says hi