Message Boards
Liferay 7.2 CE, automatic scroll to full content asset: how to disable it?
Alessandro Candini, modified 2 Years ago.
Liferay 7.2 CE, automatic scroll to full content asset: how to disable it?
Regular Member Posts: 130 Join Date: 10/17/15 Recent PostsI have an Asset Publisher, showing a content detail through a display
page ("Set as the Default Asset Publisher for This
Page" set) and it works great, showing me the content with
the usual URL myportal/-/my-content-name.
So far, so
good...the only problem is that at the end of page loading, the
content is scrolled up to the following anchor injected by Liferay:
...
<div class="asset-full-content clearfix mb-5
default-asset-publisher no-title ">
<span class="asset-anchor lfr-asset-anchor"
id="55130"></span> ... </div>
Is that possible to disable this unwanted behaviour?
Thank you.
Eric D, modified 4 Years ago.
RE: Liferay 7.2 CE, automatic scroll to full content asset: how to disable
Junior Member Posts: 55 Join Date: 3/25/16 Recent Posts
I have the same problem in 7.1.
I never find where we can change this.
I am interested if you find a solution.
I never find where we can change this.
I am interested if you find a solution.
Alessandro Candini, modified 4 Years ago.
RE: Liferay 7.2 CE, automatic scroll to full content asset: how to disable
Regular Member Posts: 130 Join Date: 10/17/15 Recent Posts
Yes, this behaviour is indeed very annoying...let's see if someone have a solution. In the meantime I'll try to get a workaround...
Cédric Henry, modified 3 Years ago.
RE: Liferay 7.2 CE, automatic scroll to full content asset: how to disable
New Member Posts: 5 Join Date: 4/20/18 Recent Posts
Sorry for being late on this post.
This the only way we found to get rid of that using a classic "widget page" (approved by the support, overwise we would need to use display page) : create a fragment to override the jsp which provide the anchor.
Notes : removing "" doesn't work. The anchor effect is provided by a javascript.To do that, follow the procedure detailed below.
1) Create a new fragment module which I will call "asset-publisher-fragment" (you can create a mvc-portlet if you don't have the fragment template in you IDE, just remove every Java classes and .jsp and only keep the META-INF.ressources folder empty.
2) Edit the bnd.bnd file to add the proper "Fragment-Host" :
3) Create a new file "view_content.jsp" in "META-INF.ressources" with the following content :
Notes : we just removed thisJS part wich annoy us :
This the only way we found to get rid of that using a classic "widget page" (approved by the support, overwise we would need to use display page) : create a fragment to override the jsp which provide the anchor.
Notes : removing "" doesn't work. The anchor effect is provided by a javascript.To do that, follow the procedure detailed below.
1) Create a new fragment module which I will call "asset-publisher-fragment" (you can create a mvc-portlet if you don't have the fragment template in you IDE, just remove every Java classes and .jsp and only keep the META-INF.ressources folder empty.
2) Edit the bnd.bnd file to add the proper "Fragment-Host" :
Bundle-Name: asset-publisher-fragment
Bundle-SymbolicName: asset.publisher.fragment
Bundle-Version: 1.0.0
Fragment-Host: com.liferay.asset.publisher.web
3) Create a new file "view_content.jsp" in "META-INF.ressources" with the following content :
<%--
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/init.jsp" %>
<liferay-util:dynamic-include key="com.liferay.asset.publisher.web#/view_content.jsp#pre" />
<%
AssetPublisherViewContentDisplayContext assetPublisherViewContentDisplayContext = new AssetPublisherViewContentDisplayContext(renderRequest, assetPublisherDisplayContext.isEnablePermissions());
if (Validator.isNotNull(assetPublisherViewContentDisplayContext.getReturnToFullPageURL())) {
portletDisplay.setURLBack(assetPublisherViewContentDisplayContext.getReturnToFullPageURL());
}
%>
<c:choose>
<c:when test="<%= assetPublisherViewContentDisplayContext.isAssetEntryVisible() %>">
<%
AssetEntry assetEntry = assetPublisherViewContentDisplayContext.getAssetEntry();
AssetRenderer<!--?--> assetRenderer = assetPublisherViewContentDisplayContext.getAssetRenderer();
request.setAttribute("view.jsp-assetEntry", assetEntry);
request.setAttribute("view.jsp-assetRenderer", assetRenderer);
request.setAttribute("view.jsp-assetRendererFactory", assetPublisherViewContentDisplayContext.getAssetRendererFactory());
request.setAttribute("view.jsp-print", assetPublisherViewContentDisplayContext.getPrint());
request.setAttribute("view.jsp-showBackURL", assetPublisherViewContentDisplayContext.isShowBackURL());
PortalUtil.addPortletBreadcrumbEntry(request, assetRenderer.getTitle(locale), currentURL);
String summary = StringUtil.shorten(assetRenderer.getSummary(liferayPortletRequest, liferayPortletResponse), assetPublisherDisplayContext.getAbstractLength());
PortalUtil.setPageDescription(summary, request);
PortalUtil.setPageKeywords(assetHelper.getAssetKeywords(assetEntry.getClassName(), assetEntry.getClassPK()), request);
PortalUtil.setPageTitle(assetRenderer.getTitle(locale), request);
%>
<liferay-util:include page="/view_asset_entry_full_content.jsp" servletContext="<%= application %>" />
</c:when>
<c:otherwise>
<liferay-util:include page="/error.jsp" servletContext="<%= application %>" />
</c:otherwise>
</c:choose>
<liferay-util:dynamic-include key="com.liferay.asset.publisher.web#/view_content.jsp#post" />
Notes : we just removed thisJS part wich annoy us :
<aui:script>
Liferay.once('allPortletsReady', function() {
if (!Liferay.Browser.isIe()) {
document
.getElementById('p_p_id_<%= portletDisplay.getId() %>_')
.scrollIntoView();
}
});
</aui:script>
4) Deploy the module and, that's it.
Eric D, modified 3 Years ago.
RE: Liferay 7.2 CE, automatic scroll to full content asset: how to disable
Junior Member Posts: 55 Join Date: 3/25/16 Recent Posts
Thanks for your post.
I will try this... Eric.
I will try this... Eric.
Alessandro Candini, modified 3 Years ago.
RE: Liferay 7.2 CE, automatic scroll to full content asset: how to disable
Regular Member Posts: 130 Join Date: 10/17/15 Recent Posts
Hi Henry, we solved the same way long ago. Thank you anyway!
Jonathan HELL, modified 2 Years ago.
RE: Liferay 7.2 CE, automatic scroll to full content asset: how to disable
New Member Posts: 3 Join Date: 11/25/20 Recent PostsHere is my awful solution for this awful behaviour.
Liferay.Browser.isIe = () => true;
This script has to be called as late as possible and this to avoid other Liferay scripts to consider your browser as IE. As the "allPortletsReady" event is fired after the DOM is rendered, this should'nt be a problem.
Hope this helps.
J.