Commit graph

394 commits

Author SHA1 Message Date
Krinkle 717edd5ed4 Merge "Whitespace and comments" 2012-09-21 01:55:53 +00: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
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 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
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
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 74ed8e8766 Rename ve_foo_bar back to VeFooBar per discussion
Change-Id: Ibf6d4f08c4761727b2e3952a76e474c8221b38f9
2012-09-06 16:15:55 -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
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 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
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
Christian Williams ac7376c8d6 Catching transactions that were not being committed.
Change-Id: Ic75b07f279e4db30f6730f10b31c66d506cb94e8
2012-08-24 15:10:29 -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
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
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
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
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
Christian Williams 9d7f4e94b5 IE triggers keyPress for Esc. We should not delete selected text when this keyPress happens.
Change-Id: I8028ba960d7e7ea15e56701850cd214bacc6a232
2012-08-20 17:39:33 -07:00
Trevor Parscal fcf4e53f14 Merge "Fix JS error about out-of-bounds selection setting" 2012-08-20 17:01:15 +00:00
Trevor Parscal 1a57e1a361 Merge "Handle uneditable nodes in ve.ce.getDomText()" 2012-08-20 16:58:13 +00:00
Trevor Parscal 277b0dce58 Merge "Switching proxy to bind" 2012-08-18 00:29:02 +00:00
Christian Williams 0790a3b470 Switching proxy to bind
This enables keyboard combos like alt-backspace and control-delete

Change-Id: I9a191977ae4ec824a9778a875e8abb706fc96a84
2012-08-17 17:27:38 -07:00
Catrope 2f31681922 Handle uneditable nodes in ve.ce.getDomText()
There is a TODO about this but these were never handled. This lack of
handling caused weird offset issues when editing paragraphs containing
inline aliens, because the text of the inline alien was returned.
Instead, return an appropriate number of characters so the offset logic
keeps working.

Removed the textContent||innerText code because it would bypass the
uneditable node logic: paragraphNode.textContent would return the text
of the entire paragraph (including any aliens), and we'd never descend
into the paragraph to reach the alien node.

Change-Id: Ia05755755dd5380cb9a0b5a0334c6721b4e0d3b7
2012-08-17 17:21:15 -07:00
Catrope 961d5e77ac Fix JS error about out-of-bounds selection setting
Don't try to restore the selection after the removal part of
onContentChange, because the removal may have caused that selection to
now be out of bounds. We also don't need to set the selection there at
all, because the insertion does it anyway (where it is safe).

Change-Id: I7b340b18dd8efc77d1df78007161720c29866cb6
2012-08-17 17:19:00 -07:00
Catrope f5bdf9d4f9 Fix JS error for inline aliens
The error occurred after pressing backspace in a paragraph that
contained an alienInline node (or other inline node). It happened
because ve.ce.BranchNode.clean() called this.$.empty(), which destroyed
all element data in the paragraph's children, including the
.data('node') property which associates the DOM node with the CE tree
node. Use .detach() instead.

Change-Id: I563c936a706a1d1711e6333404c6ca8e6ebf8eeb
2012-08-17 15:36:20 -07:00
Trevor Parscal d147504f49 Added support for apex skin
* Made vector specific styles only active in the vector skin
* Added apex specific styles
* Removed override of text size for document node
* Added stylesheet for stand-alone to specify text size for document node

Change-Id: I8a57918912499f9453a5692ff45a04a16ed34cde
2012-08-15 16:35:52 -07:00
Catrope 5b804df40f SimpleWikiLink is no longer used by Parsoid, remove it from VE
Change-Id: I7f19304dc8bd6819992756a704e215d31f8b2e7e
2012-08-13 18:05:10 -07:00
Trevor Parscal ea0467fb0e Merge "Refactor ve.js utilities and improve documentation" 2012-08-13 03:24:43 +00:00
Timo Tijhof f06952f2f3 Refactor ve.js utilities and improve documentation
Refactor:
* ve.indexOf
  Renamed from ve.inArray.
  This was named after the jQuery method which in turn has a longer
  story about why it is so unfortunately named. It doesn't return
  a boolean, but an index. Hence the native method being called
  indexOf as well.

* ve.bind
  Renamed from ve.proxy.
  I considered making it use Function.prototype.bind if available.
  As it performs better than $.proxy (which doesn't use to the native
  bind if available). However since bind needs to be bound itself in
  order to use it detached, it turns out with the "call()" and
  "bind()"  it is slower than the $.proxy shim:
  http://jsperf.com/function-bind-shim-perf
  It would've been like this:
  ve.bind = Function.prototype.bind ?
      Function.prototype.call.bind( Function.prototype.bind ) :
      $.proxy;
  But instead sticking to ve.bind = $.proxy;

* ve.extendObject
  Documented the parts of jQuery.extend that we use. This makes it
  easier to replace in the future.

Documentation:
* Added function documentation blocks.
* Added annotations to  functions that we will be able to remove
  in the future in favour of the native methods.
  With "@until + when/how".
  In this case "ES5". Meaning, whenever we drop support for browsers
  that don't support ES5. Although in the developer community ES5 is
  still fairly fresh, browsers have been aware for it long enough
  that thee moment we're able to drop it may be sooner than we think.
  The only blocker so far is IE8. The rest of the browsers have had
  it long enough that the traffic we need to support of non-IE
  supports it.

Misc.:
* Removed 'node: true' from .jshintrc since Parsoid is no longer in
  this repo and thus no more nodejs files.
 - This unraveled two lint errors: Usage of 'module' and 'console'.
   (both were considered 'safe globals' due to nodejs, but not in
   browser code).

* Replaced usage (before renaming):
 - $.inArray -> ve.inArray
 - Function.prototype.bind -> ve.proxy
 - Array.isArray -> ve.isArray
 - [].indexOf -> ve.inArray
 - $.fn.bind/live/delegate/unbind/die/delegate -> $.fn.on/off

Change-Id: Idcf1fa6a685b6ed3d7c99ffe17bd57a7bc586a2c
2012-08-12 20:32:45 +02:00
Catrope d93b82347b Clean up a few commas and some indentation
The commas were resulting from converting this:
var foo = 3,
	bar = 5;

