Changeset 647959 for wpide/trunk/js
- Timestamp:
- 01/04/2013 06:43:46 PM (12 years ago)
- Location:
- wpide/trunk/js
- Files:
- 5 added
- 1 edited
- ImageColorPicker.js (added)
- autocomplete (added)
- autocomplete/php.js (added)
- autocomplete/wordpress.js (added)
- jquery-ui-1.9.2.custom.min.js (added)
- load-editor.js (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
wpide/trunk/js/load-editor.js
r549142 r647959 87 87 88 88 range.end.column = editor.getSession().getSelection().getCursor().column +1;//set end column as cursor pos 89 89 90 90 //console.log("[ \.] based: " + editor.getSession().doc.getTextRange(range)); 91 91 … … 311 311 //clear the text in the command help panel 312 312 //jQuery("#wpide_info_content").html(""); 313 } 314 315 function selectionChanged(e) { 316 var selected_text = editor.getSession().doc.getTextRange(editor.getSelectionRange()); 317 318 //check for hex colour match 319 if ( selected_text.match('^#?([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?$') != null ){ 320 321 var therange = editor.getSelectionRange(); 322 therange.end.column = therange.start.column; 323 therange.start.column = therange.start.column-1; 324 325 // only show color assist if the character before the selection indicates a hex color (#) 326 if ( editor.getSession().doc.getTextRange( therange ) == "#" ){ 327 jQuery("#wpide_color_assist").show(); 328 } 329 330 } 313 331 } 314 332 … … 472 490 editor.getSession().on('change', onSessionChange); 473 491 492 editor.getSession().selection.on('changeSelection', selectionChanged); 493 474 494 editor.resize(); 475 495 editor.focus(); … … 565 585 jQuery(document).ready(function($) { 566 586 $("#wpide_save").click(saveDocument); 567 587 588 // drag and drop colour picker image 589 $("#wpide_color_assist").on('drop', function(e) { 590 e.preventDefault(); 591 e.originalEvent.dataTransfer.items[0].getAsString(function(url){ 592 593 $(".ImageColorPickerCanvas", $("#side-info-column") ).remove(); 594 $("img", $("#wpide_color_assist")).attr('src', url ); 595 596 }); 597 }); 598 599 $("#wpide_color_assist").on('dragover', function(e) { 600 $(this).addClass("hover"); 601 }).on('dragleave', function(e) { 602 $(this).removeClass("hover"); 603 }); 568 604 569 605 570 606 //add div for ace editor to latch on to 571 //$('#template').prepend("<div style='width:80%;height:500px;margin-right:0!important;' id='fancyeditordiv'></div>");607 $('#template').prepend("<div style='width:80%;height:500px;margin-right:0!important;' id='fancyeditordiv'></div>"); 572 608 //create the editor instance 573 609 editor = ace.edit("fancyeditordiv"); … … 637 673 //show command help panel for this command 638 674 wpide_function_help(); 639 console.log("handler is visible");675 //console.log("handler is visible"); 640 676 641 677 }else if( document.getElementById('ac').style.display === 'block' ) { … … 646 682 select.selectedIndex = select.selectedIndex-1; 647 683 } 648 console.log("ac is visible");684 //console.log("ac is visible"); 649 685 } else { 650 686 var range = editor.getSelectionRange();
Note: See TracChangeset for help on using the changeset viewer.