Index: ../../git/magnolia_main/magnolia-templating-editor/src/main/java/info/magnolia/templating/editor/client/dom/processor/ElementProcessor.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+>/**\n * This file Copyright (c) 2011 Magnolia International\n * Ltd. (http://www.magnolia-cms.com). All rights reserved.\n *\n *\n * This file is dual-licensed under both the Magnolia\n * Network Agreement and the GNU General Public License.\n * You may elect to use one or the other of these licenses.\n *\n * This file is distributed in the hope that it will be\n * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the\n * implied warranty of MERCHANTABILITY or FITNESS FOR A\n * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.\n * Redistribution, except as permitted by whichever of the GPL\n * or MNA you select, is prohibited.\n *\n * 1. For the GPL license (GPL), you can redistribute and/or\n * modify this file under the terms of the GNU General\n * Public License, Version 3, as published by the Free Software\n * Foundation. You should have received a copy of the GNU\n * General Public License, Version 3 along with this program;\n * if not, write to the Free Software Foundation, Inc., 51\n * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n *\n * 2. For the Magnolia Network Agreement (MNA), this file\n * and the accompanying materials are made available under the\n * terms of the MNA which accompanies this distribution, and\n * is available at http://www.magnolia-cms.com/mna.html\n *\n * Any modifications to this file must keep this entire header\n * intact.\n *\n */\npackage info.magnolia.templating.editor.client.dom.processor;\n\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.Node;\n\nimport info.magnolia.rendering.template.AreaDefinition;\nimport info.magnolia.templating.editor.client.PageEditor;\nimport info.magnolia.templating.editor.client.dom.MgnlElement;\n\n/**\n * Processor for DOM elements.\n */\npublic class ElementProcessor {\n\n public static void process(Node node, MgnlElement mgnlElement) {\n\n Element element = node.cast();\n if (element.hasTagName(\"A\")) {\n disableLink(element);\n removeHover(element);\n }\n PageEditor.model.addElement(mgnlElement, element);\n\n if (element.hasAttribute(AreaDefinition.CMS_ADD)) {\n mgnlElement.setComponentElement(element);\n }\n\n else if (element.hasAttribute(AreaDefinition.CMS_PLACEHOLDER)) {\n mgnlElement.setAreaElement(element);\n }\n\n else if (element.hasAttribute(AreaDefinition.CMS_EDIT)) {\n mgnlElement.setEditElement(element);\n }\n\n else {\n if (mgnlElement.getFirstElement() == null) {\n mgnlElement.setFirstElement(element);\n }\n\n if (mgnlElement.getLastElement() == null || !mgnlElement.getLastElement().isOrHasChild(element)) {\n mgnlElement.setLastElement(element);\n }\n }\n\n }\n\n public static void removeHover (Element element) {\n element.addClassName(\"disabled\");\n }\n\n public native static void disableLink(Element element) /*-{\n if (element.onclick == null) {\n element.onclick = function() {\n return false;\n };\n }\n }-*/;\n}\n
===================================================================
--- ../../git/magnolia_main/magnolia-templating-editor/src/main/java/info/magnolia/templating/editor/client/dom/processor/ElementProcessor.java (revision 026ad62bb10416ca8a59c36db5db8d8376d8c563)
+++ ../../git/magnolia_main/magnolia-templating-editor/src/main/java/info/magnolia/templating/editor/client/dom/processor/ElementProcessor.java (revision )
@@ -45,9 +45,17 @@
*/
public class ElementProcessor {
- public static void process(Node node, MgnlElement mgnlElement) {
+ private static String NAVIGATION_ROLE ="navigation";
+ public static boolean process(Node node, MgnlElement mgnlElement) {
+
Element element = node.cast();
+
+ // If element has role navigation skip node and children.
+ if (element.getAttribute("role").equals(NAVIGATION_ROLE)) {
+ return false;
+ }
+
if (element.hasTagName("A")) {
disableLink(element);
removeHover(element);
@@ -75,6 +83,7 @@
mgnlElement.setLastElement(element);
}
}
+ return true;
}
Index: ../../git/magnolia_main/magnolia-templating-editor/src/main/java/info/magnolia/templating/editor/client/PageEditor.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+>/**\n * This file Copyright (c) 2011-2012 Magnolia International\n * Ltd. (http://www.magnolia-cms.com). All rights reserved.\n *\n *\n * This file is dual-licensed under both the Magnolia\n * Network Agreement and the GNU General Public License.\n * You may elect to use one or the other of these licenses.\n *\n * This file is distributed in the hope that it will be\n * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the\n * implied warranty of MERCHANTABILITY or FITNESS FOR A\n * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.\n * Redistribution, except as permitted by whichever of the GPL\n * or MNA you select, is prohibited.\n *\n * 1. For the GPL license (GPL), you can redistribute and/or\n * modify this file under the terms of the GNU General\n * Public License, Version 3, as published by the Free Software\n * Foundation. You should have received a copy of the GNU\n * General Public License, Version 3 along with this program;\n * if not, write to the Free Software Foundation, Inc., 51\n * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n *\n * 2. For the Magnolia Network Agreement (MNA), this file\n * and the accompanying materials are made available under the\n * terms of the MNA which accompanies this distribution, and\n * is available at http://www.magnolia-cms.com/mna.html\n *\n * Any modifications to this file must keep this entire header\n * intact.\n *\n */\npackage info.magnolia.templating.editor.client;\n\n\nimport info.magnolia.templating.editor.client.dom.Comment;\nimport info.magnolia.templating.editor.client.dom.MgnlElement;\nimport info.magnolia.templating.editor.client.dom.processor.CommentProcessor;\nimport info.magnolia.templating.editor.client.dom.processor.ElementProcessor;\nimport info.magnolia.templating.editor.client.dom.processor.MgnlElementProcessor;\nimport info.magnolia.templating.editor.client.dom.processor.MgnlElementProcessorFactory;\nimport info.magnolia.templating.editor.client.jsni.JavascriptUtils;\nimport info.magnolia.templating.editor.client.model.ModelStorage;\nimport info.magnolia.templating.editor.client.widget.PreviewChannel;\nimport info.magnolia.templating.editor.client.widget.PreviewChannel.Orientation;\nimport info.magnolia.templating.editor.client.widget.dnd.LegacyDragAndDrop;\n\nimport java.util.LinkedList;\nimport java.util.List;\n\nimport com.google.gwt.core.client.EntryPoint;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.AnchorElement;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.FormElement;\nimport com.google.gwt.dom.client.Node;\nimport com.google.gwt.dom.client.NodeList;\nimport com.google.gwt.dom.client.Style.Unit;\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwt.event.dom.client.KeyDownEvent;\nimport com.google.gwt.event.dom.client.KeyDownHandler;\nimport com.google.gwt.event.dom.client.MouseMoveEvent;\nimport com.google.gwt.event.dom.client.MouseMoveHandler;\nimport com.google.gwt.event.dom.client.MouseUpEvent;\nimport com.google.gwt.event.dom.client.MouseUpHandler;\nimport com.google.gwt.http.client.Request;\nimport com.google.gwt.http.client.RequestBuilder;\nimport com.google.gwt.http.client.RequestCallback;\nimport com.google.gwt.http.client.RequestException;\nimport com.google.gwt.http.client.Response;\nimport com.google.gwt.http.client.URL;\nimport com.google.gwt.http.client.UrlBuilder;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.Window.ScrollEvent;\nimport com.google.gwt.user.client.Window.ScrollHandler;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.RootPanel;\n\n/**\n * Client side implementation of the page editor. Outputs ui widgets inside document element (typically the {@code } element).\n * Since the DOM manipulations performed by the PageEditor (i.e. dynamic creation of edit bars) happen when all other javascripts have already been loaded\n * (see GWT bootstrap FAQ),\n * if you have some custom javascript which needs to operate on elements added by the PageEditor, you will have to use the utility javascript method mgnl.PageEditor.onReady(callback)
.\n * This will ensure that your handler functions are executed when the PageEditor is actually done.\n *
For example:\n *
\n * mgnl.PageEditor.onReady( function() {\n * alert('hello, page editor is ready.')\n * });\n *\n * Modules can register multiple callbacks this way. The order in which callbacks are fired is the same in which they were registered.\n *
\n * @version $Id$\n *\n * TODO clean up/refactoring.\n */\npublic class PageEditor extends HTML implements EntryPoint {\n\n private static final String MGNL_CHANNEL_PARAMETER = \"mgnlChannel\";\n private static final String MGNL_PREVIEW_PARAMETER = \"mgnlPreview\";\n private static final String MGNL_INTERCEPT_PARAMETER = \"mgnlIntercept\";\n private static final String MGNL_VERSION_PARAMETER = \"mgnlVersion\";\n\n private static String locale;\n public final static ModelStorage model = ModelStorage.getInstance();\n private LinkedListtrue
if the current page is in the default (desktop) preview mode, false
otherwise.\n */\n public static boolean isPreview() {\n return isPreview;\n }\n\n public static void setPreview(boolean preview) {\n isPreview = preview;\n }\n\n}\n
===================================================================
--- ../../git/magnolia_main/magnolia-templating-editor/src/main/java/info/magnolia/templating/editor/client/PageEditor.java (revision 026ad62bb10416ca8a59c36db5db8d8376d8c563)
+++ ../../git/magnolia_main/magnolia-templating-editor/src/main/java/info/magnolia/templating/editor/client/PageEditor.java (revision )
@@ -304,6 +304,8 @@
}
private void processDocument(Node node, MgnlElement mgnlElement) {
+ boolean proceed = true;
+
if(process) {
for (int i = 0; i < node.getChildCount(); i++) {
Node childNode = node.getChild(i);
@@ -321,10 +323,11 @@
}
}
else if (childNode.getNodeType() == Node.ELEMENT_NODE && mgnlElement != null) {
- ElementProcessor.process(childNode, mgnlElement);
+ proceed = ElementProcessor.process(childNode, mgnlElement);
}
-
+ if (proceed) {
- processDocument(childNode, mgnlElement);
+ processDocument(childNode, mgnlElement);
+ }
}
}
}