|
Lines 135-170
define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
Link Here
|
| 135 |
return []; |
135 |
return []; |
| 136 |
} |
136 |
} |
| 137 |
} |
137 |
} |
|
|
138 |
var _editorKeys = {}; |
| 138 |
|
139 |
|
| 139 |
var _editorKeys = { |
140 |
_editorKeys[insert_copyright] = function( cm ) { |
| 140 |
'Alt-C': function( cm ) { |
|
|
| 141 |
cm.replaceRange( '©', cm.getCursor() ); |
141 |
cm.replaceRange( '©', cm.getCursor() ); |
| 142 |
}, |
142 |
} |
| 143 |
|
143 |
|
| 144 |
'Alt-P': function( cm ) { |
144 |
_editorKeys[insert_copyright_sound] = function( cm ) { |
| 145 |
cm.replaceRange( '℗', cm.getCursor() ); |
145 |
cm.replaceRange( '℗', cm.getCursor() ); |
| 146 |
}, |
146 |
} |
| 147 |
|
147 |
|
| 148 |
Enter: function( cm ) { |
148 |
_editorKeys[new_line] = function( cm ) { |
| 149 |
var cursor = cm.getCursor(); |
149 |
var cursor = cm.getCursor(); |
| 150 |
cm.replaceRange( '\n', { line: cursor.line }, null, 'marcAware' ); |
150 |
cm.replaceRange( '\n', { line: cursor.line }, null, 'marcAware' ); |
| 151 |
cm.setCursor( { line: cursor.line + 1, ch: 0 } ); |
151 |
cm.setCursor( { line: cursor.line + 1, ch: 0 } ); |
| 152 |
}, |
152 |
} |
| 153 |
|
153 |
|
| 154 |
'Shift-Enter': function( cm ) { |
154 |
_editorKeys[line_break] = function( cm ) { |
| 155 |
var cur = cm.getCursor(); |
155 |
var cur = cm.getCursor(); |
| 156 |
|
156 |
|
| 157 |
cm.replaceRange( "\n", cur, null ); |
157 |
cm.replaceRange( "\n", cur, null ); |
| 158 |
}, |
158 |
} |
| 159 |
|
159 |
|
| 160 |
'Ctrl-X': 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 |
|
163 |
|
| 164 |
cm.execCommand('deleteLine'); |
164 |
cm.execCommand('deleteLine'); |
| 165 |
}, |
165 |
} |
| 166 |
|
166 |
|
| 167 |
'Shift-Ctrl-L': function( cm ) { |
167 |
_editorKeys[link_authorities] = function( cm ) { |
| 168 |
// Launch the auth search popup |
168 |
// Launch the auth search popup |
| 169 |
var field = cm.marceditor.getCurrentField(); |
169 |
var field = cm.marceditor.getCurrentField(); |
| 170 |
|
170 |
|
|
Lines 186-203
define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
Link Here
|
| 186 |
} |
186 |
} |
| 187 |
newin=window.open("../authorities/auth_finder.pl?source=biblio&authtypecode="+authtype+"&index="+index+"&value_mainstr="+encodeURI(mainmainstring)+"&value_main="+encodeURI(mainstring), "_blank",'width=700,height=550,toolbar=false,scrollbars=yes'); |
187 |
newin=window.open("../authorities/auth_finder.pl?source=biblio&authtypecode="+authtype+"&index="+index+"&value_mainstr="+encodeURI(mainmainstring)+"&value_main="+encodeURI(mainstring), "_blank",'width=700,height=550,toolbar=false,scrollbars=yes'); |
| 188 |
|
188 |
|
| 189 |
}, |
189 |
} |
| 190 |
|
190 |
|
| 191 |
'Shift-Ctrl-X': function( cm ) { |
191 |
_editorKeys[delete_subfield] = function( cm ) { |
| 192 |
// Delete subfield |
192 |
// Delete subfield |
| 193 |
var field = cm.marceditor.getCurrentField(); |
193 |
var field = cm.marceditor.getCurrentField(); |
| 194 |
if ( !field ) return; |
194 |
if ( !field ) return; |
| 195 |
|
195 |
|
| 196 |
var subfield = field.getSubfieldAt( cm.getCursor().ch ); |
196 |
var subfield = field.getSubfieldAt( cm.getCursor().ch ); |
| 197 |
if ( subfield ) subfield.delete(); |
197 |
if ( subfield ) subfield.delete(); |
| 198 |
}, |
198 |
} |
| 199 |
|
199 |
|
| 200 |
Tab: function( cm ) { |
200 |
_editorKeys[next_position] = function( cm ) { |
| 201 |
// Move through parts of tag/fixed fields |
201 |
// Move through parts of tag/fixed fields |
| 202 |
var positions = getTabPositions( cm.marceditor ); |
202 |
var positions = getTabPositions( cm.marceditor ); |
| 203 |
var cur = cm.getCursor(); |
203 |
var cur = cm.getCursor(); |
|
Lines 210-218
define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
Link Here
|
| 210 |
} |
210 |
} |
| 211 |
|
211 |
|
| 212 |
cm.setCursor( { line: cur.line + 1, ch: 0 } ); |
212 |
cm.setCursor( { line: cur.line + 1, ch: 0 } ); |
| 213 |
}, |
213 |
} |
| 214 |
|
214 |
|
| 215 |
'Shift-Tab': function( cm ) { |
215 |
_editorKeys[prev_position] = function( cm ) { |
| 216 |
// Move backwards through parts of tag/fixed fields |
216 |
// Move backwards through parts of tag/fixed fields |
| 217 |
var positions = getTabPositions( cm.marceditor ); |
217 |
var positions = getTabPositions( cm.marceditor ); |
| 218 |
var cur = cm.getCursor(); |
218 |
var cur = cm.getCursor(); |
|
Lines 233-247
define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
Link Here
|
| 233 |
} else { |
233 |
} else { |
| 234 |
cm.setCursor( { line: cur.line - 1, ch: 0 } ); |
234 |
cm.setCursor( { line: cur.line - 1, ch: 0 } ); |
| 235 |
} |
235 |
} |
| 236 |
}, |
236 |
} |
| 237 |
|
237 |
|
| 238 |
'Ctrl-D': function( cm ) { |
238 |
_editorKeys[insert_delimiter] = function(cm){ |
| 239 |
// Insert subfield delimiter |
239 |
var cur = cm.getCursor(); |
| 240 |
var cur = cm.getCursor(); |
|
|
| 241 |
|
240 |
|
| 242 |
cm.replaceRange( "‡", cur, null ); |
241 |
cm.replaceRange( "‡", cur, null ); |
| 243 |
}, |
242 |
} |
| 244 |
}; |
|
|
| 245 |
|
243 |
|
| 246 |
// The objects below are part of a field/subfield manipulation API, accessed through the base |
244 |
// The objects below are part of a field/subfield manipulation API, accessed through the base |
| 247 |
// editor object. |
245 |
// editor object. |