You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/10/18 23:23:57 UTC
[sling-org-apache-sling-resource-editor] 41/50: Resource Editor:
Added copy & paste functionality and note at info page.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-editor.git
commit 98fc8cdda72735b45ef3594bf5ee92a58a0ec20d
Author: Sandro Boehme <sb...@apache.org>
AuthorDate: Mon Sep 21 19:52:54 2015 +0000
Resource Editor: Added copy & paste functionality and note at info page.
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1704410 13f79535-47bb-0310-9956-ffa450edef68
---
src/main/resources/META-INF/resource-editor.tld | 2 +-
.../js/tree/TreeController.js | 32 +++++++++++++++++++++-
.../SLING-INF/libs/sling/resource-editor/html.jsp | 1 +
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/src/main/resources/META-INF/resource-editor.tld b/src/main/resources/META-INF/resource-editor.tld
index b4a0288..d1fbdf5 100644
--- a/src/main/resources/META-INF/resource-editor.tld
+++ b/src/main/resources/META-INF/resource-editor.tld
@@ -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>
diff --git a/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/TreeController.js b/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/TreeController.js
index ab0f571..42733a2 100644
--- a/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/TreeController.js
+++ b/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/TreeController.js
@@ -71,17 +71,47 @@ org.apache.sling.reseditor.TreeController = (function() {
// 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");
}
diff --git a/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp b/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp
index be2241a..bf7db68 100644
--- a/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp
+++ b/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp
@@ -207,6 +207,7 @@ new org.apache.sling.reseditor.PropertyController({}, mainController);
<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>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.