| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- Trex.I.Processor.Trident = {
- /**
- * Paragraph 를 채운다.
- * @private
- * @param {Node} node - paragraph 노드
- */
- stuffNode: function(node) {
- if($tom.getLength(node) == 0) {
- node.innerHTML = ' ';
- }
- return node;
- },
- /**
- * @private
- * @memberOf Trex.Canvas.ProcessorP
- * Trident에서 newlinepolicy가 p일 경우 Enter Key 이벤트가 발생하면 실행한다.
- */
- controlEnterByParagraph: function() {
- var _bNode = this.findNode('div');
- var _dvNode;
- if (!_bNode) {
- throw $propagate;
- }
-
- var _pNode = this.findNode('%paragraph');
- if ($tom.kindOf(_pNode, 'p')) {
- if($tom.first(_bNode, 'p') == _pNode) {
- this.execWithMarker(function(marker) {
- _dvNode = $tom.divideParagraph(marker.endMarker);
- });
- this.stuffNode(_pNode);
- this.stuffNode(_dvNode);
- this.moveCaretTo(_dvNode);
- } else {
- throw $propagate;
- }
- } else if($tom.kindOf(_pNode, 'li,td,th,dd,dt')) {
- throw $propagate;
- } else {
- _dvNode = this.newParagraph('p');
- this.execWithMarker(function(marker) {
- $tom.insertNext(_dvNode, marker.endMarker);
- });
- this.moveCaretTo(_dvNode);
- }
- }
- };
- Trex.module("delete image element @when backspace key event fires",
- function(editor, toolbar, sidebar, canvas) {
- if ($tx.msie_nonstd) {
- canvas.observeKey({
- ctrlKey: _FALSE,
- altKey: _FALSE,
- shiftKey: _FALSE,
- keyCode: Trex.__KEY.BACKSPACE
- }, function() {
- var _processor = canvas.getProcessor();
- if (_processor.hasControl() && _processor.getControl()) {
- try {
- var _node = _processor.getControl();
- $tom.remove(_node);
- } catch (e) { }
- throw $stop;
- }
- throw $propagate;
- });
- }
- }
- );
- Trex.module("delete table element @when backspace key event fires",
- function(editor, toolbar, sidebar, canvas) {
- if ($tx.msie_nonstd) {
- var _oldRangeLeftOffset;
- canvas.observeKey({
- ctrlKey: _FALSE,
- altKey: _FALSE,
- shiftKey: _FALSE,
- keyCode: Trex.__KEY.BACKSPACE
- }, function() {
- var _processor = canvas.getProcessor();
- var _rng = _processor.getRange();
- try{
- if(_oldRangeLeftOffset == _rng.boundingLeft){
- var _el = $tom.previous(_processor.getNode());
- if($tom.kindOf(_el, "table")){
- $tom.remove(_el);
- }
- }
- }catch(e){ }
- _oldRangeLeftOffset = _rng.boundingLeft;
- throw $propagate;
- });
- }
- }
- );
- /*-------------------------------------------------------*/
- Object.extend(Trex.I.Processor.Trident, {
- restoreRange: function() { //TODO: rename
- if (!this.isRangeInsideWysiwyg && this.lastRange) {
- try {
- this.lastRange.select();
- } catch (e) {
- var _sel = this.getSel();
- var _type = _sel.type.toLowerCase();
- if (_type === "control") {
- _sel.empty();
- var _rng = _sel.createRange();
- _rng.collapse(_FALSE);
- _rng.select();
- }
- } finally {
- this.lastRange = _NULL;
- }
- }
- }
- });
|