Commit graph

2097 commits

Author SHA1 Message Date
Rob Moen 4613707909 re: AnnotationSet, fix JS error in getFirstLinkAnnotation.
Change-Id: I6a3cb4eb2164bf1c4c8f715e42117ac06cccac04
2012-09-24 17:16:10 -07:00
Catrope 5075d79c4b Merge "Regression fix, clearing only link annotations when creating link." 2012-09-24 22:06:00 +00:00
Rob Moen d5d44df053 Regression fix, clearing only link annotations when creating link.
Clearing only existing selected links when:
1) Creating a link
2) Pressing clear button

Change-Id: I4b1bcd9a3ac177b2f9b4af2d562d4c4fec09d5c5
2012-09-24 15:03:53 -07:00
Catrope 31fc2dc2b4 Merge "re: AnnotationSet, annotationButtonTool properly clears annotation." 2012-09-24 22:00:26 +00:00
Rob Moen 7be9f92de7 re: AnnotationSet, annotationButtonTool properly clears annotation.
Surface model annotate method previously cleared basic tool annotation objects.
Now that bold and other annotations have htmlAttributes from parsoid,
we must gather annotations by type from selection and iterate through
to properly clear.

Change-Id: Id53bf5733078524ae5aac376e01b9679eb8c32df
2012-09-24 14:58:55 -07:00
Krinkle a5a745de69 Merge "ve.dm.SurfaceFragment: Implement wrapNodes and wrapAllNodes" 2012-09-24 19:11:35 +00:00
Trevor Parscal eabe5e6f61 ve.dm.SurfaceFragment: Implement wrapNodes and wrapAllNodes
Change-Id: I378f0aad0286a6c90adeb4602a57d6617154e8b6
2012-09-24 21:11:16 +02:00
Krinkle db2c44ef2d Merge "Added CSS rules back in to put the menu above/below" 2012-09-24 01:56:26 +00:00
Trevor Parscal bee50ae84f Merge "Use inspector specific icon css files vs entire icon set css." 2012-09-21 22:49:01 +00:00
Krinkle 7b15b24496 Merge "Added missing annotation types to domElementTypes array" 2012-09-21 02:02:55 +00:00
Krinkle 717edd5ed4 Merge "Whitespace and comments" 2012-09-21 01:55:53 +00:00
Rob Moen ff1fc7ef08 Use inspector specific icon css files vs entire icon set css.
Change-Id: I9c519abc478ac22976a8d86aac461d90c92c8a57
2012-09-19 17:16:05 -07:00
Trevor Parscal 71f91dd92c Added CSS rules back in to put the menu above/below
Change-Id: I34d9031c04bed4944d2b3cd184fed021fc31d4a9
2012-09-19 12:37:06 -07:00
Trevor Parscal f2454bab68 Merge "Optimize UI tool state updates." 2012-09-19 19:34:29 +00:00
Rob Moen 96d97c2aa8 Optimize UI tool state updates.
Rather than each tool requesting annotations, and nodes pertaining to selection,
Emitted event supplies annotations and nodes to each tool's update method.

Using select vs. of traverseLeafNodes for code optimization.
Better documentation for updateTools()

Removed unneeded code.

Change-Id: I7c0baa1cc0f7fb731d6e28b175a76e931e9e2961
2012-09-19 11:16:10 -07:00
Trevor Parscal daa7e76807 Merge "Add a node type for meta nodes" 2012-09-18 18:15:46 +00:00
Trevor Parscal 944228aec7 Whitespace and comments
* Added documentation for ve.AnnotationSet
* Replaced uses of "// Inheritance" with "// parent Constructor"
* Added "// Mixin constructor" where needed
* Added missing section comments like "/* Static Methods */"
* Cleaned up excessive newlines (matching /\n\n\n/g)
* Put unnecessarily multi-line statements on a single line

Change-Id: I2c9b47ba296f7dd3c9cc2985581fbcefd6d76325
2012-09-17 16:53:03 -07:00
Trevor Parscal adda2b85c3 Merge "Documentation & clean up" 2012-09-17 23:21:49 +00:00
Timo Tijhof ab7d6bf082 Documentation & clean up
* Commands for Sublime:

  Find*: "(\* @[a-z]+) ([^{].*) \{(.*)\}"
  Replace: "$1 {$3} $2"

  Save all && Close all

  Find: " function("
  Replace: " function ("

  Save all && Close all

  Find: "Intialization"
  Replace: "Initialization"

  Save all && Close all

* Consistent use of types (documented in CODING.rm):
  - Merged {Integer} into {Number}.
  - Merged {DOM Node} into {DOMElement}.

* Remove work-around /*jshint newcap: false */ from ve.js
  Calling Object() as a function to to use the internal
  toObject no longer throws a newcap warning in JSHint.
  It only does that normal functions now .

  (e.g. var a = Cap(); or var a = new uncap();)

* Add missing annotations (@static, @method, ..).

* Remove unused variables

* Remove null-assignments to variables that should just be
  undefined. There's a few variables explicitly set to null
  whereas they are set a few lines under and not used otherwise
  (e.g. 'tx' in ve.ce.Surface.prototype.onPaste)

Change-Id: I0721a08f8ecd93c25595aedaa1aadb0e08b83799
2012-09-17 16:02:52 +02:00
Rob Moen df4391bc69 (bug 38548) Switch undo / redo buttons for RTL.
Rename the graphic files to more generic names to make them
flippable by CSSJanus.

Change-Id: Ide2540f2f281367909f7f2c7943c9106c0b36699
2012-09-16 08:39:18 -07:00
Krinkle 4edc76ab79 Merge "(Bug 33094) Disallow invalid page titles in LinkInspector." 2012-09-14 12:53:58 +00:00
Rob Moen 442a8358ea (Bug 33094) Disallow invalid page titles in LinkInspector.
Detecting page status in a similar way as WikiEditor inspector.
Disabled accept button now behaves appropriately.
Accept button status is now evaluated on enter or submit.

Change-Id: Ibfef6ffd87cb9a71e37242d6214d0f8e3af2e2c0
2012-09-14 14:51:26 +02:00
Siebrand ed66eb7a05 Merge "Revert "Added 'bytes' remaining to edit summary dialog."" 2012-09-11 20:57:39 +00:00
Siebrand a218baa8c9 Revert "Added 'bytes' remaining to edit summary dialog."
This reverts commit 75c0cdbd38
2012-09-11 20:57:21 +00:00
Reedy 4bff9bb2dc Merge "Added 'bytes' remaining to edit summary dialog." 2012-09-11 20:34:18 +00:00
Rob Moen 75c0cdbd38 Added 'bytes' remaining to edit summary dialog.
Addresses (Bug 40035)

Change-Id: Iad94ea32b62aef2e1875fa2709b6303b88c9c137
2012-09-11 12:34:19 -07:00
Trevor Parscal 80f266d582 Merge "Hiding inspector iframe by additionally setting height and width to 0." 2012-09-11 19:24:10 +00:00
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
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 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