Commit graph

530 commits

Author SHA1 Message Date
Rob Moen 67749504d2 Center Ellpisis for long page titles. Misc positioning fixes.
MultiSuggest:
Added CSS Ellipsis config option which provides CSS to suggestion items.

LinkInspector:
-Configured multiSuggest for page suggestions with CSS ellipsis off and removed CSS definitions.
Instead, using jquery.autoEllpisis plugin for centered position ellipsis. (Bug 39591)
-Temporary tweak to link input padding to prevent text from overlapping down arrow.
Down arrow soon to be implemented differently.

RTL Fixes:
-MultiSuggest overlay positions correctly by setting a width.
-MultiSuggest background image position fix.

Change-Id: I806ead5a2c2621589f76cfb2b03805cbd0b0a18a
2012-09-05 13:21:29 -07:00
Krinkle 5af7cfbd4d Merge "Improved icons" 2012-09-05 18:11:36 +00:00
Krinkle 193b70f36d Merge "Fix error in ve.copyArray() and add tests" 2012-09-04 22:26:24 +00:00
Catrope da1d0d4391 Fix error in ve.copyArray() and add tests
Change-Id: I05e7971d05dfa3118db97d76f51985f64d994d8b
2012-09-05 00:26:10 +02:00
Timo Tijhof 24590a9702 ve.dm.Converter.test: Add hrefPrefix (follows-up I33eab356)
* Tests were failing since I33eab356.

Change-Id: I1fed0e3e21ea379a583ccd4f611212940264d106
2012-09-03 03:07:24 +02:00
Trevor Parscal bc211d34e0 Merge "Preserve the leading ./ and ../ in internal link hrefs" 2012-08-31 22:22:02 +00:00
Catrope 78359c35ac Preserve the leading ./ and ../ in internal link hrefs
Previously we were just discarding them, but that causes round-trip
issues with Parsoid

Change-Id: I33eab356d77acb3c13dc9da94f773915464ef690
2012-08-31 15:07:35 -07:00
Trevor Parscal b370bbd0bc Improved icons
* Moved icons into Illustrator (used to be in Photoshop)
* Added SVG icons too
* Added support for devices with pixel ratio > 1 (they use SVG)
* Cleaned up icons (little rendering errors here and there)
* Organized icons into their own folder
* Increased the horizontal margin of the down arrows in the formatting (in the toolbar) and location (in the link inspector) drop down menus

Change-Id: I29b7084c9b1145051b2a76f514cfca9826d53ddb
2012-08-31 13:23:04 -07:00
Catrope 3ece6e825d Also copy cloneable objects in ve.copyArray()
Change-Id: I572afc282557bab059df0b2a4fd0347336531409
2012-08-30 17:09:00 -07:00
Trevor Parscal f26ae1662b Added tests for removeContent and insertContent
Also fixed the arguments given to insertContent and double-translating the range

Change-Id: I7cb7dcfcee1c88f2052c63e31a0ed37eaaf645ab
2012-08-30 16:55:49 -07:00
Catrope 4fbabd16dd Make translateRange() map the offset immediately before an insertion to after the insertion rather than before
This will cause ve.dm.SurfaceFragment.prototype.insertContent() to place
the selection after the insertion as well.

Change-Id: Ifa7e627daceb90408422eb58c110d475f34ba1e2
2012-08-30 15:26:43 -07:00
Trevor Parscal d208ca9002 Cleaned up uses of jQuery to create and appendTo/prependTo
* Separated DOM changes from creation of elements
* Always using parsing for element creation with known attributes
* Always using attr or addClass for variable attributes

Change-Id: Id101f56594014786892d382d06c658f416224a9c
2012-08-29 18:43:48 +02:00
Trevor Parscal a52d7ff65a Finally getting rid of all the es-* stuff and other cruft
* Switched a lot of classes from es-* to ve-ui-*
* Removed all the DOM structure left over from the old sandbox demo
* Got rid of transparent backgrounds
* Added menu font-size rule to stand-alone target
* Moved some rules around that were in the wrong places
* Got rid of some unused/unneeded methods in the mw target (attach and detach surface methods)
* Added active class to context icon with shallower shadow effect so it doesn't break your spacial perception when you click on it
* Renamed the iframe and iframe wrapper elements so it's easier to see where they came from
* Removed unused CSS rules
* Fixed some uses of prop( 'class', … ) to addClass

