Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Save selection on click, not just Enter

  • Loading branch information...
commit 43e48cf8e10ed218c8de4708fd143acc730504b6 1 parent 1f3c8d1
@optilude optilude authored
View
4 docs/TODO.txt
@@ -19,7 +19,9 @@ File manager
Mapper
------
-[ ] Make 'save' act on click, not (just) Enter; use shift+click to navigate
+[ ] Make alt-click-to-navigate work better
+ - fails to work when clicking on the portal logo
+ - incorrect behaviour for anchor links
[ ] Improve styling overall
View
3  src/plone/app/theming/browser/mapper.pt
@@ -743,7 +743,8 @@
<p class="discreet" i18n:translate="help_theme_mapper_details">
Hover over an element to see its selector in the status bar at the bottom
of the panel. Press Esc to move the selection to its parent. Press
- Enter to save or confirm the selection.
+ Enter or left-click to save or confirm the selection. Hold down
+ the Alt key whilst clicking to follow links.
</p>
<dl style="display: none" class="ie-warning portalMessage warning">
View
28 src/plone/app/theming/browser/resources/mapper.js
@@ -273,6 +273,34 @@ FrameHighlighter.prototype.setupElements = function() {
$(highlighter.infoPanel).text("");
return false;
+ } else if(!event.altKey) {
+ event.stopPropagation();
+ event.preventDefault();
+
+ $(highlighter.shelf).text(bestSelector(highlighter.currentOutline));
+ if(highlighter.onsave != null) {
+ highlighter.onsave(highlighter.shelf);
+ }
+
+ if(highlighter.ruleBuilder.active && highlighter.ruleBuilder.currentScope == highlighter.scope) {
+ highlighter.ruleBuilder.select(highlighter.currentOutline);
+ highlighter.ruleBuilder.next();
+ highlighter.clearOutline();
+ }
+
+ return false;
+ } else if(event.altKey) {
+ event.preventDefault();
+
+ // XXX: This doesn't work well when clicking on e.g. the Plone logo
+ if($(this).is("a")) {
+ var href = $(this).attr('href');
+ if(href.length > 0 && href[0] != '#') {
+ $(highlighter.frame).attr('src', href);
+ }
+ }
+
+ return false;
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.