Commit graph

2704 commits

Author SHA1 Message Date
Trevor Parscal c39c788105 Added missing annotation types to domElementTypes array
Change-Id: I595bce18c4a18397fdb7c91b4b033cad40e57008
2012-09-11 11:40:59 -07:00
Rob Moen 2e3821804f Pressing enter key in edit summary no longer submits save form.
Fixes (Bug 40034)

Change-Id: I5b1cca3dc97686982b8dde907c827dc6e031c312
2012-09-11 09:33:07 -07:00
Catrope 7b96fbe3d2 Add a node type for meta nodes
This node type represents <meta> or <link> (transparently, based on the
style attribute). I had to make two node types for this and hack the
toData conversion code directly into ve.dm.Converter, because we don't
have native support for node types that can be both inline and block.
(We should add this in the node API rewrite.)

The CE implementation renders a placeholder (with the same styles as an
alien node) right now. I'm not sure how nice that is, but it's better
than rendering raw <meta>/<link> tags.

This whole thing is a total pile of hacks to make VE deal with
<meta>/<link> tags until we have a proper node types API.

Change-Id: Id6783fcfc35a896db088ff424ff9faaabcaff716
2012-09-10 15:35:30 -07:00
Rob Moen 231f8b6a5d Hiding inspector iframe by additionally setting height and width to 0.
Addresses iframe bug regression

Change-Id: I498b793277fcfaeca15adffc9f33c31734dade93
2012-09-10 12:20:37 -07:00
Translation updater bot 8a725f8f92 Localisation updates from http://translatewiki.net.
Change-Id: I24aab36d264b542380c0a494c659f7f662eb6aee
2012-09-08 19:02:28 +00:00
Trevor Parscal 4cdce88b9a Merge "Fixed multiple bugs with Context Icon appearing when not relevant." 2012-09-07 23:12:31 +00:00
Rob Moen bcaab3332e Fixed multiple bugs with Context Icon appearing when not relevant.
Icon appears when scrolling and resizing window.
	Instead of always setting the context on scroll and resize, bind to the
	updateContextIcon method.
Icon appears when selecting a non content data offset.
	Changed logic to show icon changed to content length vs range difference.

Move Link inspector getSelectionText to ve.dm.document getText.
Rationale, more bits of the code depend on evaluating content.
Added new ve.Range truncate method.
Remove getSelectionText, using truncate range & document.getText instead.

Change-Id: Ibd3e99c923f18d2c96a86d92e74e2e9ebd49c85f
2012-09-07 16:12:14 -07:00
Catrope dcc26f09fd Merge "Added links to annotation set classes for demo" 2012-09-07 22:28:39 +00:00
Trevor Parscal 85cf55e487 Merge "Fix bugs in whitespace preservation for aliens" 2012-09-07 22:28:05 +00:00
Translation updater bot 992353b3a6 Localisation updates from http://translatewiki.net.
Change-Id: I07696c01128e9b21755b5f279bc03ca8898e1ca0
2012-09-07 22:26:50 +00:00
Trevor Parscal 818fdd8b52 Added links to annotation set classes for demo
Change-Id: I1584eb22a177871d1f18761cf4ec35d8961b2b91
2012-09-07 15:26:24 -07:00
Catrope c6cb537f1a Fix bugs in whitespace preservation for aliens
This was broken in three different ways:
* On the way in, we were applying whitespace to an array of elements
  rather than the actual element, so the whitespace wasn't stored.
* Whitespace processing on the way out was skipped for aliens because
  they had their own code path. Refactored this so alien openings and
  regular openings share much more code, including whitespace output.
* Somewhat unrelatedly, innerPost output was broken for paragraphs
  containing inline elements, because the inline elements' processing
  polluted lastOuterPost. Discovered this because my test with inline
  aliens also happened to be the first test of whitespace preservation
  in paragraphs with inline content elements. Fixed by explicitly
  skipping content nodes when outputting whitespace.

Fixed these issues and added a test case.

Change-Id: I8edb61a008e60ace886b1a841b3417682ec39c32
2012-09-07 15:17:28 -07:00
Trevor Parscal 4659557fef Merge "(bug 39753) UI restores #toc as inline-block instead of table." 2012-09-07 22:01:44 +00:00
Catrope 74ed8e8766 Rename ve_foo_bar back to VeFooBar per discussion
Change-Id: Ibf6d4f08c4761727b2e3952a76e474c8221b38f9
2012-09-06 16:15:55 -07:00
Timo Tijhof 9fb43b6aeb (bug 39753) UI restores #toc as inline-block instead of table.
* Follows-up 656439240d