Change-Id: I54a660ca0baf0baa4463faca7a1edcf648130b6b
2012-08-28 13:59:35 -07:00
Trevor Parscal ab1f849ad5 Fixed position and size of toolbar in Apex skin
Change-Id: I520eb03a6b000c70d3b4892b25eeda7e43f85897
2012-08-28 13:13:37 -07:00
Krinkle 26ddaa2959 Merge "A bit of cleanup in the inspector and suggestion code" 2012-08-27 23:45:33 +00:00
Trevor Parscal a8166fe5a4 A bit of cleanup in the inspector and suggestion code
* function() -> function ()
* ){ -> ) {
* Quoted JSON keys (Look the other way Timo!)
* Using more descriptive group names, which also avoid using "new" as a key
* Line breaks at 100 columns using 4 spaces/tab
* Not setting classes on suggestion items that have no effect (such as 'external' on a div - even on an <a> tag this isn't enough to get the style because it's not inside #content)

Change-Id: I37032fa8ba93adb7b719d9797f9b1b806359cc13
2012-08-27 16:39:08 -07:00
Trevor Parscal 19b95af9dd Merge "Catching transactions that were not being committed." 2012-08-27 20:09:15 +00:00
Trevor Parscal 52859f5e27 Merge "Move caching mechanism out of multiSuggest plugin to linkInspector" 2012-08-27 19:58:04 +00:00
Trevor Parscal 495796a99e Merge "Refactor ve.getHash: Stabilize cross-browser differences; + unit tests" 2012-08-27 18:02:07 +00:00
Timo Tijhof c8ed44fb07 Refactor ve.getHash: Stabilize cross-browser differences; + unit tests
* Replaces c8b4a28936

* Use Object() casting to detect objects instead of .constructor
  (or instanceof). Both .constructor and instanceof compare by reference
  the type "Object" which means if the object comes from another window
  (where there is a different "Object" and "Object.prototype") it will
  drop out of the system and go freewack.

  Theory: If a variable casted to an object returns true when strictly compared
  to the original, the input must be an object.

  Which is true. It doesn't change the inheritance, it doesn't make it inherit
  from this window's Object if the object is from another window's object. All it
  does is cast to an object if not an object already.
  So e.g. "Object(5) !== 5" because 5 is a primitive value as opposed to an instance
  of Number.
  And contrary to "typeof", it doesn't return true for "null".

* .constructor also has the problem that it only works this way if the
  input is a plain object. e.g. a simple construtor function that creates
  an object also get in the wrong side of the if/else case since it is
  an instance of Object, but not directly (rather indirectly via another
  constructor).

* Added unit tests for basic getHash usage, as well as regression tests
  against the above two mentioned problems (these tests fail before this commit).

* While at it, also improved other utilities a bit.
 - Use hasOwnProperty instead of casting to boolean
   when checking for presence of native support.
   Thanks to Douglas Crockford for that tip.
 - Fix documentation for ve.getHash: Parameter is not named "obj".
 - Add Object-check to ve.getObjectKeys per ES5 Object.keys spec (to match native behavior)
 - Add Object-check to ve.getObjectValues to match ve.getObjectKeys
 - Improved performance of ve.getObjectKeys shim. Tried several potential optimizations
   and compared with jsperf. Using a "static" reference to hasOwn improves performance
   (by not having to look it up 4 scopes up and 3 property levels deep).
   Also using [.length] instead of .push() shared off a few ms.
 - Added unit tests for ve.getObjectValues

Change-Id: If24d09405321f201c67f7df75d332bb1171c8a36
2012-08-27 00:14:02 +02:00
Amir E. Aharoni 47d1704b2b Added a comment about possible i18n messages
For easier grepping, according to
https://www.mediawiki.org/wiki/L10n#Using_messages

Change-Id: Ib766fd9c10ddbe9fd16ccec9b9866457117b3e70
2012-08-25 14:20:33 +03:00
Christian Williams ac7376c8d6 Catching transactions that were not being committed.
Change-Id: Ic75b07f279e4db30f6730f10b31c66d506cb94e8
2012-08-24 15:10:29 -07:00
Rob Moen 986d25eea1 Move caching mechanism out of multiSuggest plugin to linkInspector
Fixed issue where overlay would be incorrectly positioned if built
from previous caching method.

Change-Id: Id7c3ba211d5344292da47917a9bd06654823ee87
2012-08-24 14:04:33 -07:00
Catrope 452c759914 Preserve whitespace between elements
This commit fully utilizes all four positions in the internal.whitespace
array. Outer whitespace is now preserved as well, and is duplicated
either in the adjacent sibling (one node's outerPost is the next
sibling's outerPre) or in the parent (a branch node's innerPre is its
first child's outerPre, and its innerPost is its last child's
outerPost). Before restoring saved whitespace, we check that these two
agree with each other, and if they disagree we assume the user has been
moving stuff around and don't restore any whitespace in that spot. The
whitespace at the very beginning and the very end of the document (i.e.
the first node's outerPre and the last node's outerPost) isn't
duplicated anywhere, nor is inner whitespace in content nodes.

The basic outline of the implementation is:
* When we encounter whitespace, strip it and store it in the previous
  node's outerPost. Also store it in nextWhitespace so we can put it in
  the next node's outerPre once we encounter that node.
* When we encounter whitespace in wrapped bare text, we don't know in
  advance if it's gonna be succeeded by more non-whitespace (in which
  case it needs to be output verbatim), or not (in which case it's
  leading whitespace and needs to be stripped and stored). The fact that
  annotations are nodes in HTML makes this trickier. So we write the
  whitespace to the temporary linmod and store it in wrappedWhitespace,
  then if it turns out to be trailing whitespace we take it back out of
  the data array and record it the usual way.
* Because text nodes can contain any combination of leading whitespace
  actual text and trailing whitespace, and because we may or may not
  already have opened a wrapping paragraph, there are a lot of different
  combinations to handle. We handle all of them but the resulting code
  is pretty dense and verbose.

More low-level list of changes:

In getDataFromDom():
* Added helper function addWhitespace() for storing whitespace for an
  element
* Added helper function processNextWhitespace() for processing any
  whitespace passed on from the previous node via the nextWhitespace var
* Rename paragraph to wrappingParagraph. Make wrapping default to
  alreadyWrapped so we can simplify wrapping||alreadyWrapped and
  !wrapping&&!alreadyWrapped. Add wrappingIsOurs to track whether the
  wrapping originated in this recursion level (needed for deciding when
  to close the wrapper).
* Add prevElement to track the previous element so we can propagate
  whitespace to it, and nextWhitespace so we can propagate whitespace to
  the next element.
* Remove previous newline stripping hacks
* Integrate the logic for wrapping bare content with the outer
  whitespace preservation code
* Remove wrapperElement, no longer needed because we have a dedicated
  variable for the wrapping paragraph now and what was previously inner
  whitespace preservation for wrapper paragraphs is now covered by the
  outer whitespace preservation code.

In getDomFromData():
* Reinsert whitespace where appropriate
** outerPre is inserted when opening the element
** This covers outerPost as well except for the last child's outerPost,
   which is handled as the parent's innerPost when closing the parent.
** innerPre and innerPost are inserted when closing the element. Care is
   taken not to insert these if they're duplicates of something else.
* Propagate each node's outerPost to the next node (either the next
  sibling or the parent) using parentDomElement.lastOuterPost. We can't
  get this using .lastChild because we will have destroyed that child's
  .veInternal by then, and we can't tell whether a node will be its
  parent's last child when we process it (all other processing,
  including first child handling is done when processing the node itself,
  but this cannot be).