to this:

foo = 3,
bar = 5;

Change-Id: I0223b34a30d947c6a51f0601727b0c3850239e66
2012-08-10 16:49:14 -07:00
Catrope 5d974ed1e1 Fix replaceNonBreakingSpace() to not modify the linear model
It was replacing spaces with &nbsp;s in its copy of a slice of linmod
data, but the copy was a shallow copy, so when modifying annotated
spaces it would modify the actual data. Fixed by detecting this case and
cloning the character's array before modifying it.

Change-Id: Ic96ed34605a302af18f274a0faa6d0f650f5b771
2012-08-10 15:47:13 -07:00
Trevor Parscal fed1a98dd7 Fixed reversal of next and previous polling results
Change-Id: I504040044721603ae48a844e3f78d735f2c3159d
2012-08-10 14:06:18 -07:00
Catrope 946a7e64d6 Rename external link RDFa types to keep up with Parsoid
Change-Id: Ie232a575339a16431cbd1ee216998d1f6bf52d78
2012-08-10 10:15:05 -07:00
Catrope baf965fc50 Merge "Make use of new jshint options" 2012-08-10 01:43:25 +00:00
Timo Tijhof 23c5b0d02c Make use of new jshint options
* Restricting "camelcase":
  No changes, we were passing all of these already

* Explicitly unrestricting "forin" and "plusplus"
  These are off by default in node-jshint, but some distro of jshint
  and editors that use their own wrapper around jshint instead of
  node-jshint (Eclipse?) may have different defaults. Therefor
  setting them to false explicitly. This also serves as a reminder
  for the future so we'll always know we don't pass that, in case
  we would want to change that.

* Fix order ("quotemark" before "regexp")

* Restricting "unused"
  We're not passing all of this, which is why I've set it to false
  for now. But I did put it in .jshintrc as placeholder.
  I've fixed most of them, there's some left where there is no clean
  solution.

* While at it fix a few issues:
 - Unused variables ($target, $window)
 - Bad practices (using jQuery context for find instead of creation)
 - Redundant /*global */ comments
 - Parameters that are not used and don't have documentation either
 - Lines longer than 100 chars @ 4 spaces/tab

* Note:
 - ve.ce.Surface.prototype.onChange takes two arguments but never
   uses the former. And even the second one can be null/undefined.
   Aside from that, the .change() function emits
   another event for the transaction already. Looks like this
   should be refactored a bit, two more separated events probably
   or one that is actually used better.
 - Also cleaned up a lot of comments, some of which were missing,
   others were incorrect
 - Reworked the contentChange event so we are no longer using the
   word new as an object key; expanded a complex object into multiple
   arguments being passed through the event to make it easier to work
   with and document

Change-Id: I8490815a508c6c379d5f9a743bb4aefd14576aa6
2012-08-10 02:50:30 +02:00
Trevor Parscal 522eb08fdc Removing redundant overrides for canHaveSlug* methods
Change-Id: I2bfd08eab1cd45a193d91540bc0602549884fa89
2012-08-09 14:53:08 -07:00
Trevor Parscal 5752b3fb72 Merge "Add ve.dm.BreakNode to represent <br>" 2012-08-09 21:50:41 +00:00
Catrope 625161e35c Add ve.dm.BreakNode to represent <br>
Change-Id: I3825199c3c8cbe3b50c01e03f39f20cef7c55a28
2012-08-09 14:50:25 -07:00
Trevor Parscal d8ee3c2c29 After much research on error objects, native = good, custom = bad
Stack traces, line numbers, etc. All the approaches I've seen are bad hacks. This is the best way to go.

Change-Id: Ib12e9d2ecfe610bcc89d046005e35cc13efa3d99
2012-08-08 10:48:53 -07:00
Trevor Parscal b4de3ead08 Throw ve.Error instead of string literals
Throwing strings is bad because it doesn't include a lot of important
information that an error object does, such as a stack trace or where
the error was actually thrown from.

ve.Error inherits directly from Error. In the future we may create
more specific subclasses and/or do custom stuff.

Some interesting reading on the subject:
* http://www.devthought.com/2011/12/22/a-string-is-not-an-error/

