Commit graph

70 commits

Author SHA1 Message Date
James D. Forrester 385f895980 Update VE core submodule to master (f5083c6)
New changes:
6ec286e Support for generic file drop handlers
4f2ab66 Generic progress dialog for drag and drop uploads
742e0fe Fix pasteSpecial command
87ea9e9 Fix up/down arrowing off a focusable node
643ea34 spinner.gif: Update with new version from Trevor
ffd8b1e Position the table context relative to the first section node
393776a Fix logic for ignoring (col|row)span=1
f94b10e Don't unmerge spanned cells when spanned cell is removed
3416764 TableContext: Simplify row/column overlays styles
e6c0038 Localisation updates from https://translatewiki.net.
fb1a922 Register select all as a command and perform programmatically
3c1ce93 Make caption tool available when caption selected
dd0ac7d Move disabling logic from tools to commands
8bf33a5 Bold & italic icons for Armenian
058b32c Update OOjs UI to v0.1.0-pre (05f0fefc3f)
c01d115 Create filedrophandlers folder for implementations

Local changes:
* Register new files
* Move disabling logic from tools to commands
  onUpdateState should only ever call setActive. setDisabled should
  already be determined by the command so that it can prevent itself
  being called by triggers.

Change-Id: Icdeaa4c152a0dcd839c8e7cc4e64b2215eb2de1e
2014-11-11 16:51:24 +00:00
James D. Forrester cc8f6970a5 Update VE core submodule to master (f4ff1d6)
New changes:
d845991 Data model implementation for tables
a27c148 ContentEditable implementation for tables
3c47428 Actions and context menus for manipulating tables
543ca54 Support annotation tool on table selections
149cf3d Supporting copy paste of single table cells
25c9eee Table header/data format tools
e557e46 Merge cells tool
afcf2d9 Allow custom type and attributes when creating a table

Local changes:
Add the files and messages for table editing

Change-Id: I6e6c33b96d3089049a0fd5385191caa83df5756b
2014-10-29 11:52:09 -07:00
Roan Kattouw cbb113bccc Convince jsduck mw.Title exists
Apparently we didn't have any functions taking or returning
an mw.Title object, which is kind of concerning. But now that
we're introducing one, we need jsduck to shut up about mw.Title
not existing.

Change-Id: I04028e0e3d55ed9901878cce593f857183246ab3
2014-10-28 18:20:13 -07:00
James D. Forrester e20b47f84b Update VE core submodule to master (db78bdd)
New changes:
69ecc8e Remove MW-specific mobile hack from core
e556440 doc: Use wildcards for Desktop/Mobile …Context and …Surface for simplicity of extension

Local change:
Bring in MobileContext hack to filter out all tools except links and citations from core where
it didn't belong.

Change-Id: Ica837abd45f0ff02b49a44da617bc1fd8e9872d4
2014-10-20 12:43:39 -07:00
Ed Sanders 1af18c3c12 Update VE core submodule to master (984b57a)
New changes:
6bbcd6a Localisation updates from https://translatewiki.net.
b8d8a5b [BREAKING CHANGE] The Great Selection Rewrite of 2014

Local changes:
Update to use new selection/range API

Change-Id: I5480d5c77d599c93c2d374fac88bb2fdb68b0024
2014-10-07 21:39:33 +02:00
James D. Forrester 9d27d0605b Update VE core submodule to master (859654b)
New changes:
6cb04e0 Fix JS error in mostly-dead Opera compat code
454d486 Handle triple click with surface fragments
c1e5c78 Update OOjs UI to v0.1.0-pre (afa3241e8e)
859654b Update OOjs UI to v0.1.0-pre (30b0407428)

Change-Id: I3f166c002783e9b62f31cbd0ef02930abe107b21
2014-09-30 16:26:59 -07:00
James D. Forrester 67f304a414 Update VE core submodule to master (c4ce5ee)
New changes:
c4ce5ee Update OOjs UI to v0.1.0-pre (466a8762ac)

