(id)
| 301 | }; |
| 302 | |
| 303 | function handle_operation(id) { |
| 304 | if (id == 'file-new') { |
| 305 | window.location = '/editor'; |
| 306 | } |
| 307 | else if (id === 'file-save') { |
| 308 | var rhs = ed.mergely('get', 'rhs'); |
| 309 | |
| 310 | if(window.top.hasOwnProperty("editor")){ |
| 311 | if(window.top.editor.hasOwnProperty("$txt")){ |
| 312 | window.top.editor.$txt.html(rhs); |
| 313 | }else{ |
| 314 | |
| 315 | window.top.editor.clear(); |
| 316 | window.top.editor.insertValue(rhs); |
| 317 | } |
| 318 | |
| 319 | window.top.layer.closeAll(); |
| 320 | } |
| 321 | |
| 322 | }else if (id == 'file-share') { |
| 323 | handleShare(ed); |
| 324 | } |
| 325 | else if (id == 'file-import') { |
| 326 | importFiles(ed); |
| 327 | } |
| 328 | else if (id == 'edit-left-undo') { |
| 329 | ed.mergely('cm', 'lhs').getDoc().undo(); |
| 330 | } |
| 331 | else if (id == 'edit-left-redo') { |
| 332 | ed.mergely('cm', 'lhs').getDoc().redo(); |
| 333 | } |
| 334 | else if (id == 'edit-right-undo') { |
| 335 | ed.mergely('cm', 'rhs').getDoc().undo(); |
| 336 | } |
| 337 | else if (id == 'edit-right-redo') { |
| 338 | ed.mergely('cm', 'rhs').getDoc().redo(); |
| 339 | } |
| 340 | else if (id == 'edit-left-find') { |
| 341 | handleFind(ed.find('#mergely-editor-lhs')); |
| 342 | } |
| 343 | else if (id == 'edit-left-merge-right') { |
| 344 | ed.mergely('mergeCurrentChange', 'rhs'); |
| 345 | } |
| 346 | else if (id == 'edit-left-merge-right-file') { |
| 347 | ed.mergely('merge', 'rhs'); |
| 348 | } |
| 349 | else if ([ |
| 350 | 'edit-left-readonly', |
| 351 | 'edit-right-readonly', |
| 352 | 'options-autodiff', |
| 353 | 'options-sidebars', |
| 354 | 'options-swapmargin', |
| 355 | 'options-viewport', |
| 356 | 'options-ignorews', |
| 357 | 'options-ignorecase', |
| 358 | 'options-wrap', |
| 359 | 'options-linenumbers', |
| 360 | ].indexOf(id) >= 0) { |
no test coverage detected