Mercurial > hg > extraction-interface
comparison views/Extractapp/TaggingText.php @ 54:f9e7119339b2 extractapp
bug fixed: when addTagTitle, removing self-closing tag which causes error in coloring tag
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 30 Mar 2015 15:34:47 +0200 |
parents | 840cdb52f476 |
children | 5cf9720a2e25 |
comparison
equal
deleted
inserted
replaced
53:f9594c240826 | 54:f9e7119339b2 |
---|---|
279 $('.questionMarkClass').remove(); | 279 $('.questionMarkClass').remove(); |
280 $('.tagItemDivClass').remove(); | 280 $('.tagItemDivClass').remove(); |
281 | 281 |
282 if ( $("#editTextId").html() != "Edit the text" ) return 0; | 282 if ( $("#editTextId").html() != "Edit the text" ) return 0; |
283 var selection = getSelected(); | 283 var selection = getSelected(); |
284 range = getSelected().getRangeAt(0); | 284 |
285 range = selection.getRangeAt(0); | |
285 | 286 |
286 container = document.createElement("div"); | 287 container = document.createElement("div"); |
287 container.appendChild(selection.getRangeAt(0).cloneContents()); | 288 container.appendChild(selection.getRangeAt(0).cloneContents()); |
288 | 289 |
289 if(selection && (selection = new String(selection).replace(/^\s+|\s+$/g,''))) { | 290 if(selection && (selection = new String(selection).replace(/^\s+|\s+$/g,''))) { |
298 | 299 |
299 //console.log(selection.getRangeAt(0).cloneContents()); | 300 //console.log(selection.getRangeAt(0).cloneContents()); |
300 if ( container.innerHTML.indexOf( "br" ) != -1 ) { | 301 if ( container.innerHTML.indexOf( "br" ) != -1 ) { |
301 var newselect = document.createElement("select"); | 302 var newselect = document.createElement("select"); |
302 newselect.id = "TitletagType"; | 303 newselect.id = "TitletagType"; |
303 | 304 //console.log(JSON.parse('<?php echo json_encode($taglistArray) ?>')); |
304 | |
305 console.log(JSON.parse('<?php echo json_encode($taglistArray) ?>')); | |
306 | 305 |
307 <?php | 306 <?php |
308 foreach ( $taglistArray as $taglistValue ) { | 307 foreach ( $taglistArray as $taglistValue ) { |
309 echo "newselect.innerHTML += \"<option value='".$taglistValue[2]."'>".$taglistValue[1]."</option>\";\n"; | 308 echo "newselect.innerHTML += \"<option value='".$taglistValue[2]."'>".$taglistValue[1]."</option>\";\n"; |
310 } | 309 } |
319 newdiv.innerHTML += "<input id=\"TitletagName\" value=\""+ matchValue[1] +"\"></br>"; | 318 newdiv.innerHTML += "<input id=\"TitletagName\" value=\""+ matchValue[1] +"\"></br>"; |
320 } else { | 319 } else { |
321 newdiv.innerHTML += "<input id=\"TitletagName\" value=\"\"></br>"; | 320 newdiv.innerHTML += "<input id=\"TitletagName\" value=\"\"></br>"; |
322 } | 321 } |
323 | 322 |
324 console.log(" container innerHTML: "+ container.innerHTML ); | |
325 | 323 |
326 newdiv.innerHTML += "<button onclick=\"addTagTitle( range, container )\">Add Title Tag To Each Line</button></br>"; | 324 newdiv.innerHTML += "<button onclick=\"addTagTitle( range, container )\">Add Title Tag To Each Line</button></br>"; |
327 | 325 |
328 /* | 326 /* |
329 newdiv.innerHTML += "<button onclick=\"exportTable( range, container )\">Export As A Table</button></br></br>"; | 327 newdiv.innerHTML += "<button onclick=\"exportTable( range, container )\">Export As A Table</button></br></br>"; |
394 $('body').append(newdiv); | 392 $('body').append(newdiv); |
395 | 393 |
396 $('#TitletagType').val(lastAddTag); | 394 $('#TitletagType').val(lastAddTag); |
397 | 395 |
398 } | 396 } |
397 | |
399 //e.stopPropagation(); | 398 //e.stopPropagation(); |
400 }); | 399 }); |
401 | 400 |
402 | 401 |
403 // === for exporttable.php === | 402 // === for exporttable.php === |
668 | 667 |
669 | 668 |
670 | 669 |
671 function saveTextToLGService() { | 670 function saveTextToLGService() { |
672 | 671 |
672 // ------------- | |
673 var info = JSON.parse('<?php echo json_encode($info) ?>'); | 673 var info = JSON.parse('<?php echo json_encode($info) ?>'); |
674 var topic_id = JSON.parse('<?php echo json_encode($default_topic_id) ?>'); | 674 var topic_id = JSON.parse('<?php echo json_encode($default_topic_id) ?>'); |
675 | 675 |
676 // if this is a new branch, ask for label | 676 // if this is a new branch, ask for label |
677 if (info['branch_id'] == 0) { | 677 if (info['branch_id'] == 0) { |
685 dd='0'+dd | 685 dd='0'+dd |
686 } | 686 } |
687 if(mm<10) { | 687 if(mm<10) { |
688 mm='0'+mm | 688 mm='0'+mm |
689 } | 689 } |
690 today = dd+'/'+mm+'/'+yyyy; | 690 today = dd+'.'+mm+'.'+yyyy; |
691 var label = prompt("Please enter your label for this new branch", today); | 691 var label = prompt("Please enter your label for this new branch", today); |
692 while (label == null) { | 692 while (label == null) { |
693 alert("You haven't saved your editing."); | 693 alert("You haven't saved your editing."); |
694 return; | 694 return; |
695 // label = prompt("Please enter your label for this new branch (not empty)", "section"+info['section_id']); | 695 // label = prompt("Please enter your label for this new branch (not empty)", "section"+info['section_id']); |