Update changes:
* Remove manager arugment from window constructors
* Use this.$content instead of this.frame.$content
* Use this.getDir() instead of this.frame.getDir()
* this.loading is now a promise, not a boolean

Change-Id: Ia83449a60078dd24ea4f976221c0859e5a121279
2014-08-20 18:42:52 -07:00
James D. Forrester 54f609324f Update VE core submodule to master (59a25cb)
New changes:
5e35cc0 ve.Filibuster: Scrupulous state logging
82961d0 Re-sync bin/update-oojs.sh with equivalent script in MediaWiki core
2b540a7 Don't blank .static in ve.dm.Document
cfbb0e6 Update OOjs to v1.0.12
59a25cb Update OOjs UI to v0.1.0-pre (944c47c5fe)

Change-Id: I4713b73a7897c54da30db32db0ac66e8bcc1b208
2014-08-20 17:42:52 -07:00
James D. Forrester fbdff76263 Update VE core submodule to master (f2277ea)
New changes:
56de6f5 Localisation updates from https://translatewiki.net.
f8bda64 Widgetise demo menu
6ac48d8 Localisation updates from https://translatewiki.net.
365e131 builderloader: Omit value for boolean "disabled" attribute per HTML5
706e4b3 Prevent double counting of DM nodes in getNodeAndOffset
b141a7d Update OOjs UI to v0.1.0-pre (d2451ac748)
c5b3921 Localisation updates from https://translatewiki.net.
1606983 Update reference to ConfirmationDialog to use MessageDialog

Deletions:
* Styles for ve.ui.MWBetaWelcomeDialog - not needed anymore because
  OO.ui.MessageDialog provides them
* Styles for ve.ui.MWGalleryInspector - not needed anymore because
  ve.ui.MWExtensionInspector provides part of them and the rest are being
  replaced by programatic sizing

Modifications:
* ve.ui.MWLinkTargetInputWidget - Added support for validation and href
  getter
* Split message between tool and dialog title for ve.ui.MWEditModeTool
  and ve.ui.MWWikitextSwitchConfirmDialog

General changes:
* Updated inheritance.
* Added manager param to constructors of dialogs and inspectors.
* Updated use of show/hide with toggle.
* Added meaningful descriptions of dialog and inspector classes.
* Configured dialog and inspector sizes statically.
* Configured dialog action buttons statically.
* Interfaced with OO.ui.ActionSet to control action buttons.
* Moved applyChanges code into getActionProcess methods.
* Always using .next in setup/ready process getters and .first in
  hold/teardown process getters.

Change-Id: Ia74732e6e32c0808eee021f0a26225b9e6c3f971
2014-07-14 23:24:45 +00:00
Ed Sanders 00af43495b Update VE core submodule to master (155f4ab)
Use new setupToolbar and setupDebugbar methods in base target.

New changes:
7ff523d Localisation updates from https://translatewiki.net.
3815224 [BREAKING CHANGE] Debug bar refactor
155f4ab Edit HTML mode in demo

Change-Id: I554ce51eae872ab0f741a913bf10394c2a8c3e52
2014-06-16 14:52:48 -07:00
Trevor Parscal f65c3c6ef1 [BREAKING CHANGE] Update VE core submodule to master (88fe25f)
Switch to processes for windows (dialogs/inspectors)

This conversion also required the splitting of MWLinkInspector into
MWLinkNodeInspector and MWLinkAnnotationInspector.

New changes:
88fe25f [BREAKING CHANGE] Update OOjs UI to v0.1.0-pre (dd888aba5c)

Change-Id: I662d8985463c9fc881775f70aef87ebeb454a73f
2014-05-30 22:03:45 -07:00
Roan Kattouw 2e5e7594a8 Update VE core submodule to master (19be0c1)
Also add OO.ui.ConfirmationDialog things and
update Gruntfile.js for breaking changes in VE core.

