Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ), |
74 | 74 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ), |
76 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 161 ), |
| 76 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 162 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 37 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 52 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 19 ), |
— | — | @@ -82,10 +82,10 @@ |
83 | 83 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 3 ), |
84 | 84 | ), |
85 | 85 | 'combined' => array( |
86 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 311 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 312 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 311 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 312 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -6922,18 +6922,17 @@ |
6923 | 6923 | if ( context.oldDelayedHTML != newHTML ) { |
6924 | 6924 | context.oldDelayedHTML = newHTML; |
6925 | 6925 | event.data.scope = 'realchange'; |
6926 | | - } |
6927 | | - |
6928 | | - //surround by <p> if it does not already have it |
6929 | | - var t = context.fn.getOffset(); |
6930 | | - if ( t.node.parentNode.nodeName.toLowerCase() == 'body' ) { |
6931 | | - var cursorPos = context.fn.getCaretPosition()[0]; |
6932 | | - $( t.node ).wrap( "<p></p>" ); |
6933 | | - context.fn.refreshOffsets(); |
6934 | | - context.fn.setSelection( { start: cursorPos, end: cursorPos } ); |
6935 | | - } |
6936 | | - |
6937 | | - |
| 6926 | + |
| 6927 | + //surround by <p> if it does not already have it |
| 6928 | + var cursorPos = context.fn.getCaretPosition(); |
| 6929 | + var t = context.fn.getOffset(cursorPos[0]); |
| 6930 | + if ( t.node.parentNode.nodeName.toLowerCase() == 'body' ) { |
| 6931 | + $( t.node ).wrap( "<p></p>" ); |
| 6932 | + context.fn.purgeOffsets(); |
| 6933 | + context.fn.setSelection( { start: cursorPos[0], end: cursorPos[1] } ); |
| 6934 | + } |
| 6935 | + } |
| 6936 | + |
6938 | 6937 | context.fn.updateHistory( event.data.scope == 'realchange' ); |
6939 | 6938 | return true; |
6940 | 6939 | }, |
— | — | @@ -7032,7 +7031,7 @@ |
7033 | 7032 | |
7034 | 7033 | // Restore cursor position |
7035 | 7034 | context.fn.purgeOffsets(); |
7036 | | - var restoreTo = cursorPos[0] + context.fn.getContents().length - oldLength; |
| 7035 | + var restoreTo = cursorPos[1] + context.fn.getContents().length - oldLength; |
7037 | 7036 | context.fn.setSelection( { start: restoreTo, end: restoreTo } ); |
7038 | 7037 | }, 0 ); |
7039 | 7038 | return true; |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -460,8 +460,7 @@ |
461 | 461 | break;case 86:if(event.ctrlKey){context.evt.paste(event);} |
462 | 462 | break;} |
463 | 463 | return true;},'change':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldHTML!=newHTML){context.fn.purgeOffsets();context.oldHTML=newHTML;event.data.scope='realchange';} |
464 | | -return true;},'delayedChange':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldDelayedHTML!=newHTML){context.oldDelayedHTML=newHTML;event.data.scope='realchange';} |
465 | | -var t=context.fn.getOffset();if(t.node.parentNode.nodeName.toLowerCase()=='body'){var cursorPos=context.fn.getCaretPosition()[0];$(t.node).wrap("<p></p>");context.fn.refreshOffsets();context.fn.setSelection({start:cursorPos,end:cursorPos});} |
| 464 | +return true;},'delayedChange':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldDelayedHTML!=newHTML){context.oldDelayedHTML=newHTML;event.data.scope='realchange';var cursorPos=context.fn.getCaretPosition();var t=context.fn.getOffset(cursorPos[0]);if(t.node.parentNode.nodeName.toLowerCase()=='body'){$(t.node).wrap("<p></p>");context.fn.purgeOffsets();context.fn.setSelection({start:cursorPos[0],end:cursorPos[1]});}} |
466 | 465 | context.fn.updateHistory(event.data.scope=='realchange');return true;},'cut':function(event){setTimeout(function(){context.$content.find('br').each(function(){if($(this).parent().is('body')){$(this).wrap($('<p></p>'));}});},100);return true;},'paste':function(event){var cursorPos=context.fn.getCaretPosition();var oldLength=context.fn.getContents().length;context.$content.find(':not(.wikiEditor)').addClass('wikiEditor');if($.layout.name!=='webkit'){context.$content.addClass('pasting');} |
467 | 466 | setTimeout(function(){context.$content.find('script,style,img,input,select,textarea,hr,button,link,meta').remove();context.$content.find('*').each(function(){if($(this).children().length==0&&this.childNodes.length>0){$(this).text($(this).text());}});var t=context.fn.traverser(context.$content);while(t){if(t.node.nodeName=='#text'){if(t.node.nodeValue==='\n'){$('<p><br></p>').insertAfter($(t.node));var oldNode=t.node;t=t.next();$(oldNode).remove();continue;} |
468 | 467 | else if((t.node.nodeValue.indexOf('\n')!=1||t.node.nodeValue.indexOf('\r')!=-1)){t.node.nodeValue=t.node.nodeValue.replace(/\r|\n/g,' ');}} |
— | — | @@ -471,7 +470,7 @@ |
472 | 471 | $currentElement.remove();}else{$newElement=$('<span></span>').html(html).insertAfter($currentElement);$newElement.replaceWith($newElement[0].childNodes);$currentElement.remove();} |
473 | 472 | $selection=context.$content.find(':not(.wikiEditor)');} |
474 | 473 | context.$content.find('.wikiEditor').removeClass('wikiEditor');if($.layout.name!=='webkit'){context.$content.removeClass('pasting');} |
475 | | -context.fn.purgeOffsets();var restoreTo=cursorPos[0]+context.fn.getContents().length-oldLength;context.fn.setSelection({start:restoreTo,end:restoreTo});},0);return true;},'ready':function(event){context.history.push({'html':context.$content.html(),'sel':context.fn.getCaretPosition()});return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};} |
| 474 | +context.fn.purgeOffsets();var restoreTo=cursorPos[1]+context.fn.getContents().length-oldLength;context.fn.setSelection({start:restoreTo,end:restoreTo});},0);return true;},'ready':function(event){context.history.push({'html':context.$content.html(),'sel':context.fn.getCaretPosition()});return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};} |
476 | 475 | if(typeof event.data=='undefined'){event.data={};} |
477 | 476 | if(name in context.evt){if(!context.evt[name](event)){return false;}} |
478 | 477 | for(var module in context.modules){if(module in $.wikiEditor.modules&&'evt'in $.wikiEditor.modules[module]&&name in $.wikiEditor.modules[module].evt){$.wikiEditor.modules[module].evt[name](context,event);}} |