Commit graph

4148 commits

Author SHA1 Message Date
Catrope c36df77e3f Make reference editing work
The only reason it doesn't save correctly right now is because Parsoid
doesn't serialize reference edits correctly.

Change-Id: Ia0f272c07cc28ee829372eb848f23aec99eb92f0
2013-05-25 18:06:57 +02:00
jenkins-bot c6e06f3917 Merge "Merging and remapping of IVStores and InternalLists" 2013-05-25 11:37:12 +00:00
jenkins-bot e25aa4f199 Merge "Add getDocumentSlice" 2013-05-25 11:36:37 +00:00
Catrope 238d68eb74 Merging and remapping of IVStores and InternalLists
Add merge() methods to IndexValueStore and InternalList, which merge
another store/list in to the current one and return a mapping
translating old indexes to new ones.

Also add functions that, given such a mapping, traverse a linear
model data array and remap store/list indexes using simple logic for
annotations and node type-specific functions for node attributes.

Change-Id: I1e90755ced1a87c190947c037cf151c4d17cf8b7
2013-05-25 11:33:35 +00:00
Catrope 6562b32aa7 Add getDocumentSlice
A document slice is a document built from a data slice of an existing
document. It's completely separate from the original document and has
its own store and internalList. The new document's data also contains
the entirety of the original document's internal list. It's possible
to create a document slice of data located inside the internal list,
in which case the resulting document will contain that data twice (one
mutable copy at the top level, and one immutable copy in the internal
list).

ve.dm.Document.js:
* Optionally take an internalList in the constructor. This allows us to
  create a document with a clone of an existing internalList rather than
  an empty one.
* Add edgeMetadata flag to getFullData()

ve.dm.IndexValueStore.js, ve.dm.InternalList.js:
* Make these classes cloneable

Change-Id: I93e06f764ace16aee9df941b07f8c2bff1a28e2b
2013-05-25 11:33:14 +00:00
James D. Forrester 5819375022 Internationalisation for the metadata dialog
Change-Id: Iefb6d5c90583f0684cb9548d38b83048b43d3c81
2013-05-25 10:11:35 +00:00
jenkins-bot d6b801aa7d Merge "Store multi byte characters as one element" 2013-05-25 09:00:49 +00:00
Translation updater bot 331d74ca60 Localisation updates from http://translatewiki.net.
Change-Id: I7dc7ab1b79f2a8807ec4cbb849e01e07143f54b1
2013-05-25 08:29:47 +00:00
jenkins-bot cc59e59647 Merge "Correctly populate internalList for example documents" 2013-05-24 22:55:36 +00:00
Ed Sanders 90e4f4d665 Store multi byte characters as one element
Getting & setting the cursor is done with byte offsets
instead of data model offset (characters) so we need to
be able to convert between the two as well as splitting
characters.

TODO: The regex only works on surrogate pairs, not
yet combining accents.

fixupInsertion will combine a combining mark with the
character to its left it it can.

Bug: 48630

Change-Id: I8d936fb15d82f73cd45fac142c540a7950850d55
2013-05-25 00:50:11 +02:00
jenkins-bot 601f01dbd3 Merge changes I2dc0c151,I807a0f32
* changes:
  Attach resize handles to $localOverlay
  Remove resize handles on surface teardown
2013-05-24 22:17:50 +00:00
jenkins-bot a160da0cb9 Merge "Remove language page tab from MW meta dialog" 2013-05-24 22:15:56 +00:00
jenkins-bot bb9da98c5d Merge "Wrap pre-formatted nodes at word boundaries, not window width" 2013-05-24 20:49:09 +00:00
James D. Forrester 83c79bd586 Wrap pre-formatted nodes at word boundaries, not window width
Bug: 38043
Change-Id: I9b5e3b3e62b52c86743ee345b1cc31beec0a061e
2013-05-24 22:44:44 +02:00
Ed Sanders e14defc76f Attach resize handles to $localOverlay
Because that's where they should be.

Change-Id: I2dc0c1511f459fea6bf7db86eff9a55c07dd911b
2013-05-24 22:43:15 +02:00
Ed Sanders 80a37e9df3 Remove resize handles on surface teardown
Add teardown call to surface destruction in mw target, and
teardown listener to resizeable node.

Bug: 48530
Change-Id: I807a0f32d3d1eb490456d887f7bf867bdb896df4
2013-05-24 22:19:18 +02:00
Ed Sanders 6ca45aa2c8 Remove language page tab from MW meta dialog
MW meta is close to being moved out of experimental, but language
editing is not in line for the beta release.

