Allow a snippet to be auto-generated after a simple note has been edited.

master
Pacman Ghost 4 years ago
parent fbe01fb1f0
commit 86c2ff00df
  1. 10
      vasl_templates/webapp/static/simple_notes.js
  2. 7
      vasl_templates/webapp/static/utils.js

@ -95,9 +95,15 @@ function _do_edit_simple_note( $sortable2, $entry, default_width )
} ) ;
data.id = auto_assign_id( usedIds, "id" ) ;
}
_do_add_simple_note( $sortable2, data ) ;
$entry = _do_add_simple_note( $sortable2, data ) ;
}
}
// check if we should automatically generate a snippet
if ( isKeyDown( "Shift" ) ) {
var $elem = $entry.find( "img.snippet" ) ;
if ( $elem.length !== 0 )
$elem.click() ;
}
$(this).dialog( "close" ) ;
},
Cancel: function() { $(this).dialog( "close" ) ; },
@ -111,7 +117,7 @@ function _do_add_simple_note( $sortable2, data )
{
// add a new sortable2 entry
var note_type = _get_note_type_for_sortable( $sortable2 ) ;
$sortable2.sortable2( "add", {
return $sortable2.sortable2( "add", {
content: _make_simple_note( note_type, data.caption ),
data: data,
} ) ;

@ -445,6 +445,13 @@ function isIE()
return false ;
}
isKeyDown = ( function( key ) {
var keyState = {} ;
window.addEventListener( "keyup", function(e) { keyState[e.key] = false ; } ) ;
window.addEventListener( "keydown", function(e) { keyState[e.key] = true ; } ) ;
return function( key ) { return keyState.hasOwnProperty(key) && keyState[key] || false ; } ;
} )() ;
// --------------------------------------------------------------------
( function( scope ) {

Loading…
Cancel
Save