Lines 151-156
define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
Link Here
|
151 |
'Ctrl-X': function( cm ) { |
151 |
'Ctrl-X': function( cm ) { |
152 |
// Delete line (or cut) |
152 |
// Delete line (or cut) |
153 |
if ( cm.somethingSelected() ) return true; |
153 |
if ( cm.somethingSelected() ) return true; |
|
|
154 |
var curLine = cm.getLine( cm.getCursor().line ); |
155 |
$("#clipboard").prepend('<option>'+curLine+'</option>'); |
154 |
|
156 |
|
155 |
cm.execCommand('deleteLine'); |
157 |
cm.execCommand('deleteLine'); |
156 |
}, |
158 |
}, |
Lines 160-167
define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
Link Here
|
160 |
var field = cm.marceditor.getCurrentField(); |
162 |
var field = cm.marceditor.getCurrentField(); |
161 |
if ( !field ) return; |
163 |
if ( !field ) return; |
162 |
|
164 |
|
163 |
var subfield = field.getSubfieldAt( cm.getCursor().ch ); |
165 |
var curCursor = cm.getCursor(); |
164 |
if ( subfield ) subfield.delete(); |
166 |
var subfield = field.getSubfieldAt( curCursor.ch ); |
|
|
167 |
var subfieldText = cm.getRange({line:curCursor.line,ch:subfield.start},{line:curCursor.line,ch:subfield.end}); |
168 |
if ( subfield ) { |
169 |
$("#clipboard").prepend('<option>'+subfieldText+'</option>'); |
170 |
subfield.delete(); |
171 |
} |
172 |
}, |
173 |
|
174 |
'Ctrl-C': function( cm ) { |
175 |
// Copy line |
176 |
if ( cm.somethingSelected() ) return true; |
177 |
var curLine = cm.getLine( cm.getCursor().line ); |
178 |
$("#clipboard").prepend('<option>'+curLine+'</option>'); |
179 |
}, |
180 |
|
181 |
'Shift-Ctrl-C': function( cm ) { |
182 |
// Copy subfield |
183 |
var field = cm.marceditor.getCurrentField(); |
184 |
if ( !field ) return; |
185 |
|
186 |
var curCursor = cm.getCursor(); |
187 |
var subfield = field.getSubfieldAt( curCursor.ch ); |
188 |
var subfieldText = cm.getRange({line:curCursor.line,ch:subfield.start},{line:curCursor.line,ch:subfield.end}); |
189 |
if ( subfield ) { |
190 |
$("#clipboard").prepend('<option>'+subfieldText+'</option>'); |
191 |
} |
192 |
}, |
193 |
|
194 |
'Ctrl-P': function( cm ) { |
195 |
// Paste line from "clipboard" |
196 |
if ( cm.somethingSelected() ) return true; |
197 |
var cBoard = document.getElementById("clipboard"); |
198 |
var strUser = cBoard.options[cBoard.selectedIndex].text; |
199 |
cm.replaceRange( strUser, cm.getCursor(), null ); |
200 |
}, |
201 |
|
202 |
'Ctrl-I': function( cm ) { |
203 |
// Copy line and insert below |
204 |
if ( cm.somethingSelected() ) return true; |
205 |
var curLine = cm.getLine( cm.getCursor().line ); |
206 |
cm.execCommand('newlineAndIndent'); |
207 |
cm.replaceRange( curLine, cm.getCursor(), null ); |
165 |
}, |
208 |
}, |
166 |
|
209 |
|
167 |
Tab: function( cm ) { |
210 |
Tab: function( cm ) { |