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 ) { |