Bug: 48561
Change-Id: Ie87a3c7dde2f29c3898c08d4cade5c0ba2f937dd
2013-05-24 20:26:14 +02:00
jenkins-bot 3ccf6042ea Merge "Add MW meta button to toolbar" 2013-05-24 17:09:57 +00:00
jenkins-bot 8dca81e159 Merge changes I0a60421f,I0646b8cf
* changes:
  Make MW meta dialog experimental
  Remove unused toolbar group name.
2013-05-24 16:58:58 +00:00
Ed Sanders ce86aa77c8 Add MW meta button to toolbar
Bug: 48561
Change-Id: Ibf63329a53bcd8043d46315239c19be4e681a18a
2013-05-24 15:54:50 +00:00
Ed Sanders 626a8c60f2 Make MW meta dialog experimental
Also remove the exception thrown when we try to add an non-existent
toolbar button, as it may just be experimental and not loaded.

Change-Id: I0a60421f45d7a3941c510defc60d1fbf9469e784
2013-05-24 17:53:06 +02:00
Catrope 8157bcc474 Correctly populate internalList for example documents
Right now the internal list is very much HTML-based, so it's not
populated at all when creating a document from data. So hack this in by
specifying what should be in the internal list as a property of the
example document's data array.

Change-Id: I51c7b7b4dcd9fd3333777c1287b7ba544887aa32
2013-05-24 17:39:45 +02:00
Ed Sanders 026af0d6c0 Remove unused toolbar group name.
Can't see why we'd need to style toolbar groups differently.

Change-Id: I0646b8cf37ab19e34a8ed2eb8558773365403610
2013-05-24 15:36:00 +00:00
Ed Sanders 7ab76291b9 Display 'editingold' as a notice when editing old version of a page
Bug: 47683
Change-Id: I216cdd68014173aa65cad42ddd3d870334be9ead
2013-05-24 16:48:27 +02: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
jenkins-bot ca706b8bde Merge "Use our own collection of constant to key code. The one based on w3c is not reliable." 2013-05-24 09:19:08 +00:00
Translation updater bot 936a7fa3ac Localisation updates from http://translatewiki.net.
Change-Id: I46da13c29a2f21fd36da068df338276d8f2ace2e
2013-05-24 08:39:15 +00:00
Inez Korczyński 57317e2327 Use our own collection of constant to key code. The one based on w3c is not reliable.
Also, for next few months, please don't mention w3c when I'm around.

Change-Id: I4c8577ae50c16b177dbe370a0deac0d3272e9a06
2013-05-23 16:39:01 -07:00
jenkins-bot ba5dd768a7 Merge "Fix value for DOM_VK_DELETE" 2013-05-23 19:35:13 +00:00
Ed Sanders 181fb4d920 Fix value for DOM_VK_DELETE
The spec you link to appears to not correlate to the real world.
Firefox has a value of 0x2E (46 in decimal) store for this, and
both FF & Chrome report that value in my tests.

Change-Id: I4b0d4d27448587ca7381c640d6d3949402305656
2013-05-23 18:57:27 +02:00
jenkins-bot 41e10e2e37 Merge "Support for thumb and frame images with captions." 2013-05-23 07:47:04 +00:00
Inez Korczyński 1d7cf569e6 Support for thumb and frame images with captions.
* VisualEditor.hooks.php
** export URL to magnify clip as a configuration variable so thumbnail image can render correctly

* ve.ce.Surface.css
** add CSS styling to make image captions look the same way in edit mode as they look in the view mode

* ve.ce.ParagraphNode.js
** add CSS class ve-ce-generated-wrapper if it is a generated wrapper

* ve.ce.MWImageCaptionNode.js
** make image caption rendering match the view mode

Change-Id: I0cd1b25e8f8355e0500aabc90e7c4cdf591545f3
2013-05-23 00:44:43 -07:00
jenkins-bot 38857b4912 Merge "ve.ui.Toolbar: Clear the float before the toolbar" 2013-05-23 07:38:00 +00:00
Translation updater bot be912c464c Localisation updates from http://translatewiki.net.
Change-Id: I2797cd857bfe1ebb301c617ac0a806cede2c5a50
2013-05-23 05:44:55 +00:00
Timo Tijhof 917fbc6f30 ve.ui.Toolbar: Clear the float before the toolbar
On wikis where certain "topicons" exist the toolbar showed a
weird blank space pushing the entire toolbar down and
ve-ui-toolbar-actions to the left.