* Special handling is needed for the last node's outerPost, which ends
  up in the container's .lastOuterPost property.

Tests:
* Allow .html to be null in data<->DOM converter tests. This indicates
  that the test is a one-way data->DOM test, not a DOM->data->DOM
  round-trip test. The data will be converted to HTML and checked
  against .normalizedHtml
* Update existing tests as needed
* Add tests for outer whitespace preservation and storage
* Add test for squashing of whitespace in case of disagreement (this
  requires .html=null)

Change-Id: I4db4fe372a421182e80a2535657af7784ff15f95
2012-08-23 19:08:00 -07:00
Catrope 53b8bcbd61 Merge "Bug 37904 - Show info in title of link tags" 2012-08-23 22:49:46 +00:00
Trevor Parscal ccc2248aa8 Bug 37904 - Show info in title of link tags
Internal links use the title, other links use the href

Change-Id: I1a1cfd70c222dd1d686b46cd702edf2e9d0e5bae
2012-08-23 15:21:20 -07:00
Trevor Parscal a06d8fdf21 Merge "Also strip ./ in addition to ../" 2012-08-23 22:02:22 +00:00
Christian Williams c011a5c08f Fixing enter to leave list
Pressing enter in an empty last list item should remove the list item and add a paragraph. Transaction was not being committed.

Change-Id: I0b173125d48f629eab923e051648d2036bb8956c
2012-08-23 14:34:36 -07:00
Catrope 3ed257a5d6 Also strip ./ in addition to ../
This is necessary because Parsoid is now prefixing all hrefs with ./

Change-Id: I18c4b7470cfa1dd174e25cc921bf7d4daf5ffc55
2012-08-23 14:29:43 -07:00
Catrope 8c0249bb89 Merge "Bug 37821 - Add support for oldid" 2012-08-23 21:18:37 +00:00
Inez Korczynski 06a5e30c72 Fix for method of retrieving anchor node in ve.ce.BranchNode.onSplice method.
In current implementation ve.ce.TextNode can be represented by more then one DOM node (TEXT_NODE and or ELEMENT_NODE) - for instance "Lorem <b>Ipsum</b> est" (TEXT, ELEMENT, TEXT).

