r110859 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110858‎ | r110859 | r110860 >
Date:18:15, 7 February 2012
Author:tparscal
Status:deferred
Tags:visualeditor 
Comment:
Reorganized demo and demo-ce into demos/es and demos/ce
Modified paths:
  • /trunk/extensions/VisualEditor/demo (deleted) (history)
  • /trunk/extensions/VisualEditor/demo-ce (deleted) (history)
  • /trunk/extensions/VisualEditor/demos (added) (history)
  • /trunk/extensions/VisualEditor/demos/ce (added) (history)
  • /trunk/extensions/VisualEditor/demos/ce/index.php (modified) (history)
  • /trunk/extensions/VisualEditor/demos/es (added) (history)
  • /trunk/extensions/VisualEditor/demos/es/index.php (added) (history)
  • /trunk/extensions/VisualEditor/demos/index.php (deleted) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/demos/ce/main.js
@@ -0,0 +1,749 @@
 2+$(document).ready( function() {
 3+ var wikidoms = {
 4+ 'Wikipedia article': {
 5+ 'type': 'document',
 6+ 'children': [
 7+ {
 8+ 'type': 'heading',
 9+ 'attributes': { 'level': 1 },
 10+ 'content': { 'text': 'Direct manipulation interface' }
 11+ },
 12+ {
 13+ 'type': 'paragraph',
 14+ 'content': {
 15+ 'text': 'In computer science, direct manipulation is a human-computer interaction style which involves continuous representation of objects of interest, and rapid, reversible, incremental actions and feedback. The intention is to allow a user to directly manipulate objects presented to them, using actions that correspond at least loosely to the physical world. An example of direct-manipulation is resizing a graphical shape, such as a rectangle, by dragging its corners or edges with a mouse.',
 16+ 'annotations': [
 17+ {
 18+ 'type': 'link/internal',
 19+ 'data': {
 20+ 'title': 'Computer_science'
 21+ },
 22+ 'range': {
 23+ 'start': 3,
 24+ 'end': 19
 25+ }
 26+ },
 27+ {
 28+ 'type': 'link/internal',
 29+ 'data': {
 30+ 'title': 'Human-computer interaction'
 31+ },
 32+ 'range': {
 33+ 'start': 46,
 34+ 'end': 72
 35+ }
 36+ }
 37+ ]
 38+ }
 39+ },
 40+ {
 41+ 'type': 'paragraph',
 42+ 'content': { 'text': 'Having real-world metaphors for objects and actions can make it easier for a user to learn and use an interface (some might say that the interface is more natural or intuitive), and rapid, incremental feedback allows a user to make fewer errors and complete tasks in less time, because they can see the results of an action before completing the action, thus evaluating the output and compensating for mistakes.' }
 43+ },
 44+ {
 45+ 'type': 'paragraph',
 46+ 'content': {
 47+ 'text': 'The term was introduced by Ben Shneiderman in 1983 within the context of office applications and the desktop metaphor. Individuals in academia and computer scientists doing research on future user interfaces often put as much or even more stress on tactile control and feedback, or sonic control and feedback than on the visual feedback given by most GUIs. As a result the term direct manipulation interface has been more widespread in these environments. ',
 48+ 'annotations': [
 49+ {
 50+ 'type': 'link/internal',
 51+ 'data': {
 52+ 'title': 'Ben_Shneiderman'
 53+ },
 54+ 'range': {
 55+ 'start': 27,
 56+ 'end': 42
 57+ }
 58+ },
 59+ {
 60+ 'type': 'link/internal',
 61+ 'data': {
 62+ 'title': 'GUI'
 63+ },
 64+ 'range': {
 65+ 'start': 352,
 66+ 'end': 356
 67+ }
 68+ },
 69+ {
 70+ 'type': 'object/hook',
 71+ 'data': {
 72+ 'html': '<sup><small><a href="#">[1]</a></small></sup>'
 73+ },
 74+ 'range': {
 75+ 'start': 118,
 76+ 'end': 119
 77+ }
 78+ },
 79+ {
 80+ 'type': 'object/template',
 81+ 'data': {
 82+ 'html': '<sup><small>[<a href="#">citation needed</a>]</small></sup>'
 83+ },
 84+ 'range': {
 85+ 'start': 456,
 86+ 'end': 457
 87+ }
 88+ }
 89+ ]
 90+ }
 91+ },
 92+ {
 93+ 'type': 'heading',
 94+ 'attributes': { 'level': 2 },
 95+ 'content': { 'text': 'In contrast to WIMP/GUI interfaces' }
 96+ },
 97+ {
 98+ 'type': 'paragraph',
 99+ 'content': {
 100+ 'text': 'Direct manipulation is closely associated with interfaces that use windows, icons, menus, and a pointing device (WIMP GUI) as these almost always incorporate direct manipulation to at least some degree. However, direct manipulation should not be confused with these other terms, as it does not imply the use of windows or even graphical output. For example, direct manipulation concepts can be applied to interfaces for blind or vision-impaired users, using a combination of tactile and sonic devices and software.',
 101+ 'annotations': [
 102+ {
 103+ 'type': 'link/internal',
 104+ 'data': {
 105+ 'title': 'WIMP_(computing)'
 106+ },
 107+ 'range': {
 108+ 'start': 113,
 109+ 'end': 117
 110+ }
 111+ }
 112+ ]
 113+ }
 114+ },
 115+ {
 116+ 'type': 'paragraph',
 117+ 'content': {
 118+ 'text': 'It is also possible to design a WIMP interface that intentionally does not make use of direct manipulation. For example, most versions of windowing interfaces (e.g. Microsoft Windows) allowed users to reposition a window by dragging it with the mouse, but would not continually redraw the complete window at intermediate positions during the drag. Instead, for example, a rectangular outline of the window might be drawn during the drag, with the complete window contents being redrawn only once the user had released the mouse button. This was necessary on older computers that lacked the memory and/or CPU power to quickly redraw data behind a window that was being dragged.',
 119+ 'annotations': [
 120+ {
 121+ 'type': 'link/internal',
 122+ 'data': {
 123+ 'title': 'Microsoft_Windows'
 124+ },
 125+ 'range': {
 126+ 'start': 165,
 127+ 'end': 182
 128+ }
 129+ }
 130+ ]
 131+ }
 132+ },
 133+ {
 134+ 'type': 'heading',
 135+ 'attributes': { 'level': 2 },
 136+ 'content': { 'text': 'In point of sale graphic interfaces' }
 137+ },
 138+ {
 139+ 'type': 'paragraph',
 140+ 'content': {
 141+ 'text': 'The ViewTouch graphic touchscreen POS (point of sale) GUI developed by Gene Mosher on the Atari ST computer and first installed in restaurants in 1986 is an early example of an application specific GUI that manifests all of the characteristics of direct manipulation.'
 142+ }
 143+ },
 144+ {
 145+ 'type': 'paragraph',
 146+ 'content': {
 147+ 'text': 'Mosher\'s POS touchscreen GUI has been widely copied and is in universal use on virtually all modern point of sale displays. Even in its earliest form it contained such features as \'lighting up\' both selected \'buttons\' (i.e., widgets) and \'tab\' buttons which indicated the user\'s current position in the transaction as the user navigated among the application\'s pages.'
 148+ }
 149+ },
 150+ {
 151+ 'type': 'paragraph',
 152+ 'content': {
 153+ 'text': 'In 1995 the ViewTouch GUI was developed into an X Window System window manager, extending the usefulness of the direct manipulation interface to users equipped with no other equipment than networked displays relying on the X network display protocol. This application is a practical and useful example of the benefit of the direct manipulation interface. Users are freed from the requirement of making use of keyboards, mice and even local computers themselves while they are simultaneously empowered to work in collaborative fashion with each other in world wide virtual workgroups by merely interacting with the framework of graphical symbols on the networked touchscreen.'
 154+ }
 155+ },
 156+ {
 157+ 'type': 'heading',
 158+ 'attributes': { 'level': 2 },
 159+ 'content': { 'text': 'In computer graphics' }
 160+ },
 161+ {
 162+ 'type': 'paragraph',
 163+ 'content': {
 164+ 'text': 'Because of the difficulty of visualizing and manipulating various aspects of computer graphics, including geometry creation and editing, animation, layout of objects and cameras, light placement, and other effects, direct manipulation is an extremely important part of 3D computer graphics. There are standard direct manipulation widgets as well as many unique widgets that are developed either as a better solution to an old problem or as a solution for a new and/or unique problem. The widgets attempt to allow the user to modify an object in any possible direction while also providing easy guides or constraints to allow the user to easily modify an object in the most common directions, while also attempting to be as intuitive as to the function of the widget as possible. The three most ubiquitous transformation widgets are mostly standardized and are:'
 165+ }
 166+ },
 167+ {
 168+ 'type': 'list',
 169+ 'children': [
 170+ {
 171+ 'type': 'listItem',
 172+ 'attributes': {
 173+ 'styles': ['bullet']
 174+ },
 175+ 'children' : [
 176+ {
 177+ 'type': 'paragraph',
 178+ 'content': { 'text': 'the translation widget, which usually consists of three arrows aligned with the orthogonal axes centered on the object to be translated. Dragging the center of the widget translates the object directly underneath the mouse pointer in the plane parallel to the camera plane, while dragging any of the three arrows translates the object along the appropriate axis. The axes may be aligned with the world-space axes, the object-space axes, or some other space.' }
 179+ }
 180+ ]
 181+ },
 182+ {
 183+ 'type': 'listItem',
 184+ 'attributes': {
 185+ 'styles': ['bullet']
 186+ },
 187+ 'children' : [
 188+ {
 189+ 'type': 'paragraph',
 190+ 'content': { 'text': 'the rotation widget, which usually consists of three circles aligned with the three orthogonal axes, and one circle aligned with the camera plane. Dragging any of the circles rotates the object around the appropriate axis, while dragging elsewhere will freely rotate the object (virtual trackball rotation).' }
 191+ }
 192+ ]
 193+ },
 194+ {
 195+ 'type': 'listItem',
 196+ 'attributes': {
 197+ 'styles': ['bullet']
 198+ },
 199+ 'children' : [
 200+ {
 201+ 'type': 'paragraph',
 202+ 'content': { 'text': 'the scale widget, which usually consists of three short lines aligned with the orthogonal axes terminating in boxes, and one box in the center of the widget. Dragging any of the three axis-aligned boxes effects a non-uniform scale along solely that axis, while dragging the center box effects a uniform scale on all three axes at once.' }
 203+ }
 204+ ]
 205+ }
 206+
 207+ ]
 208+ },
 209+ {
 210+ 'type': 'paragraph',
 211+ 'content': {
 212+ 'text': 'Depending on the specific common uses of an object, different kinds of widgets may be used. For example, a light in computer graphics is, like any other object, also defined by a transformation (translation and rotation), but it is sometimes positioned and directed simply with its endpoint positions because it may be more intuitive to define the position of the light source and then define the light\'s target, rather than rotating it around the coordinate axes in order to point it at a known position.'
 213+ }
 214+ },
 215+ {
 216+ 'type': 'paragraph',
 217+ 'content': {
 218+ 'text': 'Other widgets may be unique for a particular tool, such as edge controls to change the cone of a spotlight, points and handles to define the position and tangent vector for a spline control point, circles of variable size to define a blur filter width or paintbrush size, IK targets for hands and feet, or color wheels and swatches for quickly choosing colors. Complex widgets may even incorporate some techniques from scientific visualization to efficiently present relevant data (such as vector fields for particle effects or false color images to display vertex maps).'
 219+ }
 220+ },
 221+ {
 222+ 'type': 'paragraph',
 223+ 'content': {
 224+ 'text': 'Direct manipulation, as well as user interface design in general, for 3D computer graphics tasks, is still an active area of invention and innovation, as the process of generating CG images is generally not considered to be intuitive or easy in comparison to the difficulty of what the user wants to do, especially for complex tasks. The user interface for word processing, for example, is easy to learn for new users and is sufficient for most word processing tasks, so it is a mostly solved and standardized UI, while the user interfaces for 3D computer graphics are usually either difficult to learn and use and not sufficiently powerful for complex tasks, or sufficiently powerful but extremely difficult to learn and use, so direct manipulation and user interfaces will vary wildly from application to application.'
 225+ }
 226+ }
 227+ ]
 228+ },
 229+ 'Formatting': {
 230+ 'type': 'document',
 231+ 'children': [
 232+ {
 233+ 'type': 'heading',
 234+ 'attributes': { 'level': 1 },
 235+ 'content': {
 236+ 'text': 'This is a heading (level 1)',
 237+ 'annotations': [
 238+ {
 239+ 'type': 'textStyle/italic',
 240+ 'range': {
 241+ 'start': 10,
 242+ 'end': 17
 243+ }
 244+ }
 245+ ]
 246+ }
 247+ },
 248+ {
 249+ 'type': 'paragraph',
 250+ 'content': { 'text': 'Paragraph' }
 251+ },
 252+ {
 253+ 'type': 'heading',
 254+ 'attributes': { 'level': 2 },
 255+ 'content': {
 256+ 'text': 'This is a heading (level 2)',
 257+ 'annotations': [
 258+ {
 259+ 'type': 'textStyle/italic',
 260+ 'range': {
 261+ 'start': 10,
 262+ 'end': 17
 263+ }
 264+ }
 265+ ]
 266+ }
 267+ },
 268+ {
 269+ 'type': 'paragraph',
 270+ 'content': { 'text': 'Paragraph' }
 271+ },
 272+ {
 273+ 'type': 'heading',
 274+ 'attributes': { 'level': 3 },
 275+ 'content': {
 276+ 'text': 'This is a heading (level 3)',
 277+ 'annotations': [
 278+ {
 279+ 'type': 'textStyle/italic',
 280+ 'range': {
 281+ 'start': 10,
 282+ 'end': 17
 283+ }
 284+ }
 285+ ]
 286+ }
 287+ },
 288+ {
 289+ 'type': 'paragraph',
 290+ 'content': { 'text': 'Paragraph' }
 291+ },
 292+ {
 293+ 'type': 'heading',
 294+ 'attributes': { 'level': 4 },
 295+ 'content': {
 296+ 'text': 'This is a heading (level 4)',
 297+ 'annotations': [
 298+ {
 299+ 'type': 'textStyle/italic',
 300+ 'range': {
 301+ 'start': 10,
 302+ 'end': 17
 303+ }
 304+ }
 305+ ]
 306+ }
 307+ },
 308+ {
 309+ 'type': 'paragraph',
 310+ 'content': { 'text': 'Paragraph' }
 311+ },
 312+ {
 313+ 'type': 'heading',
 314+ 'attributes': { 'level': 5 },
 315+ 'content': {
 316+ 'text': 'This is a heading (level 5)',
 317+ 'annotations': [
 318+ {
 319+ 'type': 'textStyle/italic',
 320+ 'range': {
 321+ 'start': 10,
 322+ 'end': 17
 323+ }
 324+ }
 325+ ]
 326+ }
 327+ },
 328+ {
 329+ 'type': 'paragraph',
 330+ 'content': { 'text': 'Paragraph' }
 331+ },
 332+ {
 333+ 'type': 'heading',
 334+ 'attributes': { 'level': 6 },
 335+ 'content': {
 336+ 'text': 'This is a heading (level 6)',
 337+ 'annotations': [
 338+ {
 339+ 'type': 'textStyle/italic',
 340+ 'range': {
 341+ 'start': 10,
 342+ 'end': 17
 343+ }
 344+ }
 345+ ]
 346+ }
 347+ },
 348+ {
 349+ 'type': 'paragraph',
 350+ 'content': { 'text': 'Paragraph' }
 351+ },
 352+ {
 353+ 'type': 'pre',
 354+ 'content': { 'text': 'A lot of text goes here... and at some point it wraps.. A lot of text goes here... and at some point it wraps.. A lot of text goes here... and at some point it wraps.. A lot of text goes here... and at some point it wraps.. A lot of text goes here... and at some point it wraps..' }
 355+ },
 356+ {
 357+ 'type': 'heading',
 358+ 'attributes': { 'level': 1 },
 359+ 'content': { 'text': 'Lists' }
 360+ },
 361+ {
 362+ 'type': 'list',
 363+ 'children': [
 364+ {
 365+ 'type': 'listItem',
 366+ 'attributes': {
 367+ 'styles': ['bullet']
 368+ },
 369+ 'children' : [
 370+ {
 371+ 'type': 'paragraph',
 372+ 'content': { 'text': 'Bullet' }
 373+ }
 374+ ]
 375+ }
 376+ ]
 377+ },
 378+ {
 379+ 'type': 'paragraph',
 380+ 'content': { 'text': 'Paragraph' }
 381+ },
 382+ {
 383+ 'type': 'list',
 384+ 'children': [
 385+ {
 386+ 'type': 'listItem',
 387+ 'attributes': {
 388+ 'styles': ['bullet']
 389+ },
 390+ 'children' : [
 391+ {
 392+ 'type': 'paragraph',
 393+ 'content': { 'text': 'Bullet' }
 394+ }
 395+ ]
 396+ },
 397+ {
 398+ 'type': 'listItem',
 399+ 'attributes': {
 400+ 'styles': ['bullet', 'bullet']
 401+ },
 402+ 'children' : [
 403+ {
 404+ 'type': 'paragraph',
 405+ 'content': { 'text': 'Bullet bullet' }
 406+ }
 407+ ]
 408+ },
 409+ {
 410+ 'type': 'listItem',
 411+ 'attributes': {
 412+ 'styles': ['bullet', 'bullet', 'bullet']
 413+ },
 414+ 'children' : [
 415+ {
 416+ 'type': 'paragraph',
 417+ 'content': { 'text': 'Bullet bullet bullet' }
 418+ }
 419+ ]
 420+ },
 421+ {
 422+ 'type': 'listItem',
 423+ 'attributes': {
 424+ 'styles': ['number']
 425+ },
 426+ 'children' : [
 427+ {
 428+ 'type': 'paragraph',
 429+ 'content': { 'text': 'Number' }
 430+ }
 431+ ]
 432+ },
 433+ {
 434+ 'type': 'listItem',
 435+ 'attributes': {
 436+ 'styles': ['number', 'number']
 437+ },
 438+ 'children' : [
 439+ {
 440+ 'type': 'paragraph',
 441+ 'content': { 'text': 'Number number' }
 442+ }
 443+ ]
 444+ },
 445+ {
 446+ 'type': 'listItem',
 447+ 'attributes': {
 448+ 'styles': ['term']
 449+ },
 450+ 'children' : [
 451+ {
 452+ 'type': 'paragraph',
 453+ 'content': { 'text': 'Term' }
 454+ }
 455+ ]
 456+ },
 457+ {
 458+ 'type': 'listItem',
 459+ 'attributes': {
 460+ 'styles': ['definition']
 461+ },
 462+ 'children' : [
 463+ {
 464+ 'type': 'paragraph',
 465+ 'content': { 'text': 'Definition' }
 466+ }
 467+ ]
 468+ }
 469+ ]
 470+ }
 471+ ]
 472+ },
 473+ /*
 474+ 'Tables': {
 475+ 'type': 'document',
 476+ 'children': [
 477+ {
 478+ 'type': 'heading',
 479+ 'attributes': { 'level': 1 },
 480+ 'content': { 'text': 'Tables' }
 481+ },
 482+ {
 483+ 'type': 'table',
 484+ 'attributes': { 'html/style': 'width: 600px; border: solid 1px;' },
 485+ 'children': [
 486+ {
 487+ 'type': 'tableRow',
 488+ 'children': [
 489+ {
 490+ 'type': 'tableCell',
 491+ 'attributes': { 'html/style': 'border: solid 1px;' },
 492+ 'children': [
 493+ {
 494+ 'type': 'paragraph',
 495+ 'content': { 'text': 'row 1 & cell 1' }
 496+ },
 497+ {
 498+ 'type': 'list',
 499+ 'children': [
 500+ {
 501+ 'type': 'listItem',
 502+ 'attributes': {
 503+ 'styles': ['bullet']
 504+ },
 505+ 'children' : [
 506+ {
 507+ 'type': 'paragraph',
 508+ 'content': { 'text': 'Test 4444' }
 509+ }
 510+ ]
 511+ },
 512+ {
 513+ 'type': 'listItem',
 514+ 'attributes': {
 515+ 'styles': ['bullet', 'bullet']
 516+ },
 517+ 'children' : [
 518+ {
 519+ 'type': 'paragraph',
 520+ 'content': { 'text': 'Test 55555' }
 521+ }
 522+ ]
 523+ },
 524+ {
 525+ 'type': 'listItem',
 526+ 'attributes': {
 527+ 'styles': ['number']
 528+ },
 529+ 'children' : [
 530+ {
 531+ 'type': 'paragraph',
 532+ 'content': { 'text': 'Test 666666' }
 533+ }
 534+ ]
 535+ }
 536+ ]
 537+ }
 538+ ]
 539+ },
 540+ {
 541+ 'type': 'tableCell',
 542+ 'attributes': { 'html/style': 'border: solid 1px;' },
 543+ 'children': [
 544+ {
 545+ 'type': 'paragraph',
 546+ 'content': { 'text': 'row 1 & cell 2' }
 547+ }
 548+ ]
 549+ }
 550+ ]
 551+ }
 552+ ]
 553+ }
 554+ ]
 555+ },*/
 556+ 'New document': {
 557+ 'type': 'document',
 558+ 'children': [
 559+ {
 560+ 'type': 'paragraph',
 561+ 'content': { 'text': '' }
 562+ }
 563+ ]
 564+ }
 565+ };
 566+ window.documentModel = ve.dm.DocumentNode.newFromPlainObject( wikidoms['Wikipedia article'] );
 567+ window.surfaceModel = new ve.dm.Surface( window.documentModel );
 568+ window.surfaceView = new ve.es.Surface( $( '#es-editor' ), window.surfaceModel );
 569+ window.toolbarView = new ve.ui.Toolbar( $( '#es-toolbar' ), window.surfaceView );
 570+ window.contextView = new ve.ui.Context( window.surfaceView );
 571+ window.surfaceModel.select( new ve.Range( 1, 1 ) );
 572+
 573+ /*
 574+ * This code is responsible for switching toolbar into floating mode when scrolling (with
 575+ * keyboard or mouse).
 576+ */
 577+ var $toolbarWrapper = $( '#es-toolbar-wrapper' ),
 578+ $toolbar = $( '#es-toolbar' ),
 579+ $window = $( window );
 580+ $window.scroll( function() {
 581+ var toolbarWrapperOffset = $toolbarWrapper.offset();
 582+ if ( $window.scrollTop() > toolbarWrapperOffset.top ) {
 583+ if ( !$toolbarWrapper.hasClass( 'float' ) ) {
 584+ var left = toolbarWrapperOffset.left,
 585+ right = $window.width() - $toolbarWrapper.outerWidth() - left;
 586+ $toolbarWrapper.css( 'height', $toolbarWrapper.height() ).addClass( 'float' );
 587+ $toolbar.css( { 'left': left, 'right': right } );
 588+ }
 589+ } else {
 590+ if ( $toolbarWrapper.hasClass( 'float' ) ) {
 591+ $toolbarWrapper.css( 'height', 'auto' ).removeClass( 'float' );
 592+ $toolbar.css( { 'left': 0, 'right': 0 } );
 593+ }
 594+ }
 595+ } );
 596+
 597+ var $modeButtons = $( '.es-modes-button' ),
 598+ $panels = $( '.es-panel' ),
 599+ $base = $( '#es-base' ),
 600+ currentMode = null,
 601+ modes = {
 602+ 'wikitext': {
 603+ '$': $( '#es-mode-wikitext' ),
 604+ '$panel': $( '#es-panel-wikitext' ),
 605+ 'update': function() {
 606+ this.$panel.text(
 607+ ve.dm.WikitextSerializer.stringify( documentModel.getPlainObject() )
 608+ );
 609+ }
 610+ },
 611+ 'json': {
 612+ '$': $( '#es-mode-json' ),
 613+ '$panel': $( '#es-panel-json' ),
 614+ 'update': function() {
 615+ this.$panel.text( ve.dm.JsonSerializer.stringify( documentModel.getPlainObject(), {
 616+ 'indentWith': ' '
 617+ } ) );
 618+ }
 619+ },
 620+ 'html': {
 621+ '$': $( '#es-mode-html' ),
 622+ '$panel': $( '#es-panel-html' ),
 623+ 'update': function() {
 624+ this.$panel.text(
 625+ ve.dm.HtmlSerializer.stringify( documentModel.getPlainObject() )
 626+ );
 627+ }
 628+ },
 629+ 'render': {
 630+ '$': $( '#es-mode-render' ),
 631+ '$panel': $( '#es-panel-render' ),
 632+ 'update': function() {
 633+ this.$panel.html(
 634+ ve.dm.HtmlSerializer.stringify( documentModel.getPlainObject() )
 635+ );
 636+ }
 637+ },
 638+ 'history': {
 639+ '$': $( '#es-mode-history' ),
 640+ '$panel': $( '#es-panel-history' ),
 641+ 'update': function() {
 642+ var history = surfaceModel.getHistory(),
 643+ i = history.length,
 644+ end = Math.max( 0, i - 25 ),
 645+ j,
 646+ k,
 647+ ops,
 648+ events = '',
 649+ z = 0,
 650+ operations;
 651+
 652+ while ( --i >= end ) {
 653+ z++;
 654+ operations = [];
 655+ for ( j = 0; j < history[i].stack.length; j++) {
 656+ ops = history[i].stack[j].getOperations().slice(0);
 657+ for ( k = 0; k < ops.length; k++ ) {
 658+ data = ops[k].data || ops[k].length;
 659+ if ( ve.isArray( data ) ) {
 660+ data = data[0];
 661+ if ( ve.isArray( data ) ) {
 662+ data = data[0];
 663+ }
 664+ }
 665+ if ( typeof data !== 'string' && typeof data !== 'number' ) {
 666+ data = '-';
 667+ }
 668+ ops[k] = ops[k].type.substr( 0, 3 ) + '(' + data + ')';
 669+ }
 670+ operations.push('[' + ops.join( ', ' ) + ']');
 671+ }
 672+ events += '<div' + (z === surfaceModel.undoIndex ? ' class="es-panel-history-active"' : '') + '>' + operations.join(', ') + '</div>';
 673+ }
 674+
 675+ this.$panel.html( events );
 676+ }
 677+ },
 678+ 'help': {
 679+ '$': $( '#es-mode-help' ),
 680+ '$panel': $( '#es-panel-help' ),
 681+ 'update': function() {}
 682+ }
 683+ };
 684+ $.each( modes, function( name, mode ) {
 685+ mode.$.click( function() {
 686+ var disable = $(this).hasClass( 'es-modes-button-down' );
 687+ var visible = $base.hasClass( 'es-showData' );
 688+ $modeButtons.removeClass( 'es-modes-button-down' );
 689+ $panels.hide();
 690+ if ( disable ) {
 691+ if ( visible ) {
 692+ $base.removeClass( 'es-showData' );
 693+ $window.resize();
 694+ }
 695+ currentMode = null;
 696+ } else {
 697+ $(this).addClass( 'es-modes-button-down' );
 698+ mode.$panel.show();
 699+ if ( !visible ) {
 700+ $base.addClass( 'es-showData' );
 701+ $window.resize();
 702+ }
 703+ mode.update.call( mode );
 704+ currentMode = mode;
 705+ }
 706+ } );
 707+ } );
 708+
 709+ var $docsList = $( '#es-docs-list' );
 710+ $.each( wikidoms, function( title, wikidom ) {
 711+ $docsList.append(
 712+ $( '<li class="es-docs-listItem"></li>' )
 713+ .append(
 714+ $( '<a href="#"></a>' )
 715+ .text( title )
 716+ .click( function() {
 717+ var newDocumentModel = ve.dm.DocumentNode.newFromPlainObject( wikidom );
 718+ documentModel.data.splice( 0, documentModel.data.length );
 719+ ve.insertIntoArray( documentModel.data, 0, newDocumentModel.data );
 720+ surfaceModel.select( new ve.Range( 1, 1 ) );
 721+ documentModel.splice.apply(
 722+ documentModel,
 723+ [0, documentModel.getChildren().length]
 724+ .concat( newDocumentModel.getChildren() )
 725+ );
 726+ surfaceModel.purgeHistory();
 727+
 728+ if ( currentMode ) {
 729+ currentMode.update.call( currentMode );
 730+ }
 731+ return false;
 732+ } )
 733+ )
 734+ );
 735+ } );
 736+
 737+ surfaceModel.on( 'transact', function() {
 738+ if ( currentMode ) {
 739+ currentMode.update.call( currentMode );
 740+ }
 741+ } );
 742+ surfaceModel.on( 'select', function() {
 743+ if ( currentMode === modes.history ) {
 744+ currentMode.update.call( currentMode );
 745+ }
 746+ } );
 747+
 748+ $( '#es-docs' ).css( { 'visibility': 'visible' } );
 749+ $( '#es-base' ).css( { 'visibility': 'visible' } );
 750+} );
