View | Details | Raw Unified | Return to bug 11559
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js (-2 / +4 lines)
Lines 152-159 define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ], Link Here
152
            // Delete line (or cut)
152
            // Delete line (or cut)
153
            if ( cm.somethingSelected() ) return true;
153
            if ( cm.somethingSelected() ) return true;
154
154
155
            var field = cm.marceditor.getCurrentField();
155
            cm.execCommand('deleteLine');
156
            if ( field ) field.delete();
157
        },
156
        },
158
157
159
        'Shift-Ctrl-X': function( cm ) {
158
        'Shift-Ctrl-X': function( cm ) {
Lines 272-277 define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ], Link Here
272
            return this.field._subfieldsInvalid();
271
            return this.field._subfieldsInvalid();
273
        },
272
        },
274
273
274
        delete: function() {
275
            this.cm.replaceRange( "", { line: this.field.line, ch: this.start }, { line: this.field.line, ch: this.end }, 'marcAware' );
276
        },
275
        focus: function() {
277
        focus: function() {
276
            this.cm.setCursor( { line: this.field.line, ch: this.contentsStart } );
278
            this.cm.setCursor( { line: this.field.line, ch: this.contentsStart } );
277
        },
279
        },
(-)a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/text-marc.js (-1 / +1 lines)
Lines 88-94 define( [ 'marc-record' ], function( MARC ) { Link Here
88
                    $.each( subfields, function( i, subfield ) {
88
                    $.each( subfields, function( i, subfield ) {
89
                        var next = subfields[ i + 1 ];
89
                        var next = subfields[ i + 1 ];
90
90
91
                        field.addSubfield( [ subfield.code, line.substring( subfield.ch + 3, next ? next.ch : line.length ) ] );
91
                        field.addSubfield( [ subfield.code, line.substring( subfield.ch + 2, next ? next.ch : line.length ) ] );
92
                    } );
92
                    } );
93
93
94
                    field.sourceLine = i;
94
                    field.sourceLine = i;
(-)a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/widget.js (-4 / +9 lines)
Lines 169-175 define( [ 'resources' ], function( Resources ) { Link Here
169
169
170
                $inputs.each( function( i ) {
170
                $inputs.each( function( i ) {
171
                    $(this).on( 'keydown.marc-tab', function( e ) {
171
                    $(this).on( 'keydown.marc-tab', function( e ) {
172
                        if ( e.which != 9 ) return; // Tab
172
                        // Cheap hack to disable backspace and special keys
173
                        if ( ( this.nodeName.toLowerCase() == 'select' && e.which == 9 ) || e.ctrlKey ) {
174
                            e.preventDefault();
175
                            return;
176
                        } else if ( e.which != 9 ) { // Tab
177
                            return;
178
                        }
173
179
174
                        var span = widget.mark.find();
180
                        var span = widget.mark.find();
175
                        var cur = editor.cm.getCursor();
181
                        var cur = editor.cm.getCursor();
Lines 210-216 define( [ 'resources' ], function( Resources ) { Link Here
210
216
211
        ActivateAt: function( editor, cur, idx ) {
217
        ActivateAt: function( editor, cur, idx ) {
212
            var marks = editor.findMarksAt( cur );
218
            var marks = editor.findMarksAt( cur );
213
            if ( !marks.length ) return false;
219
            if ( !marks.length || !marks[0].widget ) return false;
214
220
215
            var $input = $(marks[0].widget.node).find('input, select').eq(idx || 0);
221
            var $input = $(marks[0].widget.node).find('input, select').eq(idx || 0);
216
            if ( !$input.length ) return false;
222
            if ( !$input.length ) return false;
Lines 264-270 define( [ 'resources' ], function( Resources ) { Link Here
264
                if ( marks.length ) {
270
                if ( marks.length ) {
265
                    if ( marks[0].id == id ) {
271
                    if ( marks[0].id == id ) {
266
                        return;
272
                        return;
267
                    } else {
273
                    } else if ( marks[0].widget ) {
268
                        marks[0].widget.clearToText();
274
                        marks[0].widget.clearToText();
269
                    }
275
                    }
270
                }
276
                }
271
- 

Return to bug 11559