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

(-)a/installer/data/mysql/atomicupdate/bug_17179_add_keyboard_shortcuts.perl (+13 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q|
4
        INSERT IGNORE INTO keyboard_shortcuts (shortcut_name, shortcut_keys, shortcut_desc) VALUES
5
        ("copy_line","Ctrl-C","Copy current field"),
6
        ("copy_subfield","Ctrl-Shift-C","Copy current subfield"),
7
        ("paste_line","Ctrl-P","Paste selectiion from 'clipboard'"),
8
        ("insert_line","Ctrl-I","Copy current field on next line")
9
        ;|
10
    );
11
    SetVersion( $DBversion );
12
    print "Upgrade to $DBversion done (Bug 17179 - Add additional keyboard_shortcuts)\n";
13
}
(-)a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js (-2 / +46 lines)
Lines 160-165 define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ], Link Here
160
    _editorKeys[delete_field] =  function( cm ) {
160
    _editorKeys[delete_field] =  function( cm ) {
161
            // Delete line (or cut)
161
            // Delete line (or cut)
162
            if ( cm.somethingSelected() ) return true;
162
            if ( cm.somethingSelected() ) return true;
163
            var curLine = cm.getLine( cm.getCursor().line );
164
165
            $("#clipboard").prepend('<option>'+curLine+'</option>');
163
166
164
            cm.execCommand('deleteLine');
167
            cm.execCommand('deleteLine');
165
        }
168
        }
Lines 193-200 define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ], Link Here
193
            var field = cm.marceditor.getCurrentField();
196
            var field = cm.marceditor.getCurrentField();
194
            if ( !field ) return;
197
            if ( !field ) return;
195
198
196
            var subfield = field.getSubfieldAt( cm.getCursor().ch );
199
            var curCursor = cm.getCursor();
197
            if ( subfield ) subfield.delete();
200
            var subfield = field.getSubfieldAt( curCursor().ch );
201
            var subfieldText= cm.getRange({line:curCursor.line,ch:subfield.start},{line:curCursor.line,ch:subfield.end});
202
            if ( subfield ) {
203
                $("#clipboard").prepend('<option>'+subfieldText+'</option>');
204
                subfield.delete();
205
            }
206
        }
207
208
    _editorKeys[copy_line] = function( cm ) {
209
            // Copy line
210
            if ( cm.somethingSelected() ) return true;
211
            var curLine = cm.getLine( cm.getCursor().line );
212
            $("#clipboard").prepend('<option>'+curLine+'</option>');
213
        }
214
215
    _editorKeys[copy_subfield] = function( cm ) {
216
            // Copy subfield
217
            var field = cm.marceditor.getCurrentField();
218
            if ( !field ) return;
219
220
            var curCursor = cm.getCursor();
221
            var subfield = field.getSubfieldAt( curCursor().ch );
222
            var subfieldText= cm.getRange({line:curCursor.line,ch:subfield.start},{line:curCursor.line,ch:subfield.end});
223
            if ( subfield ) {
224
                $("#clipboard").prepend('<option>'+subfieldText+'</option>');
225
            }
226
        }
227
228
    _editorKeys[paste_line] = function( cm ) {
229
            // Paste line from "clipboard"
230
            if ( cm.somethingSelected() ) return true;
231
            var cBoard = document.getElementById("clipboard");
232
            var strUser = cBoard.options[cBoard.selectedIndex].text;
233
            cm.replaceRange( strUser, cm.getCursor(), null );
234
        }
235
236
    _editorKeys[insert_line] = function( cm ) {
237
            // Copy line and insert below
238
            if ( cm.somethingSelected() ) return true;
239
            var curLine = cm.getLine( cm.getCursor().line );
240
            cm.execCommand('newlineAndIndent');
241
            cm.replaceRange( curLine, cm.getCursor(), null );
198
        }
242
        }
199
243
200
     _editorKeys[next_position] =  function( cm ) {
244
     _editorKeys[next_position] =  function( cm ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt (-1 / +6 lines)
Lines 111-116 Link Here
111
    </fieldset>
111
    </fieldset>
112
</form>
112
</form>
113
113
114
<h3>Clipboard</h3>
115
<fieldset class="brief">
116
    <select id="clipboard" name="clipboard" size=10>
117
    </select>
118
</fieldset>
119
114
</div>
120
</div>
115
121
116
</div>
122
</div>
117
- 

Return to bug 17179