Index: trunk/extensions/VisualEditor/demos/ce/index.php
@@ -0,0 +1,156 @@
 2+<!DOCTYPE html>
 3+
 4+<html>
 5+ <head>
 6+ <title>ContentEditable Demo</title>
 7+ <!-- es -->
 8+ <link rel="stylesheet" href="../../modules/ve/ce/styles/ve.es.Document.css">
 9+ <link rel="stylesheet" href="../../modules/ve/ce/styles/ve.es.Content.css">
 10+ <link rel="stylesheet" href="../../modules/ve/ce/styles/ve.es.Surface.css">
 11+ <!-- ui -->
 12+ <link rel="stylesheet" href="../../modules/ve/ui/styles/ve.ui.Context.css">
 13+ <link rel="stylesheet" href="../../modules/ve/ui/styles/ve.ui.Inspector.css">
 14+ <link rel="stylesheet" href="../../modules/ve/ui/styles/ve.ui.Menu.css">
 15+ <link rel="stylesheet" href="../../modules/ve/ui/styles/ve.ui.Toolbar.css">
 16+ <!-- sandbox -->
 17+ <link rel="stylesheet" href="../../modules/sandbox/sandbox.css">
 18+ <style>
 19+ body {
 20+ font-family: "Arial";
 21+ font-size: 1em;
 22+ width: 100%;
 23+ margin: 1em 0;
 24+ padding: 0;
 25+ overflow-y: scroll;
 26+ background-color: white;
 27+ }
 28+ #es-base {
 29+ margin: 2em;
 30+ margin-top: 0em;
 31+ -webkit-box-shadow: 0 0.25em 1.5em 0 #dddddd;
 32+ -moz-box-shadow: 0 0.25em 1.5em 0 #dddddd;
 33+ box-shadow: 0 0.25em 1.5em 0 #dddddd;
 34+ -webkit-border-radius: 0.5em;
 35+ -moz-border-radius: 0.5em;
 36+ -o-border-radius: 0.5em;
 37+ border-radius: 0.5em;
 38+ }
 39+ #es-panes {
 40+ border: solid 1px #cccccc;
 41+ border-top: none;
 42+ }
 43+ #es-visual {
 44+ padding-left: 1em;
 45+ padding-right: 1em;
 46+ }
 47+ #es-toolbar {
 48+ -webkit-border-radius: 0;
 49+ -moz-border-radius: 0;
 50+ -o-border-radius: 0;
 51+ border-radius: 0;
 52+ -webkit-border-top-right-radius: 0.25em;
 53+ -moz-border-top-right-radius: 0.25em;
 54+ -o-border-top-right-radius: 0.25em;
 55+ border-top-right-radius: 0.25em;
 56+ -webkit-border-top-left-radius: 0.25em;
 57+ -moz-border-top-left-radius: 0.25em;
 58+ -o-border-top-left-radius: 0.25em;
 59+ border-top-left-radius: 0.25em;
 60+ }
 61+ #es-toolbar.float {
 62+ left: 2em;
 63+ right: 2em;
 64+ top: 0;
 65+ }
 66+ #es-docs {
 67+ margin-left: 2.5em;
 68+ }
 69+ </style>
 70+ </head>
 71+ <body>
 72+<?php
 73+$modeWikitext = "Toggle wikitext view";
 74+$modeJson = "Toggle JSON view";
 75+$modeHtml = "Toggle HTML view";
 76+$modeRender = "Toggle preview";
 77+$modeHistory = "Toggle transaction history view";
 78+$modeHelp = "Toggle help view";
 79+
 80+include( '../../modules/sandbox/base.php' );
 81+
 82+?>
 83+ <!-- ve -->
 84+ <script src="../../modules/jquery/jquery.js"></script>
 85+ <script src="../../modules/ve/ve.js"></script>
 86+ <script src="../../modules/ve/ve.Position.js"></script>
 87+ <script src="../../modules/ve/ve.Range.js"></script>
 88+ <script src="../../modules/ve/ve.EventEmitter.js"></script>
 89+ <script src="../../modules/ve/ve.Node.js"></script>
 90+ <script src="../../modules/ve/ve.BranchNode.js"></script>
 91+ <script src="../../modules/ve/ve.LeafNode.js"></script>
 92+
 93+ <!-- dm -->
 94+ <script src="../../modules/ve/dm/ve.dm.js"></script>
 95+ <script src="../../modules/ve/dm/ve.dm.Node.js"></script>
 96+ <script src="../../modules/ve/dm/ve.dm.BranchNode.js"></script>
 97+ <script src="../../modules/ve/dm/ve.dm.LeafNode.js"></script>
 98+ <script src="../../modules/ve/dm/ve.dm.TransactionProcessor.js"></script>
 99+ <script src="../../modules/ve/dm/ve.dm.Transaction.js"></script>
 100+ <script src="../../modules/ve/dm/ve.dm.Surface.js"></script>
 101+
 102+ <script src="../../modules/ve/dm/nodes/ve.dm.DocumentNode.js"></script>
 103+ <script src="../../modules/ve/dm/nodes/ve.dm.HeadingNode.js"></script>
 104+ <script src="../../modules/ve/dm/nodes/ve.dm.ParagraphNode.js"></script>
 105+ <script src="../../modules/ve/dm/nodes/ve.dm.PreNode.js"></script>
 106+ <script src="../../modules/ve/dm/nodes/ve.dm.ListItemNode.js"></script>
 107+ <script src="../../modules/ve/dm/nodes/ve.dm.ListNode.js"></script>
 108+ <script src="../../modules/ve/dm/nodes/ve.dm.TableCellNode.js"></script>
 109+ <script src="../../modules/ve/dm/nodes/ve.dm.TableNode.js"></script>
 110+ <script src="../../modules/ve/dm/nodes/ve.dm.TableRowNode.js"></script>
 111+
 112+ <script src="../../modules/ve/dm/serializers/ve.dm.AnnotationSerializer.js"></script>
 113+ <script src="../../modules/ve/dm/serializers/ve.dm.HtmlSerializer.js"></script>
 114+ <script src="../../modules/ve/dm/serializers/ve.dm.JsonSerializer.js"></script>
 115+ <script src="../../modules/ve/dm/serializers/ve.dm.WikitextSerializer.js"></script>
 116+
 117+ <!-- es -->
 118+ <script src="../../modules/ve/es/ve.es.js"></script>
 119+ <script src="../../modules/ve/es/ve.es.Node.js"></script>
 120+ <script src="../../modules/ve/es/ve.es.BranchNode.js"></script>
 121+ <script src="../../modules/ve/es/ve.es.LeafNode.js"></script>
 122+ <script src="../../modules/ve/ce/ve.es.Content.js"></script>
 123+ <script src="../../modules/ve/ce/ve.es.Surface.js"></script>
 124+
 125+ <script src="../../modules/ve/ce/nodes/ve.es.DocumentNode.js"></script>
 126+ <script src="../../modules/ve/es/nodes/ve.es.HeadingNode.js"></script>
 127+ <script src="../../modules/ve/es/nodes/ve.es.ParagraphNode.js"></script>
 128+ <script src="../../modules/ve/es/nodes/ve.es.PreNode.js"></script>
 129+ <script src="../../modules/ve/es/nodes/ve.es.ListItemNode.js"></script>
 130+ <script src="../../modules/ve/es/nodes/ve.es.ListNode.js"></script>
 131+ <script src="../../modules/ve/es/nodes/ve.es.TableCellNode.js"></script>
 132+ <script src="../../modules/ve/es/nodes/ve.es.TableNode.js"></script>
 133+ <script src="../../modules/ve/es/nodes/ve.es.TableRowNode.js"></script>
 134+
 135+ <!-- ui -->
 136+ <script src="../../modules/ve/ui/ve.ui.js"></script>
 137+ <script src="../../modules/ve/ui/ve.ui.Inspector.js"></script>
 138+ <script src="../../modules/ve/ui/ve.ui.Tool.js"></script>
 139+ <script src="../../modules/ve/ui/ve.ui.Toolbar.js"></script>
 140+ <script src="../../modules/ve/ui/ve.ui.Context.js"></script>
 141+ <script src="../../modules/ve/ui/ve.ui.Menu.js"></script>
 142+
 143+ <script src="../../modules/ve/ui/inspectors/ve.ui.LinkInspector.js"></script>
 144+
 145+ <script src="../../modules/ve/ui/tools/ve.ui.ButtonTool.js"></script>
 146+ <script src="../../modules/ve/ui/tools/ve.ui.AnnotationButtonTool.js"></script>
 147+ <script src="../../modules/ve/ui/tools/ve.ui.ClearButtonTool.js"></script>
 148+ <script src="../../modules/ve/ui/tools/ve.ui.HistoryButtonTool.js"></script>
 149+ <script src="../../modules/ve/ui/tools/ve.ui.ListButtonTool.js"></script>
 150+ <script src="../../modules/ve/ui/tools/ve.ui.IndentationButtonTool.js"></script>
 151+ <script src="../../modules/ve/ui/tools/ve.ui.DropdownTool.js"></script>
 152+ <script src="../../modules/ve/ui/tools/ve.ui.FormatDropdownTool.js"></script>
 153+
 154+ <!-- sandbox -->
 155+ <script src="main.js"></script>
 156+ </body>
 157+</html>