New changes:
5f1514b Localisation updates from https://translatewiki.net.
0cde22f Localisation updates from https://translatewiki.net.
ca021d8 Fix desktop dialogs
3503287 Localisation updates from https://translatewiki.net.
f02286b build: [BREAKING CHANGE] Add dependency expression
25fc053 Use message function and correct message key
a097202 Create phantom/shield nodes with methods not templates
1399844 Load dependencies in correct order
5a39c9e build: Simplify building of module dependency list
2a3871f build: Upgrade jscs and jshint
7db9b88 Localisation updates from https://translatewiki.net.
d34b2ae Update OOjs UI to v0.1.0-pre (80f1797a5c)

Change-Id: I0f23042e3cadd4614cd1dcd905287af777dd6ed3
2014-05-14 15:27:46 -07:00
Roan Kattouw f2422d916c Update VE core submodule to master (c150259) for scalable changes
ve.dm.Scalable is now a computational model for image scaling and
size manipulation. This commit adjusts the nodes and the edit and
insertion dialog to handle the new scalable model, and by that
use a centralized computational engine for all scaling and size
changes.

New changes:
3ec19fb8 Refactor Scalable functionality

Change-Id: I017a017924f544cc8bc9b7d8245335759ae0e890
2014-04-09 17:29:49 -07:00
Roan Kattouw 1a092a604e Update VE core submodule to master (8dd6a63)
New changes:
acdd445 Minor documentation fixes
79cd956 Update OOjs to v1.0.9
d5c53e1 Restore selection after ListAction too
4df22a0 Separate out debug bar for use outside the demo

Change-Id: Iba582a7f1027172828a7cf88976d1d37d05cd7e7
2014-04-02 17:33:29 -07:00
Trevor Parscal 42ba981e27 Update VE core submodule to master (520299e)
New changes:
dd15f23 Split ve.ui.Surface into DesktopSurface and MobileSurface
16283f4 Add OOjs UI's sco.json i18n file
ef94038 Split ve.ui.Context into DesktopContext and MobileContext

Minor adjustments to point to desktop and mobile Surface or Context.

Change-Id: I7cf6f99a5a1216a28a7146afcd4deb68c7eac38e
2014-03-14 13:13:02 -07:00
James D. Forrester fee4209d14 Update VE core submodule to master (43787a8)
Also run grunt locally to apply fix.

New changes:
43787a8 Add ve.Scalable to documentation listing

Change-Id: I3915272768d43aa12bdd932e4035d9bad48a09d9
2014-02-12 16:06:51 -08:00
Ed Sanders fb4f7d3e24 The great image scaling rewrite of 2014 (MW)
Implement new logic in ve.Scalable from I5b4f0f91b.

Also update VE core submodule to master (57ed8d3).

New changes:
59a0afe The great image scaling rewrite of 2014

Change-Id: I24a2976036310d3814cc7d1853a68745e0499bd5
2014-02-05 12:55:11 -08:00
Roan Kattouw ee743f869d Use submodule for VisualEditor core
* Add lib/ve.
* Remove modules provided by VisualEditor core.
* Update paths.
* Remove VisualEditor core specific things from Gruntfile.
* Remove entries from external.js already in lib/ve/.docs/external.js.
* Implement build script to compose a jsduck index that includes
  all of VisualEditor core. Right now it includes VisualEditor's
  index as-is, and because those patterns (e.g. ve.dm.*Node) will
  also MW subclasses this means our category page will include
  MW classes under "VisualEditor (core)" (before the repo split,
  this was intentional).
  This is inevitable unless we list every class individually, or
  (the plan) until we move the MW subclasses out of the ve.*
  namespace and into mw.* somewhere.

Bug: 45342
Change-Id: Iff45cd555430634c9fc341fd3b177c1e0625300b
2013-12-20 09:18:41 +00:00
Trevor Parscal 51e096d6f2 Refactor Transclusion and Meta dialogs to use BookletLayout
Use OOJS-UI's newly-extended paged dialogs (in e08eb2a03b) to refactor
how the Transclusion and Meta dialogs work, splitting out the code for
each of the panels into its own file and simplifying extensibility.