Change-Id: I57532e556eafe783c8638b25fce502a158597c97
2012-09-07 01:13:04 +02:00
Trevor Parscal e3375e8f23 Merge "Fix global scope leakage in the Transaction tests" 2012-09-06 22:51:55 +00:00
Catrope d43fffc2d2 Fix global scope leakage in the Transaction tests
Change-Id: I9283acb6179d0be84dadca8ad4e58d5cdd6e3bae
2012-09-06 15:47:33 -07:00
Catrope ef27a4b2b1 Fix order-of-annotation tests for hrefPrefix
Change-Id: I9fffad6cd0b186a070fec34fd0f827a5875a5d67
2012-09-06 15:40:41 -07:00
Timo Tijhof b1d9c83b5d Object management: Object create/inherit/clone utilities
* For the most common case:
  - replace ve.extendClass with ve.inheritClass (chose slightly
    different names to detect usage of the old/new one, and I
    like 'inherit' better).
  - move it up to below the constructor, see doc block for why.

* Cases where more than 2 arguments were passed to
  ve.extendClass are handled differently depending on the case.

  In case of a longer inheritance tree, the other arguments
  could be omitted (like in "ve.ce.FooBar, ve.FooBar,
  ve.Bar". ve.ce.FooBar only needs to inherit from ve.FooBar,
  because ve.ce.FooBar inherits from ve.Bar).

  In the case of where it previously had two mixins with
  ve.extendClass(), either one becomes inheritClass and one
  a mixin, both to mixinClass().

  No visible changes should come from this commit as the
  instances still all have the same visible properties in the
  end. No more or less than before.

* Misc.:
 - Be consistent in calling parent constructors in the
   same order as the inheritance.
 - Add missing @extends and @param documentation.
 - Replace invalid {Integer} type hint with {Number}.
 - Consistent doc comments order:
   @class, @abstract, @constructor, @extends, @params.
 - Fix indentation errors
   A fairly common mistake was a superfluous space before the
   identifier on the assignment line directly below the
   documentation comment.
   $ ack "^ [^*]" --js modules/ve
 - Typo "Inhertiance" -> "Inheritance".
 - Replacing the other confusing comment "Inheritance" (inside
   the constructor) with "Parent constructor".
 - Add missing @abstract for ve.ui.Tool.
 - Corrected ve.FormatDropdownTool to ve.ui.FormatDropdownTool.js
 - Add function names to all @constructor functions. Now that we
   have inheritance it is important and useful to have these
   functions not be anonymous.

   Example of debug shot: http://cl.ly/image/1j3c160w3D45

   Makes the difference between

   < documentNode;
   > ve_dm_DocumentNode
     ...
     : ve_dm_BranchNode
       ...
       : ve_dm_Node
         ...
         : ve_dm_Node
           ...
           : Object
             ...

   without names (current situation):

   < documentNode;
   > Object
     ...
     : Object
       ...
       : Object
         ...
         : Object
           ...
           : Object
             ...

   though before this commit, it really looks like this
   (flattened since ve.extendClass really did a mixin):

   < documentNode;
   > Object
     ...
     ...
     ...

   Pattern in Sublime (case-sensitive) to find nameless
   constructor functions:
   "^ve\..*\.([A-Z])([^\.]+) = function \("

Change-Id: Iab763954fb8cf375900d7a9a92dec1c755d5407e
2012-09-06 15:29:31 -07:00
Timo Tijhof 831f2f5cb1 Shared closure around utility functions in ve.js
In preparation of pushing the object-management branch, which
will need more shared variables (for efficiency) creating
a shared closure. To avoid a spegetti of immediately-invoked
functions that return functions (like ve.getObjectValues and
ve.getObjectKeys).

Less duplication of code and faster execution.

First I had the closure around it as-is but then I figured it'd
be faster to have a local reference to ve (instead of having to
go through implied globals for references to other ve.*)

So I made it a local variable and then exposed it. That way
anything inside referring to each other stays within the same
scope.

Review with ignore-whitespace for clarity.

Change-Id: I415d8635db6d82cf239f0364ccc2d63a61bd5a6d
2012-09-06 15:29:26 -07:00
Trevor Parscal 64209467df Merge "Alienate everything with an unrecognized mw: type." 2012-09-06 21:57:00 +00:00
Trevor Parscal c25e237620 Merge "Also add clone functionality, undefined guard and tests to ve.copyObject()" 2012-09-06 21:53:05 +00:00
Catrope debc429a9f Also add clone functionality, undefined guard and tests to ve.copyObject()
Change-Id: I84ca938cbedf93bfd1c73da16bf9d0d96b3bc749
2012-09-06 14:52:41 -07:00
Catrope 742a97b410 Add tests asserting ordering of annotations works
Change-Id: Iada85b95914a8728ca809ebab9a42723c1e7a02c
2012-09-06 14:43:13 -07:00
Catrope 5e7c14c868 Manage annotations in ve.AnnotationSet object
Introduced the ve.AnnotationSet class to manage sets of annotations. This
is a generalization of ve.OrderedHashSet, a class that manages a set
using an array and an object keyed by hash.