Index: trunk/extensions/VisualEditor/demos/es/index.php
@@ -0,0 +1,156 @@
 2+<!DOCTYPE html>
 3+
 4+<html>
 5+ <head>
 6+ <title>EditSurface Demo</title>
 7+ <!-- es -->
 8+ <link rel="stylesheet" href="../../modules/ve/es/styles/ve.es.Document.css">
 9+ <link rel="stylesheet" href="../../modules/ve/es/styles/ve.es.Content.css">
 10+ <link rel="stylesheet" href="../../modules/ve/es/styles/ve.es.Surface.css">
 11+ <!-- ui -->
 12+ <link rel="stylesheet" href="../../modules/ve/ui/styles/ve.ui.Context.css">
 13+ <link rel="stylesheet" href="../../modules/ve/ui/styles/ve.ui.Inspector.css">
 14+ <link rel="stylesheet" href="../../modules/ve/ui/styles/ve.ui.Menu.css">
 15+ <link rel="stylesheet" href="../../modules/ve/ui/styles/ve.ui.Toolbar.css">
 16+ <!-- sandbox -->
 17+ <link rel="stylesheet" href="../../modules/sandbox/sandbox.css">
 18+ <style>
 19+ body {
 20+ font-family: "Arial";
 21+ font-size: 1em;
 22+ width: 100%;
 23+ margin: 1em 0;
 24+ padding: 0;
 25+ overflow-y: scroll;
 26+ background-color: white;
 27+ }
 28+ #es-base {
 29+ margin: 2em;
 30+ margin-top: 0em;
 31+ -webkit-box-shadow: 0 0.25em 1.5em 0 #dddddd;
 32+ -moz-box-shadow: 0 0.25em 1.5em 0 #dddddd;
 33+ box-shadow: 0 0.25em 1.5em 0 #dddddd;
 34+ -webkit-border-radius: 0.5em;
 35+ -moz-border-radius: 0.5em;
 36+ -o-border-radius: 0.5em;
 37+ border-radius: 0.5em;
 38+ }
 39+ #es-panes {
 40+ border: solid 1px #cccccc;
 41+ border-top: none;
 42+ }
 43+ #es-visual {
 44+ padding-left: 1em;
 45+ padding-right: 1em;
 46+ }
 47+ #es-toolbar {
 48+ -webkit-border-radius: 0;
 49+ -moz-border-radius: 0;
 50+ -o-border-radius: 0;
 51+ border-radius: 0;
 52+ -webkit-border-top-right-radius: 0.25em;
 53+ -moz-border-top-right-radius: 0.25em;
 54+ -o-border-top-right-radius: 0.25em;
 55+ border-top-right-radius: 0.25em;
 56+ -webkit-border-top-left-radius: 0.25em;
 57+ -moz-border-top-left-radius: 0.25em;
 58+ -o-border-top-left-radius: 0.25em;
 59+ border-top-left-radius: 0.25em;
 60+ }
 61+ #es-toolbar.float {
 62+ left: 2em;
 63+ right: 2em;
 64+ top: 0;
 65+ }
 66+ #es-docs {
 67+ margin-left: 2.5em;
 68+ }
 69+ </style>
 70+ </head>
 71+ <body>
 72+<?php
 73+$modeWikitext = "Toggle wikitext view";
 74+$modeJson = "Toggle JSON view";
 75+$modeHtml = "Toggle HTML view";
 76+$modeRender = "Toggle preview";
 77+$modeHistory = "Toggle transaction history view";
 78+$modeHelp = "Toggle help view";
 79+
 80+include( '../../modules/sandbox/base.php' );
 81+
 82+?>
 83+ <!-- ve -->
 84+ <script src="../../modules/jquery/jquery.js"></script>
 85+ <script src="../../modules/ve/ve.js"></script>
 86+ <script src="../../modules/ve/ve.Position.js"></script>
 87+ <script src="../../modules/ve/ve.Range.js"></script>
 88+ <script src="../../modules/ve/ve.EventEmitter.js"></script>
 89+ <script src="../../modules/ve/ve.Node.js"></script>
 90+ <script src="../../modules/ve/ve.BranchNode.js"></script>
 91+ <script src="../../modules/ve/ve.LeafNode.js"></script>
 92+
 93+ <!-- dm -->
 94+ <script src="../../modules/ve/dm/ve.dm.js"></script>
 95+ <script src="../../modules/ve/dm/ve.dm.Node.js"></script>
 96+ <script src="../../modules/ve/dm/ve.dm.BranchNode.js"></script>
 97+ <script src="../../modules/ve/dm/ve.dm.LeafNode.js"></script>
 98+ <script src="../../modules/ve/dm/ve.dm.TransactionProcessor.js"></script>
 99+ <script src="../../modules/ve/dm/ve.dm.Transaction.js"></script>
 100+ <script src="../../modules/ve/dm/ve.dm.Surface.js"></script>
 101+
 102+ <script src="../../modules/ve/dm/nodes/ve.dm.DocumentNode.js"></script>
 103+ <script src="../../modules/ve/dm/nodes/ve.dm.HeadingNode.js"></script>
 104+ <script src="../../modules/ve/dm/nodes/ve.dm.ParagraphNode.js"></script>
 105+ <script src="../../modules/ve/dm/nodes/ve.dm.PreNode.js"></script>
 106+ <script src="../../modules/ve/dm/nodes/ve.dm.ListItemNode.js"></script>
 107+ <script src="../../modules/ve/dm/nodes/ve.dm.ListNode.js"></script>
 108+ <script src="../../modules/ve/dm/nodes/ve.dm.TableCellNode.js"></script>
 109+ <script src="../../modules/ve/dm/nodes/ve.dm.TableNode.js"></script>
 110+ <script src="../../modules/ve/dm/nodes/ve.dm.TableRowNode.js"></script>
 111+
 112+ <script src="../../modules/ve/dm/serializers/ve.dm.AnnotationSerializer.js"></script>
 113+ <script src="../../modules/ve/dm/serializers/ve.dm.HtmlSerializer.js"></script>
 114+ <script src="../../modules/ve/dm/serializers/ve.dm.JsonSerializer.js"></script>
 115+ <script src="../../modules/ve/dm/serializers/ve.dm.WikitextSerializer.js"></script>
 116+
 117+ <!-- es -->
 118+ <script src="../../modules/ve/es/ve.es.js"></script>
 119+ <script src="../../modules/ve/es/ve.es.Node.js"></script>
 120+ <script src="../../modules/ve/es/ve.es.BranchNode.js"></script>
 121+ <script src="../../modules/ve/es/ve.es.LeafNode.js"></script>
 122+ <script src="../../modules/ve/es/ve.es.Content.js"></script>
 123+ <script src="../../modules/ve/es/ve.es.Surface.js"></script>
 124+
 125+ <script src="../../modules/ve/es/nodes/ve.es.DocumentNode.js"></script>
 126+ <script src="../../modules/ve/es/nodes/ve.es.HeadingNode.js"></script>
 127+ <script src="../../modules/ve/es/nodes/ve.es.ParagraphNode.js"></script>
 128+ <script src="../../modules/ve/es/nodes/ve.es.PreNode.js"></script>
 129+ <script src="../../modules/ve/es/nodes/ve.es.ListItemNode.js"></script>
 130+ <script src="../../modules/ve/es/nodes/ve.es.ListNode.js"></script>
 131+ <script src="../../modules/ve/es/nodes/ve.es.TableCellNode.js"></script>
 132+ <script src="../../modules/ve/es/nodes/ve.es.TableNode.js"></script>
 133+ <script src="../../modules/ve/es/nodes/ve.es.TableRowNode.js"></script>
 134+
 135+ <!-- ui -->
 136+ <script src="../../modules/ve/ui/ve.ui.js"></script>
 137+ <script src="../../modules/ve/ui/ve.ui.Inspector.js"></script>
 138+ <script src="../../modules/ve/ui/ve.ui.Tool.js"></script>
 139+ <script src="../../modules/ve/ui/ve.ui.Toolbar.js"></script>
 140+ <script src="../../modules/ve/ui/ve.ui.Context.js"></script>
 141+ <script src="../../modules/ve/ui/ve.ui.Menu.js"></script>
 142+
 143+ <script src="../../modules/ve/ui/inspectors/ve.ui.LinkInspector.js"></script>
 144+
 145+ <script src="../../modules/ve/ui/tools/ve.ui.ButtonTool.js"></script>
 146+ <script src="../../modules/ve/ui/tools/ve.ui.AnnotationButtonTool.js"></script>
 147+ <script src="../../modules/ve/ui/tools/ve.ui.ClearButtonTool.js"></script>
 148+ <script src="../../modules/ve/ui/tools/ve.ui.HistoryButtonTool.js"></script>
 149+ <script src="../../modules/ve/ui/tools/ve.ui.ListButtonTool.js"></script>
 150+ <script src="../../modules/ve/ui/tools/ve.ui.IndentationButtonTool.js"></script>
 151+ <script src="../../modules/ve/ui/tools/ve.ui.DropdownTool.js"></script>
 152+ <script src="../../modules/ve/ui/tools/ve.ui.FormatDropdownTool.js"></script>
 153+
 154+ <!-- sandbox -->
 155+ <script src="../../modules/sandbox/sandbox.js"></script>
 156+ </body>
 157+</html>
Property changes on: trunk/extensions/VisualEditor/demos/es/index.php
___________________________________________________________________
Added: svn:mime-type
1158 + text/plain
Added: svn:eol-style
2159 + native

Status & tagging log