The Meta dialog (ve.ui.MWMetaDialog) now has two self-managing panels:
* ve.ui.MWCategoriesPage for categories and the default sort key
* ve.ui.MWLanguagesPage for language links

The Transclusion dialog (ve.ui.MWTransclusionDialog) now has four:
* ve.ui.MWTemplatePage for a template's primary panel
* ve.ui.MWTemplateParameterPage for each parameter of a template
* ve.ui.MWTemplatePlaceholderPage for a placeholder to insert a template
* ve.ui.MWTransclusionContentPage for non-template transclusion

Additionally, the Transclusion dialog has been slightly cleaned up:
* Replace add/remove events with replace events in transclusion model
* Actually return and resolve a promise (as documented)
* Get rid of "origin" info in template models
* Add method for adding required parts

TODO:

* Decide how and when we will choose between advanced transclusion and
  template dialogs
* Work out design issues with how template descriptions will be visible
  and how adding parameters will work if only showing parameters in
  outline
* Add preview to template dialog
* Consider ways to further improve pages for use in continuous mode

WARNING:

* Right now the template dialog gets overridden by the advanced
  transclusion dialog because they have the same symbolic name and the
  latter is registered later than the former. To test the template
  dialog, just change the symbolic name of the advanced transclusion
  dialog.

Change-Id: I51e74b322aec9a4c3918e6f792bdb3d318060979
2013-12-05 16:26:26 -08:00
jenkins-bot c18534bcad Merge changes If814e178,Id133431e,I38d63e31,I16d575b6
* changes:
  Plain text paste with paste special
  Use rare unicode characters for paste placeholders
  Rich paste
  Add fixUpInsertion to newFromDocumentReplace
2013-11-26 21:07:46 +00:00
Ed Sanders 7cec9ae04a Rich paste
Allow pasting of rich (HTML) content.

ve.ce.Surface
* Use a sliced document clone for converting to DM HTML (copy)
* Add full context to pasteTarget before copying
* Add ve-pasteProtect class to spans to prevent them being dropped
* Implement external paste by converting HTML to data and inserting
  with newFromDocumentInsertion
* Remove clipboard key placeholder after read so they aren't picked
  up by rich paste. Hash no longer includes the placeholder.
* Detect the corruption of important spans and fallback to clipboard
  data HTML if available.

ve.dm.LinearData
* Add clone method for copy

ve.dm.ElementLinearData
* Add compareUnannotated for use by context diffing.
* Add sanitize method for cleaning data according to a set of rules.

ve.dm.Transaction
* Add range parameter for inserting a range of a document only,
  e.g. stripping the paste context.

ve.dm.Document
* Implement sliced document clone creation so that DM HTML
  is generated correctly in onCopy

ve.dm.DocumentSlice
* Replaces LinearDataSlice. Now has two ranges for balanced data
  and data with a full context.

ve.init.Target.js
* Define default, loose, paste rules (just remove aliens).

ve.init.mw.ViewPageTarget
* Define strict MW paste rules:
  + no links, spans, underlines
  + no images, divs, aliens
  + strip extra HTML attribues

ve.init.sa.Target, ve.init.mw.ViewPageTarget, ve.ui.Surface
* Pass through and store paste rules.

Bug: 41193
Bug: 48170
Bug: 50128
Bug: 53828
Change-Id: I38d63e31ee3e3ee11707e3fffed5174e1d633b42
2013-11-26 18:23:12 +00:00
David Chan addd1d7b23 Test Surface with IME-like event sequences
* modules/ve/test/ce/ve.ce.TestRunner.js
Class to interact with the CE Surface and document in tests

* modules/ve/ve.EventSequencer.js
Wrap setTimeout/clearTimeout calls (for easy replacement in tests)

Change-Id: I2e2407e2b169ae77237c87bf8857b3026cc7efce
2013-11-25 16:49:49 +00:00
Trevor Parscal 4192cbc4d5 Window refactor
Changes:

