在SharePoint 2013中,可以使用新的设计管理器创建母版页和页面布局。在将HTML文件转换为母版页之后,或者在创建新的页面布局之后,可以使用片段管理器添加SharePoint功能。我已经使用这种方法将一个静态的HTML/CSS文件转换成带有附带页面布局的SharePoint主页面。我可以使用片段管理器中的所有片段,但“内容编辑器”片段除外。我能够添加顶部导航,快速启动栏,页面属性以及“Web部件区域”片段。SharePoint 2013无法编辑内容编辑器代码段
用例:
我想要一个可编辑的页脚。页脚由四部分组成,因此我添加了四个内容编辑器片段,方法是将片段代码粘贴到HTML主页面中。生成片段时,可以设置自定义属性。我注意到在这里设置WebPartID是不可能的。在代码片段中,总是使用以下WebPartID:00000000-0000-0000-0000-000000000000。然而,“Web Part Zone”片段将生成一个(随机?)WebPartID(并且工作)。
问题:
添加段工作正常,但是当我发布的母版页或页面布局这是不可能的编辑CEWP。编辑使用母版页或页面布局的页面时,CEWP应转换为可编辑区域,但不能。没有显示错误。 webpart呈现正确。
我的尝试:
我想在一个随机WebPartID填充,但不起作用。在谷歌和StackOverflow上搜索没有给我任何线索,我找不到任何人面临同样的问题。
的代码:生成
下面的代码片断:
<!--CS: Start Content Editor Snippet--><!--SPM:<%@Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>--><!--MS:<WebPartPages:ContentEditorWebPart xmlns:WebPartPages="namespace" runat="server" webpart="true">--><!--PS: Start of READ-ONLY PREVIEW (do not modify)--><div class="ms-webpart-chrome ms-webpart-chrome-fullWidth "><div WebPartID="00000000-0000-0000-0000-000000000000" HasPers="true" id="WebPart" width="100%" class="ms-WPBody noindex " OnlyForMePart="true" allowMinimize="false" allowRemove="false" allowDelete="false" style=""><div class="ms-rtestate-field"></div><div class="ms-clear"></div></div></div><!--PE: End of READ-ONLY PREVIEW--><!--MS:<WebPart xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/WebPart/v2">--><!--MS:<Title>--><!--SPM:$Resources:core,ContentEditorWebPartTitle;--><!--ME:</Title>--><!--MS:<FrameType>--><!--SPM:None--><!--ME:</FrameType>--><!--MS:<Description>--><!--SPM:$Resources:core,ContentEditorWebPartDescription;--><!--ME:</Description>--><!--MS:<IsIncluded>--><!--SPM:true--><!--ME:</IsIncluded>--><!--MS:<ZoneID>--><!--SPM:ImportedPartZone--><!--ME:</ZoneID>--><!--MS:<PartOrder>--><!--SPM:0--><!--ME:</PartOrder>--><!--MS:<FrameState>--><!--SPM:Normal--><!--ME:</FrameState>--><!--MS:<Height>--><!--ME:</Height>--><!--MS:<Width>--><!--ME:</Width>--><!--MS:<AllowRemove>--><!--SPM:false--><!--ME:</AllowRemove>--><!--MS:<AllowZoneChange>--><!--SPM:false--><!--ME:</AllowZoneChange>--><!--MS:<AllowMinimize>--><!--SPM:false--><!--ME:</AllowMinimize>--><!--MS:<AllowConnect>--><!--SPM:true--><!--ME:</AllowConnect>--><!--MS:<AllowEdit>--><!--SPM:true--><!--ME:</AllowEdit>--><!--MS:<AllowHide>--><!--SPM:false--><!--ME:</AllowHide>--><!--MS:<IsVisible>--><!--SPM:true--><!--ME:</IsVisible>--><!--MS:<DetailLink>--><!--ME:</DetailLink>--><!--MS:<HelpLink>--><!--ME:</HelpLink>--><!--MS:<HelpMode>--><!--SPM:Modeless--><!--ME:</HelpMode>--><!--MS:<Dir>--><!--SPM:Default--><!--ME:</Dir>--><!--MS:<PartImageSmall>--><!--ME:</PartImageSmall>--><!--MS:<MissingAssembly>--><!--SPM:Cannot import this Web Part.--><!--ME:</MissingAssembly>--><!--MS:<PartImageLarge>--><!--SPM:/_layouts/15/images/mscontl.gif--><!--ME:</PartImageLarge>--><!--MS:<IsIncludedFilter>--><!--ME:</IsIncludedFilter>--><!--MS:<ExportControlledProperties>--><!--SPM:true--><!--ME:</ExportControlledProperties>--><!--MS:<ConnectionID>--><!--SPM:00000000-0000-0000-0000-000000000000--><!--ME:</ConnectionID>--><!--MS:<ID>--><!--SPM:g_2bfa6a66_54d1_45e6_84e7_ebbb461f2911--><!--ME:</ID>--><!--MS:<ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">--><!--ME:</ContentLink>--><!--MS:<Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">--><!--ME:</Content>--><!--MS:<PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">--><!--ME:</PartStorage>--><!--MS:<ID>--><!--SPM:g_a4deccb6_9661_415d_99c8_51f528cf7428--><!--ME:</ID>--><!--ME:</WebPart>--><!--ME:</WebPartPages:ContentEditorWebPart>--><!--CE: End Content Editor Snippet-->
由此,在文件名为.master以下代码:
<WebPartPages:ContentEditorWebPart runat="server" webpart="true" __WebPartId="{B2063517-7C26-4084-AA28-36434C760CDB}"><WebPart xmlns="http://schemas.microsoft.com/WebPart/v2"><Title>$Resources:core,ContentEditorWebPartTitle;</Title><FrameType>None</FrameType><Description>$Resources:core,ContentEditorWebPartDescription;</Description><IsIncluded>true</IsIncluded><PartOrder>0</PartOrder><FrameState>Normal</FrameState><Height /><Width /><AllowRemove>false</AllowRemove><AllowZoneChange>false</AllowZoneChange><AllowMinimize>false</AllowMinimize><AllowConnect>true</AllowConnect><AllowEdit>true</AllowEdit><AllowHide>false</AllowHide><IsVisible>true</IsVisible><DetailLink /><HelpLink /><HelpMode>Modeless</HelpMode><Dir>Default</Dir><PartImageSmall /><MissingAssembly>Cannot import this Web Part.</MissingAssembly><PartImageLarge>/_layouts/15/images/mscontl.gif</PartImageLarge><IsIncludedFilter /><ExportControlledProperties>true</ExportControlledProperties><ConnectionID>00000000-0000-0000-0000-000000000000</ConnectionID><ID>g_2bfa6a66_54d1_45e6_84e7_ebbb461f2911</ID><ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
<Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor"><![CDATA[]]></Content>
<PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" /><ID>g_a4deccb6_9661_415d_99c8_51f528cf7428</ID></WebPart></WebPartPages:ContentEditorWebPart>
一些更多的信息:
如图所示,我正在将HTML片段粘贴到HTML文件中。当我添加Web部件区片段时,我可以在其中添加工作的“内容编辑器”WebParts。 “Web部件区域”片段仅在页面布局片段管理器中可用,所以我不能将其用作解决方案以使主页中的页脚正常工作。
我的问题:
- 我如何通过段管理器中添加内容编辑器Web部件?
- 有其他人面临同样的问题吗?
- 可以离开WebPartID 00000000-0000-0000-0000-000000000000吗?
你解决了这个问题吗? – 2013-12-05 17:40:48
不,我无法花更多时间在它上面。我们最终没有对页脚进行修改(这对业务是可以接受的,因为内容不会经常更改)。如果有人发现此问题的解决方法,请分享。 – Arjan 2014-03-14 12:23:14