r62190 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62189‎ | r62190 | r62191 >
Date:19:27, 9 February 2010
Author:catrope
Status:ok
Tags:
Comment:
wmf-deployment: Merge r62154, r62186 from trunk (makes charinsert, old toolbar work with usability beta)
Modified paths:
  • /branches/wmf-deployment/skins/common/edit.js (modified) (history)

Diff [purge]

Index: branches/wmf-deployment/skins/common/edit.js
@@ -47,11 +47,14 @@
4848 var textbox = document.getElementById('wpTextbox1');
4949 if (!textbox) { return false; }
5050
51 - // Don't generate buttons for browsers which don't fully
52 - // support it.
53 - if (!(document.selection && document.selection.createRange)
54 - && textbox.selectionStart === null) {
55 - return false;
 51+ // Only check for selection capability if the textarea is visible - errors will occur otherwise - just because
 52+ // the textarea is not visible, doesn't mean we shouldn't build out the toolbar though - it might have been replaced
 53+ // with some other kind of control
 54+ if ( textbox.style.display != 'none' ) {
 55+ if ( !( document.selection && document.selection.createRange )
 56+ && textbox.selectionStart === null ) {
 57+ return false;
 58+ }
5659 }
5760
5861 for (var i = 0; i < mwEditButtons.length; i++) {
@@ -66,6 +69,12 @@
6770 // apply tagOpen/tagClose to selection in textarea,
6871 // use sampleText instead of selection if there is none
6972 function insertTags(tagOpen, tagClose, sampleText) {
 73+ if ( typeof $j != 'undefined' && typeof $j.fn.textSelection != 'undefined' ) {
 74+ $j( '#wpTextbox1' ).textSelection(
 75+ 'encapsulateSelection', { 'pre': tagOpen, 'peri': sampleText, 'post': tagClose }
 76+ );
 77+ return;
 78+ }
7079 var txtarea;
7180 if (document.editform) {
7281 txtarea = currentFocused;
Property changes on: branches/wmf-deployment/skins/common/edit.js
___________________________________________________________________
Name: svn:mergeinfo
7382 - /branches/REL1_15/phase3/skins/common/edit.js:51646
/trunk/phase3/skins/common/edit.js:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816,59604,59939,61557-61558,61700
7483 + /branches/REL1_15/phase3/skins/common/edit.js:51646
/trunk/phase3/skins/common/edit.js:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816,59604,59939,61557-61558,61700,62154,62186

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r62154Updated to use the textSelection plugin when possible.tparscal01:31, 9 February 2010
r62186Fix up r62154: don't throw a JS error when $j is undefined, and bump $wgStyle...catrope16:58, 9 February 2010

Status & tagging log