* Cleanup the window API to use more consistent and intuitive methods - we
  now use initialize/setup/teardown instead of
  initialize/onSetup/onOpen/onClose as methods which are overridden, and
  use open/close methods to control the window
* Change events around to have opening/open and closing/close events which
  act as before/after points during the opening/closing process
* Make WindowSet and Context respond to windows being opened, rather than
  opening them directly
* Fix a LinkInspector creation mode bug where the initial text doesn't get
  reset
* Move inspector, a VisualEditor concept, back to VE
* Cleanup naming of SurfaceDialog, SurfaceToolbar, etc. to use shorter
  names, they were given Surface* names when the generic ones were also in
  VE, but now the generic ones are in OO, so they can return to their
  original names

Change-Id: I82c4fed8bcb3fb5630938c8bc4dd9b2d5f1a8c1d
2013-11-08 12:33:25 -08:00
Trevor Parscal 6774cd74f3 Detangle triggers from OOUI
Changes:

* Pass toolGroup into tools instead of toolbar
* Split tool labels into title and accel
* Make toolbars provide accelerator labels
* Remove getLabelText method since it's not being used and is likely not useful
* Make tools update their own labels
* Only show accelerator information for triggers that are active in the surface
* Make surface toolbars listen to commands being added and update tools accordingly
* Introduce command object to encapsulate command info

Change-Id: Ieac4bfa63b63ac0a9dee154af3007a33b4d447ff
2013-10-29 05:50:30 +00:00
Trevor Parscal d2dfb9ac4f Split oojs-ui from ve.ui
* Move and rename generic parts of ve.ui to OO.ui
* We now have a UI test suite because ve.Element (outside ve.ui)
  is now part of oojs-ui, so it needs a test suite.
* Added to the MW test run (just like we do for unicodejs).
* Updated csslint config (also added ve-mw and syntaxhighlight
  which were missing).

oojs-ui still depends on the TriggerRegistry in VE, this is addressed
in a follow-up commit.

Change-Id: Iec147155c1ddf20b73a4d15d87b8742207032312
2013-10-28 22:40:08 -07:00
Trevor Parscal 26a1d8986b Remove ve.Factory and ve.Registry and use oojs instead
Change-Id: I2717300e6cc6102296a2b8d063d344fa5897c825
2013-10-22 19:15:18 +00:00
Trevor Parscal 6018e77d70 Use OO.EventEmitter instead of ve.EventEmitter
Change-Id: Ie35e5f51a8d3c0d7f4fa46230b7b37112df610b9
2013-10-22 16:57:33 +00:00
Trevor Parscal 4aa86d0f87 Make dialogs, inspectors windows and window sets generic
Objective:
* Remove surface dependencies in dialogs, inspectors, windows and window sets
* Introduce surface-specific versions of dialogs, inspectors and window sets

Change-Id: I2db59127d2085b02e173a3605e174317e419e213
2013-10-07 10:37:47 -07:00
jenkins-bot c21c8556fc Merge "Make ve.Factory require static name property" 2013-10-03 22:03:26 +00:00
Trevor Parscal 61ddfb76e4 Make ve.Factory require static name property
Objective:
* Make ve.Factory behave like ve.NamedClassFactory
* Remove the only remaining use of ve.Factory (actions)
* Remove ve.NamedClassFactory

Change-Id: Ie302ef5ea31081de7ab0db6091058a59946aef4c
2013-10-03 14:52:19 -07:00
Ed Sanders 5c31d3215b Change ve.dm.DocumentSlice to a mixin to ve.dm.LinearData
Document slice only ever contained linear data, with extra functionality
to preserve the range. It pre-dated LinearData, but now we should
refactor it to reflect its purpose.

