You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by sb...@apache.org on 2015/09/21 21:52:54 UTC

svn commit: r1704410 - in /sling/trunk/contrib/explorers/resourceeditor/src/main/resources: META-INF/resource-editor.tld SLING-INF/libs/sling/resource-editor-static-content/js/tree/TreeController.js SLING-INF/libs/sling/resource-editor/html.jsp

Author: sboehme
Date: Mon Sep 21 19:52:54 2015
New Revision: 1704410

URL: http://svn.apache.org/viewvc?rev=1704410&view=rev
Log:
Resource Editor: Added copy & paste functionality and note at info page.

Modified:
    sling/trunk/contrib/explorers/resourceeditor/src/main/resources/META-INF/resource-editor.tld
    sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/TreeController.js
    sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp

Modified: sling/trunk/contrib/explorers/resourceeditor/src/main/resources/META-INF/resource-editor.tld
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/resources/META-INF/resource-editor.tld?rev=1704410&r1=1704409&r2=1704410&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/resources/META-INF/resource-editor.tld (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/resources/META-INF/resource-editor.tld Mon Sep 21 19:52:54 2015
@@ -1,6 +1,6 @@
 <taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee">
  <tlib-version>1.0-SNAPSHOT</tlib-version>
- <short-name>test</short-name>
+ <short-name>resource-editor</short-name>
  <uri>http://sling.apache.org/resource-editor</uri>
  <tag-file>
   <name>string-editor</name>

Modified: sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/TreeController.js
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/TreeController.js?rev=1704410&r1=1704409&r2=1704410&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/TreeController.js (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/TreeController.js Mon Sep 21 19:52:54 2015
@@ -71,17 +71,47 @@ org.apache.sling.reseditor.TreeControlle
     	// see http://www.javascripter.net/faq/keycodes.htm
 		var del = 46;
 		var c = 67;
+		var v = 86;
+
+    	if (e.ctrlKey && c==e.which) { /*ctrl-c*/
+    		var resourcePath = this.getPathFromLi($(e.target).parents("li"));
+    		sessionStorage["resourcePath"] = resourcePath;
+    	}
+    	if (e.ctrlKey && v==e.which) { /*ctrl-v*/
+    		var from = sessionStorage["resourcePath"];
+    		var to = this.getPathFromLi($(e.target).parents("li"));
+    		this.copy(from, to);
+    	}
 		switch(e.which) {
 		    case del:
 	    		treeController.deleteNodes();
 		        break;
 		    case c:
-				this.openAddNodeDialog($(e.target).parents("li"));
+		    	if (!e.ctrlKey){
+		    		this.openAddNodeDialog($(e.target).parents("li"));
+		    	}
 		        break;
 		}
 		
 	}
 
+	TreeController.prototype.copy = function(from, to) {
+		var thisTreeController = this;
+		var dest = to+"/";
+		var data = {
+				":operation": "copy",
+				":dest": dest};
+		$.post( from, data, function( data ) {
+			  $( ".result" ).html( data );
+			}, "json")
+			.done(function() {
+				thisTreeController.mainController.redirectTo(to);
+			})
+			.fail(function(errorJson) {
+				thisTreeController.mainController.displayAlert(errorJson);
+			});;
+	}
+
 	TreeController.prototype.afterOpen = function(node) {
 		$('#'+node.id).addClass("opened");
 	}

Modified: sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp?rev=1704410&r1=1704409&r2=1704410&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp Mon Sep 21 19:52:54 2015
@@ -207,6 +207,7 @@ new org.apache.sling.reseditor.PropertyC
 						  			<li>the <kbd>shift</kbd> key for multi selecting a list of nodes.</li>
 						  			<li>the <kbd>del</kbd> key for deleting the selected nodes.</li>
 						  			<li>the <kbd>c</kbd> key on a node when the tree has the focus for opening the dialog to add a child node.</li>
+						  			<li><kbd><kbd>ctrl</kbd>+<kbd>c</kbd></kbd> and <kbd><kbd>ctrl</kbd>+<kbd>v</kbd></kbd> can be used to copy and paste a node.</li>
 						  			<li>a double click to rename a node. Special JCR characters like ':' are not allowed as node names.</li>
 						  		</ul>
 							</div>