Change-Id: I6530cbf1273ad1b1de3599c3eb929eb7abc2d59e
2012-08-23 13:34:09 -07:00
Trevor Parscal 5ee75fbbfd Merge "Set inspector container height and width to 0 on close." 2012-08-23 19:04:33 +00:00
Trevor Parscal fb09872781 Bug 37821 - Add support for oldid
* Added oldid param to the API
* Added oldId argument to ve.init.mw.ViewPageTarget
* Added redirect when saving an oldid page (which adds a new revision)
* Added venotify param to allow notifications even when redirected
* Added creation notification
* Added page title to saved/created notification

Change-Id: I9e957e6f5bc7920093481ffe3c33e299f87ce50a
2012-08-23 12:03:40 -07:00
Rob Moen f8a43c8776 Set inspector container height and width to 0 on close.
Addresses (Bug 38655)

Change-Id: I93076314bab521fdbc16c5441de4496c4d0b04de
2012-08-23 11:41:42 -07:00
Catrope 337b059e84 Merge "Cleaned up some CSS in ve.ui.Surface.css" 2012-08-23 18:05:19 +00:00
Trevor Parscal c6b1011931 Cleaned up some CSS in ve.ui.Surface.css
Got rid of some commented out code we aren't going to use and fixed the order of arguments to background position to x, y

Change-Id: I4e638c33b053dd916681dc91c8c0d7cff224375d
2012-08-23 11:02:31 -07:00
Trevor Parscal 9c782b29b3 Added monobook support
* Added style for monobook
* Added monobook to whitelisted skins
* Made ve.init.mw.ViewPageTarget resilliant to vector and monobook-like skins

Change-Id: Ia39e034229204ae5f1f70dce5d74c6c4db42277b
2012-08-23 11:01:20 -07:00
Catrope f948c359eb Merge "Bug 38902 - Error on onbeforunload" 2012-08-23 17:39:44 +00:00
Catrope 85d8d1cfa6 Merge "Bug 38857 - UserAgent blacklisting" 2012-08-23 17:31:06 +00:00
Trevor Parscal 9cbc2b0fb2 Bug 38902 - Error on onbeforunload
Just had to make sure the surface was still around before using it.

Change-Id: I13a2f02d256937b7da3aca3ad3c3404bd8f31244
2012-08-22 14:44:03 -07:00
Trevor Parscal b360437243 Bug 38857 - UserAgent blacklisting
Add ?vewhitelist to the URL to override this - useful when testing in a blacklisted browser.

Blacklist:
- msie < 9
- firefox < 11
- safari < 5
- chrome < 19
- opera *
- netscape *
- blackberry *

Change-Id: I6ebb3f7a7d56d395e5fe5c7c9129b606f97aeaab
2012-08-22 14:31:45 -07:00
Trevor Parscal 37b0b9a2f2 Bug 33175 - Copy dir and lang from #mw-content-text div to document
This resolves the content direction issues identified in bug 33175

Change-Id: Iaf61fb9e8ad0ba3ab70ffa00c75da4c6f01aad61
2012-08-22 14:01:38 -07:00
Catrope aae793537c Merge "Support for <center> tag" 2012-08-22 19:54:39 +00:00
Inez Korczynski 844df5c8e6 Support for <center> tag
Change-Id: I0d64561dd82b8377ee7491103e81569eaca22fee
2012-08-22 12:51:33 -07:00
Trevor Parscal d1a0d2f946 Merge "Fixing ve.log and ve.dir for IE" 2012-08-22 18:20:01 +00:00
Catrope 31fdb1044b Fix syntax error in 9d7f4e94b5
Change-Id: Ia063de19bf54cb32d4a72304f3289c6c7fa669ca
2012-08-22 11:14:23 -07:00
Catrope 31bf0ea1f8 Merge "Fix ve.ce.getDomText to work with <br/> tags by making it skip not contenteditable=false but all leaf nodes." 2012-08-22 18:09:30 +00:00
Inez Korczynski 9920fb0725 Fix ve.ce.getDomText to work with <br/> tags by making it skip not contenteditable=false but all leaf nodes.
Change-Id: I9e728e091a3021840dac07e9601fc764e7750c49
2012-08-22 11:08:11 -07:00
Catrope 487a64c3f0 Merge "Floating toolbar fixes" 2012-08-22 18:07:23 +00:00
Christian Williams 2ad6577713 Fixing ve.log and ve.dir for IE
Change-Id: Ieee1aec3e6ea45f3eecdea53e3691ebe19306a33
2012-08-22 11:04:10 -07:00