Change-Id: Ifc908f7526c83a43a51372c8d2494d7260e7facd
2013-10-03 19:38:59 +01:00
jenkins-bot 48c60153a6 Merge "Extend SurfaceToolbar into TargetToolbar" 2013-09-23 23:48:41 +00:00
Timo Tijhof e4662a65cd Clean up VisualEditorDataModule and document ve.version
* Check in #getGitHeadHash now ensures a false value is
  cached as well.
* Made ve.version.id being false when invalid more stable
  since we now rely on this as of eeb3ac3b19.
* Added documentation for ve.version.

Change-Id: I164aa9ebaa7f8a4d1e8f2210af76e06b23abef09
2013-09-18 03:40:00 +02:00
Ed Sanders 4d1d632ebd Extend SurfaceToolbar into TargetToolbar
Toolbars may want to control the target as well as the surface (spoiler alert!).
The new TargetToolbar has a pointer to its target as well as its surface.

Change-Id: I928316d9e23ac3f3de3e76c34ef0ac3d27855ab3
2013-09-17 17:05:01 +01:00
jenkins-bot 8dfa827a97 Merge "ve.EventSequencer: Post-event listening" 2013-09-04 20:08:42 +00:00
David Chan 793172e41e ve.EventSequencer: Post-event listening
modules/ve/ve.EventSequencer.js
* Class to sequence pre-event and post-event listening correctly

demos/ve/eventSequencer.html
* Plain HTML example page for testing EventSequencer and event sequences

Change-Id: I4ddb10a30c2f44015136a7978a185d0b13f0690b
2013-09-04 11:20:46 -07:00
Trevor Parscal 8dfbc5baa5 Make tools generic and add fancy tool groups
Objectives:

* Got rid of mw prefixing in tools, inspectors and dialogs
* Simplify tool classes so they can be generically used as items in bars, lists and menus
* Add support for a catch-all toolbar group
* Simplify tool registration, leaning on tool classes' static name property
* Move default commands to command registry
* Move default triggers to trigger registry
* Get language tool working in standalone

Change-Id: Ic97a636f9a193374728629931b6702bee1b3416a
2013-09-03 11:27:39 -07:00
Trevor Parscal 2717ea1645 Add ve.ui.ToolGroup and use within toolbar setup
Objectives:

* Use a class for toolbar groups to add more functionality later
* Rename addTools method to setup

Changes:

*.php
* Add link to new file
* Move ui element classes up for more general use

ve.init.mw.ViewPageTarget.js, ve.init.sa.Target.js, ve.ui.Context.js,
ve.ui.SurfaceWidget.js
* Update use of addTools method

ve.ui.Tool.css, ve.ui.Toolbar.css
* Move styles between sheets

ve.ui.Toolbar.js
* Rename addTools to setup
* Use ve.ui.ToolGroup objects when building tools

ve.ui.ToolGroup.js
* New class, encapsulates tools

Change-Id: Ic3a643634a80a8ac7d6f6f47f031d001c7efaee7
2013-08-07 05:08:20 +00:00
Trevor Parscal a226716d70 Split ve.ui.Toolbar and ve.ui.SurfaceToolbar
Objective:

* Make it possible to make a toolbar without a surface

Changes:

*.php
* Links to new file

ve.ui.Toolbar.js, ve.ui.SurfaceToolbar.js
* Split toolbar into generic and surface specific classes

*.js
* Update symbol names

Change-Id: Ice063a2fb67b5ce5155cdc96a0d47af49eee48cb
2013-08-02 14:33:25 -07:00
David Chan a1eb56c14f splitClusters uses Grapheme Cluster Boundary rules
unicodejs.graphemebreak.js
* New file: singleton class with splitClusters method
* On load, builds graphemeBreakRegexp from unicodejs.graphemebreakproperties.js

unicodejs.js
* Remove old splitClusters method (was just a placeholder)
* Change "conjunction" -> "disjunction", for consistency and correctness

unicodejs.textstring.js
* Use new splitClusters method

modules/ve/ve.js
* Use new splitClusters method

unicodejs.wordbreak.text.js
* Add new splitClusters test
* Refactor charRangeArrayRegexp test to use splitClusters

