| 4487 | | var sel = null; |
| 4488 | | var range = null; |
| 4489 | | var key = String.fromCharCode(HTMLArea.is_ie ? ev.keyCode : ev.charCode).toLowerCase(); |
| 4490 | | var cmd = null; |
| 4491 | | var value = null; |
| 4492 | | switch (key) |
| 4493 | | { |
| 4494 | | case 'a': |
| 4495 | | if ( !HTMLArea.is_ie ) |
| 4496 | | { |
| 4497 | | // KEY select all |
| 4498 | | sel = this._getSelection(); |
| 4499 | | sel.removeAllRanges(); |
| 4500 | | range = this._createRange(); |
| 4501 | | range.selectNodeContents(this._doc.body); |
| 4502 | | sel.addRange(range); |
| 4503 | | HTMLArea._stopEvent(ev); |
| 4504 | | } |
| 4505 | | break; |
| 4506 | | |
| 4507 | | // simple key commands follow |
| 4508 | | |
| 4509 | | case 'b': cmd = "bold"; break; |
| 4510 | | case 'i': cmd = "italic"; break; |
| 4511 | | case 'u': cmd = "underline"; break; |
| 4512 | | case 's': cmd = "strikethrough"; break; |
| 4513 | | case 'l': cmd = "justifyleft"; break; |
| 4514 | | case 'e': cmd = "justifycenter"; break; |
| 4515 | | case 'r': cmd = "justifyright"; break; |
| 4516 | | case 'j': cmd = "justifyfull"; break; |
| 4517 | | case 'z': cmd = "undo"; break; |
| 4518 | | case 'y': cmd = "redo"; break; |
| 4519 | | case 'v': |
| 4520 | | if ( HTMLArea.is_ie || editor.config.htmlareaPaste ) |
| 4521 | | { |
| 4522 | | cmd = "paste"; |
| 4523 | | } |
| 4524 | | break; |
| 4525 | | case 'n': |
| 4526 | | cmd = "formatblock"; |
| 4527 | | value = HTMLArea.is_ie ? "<p>" : "p"; |
| 4528 | | break; |
| 4529 | | |
| 4530 | | case '0': cmd = "killword"; break; |
| 4531 | | |
| 4532 | | // headings |
| 4533 | | case '1': |
| 4534 | | case '2': |
| 4535 | | case '3': |
| 4536 | | case '4': |
| 4537 | | case '5': |
| 4538 | | case '6': |
| 4539 | | cmd = "formatblock"; |
| 4540 | | value = "h" + key; |
| 4541 | | if ( HTMLArea.is_ie ) |
| 4542 | | { |
| 4543 | | value = "<" + value + ">"; |
| 4544 | | } |
| 4545 | | break; |
| 4546 | | } |
| 4547 | | if ( cmd ) |
| 4548 | | { |
| 4549 | | // execute simple command |
| 4550 | | this.execCommand(cmd, false, value); |
| 4551 | | HTMLArea._stopEvent(ev); |
| 4552 | | } |
| | 4487 | this._shortCuts(ev); |
| 4751 | | |
| | 4686 | // handles ctrl + key shortcuts |
| | 4687 | HTMLArea.prototype._shortCuts = function (ev) |
| | 4688 | { |
| | 4689 | var editor = this; |
| | 4690 | var sel = null; |
| | 4691 | var range = null; |
| | 4692 | var key = String.fromCharCode(HTMLArea.is_ie ? ev.keyCode : ev.charCode).toLowerCase(); |
| | 4693 | var cmd = null; |
| | 4694 | var value = null; |
| | 4695 | switch (key) |
| | 4696 | { |
| | 4697 | case 'a': |
| | 4698 | if ( !HTMLArea.is_ie ) |
| | 4699 | { |
| | 4700 | // KEY select all |
| | 4701 | sel = this._getSelection(); |
| | 4702 | sel.removeAllRanges(); |
| | 4703 | range = this._createRange(); |
| | 4704 | range.selectNodeContents(this._doc.body); |
| | 4705 | sel.addRange(range); |
| | 4706 | HTMLArea._stopEvent(ev); |
| | 4707 | } |
| | 4708 | break; |
| | 4709 | |
| | 4710 | // simple key commands follow |
| | 4711 | |
| | 4712 | case 'b': cmd = "bold"; break; |
| | 4713 | case 'i': cmd = "italic"; break; |
| | 4714 | case 'u': cmd = "underline"; break; |
| | 4715 | case 's': cmd = "strikethrough"; break; |
| | 4716 | case 'l': cmd = "justifyleft"; break; |
| | 4717 | case 'e': cmd = "justifycenter"; break; |
| | 4718 | case 'r': cmd = "justifyright"; break; |
| | 4719 | case 'j': cmd = "justifyfull"; break; |
| | 4720 | case 'z': cmd = "undo"; break; |
| | 4721 | case 'y': cmd = "redo"; break; |
| | 4722 | case 'v': |
| | 4723 | if ( HTMLArea.is_ie || editor.config.htmlareaPaste ) |
| | 4724 | { |
| | 4725 | cmd = "paste"; |
| | 4726 | } |
| | 4727 | break; |
| | 4728 | case 'n': |
| | 4729 | cmd = "formatblock"; |
| | 4730 | value = HTMLArea.is_ie ? "<p>" : "p"; |
| | 4731 | break; |
| | 4732 | |
| | 4733 | case '0': cmd = "killword"; break; |
| | 4734 | |
| | 4735 | // headings |
| | 4736 | case '1': |
| | 4737 | case '2': |
| | 4738 | case '3': |
| | 4739 | case '4': |
| | 4740 | case '5': |
| | 4741 | case '6': |
| | 4742 | cmd = "formatblock"; |
| | 4743 | value = "h" + key; |
| | 4744 | if ( HTMLArea.is_ie ) |
| | 4745 | { |
| | 4746 | value = "<" + value + ">"; |
| | 4747 | } |
| | 4748 | break; |
| | 4749 | } |
| | 4750 | if ( cmd ) |
| | 4751 | { |
| | 4752 | // execute simple command |
| | 4753 | this.execCommand(cmd, false, value); |
| | 4754 | HTMLArea._stopEvent(ev); |
| | 4755 | } |
| | 4756 | } |