r92274 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92273‎ | r92274 | r92275 >
Date:18:47, 15 July 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Made cursor show only occur when selection was not painted, and prevented toolbar tools from stealing focus.
Modified paths:
  • /trunk/parsers/wikidom/demos/es/index.html (modified) (history)
  • /trunk/parsers/wikidom/lib/es/es.Surface.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/es/es.Surface.js
@@ -66,8 +66,7 @@
6767 } );
6868
6969 this.doc.on( 'update', function() {
70 - surface.drawSelection();
71 - if ( surface.location && surface.location.block ) {
 70+ if ( surface.location && surface.location.block && !surface.drawSelection() ) {
7271 var cursorPosition = surface.location.block.getPosition( surface.location.offset );
7372 surface.cursor.show( cursorPosition, surface.location.block.$.offset() );
7473 }
@@ -370,9 +369,10 @@
371370 .show();
372371 }
373372 this.$ranges.show();
374 - } else {
375 - this.$ranges.hide();
 373+ return true;
376374 }
 375+ this.$ranges.hide();
 376+ return false;
377377 };
378378
379379 /**
Index: trunk/parsers/wikidom/demos/es/index.html
@@ -107,46 +107,58 @@
108108 ]);
109109 var surface = new Surface( $('#es-editor'), doc );
110110
 111+ $( '#es-toolbar .es-toolbarTool' ).mousedown( function( e ) {
 112+ e.preventDefault();
 113+ return false;
 114+ } );
111115 $( '#es-toolbar-bold' ).click( function() {
112 - surface.annotateContent( 'toggle', { 'type': 'bold'
 116+ surface.annotateContent( 'toggle', { 'type': 'bold'
 117+ } );
 118+ return false;
113119 } );
114 - } );
115120 $( '#es-toolbar-italic' ).click( function() {
116121 surface.annotateContent( 'toggle', { 'type': 'italic' } );
 122+ return false;
117123 } );
118124 $( '#es-toolbar-small' ).click( function() {
119125 surface.annotateContent( 'toggle', {
120126 'type': 'size',
121127 'data': { 'type': 'small' }
122128 } );
 129+ return false;
123130 } );
124131 $( '#es-toolbar-big' ).click( function() {
125132 surface.annotateContent( 'toggle', {
126133 'type': 'size',
127134 'data': { 'type': 'big' }
128135 } );
 136+ return false;
129137 } );
130138 $( '#es-toolbar-sub' ).click( function() {
131139 surface.annotateContent( 'toggle', {
132140 'type': 'script',
133141 'data': { 'type': 'sub' }
134142 } );
 143+ return false;
135144 } );
136145 $( '#es-toolbar-super' ).click( function() {
137146 surface.annotateContent( 'toggle', {
138147 'type': 'script',
139148 'data': { 'type': 'super' }
140149 } );
 150+ return false;
141151 } );
142152 $( '#es-toolbar-link' ).click( function() {
143153 surface.annotateContent( 'toggle', {
144154 'type': 'link',
145155 'data': { 'href': '#' }
146156 } );
 157+ return false;
147158 } );
148159 $( '#es-toolbar-clear' ).click( function() {
149160 surface.annotateContent( 'remove', { 'type': 'all' } );
150161 } );
 162+ return false;
151163 } );
152164 </script>
153165 </body>

Follow-up revisions

RevisionCommit summaryAuthorDate
r92281Added documentation for changes made in r92274.tparscal19:11, 15 July 2011

Status & tagging log