PHP files
* add unicodejs.graphemebreak.js, unicodejs.graphemebreakproperties.js

.docs/categories.json
* add unicodeJS.wordbreak class

Change-Id: I8f512e2fc2c46eb4b5f00994a8dac88f3c8f7dd2
2013-06-16 21:46:02 +01:00
Trevor Parscal d3a2fab2c4 Transclusion editing
Objectives:

* Rename just about every use of "template" to "transclusion"
* Make a proper data structure for transclusions
* Abstract away template data
* Use more template data in the user interface
* Allow adding parameters
* Allow removing templates, parameters and content

Changes:

ve.ui.Dialog.css
* Add rule to place add param controls on a single line

ve.ui.MWTemplateDialogs.js
* Move template spec loading into transclusion class
* Add remove button for parts and parameters
* Add parameter adding form
* Use template data for labels and descriptions

ve.dm.*
* Add new transclusion data structures

*.php
* Add links to new files

*.*
* Rename all things "template" to "transclusion"

Bug: 39598
Bug: 49403
Change-Id: I3bcf924a3e179cb65f19e833277a39dfd3dad8bd
2013-06-12 16:39:13 -07:00
Timo Tijhof 908d1a8c19 oojs: Integrate with OOJS v1.0.0
To make integration and testing easier keeping references and
tests unchanged.

Change-Id: Ie808eaf0ffb754ba9c6be13810cfec2385d8de36
2013-06-06 17:29:55 +02:00
David Chan 1c78d0a38c Use grapheme clusters in unicodeJS.TextString
unicodejs.js:
* add splitClusters(text) and splitCharacters(text) methods

unicodejs.textstring.js:
* change internal representation from a char string to a list of grapheme
  clusters

unicodejs.wordbreak.js:
* change getGroup to work on the first character of a grapheme cluster

ve.js:
* Use new unicodejs.splitClusters function

Bug: 48975
Change-Id: I202b98199d2780534d1e02519b72579ba796f08f
2013-05-30 17:34:10 +01:00
Trevor Parscal 2e76271b4e The Great ve.ui.Surface refactor of 2013
Prologue:

Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.

Note to Roan and/or Ed:

Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.

Objectives:

* Make it possible to have multiple surfaces be instantiated, get along
  nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog

Approach:

* Move what's left of ve.Editor to ve.ui.Surface and essentially
  obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
  the top level one
* Resolve stacking order issues by removing the excessive use of z-index
  and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
  and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype

Bonus:

* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
  was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed

Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-24 14:01:02 +02:00
Trevor Parscal a56e795f58 ve.Editor
Objectives:

* Split ve.Surface into ve.Editor and ve.ui.Surface
* Move actions, triggers and commands to ve.ui
* Move toolbar wrapping, floating, shadow and actions functionality to configurable options of ve.ui.Toolbar
* Make ve.ce.Surface and ve.ui.Surface inherit ve.Element and use this.$$ for iframe friendliness
* Make the toolbar separately initialized so it's possible to have a surface without one, as well as control where the toolbar is

Some change notes:

VisualEditor.php
* Added standalone module for mediawiki integrated unit testing

ve.ce.Surface.js
* Remove requirement to pass in an attached container to construct object
* Inherit ve.Element and use this.$$ instead of $
* Make getSelectionRect iframe friendly
* Move most of the initialize stuff to a new initialize method to be called after the surface is attached to the DOM

