Browse Source

Fixed error where the module-field onclick was not being saved to Library

Nathan Schneider 4 years ago
parent
commit
524c5290b9
1 changed files with 4 additions and 5 deletions
  1. 4 5
      _layouts/rule.html

+ 4 - 5
_layouts/rule.html

@@ -71,10 +71,9 @@ https://github.com/Bernardo-Castilho/dragdroptouch -->
       module.children[2].style.display = "inline";
       // pop it in!
       target.appendChild(module);
-      // set up module-field
-      module.children.item("module-name").onclick = function() {
-          moduleEditField(this.parentNode.id); 
-      }
+      // add module-field button (using HTML so it saves to Library)
+      module.outerHTML = module.outerHTML.replace("id=\"module-name\"",
+                               "id=\"module-name\" onclick=\"moduleEditField(this.parentNode.id)\"");      
       // create the module-field
       moduleEditField(module.id);
       // be sure the dummy text is gone
@@ -664,7 +663,7 @@ https://github.com/Bernardo-Castilho/dragdroptouch -->
         {% assign last_type = module.type %}
 		<span class="module" id="module-{{ module.title | slugify }}"
 			  draggable="true" ondragstart="drag(event)">
-		  <span id="module-title" title="{{ module.summary }}">{{ module.title }}</span>
+		  <span id="module-name" title="{{ module.summary }}">{{ module.title }}</span>
           <a target="_blank" href="{{ module.url }}">
             <img title="{{ module.type }} (press for info)" draggable="false" class="module-logo"
                  {% if module.type == "structure" %}