Bug: 48734
Change-Id: Ic5f73ac1eb8c41b891dd1c67b71795cb6c456141
2013-05-23 01:07:51 +02:00
jenkins-bot f25572a992 Merge "Fix for check if data is balanced" 2013-05-22 22:05:43 +00:00
Inez Korczyński 02d522500c Fix for check if data is balanced
Previous check wouldn't make sense, cause the last offset in the data
could be that one that makes data balanced (and j is increased always
after iteration).


Change-Id: Ie9498d0ac9e3417d09b8b3043bf3281e7dfbf9db
2013-05-22 14:19:42 -07:00
Inez Korczyński f29fa6ec88 Added comment to explain better what ve.Keys is.
Change-Id: I9c9b181c4ddbaa0a32e419726fc91b6ae8db7b2a
2013-05-22 13:19:45 -07:00
jenkins-bot f8e36324c0 Merge "Clicking link button while link inspector is already open throws error" 2013-05-22 19:57:14 +00:00
jenkins-bot ec44f52a8c Merge "Remove native KeyEvent" 2013-05-22 19:56:36 +00:00
jenkins-bot 5b343fcc2c Merge "Get rid of try..catch by using ve.dm.nodeFactory.lookup." 2013-05-22 19:55:32 +00:00
jenkins-bot a0bf6a0fc2 Merge "ve.Element: Add unit tests" 2013-05-22 19:53:01 +00:00
Christian Williams d0dbc395a5 Remove native KeyEvent
Relying on any native implementation of window.KeyEvent is
unreliable. The two specs listed in the comments for this method
are not the same and Firefox now has DOM_VK_ENTER and
DOM_VK_RETURN which are equivalent to 13 and 14 respectively.
The key on the right side of my home row triggers 14 using
native window.KeyEvent in Firefox, where Chrome uses our
defined constants and returns 13. This fix ensures the same
values for all browsers.

Change-Id: I12b2f5d674bdf13526577cb81d0505b608f2846c
2013-05-22 12:52:31 -07:00
Inez Korczyński bf6df1ff37 Get rid of try..catch by using ve.dm.nodeFactory.lookup.
Change-Id: I017ed60f7d7ce8af34c94fe237cc4101192518f1
2013-05-22 12:51:51 -07:00
jenkins-bot df1e82bcf9 Merge "ve.ui.MWTemplateDialog: Implement templatedata API fetch" 2013-05-22 18:03:35 +00:00
Timo Tijhof 70694b2bbf MWLinkTargetInputWidget: Normalise value before matching
Don't suggest a "new page" (redlink) for values that are
strictly different but the same as a suggestion according
to mw.Title (e.g. input "foo" with an existing "Foo" page
should not suggest a redlink to inexistant page "foo").

Bug: 48476
Change-Id: I66f5fc56554984af58d6223dc6cd76b3ab9940bd
2013-05-22 00:20:41 +02:00
Timo Tijhof d28e10d830 ve.Element: Add unit tests
Follows-up c2defc9.

Change-Id: I2045e40567de01f6b44beffe760b6a6287754f75
2013-05-21 19:18:46 +02:00
Ed Sanders 38f199d505 Clicking link button while link inspector is already open throws error
Bug: 48549
Change-Id: Ia97b6e3d862e02f5c55cac3f490fd8f26052027a
2013-05-21 16:26:45 +01:00
Timo Tijhof e7af635e88 ve.ui.MWTemplateDialog: Implement templatedata API fetch
Fetch
* Added basic name expansion logic since bug 48663 is not yet
  resolved in Parsoid.
* Fetch info from template data API.

Clean up (follows-up 97157a1c, de203cb8, 718db58)
* Remove redundant initialize method.
* Pass the entire target object to #getTemplateData
  because `target.wt` is *not* the template name.
* Reorganise #createPage to be more logical and rename
  to #createParamPage.
* Add todo comments for things currently missing.
* Implement error handling of promise to prevent UI from
  going stale if the promise is not resolved.
* Fix documentation in ve.ui.MWCategoryInputWidget.

Change-Id: Ie0114a81eead86d7a3b3e3a7a5b10d25c457b524
2013-05-20 23:50:19 -07:00
jenkins-bot 22bbba249e Merge "Show warning when commit message is empty and preference is set" 2013-05-21 06:38:38 +00:00