ve.init.mw.ViewPageTarget.js
* Merge toolbar functions into setup/teardown methods
* Add toolbar manually (since it's not added by the surface anymore)

ve.init.sa.Target.js
* Update new init procedure for editor, surface and toolbar separately
* Move toolbar floating stuff to ve.Toolbar

Change-Id: If91a9d6e76a8be8d1b5a2566394765a37d29a8a7
2013-05-15 10:39:12 -07:00
Trevor Parscal c2defc9783 ve.Element refactor
Objectives:

* Move ve.ui.Element to ve.Element
* Make CE nodes inherit from ve.Element

Changes:

ve.ui.Element.js, ve.Element.js
* Move and rename
* Move ve.ui.get$$ to ve.Element.static.get$$
* Add static getDocument and getWindow methods
* Add instance getElementDocument and getElementWindow methods
* Add getTagName method, which by default reads the static tagName property, but when overridden can return a tag name based on other factors

*.php
* Updated file link

ve.ce.*Annotation.js, ve.ce.*Node.js, ve.ce.View.js, ve.ce.Document
* Added config options pass through
* Replaced passing elements through constructor with defining static tag names
* Added getTagName overrides where needed that derive tag name from model
* Refactore dom wrapper methods, now consistently using getTagName

ve.ce.Surface.js
* Removed static initialization (not needed)

ve.dm.Model.js, ve.ui.Window.js
* Added missing docs

ve.ui.GroupElement.js, ve.ui.Layout.js, ve.ui.Widget.js,
* Updated class name for elements

ve.ui.Frame.js, ve.ui.LookupInputWidget.js
* Updated location of get$$

ve.ui.js
* Move get$$ to ve.Element

ve.js
* Add auto-init of static properties to mixinClass

Change-Id: I39ae14966456903728e4d9e53f806ddce9ca2b70
2013-05-14 19:47:32 +00:00
Ed Sanders 6ad61d4ddb Add data model support for MediaWiki references
So far just read-only.

Bug: 39599
Change-Id: I6daff5c5969e5fdc871f8f346cf790b4302ae080
2013-04-23 10:17:42 +01:00
Trevor Parscal bf254f44da UI "Views" refactor
Objective:

Make it possible for inspectors to inspect nodes or annotations, rather
than only annotations. Meanwhile, also make it possible for dialogs to
edit an annotation.

Strategy:

Switch from using type patterns to associate inspectors with annotations
to using arrays of classes, similar to how dialogs already work.
Introduce a view registry which provides lookups for relationships
between models and views. This is more centralized and less repetitive
than implement matching functions for both annotations and nodes in both
the dialog and inspector factories.

Changes:

*.php
* Added links to new file

ve.AnnotationAction.js
* Removed unused parameter to filter annotations using a string or regexp

ve.dm.AnnotationSet.js
* Switched from property/value arguments to callbacks

ve.ui.*(Dialog|Inspector).js
* Replaced type patterns with class lists
* Added class to view registry

ve.ui.*Tool.js, ve.ui.Context.js
* Updated model/view relationship lookup

ve.ui.*Factory.js
* Removed overly-specific lookup functions

ve.ui.Inspector.js
* Removed typePattern property
* Updated model/view relationship lookup

ve.ui.ViewRegistry.js
* New class!
* Migrated node and annotation lookup functions from factories

Change-Id: Ic2bbcf072fdd87e5ce8a03fe1ae3e6d8d50e2593
2013-04-18 15:53:50 -07:00
Catrope 9c967267e6 Rename ve.NodeFactory to ve.NamedClassFactory
We weren't really using it exclusively for nodes any more, and the only
functionality in there was for using .static.name

Change-Id: Ie26928cd01faee95a10912201663b45f1f20fb19
2013-04-09 12:05:05 -07:00
Catrope 2eb77c1298 Add ve.ce.View as a common base class for ce.Node and ce.Annotation
Just like ve.dm.Model is a common base class for dm.Node, dm.Annotation
and dm.MetaItem.

ce.View abstracts the this.model and this.$ behavior, including liveness,
whitelisted HTML attribute rendering and adding a back reference in
.data(). The back reference has been renamed from .data( 'node' ) to
the more generic .data( 'view' ).

At this point this means ce.Annotation is just a shell around ce.View
(except where it defaults to a span rather than a div), but that could
change in the future.

Change-Id: I0eef5b80718e0b0fcd3f8bba096b452f0bb680d0
2013-04-09 12:05:05 -07:00