Change-Id: Ib7c568a1dcb98abac44c6c146e84dde5315b2826
2012-08-08 06:19:00 +02:00
Trevor Parscal 255ce870e2 Puttin' em white-spacers where they aught'a be
function() -> function ()
){ -> ) {

Change-Id: I20a85fcf79d7aec64f7f2559e84c0279550d4eea
2012-08-06 18:52:19 -07:00
Trevor Parscal 13ccb68ae1 Cleanup - all jshint conditions are now met
Also:
* Removed a lot of dead code in Surface that was used in the now dead and gone sandbox.
* Changed from throwing an exception when calling getBalancedData on a range that produces no results from selectNodes to just returning []

Change-Id: Icf27094724eae5b90eec21308f9e26afe877e3ee
2012-08-03 18:56:04 -07:00
Catrope 47f08a0613 Merge "Fixed problem with closing context menu on document blur." 2012-08-01 01:06:42 +00:00
Rob Moen 69ee22fb39 Fixed problem with closing context menu on document blur.
When editor surface loses focus, now checking to see if an inspector
is set or a menu is open prior to closing the context.

This ruling ensures more rational context icon / child menu behavior.

Change-Id: Ic4b74bb51e811e264a2109a3c1c5a8ae503a8c49
2012-07-31 18:02:44 -07:00
Timo Tijhof 077e21867e Kranitor #3: jQuerlyfornication ft. The Cascaders
* Classicifation (JS)
 Use addClass instead of attr( 'class' ) whenever possible.
 addClass will manipulate the properties directly instead of
 (re-)setting an attribute which (most) browsers then sync
 with the properties.

 Difference between:
 elem.className
 and
 elem.setAttribute( 'class', .. );

 Just like .checked, .value, .disabled and other interactive
 properties, the HTML attributes should only be used for initial
 values from the html document. When in javascript, only set
 properties. Attributes are either ignored or slow.

* Styling (JS)
 Use .css() instead of attr( 'style' ).

 Again, setting properties instead of attributes is much faster,
 easier and safer. And this way it takes care of cross-browser
 issues where applicable, and less prone to error due to dealing
 with key-value pairs instead of css strings.

 Difference between:
 elem.style.foo = 'bar';
 and
 elem.setAttribute( 'style', 'foo: bar;' );

* Finding (JS)
 Use .find( 'foo bar' ) instead of .find( 'foo' ).find( 'bar' ).
 It is CSS!

* Vendor prefixes (CSS)
 It is important to always list newer (standards-compliant) versions
 *after* the older/prefixed variants.

 See also http://css-tricks.com/ordering-css3-properties/

 So the following three:
 -webkit-gradient (Chrome, Safari 4)
 -webkit-linear-gradient (Chrome 10, Safari 5+)
 linear-gradient (CSS3 standard)

 ... must be in that order.

 Notes:
  - "-moz-opacity" is from before Mozilla 1.7 (Firefox < 0.8)
    Has not been renamed to "opacity" since Firefox 0.9.
  - Removed redundant "-moz-opacity"
  - Added "filter: alpha(opacity=**);" where missing
  - Fixed order of css3 properties (old to new)
  - Add standardized css3 versions where missing
    (some 'border-radius' groups didn't have the non-prefixed version)
  - Spacing
  - @embed
  - Shorten hex colors where possible (#dddddd -> #ddd)
    $ ack '#([0-9a-f])\1{5}' --css
    $ ack '#([0-9a-f])\1{2};' --css

Change-Id: I386fedb9058c2567fd0af5f55291e9859a53329d
2012-07-28 13:05:57 -07:00
Trevor Parscal 1639b78df7 Merge "Bug 36200 - VisualEditor: Sticky selection popup" 2012-07-27 21:49:39 +00:00
Timo Tijhof 88f6089952 Kranitor #1: On-boarding
'''Kranitor commits''' are commits by Krinkle with his janitor hat on.
Must never contain functional changes mixed with miscellaneous changes.

.gitignore:
 * Add .DS_Store to the ignore list so that browsing the directories
   on Mac OS X, will not add these files to the list of untracked
   files.
 * Fix missing newline at end of file

.jshintrc
 * raises -> throws
 * +module (QUnit.module)
 * remove 'Node' (as of node-jshint 1.7.2 this is now part of
   'browser:true', as it should be)

Authors:
 * Adding myself

MWExtension/VisualEditor.php
 * Fix default value of wgVisualEditorParsoidURL to not
   point to the experimental instance in WMF Labs.

Issues:
 * ve.ce.TextNode:
  - Fix TODO: Don't perform a useless clone of an already-jQuerified object.
  - Use .html() to set html content instead of encapsulating between
    two strings. This is slightly faster but more importantly safer,
    and prevents situations where the resulting jQuery collection
    actually contains 2 elements instead of 1, thus messing up
    what .contents() is iterating over.
 * ve.ce.Document.test.js
  - Fix: ReferenceError: assert is not defined
 * ve.dm.Document.test.js
  - Fix: ReferenceError: assert is not defined
 * ve.dm.Transaction.test.js
  - Fix: ReferenceError: assert is not defined
 * ve.dm.TransactionProcessor.test.js
  - Fix: ReferenceError: assert is not defined
 * ext.visualEditor.viewPageTarget
  - Missing dependency on 'mediawiki.Title'

Code conventions / Misc cleanup
 * Various JSHint warnings.
 * Whitespace
 * jQuery(): Use '<tag>' for element creation,
   use '<valid><xml/></valid>' for parsing
 * Use the default operator instead of ternary when the condition and
   first value are the same.
   x = foo ? foo : bar; -> x = foo || bar;
   Because contrary to some programming language (PHP...), in JS the
   default operator does not enforce a boolean result but returns the
   original value, hence it being called the 'default' operator, as
   opposed to the 'or' operator.
 * No need to call addClass() twice, it takes a space-separated list
   (jQuery splits by space and adds if needed)
 * Use .on( event[, selector], fn ) instead of the deprecated
   routers to it such as .bind(), .delegate() and .live().
   All these three are now built-in and fully compatible with .on()
 * Add 'XXX:' comments for suspicious code that I don't want to change
   as part of a clean up commit.
 * Remove unused variables (several var x = this; where x was not
   used anywhere, possibly from boilerplate copy/paste)
 * Follows-up Trevor's commit that converts test suites to the new
   QUnit format. Also removed the globals since we no longer use those
   any more.

Change-Id: I7e37c9bff812e371c7f65a6fd85d9e2af3e0a22f
2012-07-27 14:40:00 -07:00
Rob Moen c656f831d1 Bug 36200 - VisualEditor: Sticky selection popup
Clearing context icon when editor loses focus.
-Reproduce problem by selecting text, then click outside of
the editor.  Selection is lost, and context icon is stuck.

Change-Id: I4b321f16cea73ec0e51540c0e71f265ab47514e9
2012-07-26 16:34:51 -07:00
Catrope 67e11ebbc3 Make VE work again with the link RDFa changes in Parsoid
This is ugly but makes things work again. I intend to clean this up once
we have a better attribute API

* Recognize mw:WikiLink, mw:SimpleWikiLink, mw:ExtLink,
 mw:NumberedExtLink and mw:UrlLink
* Support is incomplete because we can't get to the annotation text with
  the current API
* Preserve all unhandled attributes rather than special-casing data-mw
* Update remaining code using data-mw (sHref and stx extraction) to
  account for the data-mw -> data-rt rename
* Update tests accordingly

Change-Id: Ia13d3008a6d4cdc8828f9acda5aa797566bc597f
2012-07-26 16:23:03 -07:00
Christian Williams 9723bf51e5 Switching to localStorage for copy and paste, remove test
Change-Id: I555b8756afb53680d60f2068b8615787c60e9d8f
2012-07-25 17:07:08 -07:00
Catrope c8ce42c8e3 Do not put slugs after nested lists
But still put slugs before them. Done by overriding canHaveSlugAfter()
in ve.ce.ListNode.

Eventually this should be configurable and MediaWiki-specific

Change-Id: I5ad15ca4085a2d730add4954acbea358819b3986
2012-07-20 14:07:53 -07:00
Catrope 5be1b7798c Split canHaveSlug() into canHaveSlugBefore() and canHaveSlugAfter()
These determine whether a node can have a slug before and after,
respectively. The default implementation in ve.ce.Node is to use the
same rules for both, but individual node types can override this.

I'll need this to suppress slugs after nested lists but not before them.

Change-Id: Id88c0fc98aca7c7f52ce990ed9b8c42181ef6d18
2012-07-20 14:07:53 -07:00
Catrope feab4e58a1 Make Enter in an empty list item unindent
For pressing Enter in an empty list item at the end of a top-level list,
this has the same result as the previous code, but if you're in a nested
list it has the effect of jumping down a level. A previous incarnation
of this change just made Enter insert more list items ad infinitum if
you were in a nested list, but I think this is better.

This fixes a bug where pressing at the end of a nested list inserted a
paragraph in an invalid location

Change-Id: I9c7dbaf29a98f84926ed3a05e71c6294926dfce2
2012-07-20 14:07:53 -07:00
Catrope 5b4554b47f Let Tab and Shift+Tab trigger indentation again
Fix the commented-out code: it caused unindent to be triggered by just
pressing Shift. ASCII 16 is "data link escape", no idea where that came
from, so I removed it and used e.shiftKey instead.

Also check whether indent/outdent is even possible before doing it.
Currently this is done in a very hacky way (by checking the state of the
indent button), ideally we'd refactor things such that toolbar tools can
listen for keydowns and intercept them, that would make the code much
cleaner and we wouldn't have this problem.

Change-Id: I99885ee4b8a79cd24c4958c188addfc2b0453b03
2012-07-20 14:07:53 -07:00
Catrope ce1f4dac55 Work around crazy list rendering bug in Firefox
After indenting or outdenting a list item in a numbered list, the
numbering wasn't updated. So if you had:
1. One
2. Two
3. Three

and you indented "Two", you'd get:
1. One
     1. Two
3. Three

Adding or removing items in the list using the keyboard, or even
inspecting the list in Firebug (!), would trigger a renumbering and fix
the list to display "2. Three". But then the same issue would occur in
in reverse when outdenting "Two" (either using undo or using the
outdent button):
1. One
2. Two
2. Three

The workaround is to force a reflow by requesting the height (thank you
Timo). Implemented this in an override of onSplice() in ve.ce.ListNode, so
the list is detached and reattached every time children are spliced into
or out of it.

I haven't managed to come up with a minimal test case for this, not even
by putting a list in a contentEditable div and doing the same DOM
operations that ve.ce does from a setTimeout callback.

Change-Id: I93b2a309034c411a7b4e4b6c6bd4ef9d473999eb
2012-07-20 14:07:53 -07:00
Trevor Parscal 6b34f09df2 Removed some whitespace
And added a license to some files that didn't have it yet

Change-Id: I3a7e60374d1198d369a0475b8f65f7415012a337
2012-07-19 14:25:16 -07:00
Trevor Parscal c40174b60c Changed to use MIT license per agreement with the VisualEditor team
This license change is aimed at maximizing the reusability of this code
in other projects. VisualEditor is more than just an awesome editor for
MediaWiki, it's the new editor for the entire internet.

Added license and author files, plus mentions of the license to all
VisualEditor PHP, JavaScript and CSS files. Parser files have not been
modified but are effectively re-licensed since there's no overriding
license information. 3rd party libraries are not changed, but are all
already MIT licensed.

Change-Id: I895b256325db7c8689756edab34523de4418b0f2
2012-07-19 13:25:45 -07:00
Krinkle ab47265c34 Merge "JSHint: Added dotfiles and fixed tons of linting warnings." 2012-07-19 17:09:03 +00:00
Trevor Parscal a564f81aa7 JSHint: Added dotfiles and fixed tons of linting warnings.
* "onevar" warning sometimes solved by just merging var statements
  other times solved by making it a function declaration instead
  of a function expression.
* Also fixed several '_this' variable names in ve.es.Surface to
  more descriptive names, and enabled warnings for dangling _
  in identifiers.

Change-Id: I7d411881e3e06cf9a7fe56d689c29375881a81de
2012-07-19 10:01:00 -07:00
Trevor Parscal 3afb270567 Renamed ve.ce.Document.css to ve.ce.DocumentNode.css to match it's contents
Change-Id: I3d7504dfda27309f631a5856ffa4aacd13b6edc7
2012-07-18 18:23:11 -07:00
Rob Moen b71586f296 Bug 37811 - VisualEditor: editing toolbar float trigger also triggers contextView icon, although there is no context to act on
-Remove unused updateContext method.
-Added check for selection length in contextView set method.

Change-Id: I1d5791c69deea80c54cff3e021ba4c90cdac2cc4
2012-07-07 08:47:51 -07:00
Catrope 970873595b Merge "Made extendClass accept a variadic list of base classes to extend with" 2012-07-07 04:31:48 +00:00
Catrope bc0c8ae525 Merge "Rename ve.ce.BranchNode.doSlugs -> ve.ce.BranchNode.addSlugs" 2012-07-07 02:04:17 +00:00
Trevor Parscal 12b8818a02 (bug 37848) Fixing delete key at end of document, removing whitespace.
Change-Id: I64cc9e7a3251b7326b104cd3b8ecb0d07240cd77
2012-07-06 19:02:01 -07:00
Inez Korczynski d4bfa89b32 Rename ve.ce.BranchNode.doSlugs -> ve.ce.BranchNode.addSlugs
Change-Id: I162067be5a544817e36986eeb0acd0497d37f443
2012-07-05 16:55:45 -07:00
Trevor Parscal 1067f84764 Merge "Removing some logging" 2012-06-27 16:42:34 +00:00
Trevor Parscal efe26d9be2 Merge "(bug 36201) Control-K triggers link inspector" 2012-06-27 16:41:51 +00:00
Christian Williams b9f6baba63 (bug 36201) Control-K triggers link inspector
Change-Id: I0ffd237ce51d1899d2151fb76243e818c5f5cfb8
2012-06-27 09:41:06 -07:00
Trevor Parscal 02e24d6a39 Merge "Bugzilla:37804 - Double bound events were causing double backspace bugs" 2012-06-27 16:20:43 +00:00
Christian Williams a26708dd6e Removing some logging
Change-Id: I2876e56d2e3680d21877103618e59afec1c81ef9
2012-06-22 15:49:34 -07:00
Christian Williams 89e0f3d6ad Bugzilla:37804 - Double bound events were causing double backspace bugs
Change-Id: I589185d077e1efe6fb2c0457a290a8ac9ce8bceb
2012-06-22 15:39:43 -07:00
Christian Williams 122a31a021 Bugzilla:33093 - Shift-Enter splits at paragraphs instead of list items
Change-Id: Ie32e878cf9c71f7179143c631a01c0e2e671ed18
2012-06-22 15:05:35 -07:00
Trevor Parscal 02b0c7a6f4 Made extendClass accept a variadic list of base classes to extend with
Change-Id: I6d2307ce39da47ad2673dd439789a2f74632c59f
2012-06-22 10:50:41 -07:00
Catrope a0d87989cf You know what, just don't render hrefs, these links aren't clickable anyway
Change-Id: If5f0c9a2fa41f09569195fe7807aba9a8207a3c9
2012-06-21 16:12:17 -07:00
Trevor Parscal b560924467 Merge "Use title for rendering internal links, and guard against undefined" 2012-06-21 23:04:11 +00:00
Catrope 6ddfc4bcab Use title for rendering internal links, and guard against undefined
Change-Id: I18a4e5e06303fcd9540fde8c3b21fe8f8887417e
2012-06-21 15:52:25 -07:00
Trevor Parscal f021b02ce1 Merge "Reconcile the order and completeness of textStyles in 2 different places" 2012-06-21 22:33:41 +00:00
Catrope 9576f8fc48 Escape the href attribute on links
Change-Id: I3edaa5c9346f5c8c222c482bcb190acad2bac24d
2012-06-21 15:28:07 -07:00
Christian Williams 4f43ecefdf No need to apply selection in this transaction
Change-Id: Ia1ea5800dfbe5d89ef2fe22462712d8a558e5e3b
2012-06-21 15:20:21 -07:00
Inez Korczynski 41f5f7378b In Firefox hitting enter fires both events - keydown and keypress. We want to ignore key press for enter.
Change-Id: I49d19267cc6115342aadf11ea720e82bbf65ddb2
2012-06-21 14:52:43 -07:00
Catrope f58b5b6fc8 Reconcile the order and completeness of textStyles in 2 different places
ve.ce.TextNode listed textStyle annotations that didn't actually exist,
and failed to recognize some that did exist (such as span; bug 37808).

Added all annotations to both places. <span> tags are now tolerated by
the editor in that it doesn't crash anymore, but they're displayed (and
saved!) without any attributes, so <span style="color:yellow;">y</span>
doesn't show a yellow 'y' in the editor and is saved back as
<span>y</span> .

Change-Id: Iaae11ad5044150fa904010983ff83579cb37733d
2012-06-21 14:46:43 -07:00
Trevor Parscal ed33ca373f Merge "Undo and redo keyboard shortcuts" 2012-06-21 20:58:53 +00:00
Christian Williams 050134d55e Undo and redo keyboard shortcuts
Change-Id: Ia1e9db52f6fb2da79be28cdedaaf0dffc6097dc9
2012-06-21 13:58:21 -07:00
Inez Korczynski 07760653b2 Don't use custom handling for left and right arrow while metaKey is pressed as well.
Change-Id: I7e2f73ab085b877169f4a29bec04a294d6e13a2a
2012-06-21 13:56:32 -07:00
Inez Korczynski 6381709703 In case of IE use non-breaking spaces inside slugs instead of invisible separators - as in different browsers.
Change-Id: Ib6ae077206de1ad772e47e212a9f276f6b0081e0
2012-06-21 13:34:13 -07:00
Trevor Parscal 437649e062 Merge "Fix problem in hasSlugAtOffset when a given offset is out of range of the document - so no node is returned from getNodeAtOffset" 2012-06-21 18:19:51 +00:00
Inez Korczynski 82d3040d76 Fix problem in hasSlugAtOffset when a given offset is out of range of the document - so no node is returned from getNodeAtOffset
Change-Id: I91951528c21ddd57f56d7f4854d0e626d96e04a1
2012-06-21 11:09:41 -07:00
Trevor Parscal f35c8adac8 Merge "Aggressive keyboard shortcut fix for all browsers and platforms" 2012-06-21 18:09:24 +00:00
Christian Williams 8f7ce742de Aggressive keyboard shortcut fix for all browsers and platforms
Change-Id: Ic9e6359a06752861a05526dba090b08ccd39b83f
2012-06-21 11:09:30 -07:00
Inez Korczynski 847fddd639 Fix for drawing selection in IE - temporary approach
Change-Id: Ia944e4c96b1d1d78274f9c23e7120954f694ca08
2012-06-21 11:04:26 -07:00
Christian Williams f27425eb91 Firefox has some crazy bindings for browser features. This prevents it and properly annotates.
Change-Id: Ide294efda8b661e16f24cc1f3584a8f08785ff5b
2012-06-21 10:33:40 -07:00
Trevor Parscal 861ce8d54f Fixed pressing backspace in a slug, now we just move the cursor to some nearby content
Change-Id: Idaf61264fb493169cfef1c48613036c292d590f0
2012-06-21 00:01:32 -07:00
Trevor Parscal c548b3cdba Merge changes I44515c86,Ife902ace,Ia6510de1
* changes:
  Got rid of iteration to get the surface
  Removed attach and detach methods from ve.ce.Node
  Track adjustments in DocumentSynchronizer and apply them to oldRange
2012-06-21 06:41:57 +00:00
Trevor Parscal 07eb2df53a Got rid of iteration to get the surface
Also added a safety check to make it easier to spot a regression

Change-Id: I44515c867852f2f726be74161f6b8e466c0933da
2012-06-20 23:40:38 -07:00
Trevor Parscal 00c555ebe5 Removed attach and detach methods from ve.ce.Node
Added some needed functionality in ve.Node to make up for this

Change-Id: Ife902aceb4e8535411dc653ae61087aecf67a0c6
2012-06-20 23:40:38 -07:00
Catrope df4e5f0200 Merge "Fix minor bug with space replacement in TextNode" 2012-06-21 06:37:56 +00:00
Inez Korczynski 74440be132 Fix minor bug with space replacement in TextNode
Change-Id: Iafdc59d9fd8654444079e55a2ad36a40cc21fa4c
2012-06-20 23:33:22 -07:00
Inez Korczynski ab16987ae8 Better support for left & right arrow keys
Change-Id: Iad56f8179d3ed90828e31ad0203a5cec9e9d2458
2012-06-20 23:06:47 -07:00
Trevor Parscal 88ef5b1517 Merge "Logic for moving cursor left and right programmatically" 2012-06-21 05:54:50 +00:00
Trevor Parscal 7e892daac9 Merge "Fixing backspace when at the beginning of the document." 2012-06-21 05:52:45 +00:00
Trevor Parscal a7b47a2c00 Merge "Pressing enter in the last listItem, if empty, will exit the list" 2012-06-21 05:50:51 +00:00
Inez Korczynski 9b1e96cd46 Logic for moving cursor left and right programmatically
Change-Id: I48844cfbebaf3933ad61dc462ab5ea73be45a8aa
2012-06-20 22:24:12 -07:00
Christian Williams 4df69b01de Fixing backspace when at the beginning of the document.
Change-Id: Ib4c463c6a1eb27897a39c96c46617047d8ee4325
2012-06-20 21:34:11 -07:00
Inez Korczynski 7eae9cdba6 Support for insertion in slugs.
Change-Id: I8e144206520b59271edf854020b87ce947fe0559
2012-06-20 21:32:26 -07:00
Christian Williams 0ab3b65c03 Pressing enter in the last listItem, if empty, will exit the list
Change-Id: I084fabac09654adf50db97b554e937d2772f9a37
2012-06-20 21:10:48 -07:00
Christian Williams 8556888a9a Fixing handleEnter to allow splitting headlines
Change-Id: I4f75ee1b454f66c4b112a1ab59386994bb249792
2012-06-20 20:02:25 -07:00
Trevor Parscal 9c0b8f57b2 Merge "Use getClonedElement() rather than manually building a node" 2012-06-21 02:40:11 +00:00
Inez Korczynski 7291485ce5 Move slugs logic into doSlugs since it is being used in onSplice and in cleanup methods.
Change-Id: I10395bbdfd71fda2913e6da736189f0ff8216702
2012-06-20 19:10:28 -07:00
Catrope ac835c2d69 Merge "Keyboard shortcuts for bold and italic" 2012-06-21 02:09:28 +00:00
Christian Williams 14054becb5 Keyboard shortcuts for bold and italic
Change-Id: I12b80134152bbbbd2dfa42b32fec072cde29baa5
2012-06-20 19:09:06 -07:00
Catrope 319ff040bb Merge "Fix method hasSlugAtOffset to return true when length of the element is 0" 2012-06-21 02:00:51 +00:00
Trevor Parscal 09fd90f66f Merge "Add slugs inside empty branch nodes so cursor can be correctly placed." 2012-06-21 02:00:17 +00:00
Catrope 7be404f818 Merge "Removed trailing whitespace and other cruft" 2012-06-21 01:59:57 +00:00
Catrope e8702e8f0f Use getClonedElement() rather than manually building a node
Change-Id: I3d6390830c6a01235e55b1484e161d1f6737ac01
2012-06-20 18:59:12 -07:00
Catrope 7f3106802c Merge "Modified handleEnter to insert a paragraph above/below a non-paragraph if at the edges" 2012-06-21 01:57:58 +00:00
Trevor Parscal 3743b75d59 Modified handleEnter to insert a paragraph above/below a non-paragraph if at the edges
Change-Id: Icfe650890ceb32f77c79347bebdf8be9612cfdbb
2012-06-20 18:57:35 -07:00
Catrope 01407b1ec5 Merge "Typo fixes throughout the codebase" 2012-06-21 01:49:15 +00:00
Catrope 22677ac475 Merge "When there is a selection range, pressing arrow keys should not remove the selection in Firefox." 2012-06-21 01:48:30 +00:00
Christian Williams 58917f5015 When there is a selection range, pressing arrow keys should not remove the selection in Firefox.
Change-Id: I93bca05dd0f37fd8f87eba3f407a68c922ed66e3
2012-06-20 18:48:02 -07:00
Rob Moen 1462a6cf37 Add commented-out tab key support for indentation button tool
Change-Id: I4741182bb79becf08288287142a930ddf7f547ad
2012-06-20 18:45:44 -07:00
Inez Korczynski c1225acb68 Fix method hasSlugAtOffset to return true when length of the element is 0
Change-Id: Icf43eb6adfcc45eaf1ae8ff146a029546341ba33
2012-06-20 18:18:49 -07:00
Inez Korczynski a62e78292f Add slugs inside empty branch nodes so cursor can be correctly placed.
Change-Id: I075a76da50bd4927c3832a660fdf96bbd250e3b0
2012-06-20 18:18:49 -07:00
Trevor Parscal 6fe115a563 Removed trailing whitespace and other cruft
Change-Id: I8c439d2a272e01b9e26bfd6b13d9e600d324930b
2012-06-20 17:42:12 -07:00
Christian Williams 93594d1c22 Pressing backspace or delete at boundary of dislike nodes will cause adoption
Change-Id: Idd6cd40c8d4f34081851fc9ea1cc70037915244b
2012-06-20 16:28:13 -07:00
Trevor Parscal e175292c07 Typo fixes throughout the codebase
And a missing semicolon

Change-Id: I8487525ae2a7fa8f58e00c92c7dff600d9bd9520
2012-06-20 16:01:02 -07:00
Inez Korczynski bbaa17a6c4 * Replace spaces at the beginning and at the end of text node with &nbsp;
* Alternate double spaces with &nbsp, "  " -> " &nbsp;"

Change-Id: Ib4351ed6263e69f0d98957c2d0d8411e040fece7
2012-06-20 15:32:14 -07:00
Trevor Parscal bcf93eb695 Automatically bind and unbind context's window event bindings on documentNode focus and blur
Change-Id: Ie43165da49a36a7d0d13a52318d9c5438dad9605
2012-06-20 12:34:20 -07:00
Trevor Parscal 7a1d74fd18 Change state variable so updates work more than once
Change-Id: I7c701761b09e96e01e26164080d22cafe43019e0
2012-06-20 12:28:01 -07:00
Catrope 6afed5e5cc Move ve2/ back to ve/
Change-Id: Ie51d8e48171fb1f84045d1560ee603cee62b91f6
2012-06-19 18:20:28 -07:00
Christian Williams 933ff678a4 Focus can now be set in slugs using showCursor or showSelection.
Change-Id: I12ab361a30d277a4752579bf885fd37bc46b32ed
2012-05-24 13:18:30 -07:00
Christian Williams 32b9ccd0bf Moving alien node styling to CSS file
Change-Id: I21e4593b81669b48cec831236398866f89616f9a
2012-05-23 12:03:28 -07:00
Rob Moen b05347ac4e removed margin-top for documentNode
Change-Id: I6e888ca858bc2d9e6772150715b10ab157f84b46
2012-05-03 16:07:51 -07:00
Inez Korczynski d6ae8390f5 Get rid of selectionDirection. Introduce getDirection() methdo in
ve.Range.

Change-Id: Iaf11b2dbfb7ae82a7f54ee205cd6cdc8ee235aef
2012-04-27 17:36:55 -07:00
Inez Korczynski af6a9f9ccc Created a named method inside a Surface (instead of anonymouse one) to
handle logic for rangeChange event handler.

Change-Id: Ief32e647f9399e3ea47c5613902cebcbaaf4874c
2012-04-27 17:31:49 -07:00
Inez Korczynski f188772259 Introduce new method called "proxy" in surfaceView to avoid using the same
construct with anonynous function over and over.

Change-Id: I1e96cf1efaa6fa5d551fdfa8bb5a80c31e519579
2012-04-26 14:49:12 -07:00
Rob Moen 5fc9f1c7e4 Modify rangeChange event to save selection direction.
Renamed Selection method to more suitable name.
Misc cleanup
Patchset 2, whitespace cleanup
Patchset 3: Change values used with selection direction to -1 or 1
1 for left to right (normal)
-1 for right to left (opposite)
Change-Id: If9ecc721ace1c7550903170f92395947f1ccc22c
2012-04-20 16:27:26 -07:00
Rob Moen d37a325f44 Cleanup terms used in annotation method
Change-Id: I509a1f1b680cc8a2973188f0ed7c7d67b8a15f4f
2012-04-12 16:37:23 -07:00
Rob Moen 961f83d326 Elminiated isSelection method
Determine actual selection from model by checking length

Change-Id: I1c58a4de31b26d49b55c7a2c55c9c6462741bdfb
2012-04-12 14:05:14 -07:00
Rob Moen 28e86c8688 New Method isSelection() in Surface View
Used to properly hide/show Context menu and UI elements.

Change-Id: I8b3750c270651498b7e6c54a1921f5012cf33ea6
2012-04-12 10:22:42 -07:00
Rob Moen b5befb1d57 On annotate, get current selection from model
Fixes link annotation, and any annotation that pops up an inspector as selection is lost.

Change-Id: Idd8812b05f4fddfa4e613dea28a1a8421792656d
2012-04-11 14:15:52 -07:00
Rob Moen 224cc1f9a0 Migrate tools from SurfaceObserver Class
ContextView positioning, Italic, and Bold annotations working

Change-Id: Ifc68bd61c8f27b6a14d314dc2999753af6e0ee04
2012-04-11 13:19:58 -07:00
Rob Moen 01e02e888d Fix copy / paste errors for setStyle method in ListNode and ListeItemNode
Change-Id: Ifc8183e047398fd7f4b0436e61768992a3a94612
2012-04-06 11:37:53 -07:00
Robmoen 8a06ea5adc Merge "Changed to using structured lists" 2012-04-06 18:28:04 +00:00
Inez Korczynski 50acc0c785 Make toolbar and context menu works
Change-Id: Ice981390b22a257158b3417dda3a1945d777cb14
2012-04-06 17:43:14 +02:00
Inez Korczynski 68cf13fb1e getLeafNode is now a static method and should be called as a static method
Change-Id: I4f079523add81ef14537c950b29436422e1de850
2012-04-06 17:13:43 +02:00
Inez Korczynski a57ae2692e Merge changes from branch ce-poll
Change-Id: Ibb6da1ac5229ed5afeda1a3944fe7deff3bfb9a7
2012-04-06 17:10:30 +02:00
Inez Korczynski 090e42c8d9 Just a test
Change-Id: I74fb371a26b4b6068fee593bf7e6ee950080bca8
2012-04-06 16:49:30 +02:00
Trevor Parscal 85b807ed5d Changed to using structured lists
This makes it possible to get identical rendering in the editor, but may make other things more complex. The Wikitext serializer is no longer compatible for rendering lists so it's been stubbed out. Also the way the toolbar works with lists is broken, so that's been disabled. The HTML serializer has been fixed to work correctly and no-longer-used styles have been removed.

Change-Id: If156f55068b1f6d229b3fa789164f28b2e3dfc76
2012-04-05 14:32:08 -07:00
Trevor Parscal a2eee63525 Updated CSS classes and rules for CE, which for the most part uses native elements
Also:
* Simplified ve.ce.Surface.getLeafNode, which may be better to just be removed and be used inline in the few places it's being used.
* Removed method wrapper for static function ve.ce.Surface.getLeafNode

Change-Id: I1d4cf0bb7ecc8f07f030753e40a13ebef7d02daa
2012-04-04 11:54:06 -07:00
Rob Moen d8de26d7e9 On selection, update selection in the model. Fixes selection.clone() error.
Change-Id: Ibd5cf0398002e5fbb2c50549e4a7043ba8fd00a7
2012-04-02 14:19:53 -07:00
Rob Moen c1300ba949 Fixed surfaceView undefined error
Change-Id: Iba3ae54b4e508afbfa132e0f0b2b0b237e685395
2012-04-02 13:49:45 -07:00
Inez Korczynski 299c77db84 Make LinkInspector works (using annotate method in SurfaceView) 2012-03-16 22:16:15 +00:00
Inez Korczynski b2f4b48a9a Use on and off insteaf of bind and unbind. 2012-03-16 22:01:09 +00:00
Inez Korczynski 6ef8ac182a No more endless looping! And fix getSelectionRect to return document relative coordiantes instead of viewport relative. 2012-03-16 21:52:17 +00:00
Rob Moen cde7a3bf7e adapt LinkInspector to use surfaceObserver for selection 2012-03-16 20:18:26 +00:00
Rob Moen 93376d68eb add surfaceObserver on select methods to ui toolbar and surfaceView for responding to select event. tools now updating to selected node annotations. revise getSelectionRect to return actual start & end pos. context icon properly showing on range selection 2012-03-15 22:06:40 +00:00
Inez Korczynski f87709d6bb Use <h[1-6]> tags for rendering headings (instead of divs) 2012-03-14 00:51:04 +00:00
Inez Korczynski 294d474c54 Replace CursorObserver and ContentObserver with SurfaceObserver 2012-03-14 00:04:24 +00:00
christian d174809b54 replacing showCursorAt calls with correct showCursor method 2012-03-13 18:12:57 +00:00
christian 010c97acc8 removing min height attribute to fix IE bug 2012-03-12 23:31:08 +00:00
christian ba437744b3 preventing native contenteditable resizing tools 2012-03-12 23:06:47 +00:00
Rob Moen 22a351e855 small fix: getSelectionRange was breaking the surface layer, changed to saved state member 2012-03-12 22:04:29 +00:00
Rob Moen 65170e13df port over select event listener, and updateSelection methods for setting and removing context icon, add getSelectionRect method for context icon position 2012-03-12 21:50:22 +00:00
christian 56b9068d03 switch to getSelectionRange and fixing IME native menu 2012-03-12 20:39:08 +00:00
Alexandre Emsenhuber 99a31bacbc svn:eol-style native 2012-03-11 18:38:27 +00:00
Inez Korczynski 9a8f7059fc Make ContentObserver pass information about content when emiting change event. 2012-03-09 23:15:23 +00:00
Trevor Parscal 02592b3ec0 More cleanup 2012-03-09 22:55:49 +00:00
Trevor Parscal 60c9c484aa More cleanup (jshint complaints) 2012-03-09 22:51:00 +00:00
Trevor Parscal ce824d6299 Cleanup 2012-03-09 22:45:22 +00:00
Inez Korczynski 4bc7dbbe5e Initial import of CursorObserver and ContentObserver (not being used yet). 2012-03-09 22:18:24 +00:00
Alexandre Emsenhuber 62e8312535 svn:eol-style native 2012-03-08 12:27:02 +00:00
christian df4f017b21 preserve range after applying annotation 2012-03-07 23:35:38 +00:00
Inez Korczynski ab496f7bc9 Get rid of showCursorAt method. And replace calls to it with calls to showCursor. 2012-03-07 23:33:41 +00:00
Inez Korczynski 8e56acbaca Added getDOMNodeAndOffset and showSelection methods to Surface. Ohhh and little wrapper around it - showCursor. 2012-03-07 23:32:26 +00:00
christian 76b7127e29 removing usage of rangy anchornode for determining rendering scope - using model and autoRender 2012-03-07 21:41:53 +00:00
Inez Korczynski 73f53e89c6 Small refactoring. Changed method name, from Surface.getSelection to Surface.getSelectionRange. 2012-03-07 21:37:39 +00:00
christian 22ce25dc69 replacing cursor after annotating works 2012-03-07 21:06:07 +00:00
Rob Moen 0520e64d97 port over annotation methods from ES to CE, remove unused renderDomNode method 2012-03-07 19:37:17 +00:00
Rob Moen 73fbbe29ab cleanup whitespace 2012-03-07 19:33:00 +00:00
christian 816a6717a6 adding autoRender property to SurfaceView to enable/disable automatic rendering of view when model is updated 2012-03-07 08:13:12 +00:00
Trevor Parscal a82ddeae51 Fixed some jshint complaints and enforced 100char line endings 2012-03-06 23:51:31 +00:00
Inez Korczynski 2e9ab44719 Update class names, from ve.es to ve.cs, and update code that uses those classes 2012-03-06 22:39:43 +00:00
Inez Korczynski 594a0e6d6c Rename bunch of files from ve.es.* to ve.ce.* (and update references) 2012-03-06 22:35:42 +00:00
Inez Korczynski 8dcd638249 Copy files from ve/es to ve/ce and update references 2012-03-06 22:31:44 +00:00
Rob Moen 809df81282 enable CE demo toolbar, added annnotation and renderDomNode methods 2012-03-05 22:08:35 +00:00
Inez Korczynski 01e84a558c Improvements to changes polling mechanism 2012-03-02 02:07:55 +00:00
Inez Korczynski 90cfb62cb6 Added basic support for enter key 2012-03-02 01:35:34 +00:00
christian 923e9380cd event binding cleanup 2012-03-02 01:12:18 +00:00
christian 3a1ee7e5b9 adding paste fixes to cut handler 2012-03-02 00:37:01 +00:00
Inez Korczynski b16a1c3899 Fix bug in Chrome when moving cursor with left/right arrow in between <table> and textnode 2012-03-02 00:34:31 +00:00
christian 5ec5fb77e6 better cut-copy-paste support 2012-03-02 00:27:04 +00:00
Inez Korczynski 7de9e98583 Fix couple of poll interval bugs in Surface and add new parameter called 'byref' to method getAnnotationsFromOffset which makes it return array references instead of copy of arrays. 2012-03-02 00:10:08 +00:00