contextItemContainer: '@',
contextItemGenerator: '=',
max: '@',
- itype: '@'
+ itype: '@',
+ selectOnFocus: '='
},
controller : ['$scope',
function ( $scope ) {
if (scope.onKeydown) element.bind('keydown', {scope : scope}, scope.onKeydown);
+ if (Boolean(scope.selectOnFocus)) {
+ element.addClass('noSelection');
+ element.bind('focus', function () { element.select() });
+ }
+
element.bind('change', function (e) { element.size = scope.max || parseInt(scope.content.length * 1.1) });
element.bind('contextmenu', {scope : scope}, scope.showContext);
'for="r{{field.record.subfield(\'901\',\'c\')[1]}}f{{field.position}}s{{subfield[2]}}code" '+
'>‡</label><eg-marc-edit-editable '+
'itype="sfc" '+
+ 'select-on-focus="true" '+
'class="marcedit marcsf marcsfcode" '+
'field="field" '+
'subfield="subfield" '+
template: '<span><eg-marc-edit-editable '+
'itype="ind" '+
'class="marcedit marcind" '+
+ 'select-on-focus="true" '+
'field="field" '+
'content="ind" '+
'max="1" '+
template: '<span><eg-marc-edit-editable '+
'itype="tag" '+
'class="marcedit marctag" '+
+ 'select-on-focus="true" '+
'field="field" '+
'content="tag" '+
'max="3" '+
if (!$scope.field.isControlfield()) {
options = options.concat([
- { label : 'Add Datafield', action : function(j1,j2,j3,j4,e) { $scope.contextFunctions.addDatafield(e) } },
- { label : 'Insert Datafield', action : function(j1,j2,j3,j4,e) { $scope.contextFunctions.addDatafield(e,true) } },
+ { label : 'Insert field after ', action : function(j1,j2,j3,j4,e) { $scope.contextFunctions.addDatafield(e) } },
+ { label : 'Insert field before', action : function(j1,j2,j3,j4,e) { $scope.contextFunctions.addDatafield(e,true) } },
]);
}
},
link: function (scope, element, attrs) {
+ element.bind('mouseup', function(e) {;
+ scope.current_event_target = $(e.target).attr('id');
+ if (scope.current_event_target && $(e.target).hasClass('noSelection')) {
+ e.preventDefault()
+ return false;
+ }
+ });
+
element.bind('click', function(e) {;
scope.current_event_target = $(e.target).attr('id');
if (scope.current_event_target) {