Converted everything that stores, tracks or passes around annotations to
use ve.AnnotationSet. In particular, this means the linear model now
contains AnnotationSets instead of hash-keyed objects.

This allows us to maintain the order of annotations in the linear model,
and will help fix bugs with annotation ordering and splitting.

Change-Id: I50975b0a95f4cc33017a0b59fdede9ed1eff0124
2012-09-06 14:39:38 -07:00
Trevor Parscal efa8a33559 Merge "Plug new vector icons / styles into inspector iframe." 2012-09-06 21:13:43 +00:00
Catrope e14d30f3cc Alienate everything with an unrecognized mw: type.
Currently this is done in a hacky way because we don't have a real
registry of RDFa types for node types, so we just hardcode the list of
recognized types (only links currently).

Change-Id: I5afcc55701fc6fa0ee2a360dcf5ca62b065292f5
2012-09-06 13:33:20 -07:00
Timo Tijhof d660d203ea (bug 39558) Implement byteLimit
* Also clean up ve.init.mw.ViewPageTarget...setupSaveDialog
  Consistently use viewPage instead of 'this' inside this
  function. The reason it is locally aliased is because there is
  other 'this'es used here. Using them mixed is even more
  confusing.
- No need for ve.bind, other handlers in this function also
  just use viewPage instead of binding this.

Change-Id: I25e93862a39134961bf80835f46cbf531d8109e0
2012-09-06 02:54:43 +02:00
Rob Moen 3331b16b3f Plug new vector icons / styles into inspector iframe.
Change-Id: Ibd5227de6b74c51f31093e64a4404d5830e84a4e
2012-09-05 17:15:20 -07:00
Trevor Parscal 1df15237fb Merge "Convert the last two uses of $.toJSON to ve.getHash" 2012-09-05 22:52:00 +00:00
Trevor Parscal 3e9eed623c Expanded isSomethingFishy function
No need to declare the function inline and then run the function 2x on the same data

Change-Id: I41c57f2aa6e38316edb54dd0c7ebb5726d83ebcf
2012-09-05 13:46:32 -07:00
Timo Tijhof 71020f7175 Remainder JSHint fixes on modules/ve/*
[jshint]
ce/ve.ce.Surface.js: line 670, col 9, Too many var statements.
ce/ve.ce.Surface.js: line 695, col 6, Missing semicolon.
ce/ve.ce.Surface.js: line 726, col 22, Expected '===' and instead saw '=='.
ce/ve.ce.Surface.js: line 726, col 41, Expected '===' and instead saw '=='.
ce/ve.ce.Surface.js: line 733, col 13, Too many var statements.
ce/ve.ce.Surface.js: line 734, col 24, Expected '===' and instead saw '=='.
ce/ve.ce.Surface.js: line 1013, col 13, Too many var statements.
ce/ve.ce.Surface.js: line 1019, col 17, Too many var statements.
ce/ve.ce.Surface.js: line 1023, col 18, Too many ar statements.
ce/ve.ce.Surface.js: line 1027, col 13, Too many var statements.
dm/annotations/ve.dm.LinkAnnotation.js: line 70, col 52, Insecure '.'.
dm/ve.dm.Converter.js: line 383, col 29, Empty block.
dm/ve.dm.Converter.js: line 423, col 33, Empty block.

Commands:
 * jshint .
 * ack '(if|else|function|switch|for|while)\('
 * Sublime Text 2:
   Find(*): (if|else|function|switch|for|while)\(
   Replace: $1 (
 * ack '  ' -Q # double spaces, except in certain comments

Change-Id: I8e34bf2924bc8688fdf8acef08bbc4f6707e93be
2012-09-05 13:45:09 -07:00
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
Translation updater bot e7d3dac1b9 Localisation updates from http://translatewiki.net.
Change-Id: I8e40afc93c7cde4b7814b11f5c967195f491ff46
2012-09-01 20:48:18 +00: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 2d36ce9465 Convert the last two uses of $.toJSON to ve.getHash
Change-Id: Iff033590a6033a8de88dc571481442a819146c90
2012-08-30 17:29:54 -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
Translation updater bot 3d47dca9e7 Localisation updates from http://translatewiki.net.
Change-Id: Ibfa61b9fa71e39ba49da7e8d7aa219e09068d8e1
2012-08-30 19:43:08 +00:00
Translation updater bot 483a2ae2a6 Localisation updates from http://translatewiki.net.
Change-Id: Ia754b201c3972aea20f224a2698c611da585066e
2012-08-29 19:24:26 +00: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