Commit graph

561 commits

Author SHA1 Message Date
Trevor Parscal 32a67dc762 Merge "Multiple Transactions" 2012-08-18 00:17:39 +00:00
Christian Williams 8b9be7b99c Multiple Transactions
Make ve.dm.Surface.change accept array of transactions as a parameter (instead of just one) and use it in complex content removal (handled in Surface view).

Change-Id: I453b3606cefe140db206f5a2d2c9036bcbd639c9
2012-08-17 17:17:12 -07:00
Catrope 7c39f65469 Merge "Added saving "spinner" icon to save dialog" 2012-08-17 23:15:48 +00:00
Trevor Parscal da3aecfaee Merge "Fix JS error for inline aliens" 2012-08-17 23:11:57 +00:00
Trevor Parscal 6a3bb91252 Added saving "spinner" icon to save dialog
Change-Id: Ie6ef43378b1a0a18c504efe7bb850d7c9de1bbeb
2012-08-17 16:10:14 -07:00
Catrope 2c2d7b48dc Merge "VE multiSuggest bug fixes." 2012-08-17 22:49:16 +00:00
Trevor Parscal b02055be0f Fixed the text in the edit summary box being the wrong font and size
In Firefox at least...

Change-Id: I236902cde51ac6e25e4edc738fa4a80977d39d29
2012-08-17 15:43:49 -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
Rob Moen 58558b26fd VE multiSuggest bug fixes.
-Using keydown on arrows allows preventDefault which stops the cursor movement in the input.

-Consolidated Keydown bindings, no longer unbinding keydown, instead checking for visible state first.

-Using case insensitive comparison for selected item.

-Changed use of ve.inArray to ve.indexOf because method name was changed.

-Moved clear break into suggestion container rather than after it.
Added margin bottom on suggestion container for category separation.

Change-Id: I2bd1db049a948db189194037dc8e38dfe884c197
2012-08-17 15:13:19 -07:00
Trevor Parscal d5ce342268 Merge "Added MW page suggestion functionality." 2012-08-17 21:13:18 +00:00
Rob Moen dda2c932bd Added MW page suggestion functionality.
Created jQuery plugin MultiSuggest which builds a categorized dropdown
under specified input box.

Revised inspector to no longer be an iframe but to contain an Iframe.
This reduces xbrowser issues with positioning and toggling inspector
container.

Added Inspector overlay element for positioning arbitrary elements
over the iFrame.  This prevents growing the iframe to arbitrary lenghts.

Change-Id: I8efbbd091b0b24a19a4b73aa122d21a329cf97e4
2012-08-17 14:12:26 -07:00
Catrope 1a4dd7a3db Merge "Design changes for save dialog" 2012-08-17 20:58:24 +00:00
Catrope 453620b3e6 Merge "Added check for empty document to avoid error" 2012-08-17 20:57:46 +00:00
Trevor Parscal b4ed671dbc Added check for empty document to avoid error
When the document is empty, there is no last branch, and it causes an error because the code was assuming there was always going to be a last branch.

Change-Id: I371dce89db6258d30a11022c1bdb11830f59505d
2012-08-17 13:49:34 -07:00
Trevor Parscal f48332d176 Design changes for save dialog
* Summary label is now placeholder text
* Edit summary and options are visually connected
* Added summary length count-down label
* Removed check-mark icons from toolbar and dialog save buttons
* Made toolbar and dialog save buttons the same size
* Reduced line-height and margins of license information
* Changed from X icon for close (which might be confused with cancel) to ^ icon for collapse

Change-Id: Ib1711f49af8929be12796aecdea49467b726856e
2012-08-17 13:48:16 -07:00
Catrope 8c91e3526d Merge "Utilizing RL skinStyles for skin-specific ve.init styles" 2012-08-17 20:24:12 +00:00
Catrope 75c60b3c8e Merge "Fixed scroll and selection issues" 2012-08-17 20:19:32 +00:00
Trevor Parscal a1ba65cc31 Utilizing RL skinStyles for skin-specific ve.init styles
Change-Id: I4b2ed55289be5dceee3e3fbdf305b4ff81d80189
2012-08-17 13:16:25 -07:00
Catrope f4459b589b Merge "Added some unit tests for ve.dm.SurfaceFragment" 2012-08-17 20:16:00 +00:00
Trevor Parscal dfdc69f994 Fixed scroll and selection issues
* When you visit the page with url# (empty target) it scrolls down - which made setting the URL of the namespace tab to # really bad, plus it was useless since we already handle that click using JS
* Found that this.$toolbarWrapper wasn't pointing to the right place because of a missing .end() call at the end of a chain of jQuery madness

Change-Id: I7dc6953e39d4081f1b91a351bb830e4c18f7b988
2012-08-17 13:11:55 -07:00
Trevor Parscal 8169dbc085 Added notification on save
Change-Id: I362275eb38655401bc48b3209189776e9e37619a
2012-08-17 12:41:33 -07:00
Catrope 41b5244a46 Merge "There's no such thing as ghosts, just sneaky array references" 2012-08-17 18:27:29 +00:00
Trevor Parscal 1e2502a726 Added some unit tests for ve.dm.SurfaceFragment
Also:
* Made a fragment with a null range become a null fragment
* Fixed incorrect order of arguments for binding a handler to transact event
* Added getters for surface, document and range
* Fixed several instances of passing a document instead of a surface into the constructor of a new surface fragment
* Fixed closest mode in expandRange - needed to check if parent existed before checking for it's type
* Fixed uses of ve.Transaction (doesn't exist) that were supposed to be uses of ve.dm.Transaction (does exist)

Change-Id: Ide13d9d2d1637399188c98c2e8b6e0826caeecc4
2012-08-17 10:48:40 -07:00
Trevor Parscal 735c4cd20e Merge "Strip generated <p> tags in dataToDom" 2012-08-17 17:42:38 +00:00
Trevor Parscal c3c909d2ab Merge "Remove attributes from DocumentNode constructor" 2012-08-17 17:40:57 +00:00
Trevor Parscal 467c80fb44 Merge "Rename fringeWhitespace to internal" 2012-08-17 17:40:36 +00:00
Trevor Parscal 264b97df7f There's no such thing as ghosts, just sneaky array references
When a document is created, it should take it upon itself to make sure it has a new reference to the data using slice, not place this on the caller. Callers that do not use slice will often find strange and mysterious things going on and not know why. The real reason is that multiple documents sharing a reference to the same data array leads to seriously messed up behavior.

Change-Id: Ic4e25fcd9bf3f41a805003520a8f38e2768f5dbf
2012-08-17 10:37:28 -07:00
Catrope 9ef82d3222 Remove attributes from DocumentNode constructor
'document' is an unwrapped node type, so a document cannot have
attributes in the linear model

Change-Id: Ifb0b5a189a65b71925b0fb379bd544d19102ed01
2012-08-16 16:21:13 -07:00
Catrope 7319038ed6 Strip generated <p> tags in dataToDom
domToData wraps bare content in paragraph elements, which were then
converted to <p> tags by domToData. With this fix, HTML with "missing"
<p> tags actually round-trips through the editor correctly now, rather
than having <p> tags added wherever VE believes they should exist.

* Mark generated paragraph elements with .internal.generated = 'wrapper'
** This signifies the wrapper was generated but its contents were not,
   so the right thing to do when converting back to HTML is to remove
   the wrapper and keep the contents. We might want to use other values
   of generated in the future.
* Unwrap nodes with generated=wrapper when converting to HTML

Tests:
* Add 'generated': 'wrapper' as appropriate. Only affects 1 test
* Remove 'normalizedHtml' for this test because it is no longer needed
** Need to keep 'normalizedHtml' for now because we normalize hrefs
* Eventually the main example should test bare content, but that
  requires touching a lot of stuff. The main example could use some
  beefing up anyway.

Change-Id: I277ad5fe3f64e07c1bbf49007d6bbaecc90b7466
2012-08-16 16:09:28 -07:00
Catrope ce60b54d33 Rename fringeWhitespace to internal
This allows us to put other internal data in there in the future. Also
passing it through the Node constructor properly now.

* ve.dm.Node
** Rename fringeWhitespace property to internal
** Add internal parameter to constructor
** Remove setFringeWhitespace()
* Increase the number of parameters passed through by ve.Factory to 3
* Pass through .internal from linmod to nodeFactory in ve.dm.Document
* ve.dm.Converter
** Rename .fringeWhitespace to .internal.whitespace and make it an array
** Store a temporary reference to .internal in domElement.veInternal
* Add internal to all node constructors except TextNode

Tests:
* Update for fringeWhitespace->internal rename
* Add third parameter to ve.Factory tests
* Add .internal to getNodeTreeSummary

Change-Id: If20c0bb78fee3efa55f72e51e7fc261283358de7
2012-08-16 15:14:01 -07:00
Trevor Parscal 297b4568d8 Changed initial surface range to (0, 0)
This makes a lot more sense when you start making a surface fragment from a new surface, because a null range would seem to have unpredictable behavior.

Change-Id: I85210878deca3067960fa4a14e2a760e55f67e4e
2012-08-16 13:16:48 -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
Trevor Parscal c8b4a28936 Added key-sorting to make hashes referentially transparent
To do this, we are using the replacer callback of JSON.stringify, which is supported by all of our target browsers including IE8. We are also leaning on Object.keys and Array.reduce, the latter of which required adding a new fallback implementation for some browsers which do not support it yet.

Change-Id: Ifa285ca3da4d94d962464f09414591532bbea79c
2012-08-15 11:14:44 -07:00
Trevor Parscal e113ae3d9f Merge "Update LinkAnnotation for Parsoid href changes" 2012-08-14 20:08:58 +00:00
Catrope 48777cceca Merge "Added setSelection to ve.dm.Surface" 2012-08-14 18:56:19 +00:00
Catrope 6f8307d5d2 Update LinkAnnotation for Parsoid href changes
Because the Parsoid prefix format changed from /mw:Foo to /mw/Foo , the
href format for internal links has changed from "/Foo" to "Foo". So the
href is now simply the title, except that it may be preceded by one or
more "../" if the title of the page we're on contains a '/'.

So instead of stripping the leading slash from internal link hrefs and
putting it back on the way out, only strip any leading "../"s and dump
the titles directly into the hrefs on the way out.

Also update the link test case for this, and add a test case for the ../
stripping.

Change-Id: I3e0bdde20f22cda34eb45fc351de5e780419b6a2
2012-08-14 11:03:37 -07:00
Trevor Parscal cc6f0d17ea Merge "Recognize ExtLink/URL and ExtLink/Numbered in LinkInspector" 2012-08-14 15:50:44 +00:00
Trevor Parscal 0db79e5154 Merge "SimpleWikiLink is no longer used by Parsoid, remove it from VE" 2012-08-14 15:49:27 +00:00
Trevor Parscal d7f99141a2 Added setSelection to ve.dm.Surface
This is a convenience method which also can improve code readability.

Change-Id: If71b83b2861d195b58915f81dc614e2718e75d95
2012-08-14 08:41:32 -07:00
Catrope 70fa9c8aeb Recognize annotation types with multiple slashes correctly
Annotation types with more than one slash such as 'link/ExtLink/URL'
weren't being processed correctly because .split( '/', 2 ) throws away
everything after the second slash. Instead, don't pass a limit to
.split(); the code for reconstructing a slash-separated string from
multiple components was already in place.

Also add test cases for URL links and numbered links.

(Do you like the lines-of-code to lines-of-test ratio in this commit,
Trevor? ;) )

Change-Id: I7add87396447a01b1c23a4f9bfd63d2e8fd861ce
2012-08-13 18:22:31 -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
Catrope 826518c1e1 Recognize ExtLink/URL and ExtLink/Numbered in LinkInspector
Change-Id: Ib13fd3396132695a844db6151296c52fa5f96032
2012-08-13 18:03:34 -07:00
Trevor Parscal f99088b79f Merge "Strip and preserve inner leading&trailing whitespace in the linear model" 2012-08-13 16:56:50 +00: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 63e6702c52 Strip and preserve inner leading&trailing whitespace in the linear model
This makes things like
== Foo ==
* Bar
render without the leading and trailing spaces, while still
round-tripping those spaces.

* Added a .fringeWhitespace property to the linear model and ve.dm.Node
** Object containing innerPre, innerPost, outerPre, outerPost
** Only inner* are used right now, outer* are planned for future use
** Like .attributes , it's suppressed if it's an empty object
* In getDataFromDom():
** Store the stripped whitespace in .fringeWhitespace
** Move emptiness check up: empty elements with .fringeWhitespace have
   to be preserved
** Move paragraph wrapping up: .fringeWhitespace has to be applied to
   the generated paragraph, not its parent
** Add wrapperElement to keep track of the element .fringeWhitespace has
   to be added to; this is either dataElement or the generated paragraph
   or nothing, but we can't modify dataElement because it's used later
* In getDomFromData():
** When processing an opening, store the fringeWhitespace data in the
   generated DOM node
** When processing a closing, add the stored whitespace back in
* In the ve.dm.Document constructor, pass through .fringeWhitespace from
  the linear model data to the generated nodes

Tests:
* Change one existing test case to account for this change
* Add three new test cases for this behavior
* Add normalizedHtml field so I can test behavior with bare content

Change-Id: I0411544652dd72b923c831c495d69ee4322a2c14
2012-08-10 17:23:53 -07: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 a0fa371481 Added isNoOp to ve.dm.Transaction
Also added some checks in content branch conversion to make sure that converting from and to the same thing results in a no-op

Change-Id: Ie47520d666e45a77d12c7ebb9457aef7ab6b8097
2012-08-10 15:35:48 -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 8887a0731b Fix up c0ea02c0bf
Was stripping whitespace before and after annotations as well

Change-Id: Ie49319c15e68de6855fef2beadec0a11beea3ec6
2012-08-10 13:44:35 -07:00
Trevor Parscal 17bf3ef756 Merge "Fix up 62d08588050f576b0728800067b97d41b7eec9fa" 2012-08-10 17:31:56 +00:00
Catrope 3f2a256f86 Fix up 62d0858805
* Per Krinkle's comment, be tolerant of missing .htmlAttributes
* Drop .htmlAttributes if no attributes, fixes some tests

Change-Id: I65589a8b489e19a7c8a41ba2f4a57e68fc52684c
2012-08-10 10:23:14 -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
Catrope c0ea02c0bf Strip leading and trailing whitespace in text
Right now this means things like headings and list items are rendered
nicer (without the whitespace), but also get their whitespace normalized
when saving back. I'll submit code tomorrow that preserves this
whitespace.

Submitting this now because it's needed to make <br>s look reasonable

Change-Id: I4b5e5ad8ee1bbe2f1eaf0fb860dd59f6e401dc3d
2012-08-09 16:26:35 -07:00
Catrope d6d05a40c5 Merge "Added basic ve.dm.SurfaceFragment class" 2012-08-09 23:19:20 +00:00
Trevor Parscal 72bddc03f0 Added basic ve.dm.SurfaceFragment class
Lots left to do here, but this is the future API for working with documents

Change-Id: I7b7e705ad4d922f37c327042051634a61dc8be66
2012-08-09 16:18:13 -07: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
Catrope 62d0858805 Preserve HTML attributes for textStyle/* annotations
The new annotation API will do this too; this is a temporary hack to fix
the bugs caused by stripping attributes.

This code doesn't actually render the attributes, but the new annotation
API will.

Change-Id: Ic0ddf822fe02f101f2e825080c6bcc2a03115974
2012-08-09 13:30:21 -07:00
Catrope c6a4e7a896 Rename wikiLink to WikiLink everywhere
Was causing link inspector breakage

Change-Id: Idf12f90aec9cbd2ddca47c66eb9e6e705a0e48f5
2012-08-09 12:36:09 -07:00
Trevor Parscal 8479e3d060 This should never happen, but if it does, lets make sure we know
In the past, this has cause things to break in mysterious ways

Change-Id: I2fcf1e2a9cf776a9ab9b3969d9ec552e23120e79
2012-08-08 15:17:45 -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
Krinkle 08b349d7dd Merge "Throw ve.Error instead of string literals" 2012-08-08 04:20:47 +00: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
Rob Moen e009d11dca Quick link inspector fix to support recently changed types.
Change-Id: I095968db70b2f523cdd50d51242268894aa7ddec
TODO: Link Inspector needs to support all 6 link types.
2012-08-07 14:43:10 -07:00
Trevor Parscal 1c4f66c49b Merge "(bug 38125) ve.init.mw.ViewPageTarget: Preserve original query" 2012-08-07 16:48:55 +00:00
Timo Tijhof 6b048f4f55 (bug 38125) ve.init.mw.ViewPageTarget: Preserve original query
* Use 'href' of #ca-edit instead of constructing it manually.
  MediaWiki's output of #ca-edit already takes care of all needed
  queries, including "oldid" (bug 38125).

* Misc clean up:
 - Use .get() instead of accessing the array directly.

* Clean up setupSkinTabs and add more inline documentation.

Change-Id: I7d702a3eb1f9ce23a5e3c9e846b00da5cead386e
2012-08-07 11:36:27 +02:00
Timo Tijhof 9b49a7ce81 Clean up: Single quotes
* There were only 3 files with single quotes, fixed them all.

* Added option to .jshintrc (be sure to use the latest version of
  node-jshint since this is a fairly new addition to the library).

Change-Id: I8bf8895ce56bf86e3bed244279a9d32269e44763
2012-08-07 07:02:01 +02:00
Trevor Parscal 2eb0d4e51f Javascript, unlike PHP doesn't need double quotes for \n
This just cleans up a few places where single quotes should have been used instead of double quotes.

Change-Id: I6c53652e71ab96842ed5bb41fb1e0b8c923eb25d
2012-08-07 06:49:44 +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 f0549e0075 Merge "Kill all but one of the Parsoid compat hacks, we don't need them any more" 2012-08-06 21:02:03 +00:00
Catrope 444961af2f Kill all but one of the Parsoid compat hacks, we don't need them any more
Also remove traces of Parsoid workarounds in tests. Tests are now
passing, yay :)

Change-Id: I8a59fc92c567c3595849e3e9377ce6eb6acde280
2012-08-06 13:56:40 -07:00
Catrope 68c5430872 Fix weird bug that was suddenly happening on the live site
When closing annotation nodes, we weren't popping them off
annotationStack. Not sure where this came from, but the code was
definitely bad and this fixes it.

Change-Id: I6d805e9aca3778666212135f76ff34c6baacbbc8
2012-08-06 13:51:51 -07:00
Timo Tijhof c889292adf Kranitor #004: MediaWiki-specific clean up and minor fixes
* Default value of wgVisualEditorParsoidURL is broken.
  Slash is needed, else Api will request to
  http://hostnamePageName
  Roan says double slashes are okay, and look cleaner than string
  search checks etc.

* Use .clone() for mw.Uri instead of converting to string
  and letting mw.Uri parse it, again. Clone creates a basic
  instance and copies over properties internally (deep copy,
  no references).

* No need for hasOwnProperty (and its potential issues)

* Code clean up
 - Whitespace consistency
 - Variable hosting
 - Remove redundant `return false;` statements in event handlers
   e.preventDefault() is a jQuery.Event method that takes care
   of cross-browser issues.
 - Same for e.keyCode||e.which thing, this is already normalized
   by jQuery.Event
 - Add missing parameter to setTimeout
 - Consistent order in success/error handlers in $.ajax options

Change-Id: I5bc24e0cbdf01b3704d4ccb0b45b3052e3b58694
2012-08-03 23:55:52 -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
Trevor Parscal 1b09db518c Merge "Register QUnit tests suites in MediaWiki to run from Special:JavaScriptTest" 2012-07-30 18:59:50 +00: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
Timo Tijhof b5a12d0167 Register QUnit tests suites in MediaWiki to run from Special:JavaScriptTest
* Also update test/index.html with latest minimalistic format
* Update test suite hardcoded paths to match the definition in
  VisualEditor.php for ResourceLoader
* Issues:
 - 'jquery/jquery.json.js' should not be loaded directly,
   using a dependency instead.
 - Load scripts from the <head> in test/index.html so that
   code that depends on document being ready is catches instead of
   silently being ignored.

Change-Id: I5ad7390137f4d17c153a1bf69f19c4869c08e323
2012-07-27 17:14:23 -07:00
Catrope aabdb8dfba Flag MW-specific code in LinkInspector
Change-Id: I1a85c4c9f5ca0522c2d5491993fad7f05d3a1203
2012-07-27 14:51:58 -07:00
Trevor Parscal 1639b78df7 Merge "Bug 36200 - VisualEditor: Sticky selection popup" 2012-07-27 21:49:39 +00:00
Rob Moen f95677e428 Fixed the following bugs with save dialog.
-Bug 38042
Save dialog description field doesn't respond to 'Enter' or 'Return' keys

-Bug 38621
Pressing 'Esc' in Save-dialog should exit saving, return to editor

Change-Id: I9c43c6c9f2f2b538becc4fbbce1eda6e918d4879
2012-07-27 14:41:27 -07: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
Trevor Parscal ad3145ea8b Merge changes I4855fce2,Idabdbf25
* changes:
  Do underscore/space conversion in internal link targets
  Get link title from href by stripping article path
2012-07-27 21:23:44 +00:00
Trevor Parscal 2f6cde7c56 Merge "Make VE work again with the link RDFa changes in Parsoid" 2012-07-27 21:23:01 +00:00
Trevor Parscal 53e9258280 Added ve.init.platform with MediaWiki and stand-alone implementations
This should make it much simpler to keep MediaWiki specifics out of VisualEditor, which will in turn make it easier to integrate VisualEditor into another platform.

Change-Id: I073e9737b37c28af889f2457d10b082cefd0d63b
2012-07-27 13:39:19 -07:00
Catrope 7f5dc887ea Do underscore/space conversion in internal link targets
Convert underscores in the href attribute to spaces in the linear model,
and back to underscores when going back to HTML. This ensures the link
targets displayed to and edited by the user look nice

Change-Id: I4855fce28ad8b724284c53881abc7b99b59b9079
2012-07-26 17:30:35 -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 2b548a002f Get link title from href by stripping article path
This means we don't have to rely on data-rt.sHref. It also means that
we'll now be showing the canonical link target in the link inspector
rather than the link target as entered by the user, but that's fine.

Also change test to have href differ from sHref to show that we use
href.

Change-Id: Idabdbf2579663ef1efb47d6a73f39743c9f64f3b
2012-07-26 16:25:35 -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
Catrope 0a8fc3838d Merge "Code and comment cleanup in the ve module" 2012-07-26 20:50:11 +00:00
Trevor Parscal cd185cef1f Merge "Bug 38657 - VisualEditor: User should be able to select text in the save dialog." 2012-07-26 20:42:00 +00:00
Trevor Parscal 12d3afa85c Merge "(bug 37905) Make unlisting unlist all list levels" 2012-07-26 18:53:00 +00:00
Rob Moen 2ae174f805 Bug 38657 - VisualEditor: User should be able to select text in the save dialog.
- Attaching save dialog to toolbar wrapper vs toolbar itself.
- Attaching surface specific toolbar wrapper vs all toolbar wrappers
in the case of multiple editors on the page.

Change-Id: Ic81f5a680f5593c71c27b7d47fe246487eebd4a3
2012-07-26 11:47:11 -07:00
Trevor Parscal d12beec67b Code and comment cleanup in the ve module
Change-Id: Ifec72c3992db2ad222a1a89c5172d4089afd865b
2012-07-26 11:42:33 -07:00
Trevor Parscal b9af72e7e3 Merge "Switching to localStorage for copy and paste, remove test" 2012-07-26 00:08:10 +00:00
Christian Williams 9723bf51e5 Switching to localStorage for copy and paste, remove test
Change-Id: I555b8756afb53680d60f2068b8615787c60e9d8f
2012-07-25 17:07:08 -07:00
Trevor Parscal 94c68e6c4b Merge "Bug 33088 - VisualEditor: Editing a part of text of a link doesn't work" 2012-07-25 23:51:51 +00:00
Rob Moen df0fa5159c Bug 33088 - VisualEditor: Editing a part of text of a link doesn't work
(or this shouldn't be allowed)

-Revised method for for returning all link annotations in a
selection.  Now properly clearning all selected links.

-Trimming whitespace from selection
-Modifying selection if it doesn't contain annotated range
-Disabled link creation only if target is blank.  This allows
Existing link text to be modified while having the same target.

Change-Id: I7255dcf1c88fa1cd6e7edbc3baa82cd4c72a95d1
2012-07-25 16:49:34 -07:00
Trevor Parscal c244efe1ac Merge "Fix position of context icons." 2012-07-25 23:41:12 +00:00
Catrope 1a573480f7 Moved text node test to the correct directory
Change-Id: I6c2146cd051e9e992e6a30a2d5f83d337d454387
2012-07-25 14:49:48 -07:00
Catrope 23e3726a04 Merge "Added the missing "Node" to alien dm class names" 2012-07-25 21:45:39 +00:00
Catrope e9cfdd0230 Merge "Move test files" 2012-07-25 21:43:08 +00:00
Rob Moen 277e0f8b86 Fix position of context icons.
-Added RL embed for images

Change-Id: Id92e3cfe31376e18a924acc983ab17a2bcca837a
2012-07-25 14:41:25 -07:00
Trevor Parscal c03c52e762 Merge "Fix bug in getCoveredSiblingGroups(): forgot to decrement i at the end" 2012-07-25 21:38:06 +00:00
Trevor Parscal 76bac7d152 Move test files
Change-Id: Id0a0bd5b4a91f702cad34e9f5e7f2121763abffd
2012-07-25 14:35:49 -07:00
Catrope 639c9c189c (bug 37905) Make unlisting unlist all list levels
This means that when unlisting (unwrapping) a list, all of its child
lists are unwrapped too.

Change-Id: I7456ddf289dc15a662a4e1fabdeae283d31cd311
2012-07-25 14:24:39 -07:00
Catrope ce84277287 Fix bug in getCoveredSiblingGroups(): forgot to decrement i at the end
Change-Id: Iaba268e01000ac5a7ccfc6dfe23db624408e5234
2012-07-25 14:22:22 -07:00
Trevor Parscal a05381dce7 Merge "Inspector box shadow was a bit too dramatic, adjusted styles." 2012-07-25 19:50:29 +00:00
Trevor Parscal abe32945d1 Merge "Bug 38655 - VisualEditor: White box syndrome strikes back!" 2012-07-25 19:49:45 +00:00
Rob Moen 99ff0d5f6c Inspector box shadow was a bit too dramatic, adjusted styles.
Change-Id: Ie0f066f62b363df645c072ee174000991258574e
2012-07-25 12:47:04 -07:00
Rob Moen 5a41f77b99 Bug 38655 - VisualEditor: White box syndrome strikes back!
-Hide / show inspector with visibility vs display property
for iframe cross browser compatibility.

Change-Id: Ibdd0250872c42d74d6ff7d22abdf9d838962acc1
2012-07-25 12:40:56 -07:00
Trevor Parscal c88cc63b81 Merge "Restore arrow-down to original size because it is needed in context menu." 2012-07-25 19:33:16 +00:00
Trevor Parscal 565432d4aa Merge "Fix childNodeTypes for table" 2012-07-25 19:30:19 +00:00
Catrope 13ba9b7de8 (bug 37980) Cutting all text and repasting it breaks the editor
This was caused by a bug in fixupInsertion that caused it to believe
that inserting something like "a</p><p>b</p><p>c" into the middle of an
empty paragraph was invalid.

This commit fixes the fixupInsertion bug, which fixes the
select-all-cut-paste behavior in Chrome. It's still broken in Firefox
because of selection-related issues, but I'll split that out into a
different bug report.

Change-Id: I767f5d37ec7e511778ae9ca8283ec4b26c728298
2012-07-25 12:29:19 -07:00
Rob Moen 3c9a4e7027 Restore arrow-down to original size because it is needed in context menu.
Add element for arrow icon in dropdown tool and new css rules which
support RTL.

Change-Id: I4193f9cac7af7b84cf8400e9bdcbcb4967b57932
2012-07-25 12:18:51 -07:00
Trevor Parscal f43eeac80e Added the missing "Node" to alien dm class names
Change-Id: Ia18d3ede612e2ab8054feb6d94d3587a605e47c2
2012-07-25 11:54:54 -07:00
Catrope f3f7715553 Merge "(bug 38545) Fix RTL position of the drop-down arrow" 2012-07-24 02:32:43 +00:00
Amir E. Aharoni fd0af6541b (bug 38545) Fix RTL position of the drop-down arrow
In RTL interface the drop-down arrow overlaps with the text.

The arrow was positioned explicitly in relation to the left margin, and this
can't work in a flipped RTL environment. I changed the position to "right"
and modified the arrow image a bit.

Some visual tweaks to the arrow may still be needed. Another option can be
to convert the image to SVG or to use a character like ▼.

Change-Id: Ib09a2a20b150de6e8a9531fc0db7dfffe4e95525
2012-07-23 19:27:53 -07:00
Catrope da2e945ead Remove trailing commas
Change-Id: Iffd10561fbf2a5bc92acb50b9827a19016c623d6
2012-07-23 19:15:23 -07:00
Catrope d8a8e0328a Fix childNodeTypes for table
Change-Id: I0981fab7687f98859550b2ab4413a490f96d3fe3
2012-07-23 18:00:23 -07:00
Catrope 1e62e9f64c Prepend a colon to internal links to Category: and File: pages
Change-Id: I77570ea6ec9f29b5d5eb06b518cb08a1b2cea0b2
2012-07-20 16:50:14 -07:00
Catrope 4eca804542 Factored out building the annotation into a separate function.
Also cleaned up some var statements.

Change-Id: I819cd9b783da71f407fe7b6b862e98f5e0cfa3c2
2012-07-20 16:50:13 -07:00
Rob Moen 0195b04f26 Bug 33163 - VisualEditor: Floating toolbar should not be displayed when the edit area is entirely off-screen
- Added limits to toolbar float, Toolbar will not go past the last node in editor.
- Added bottom mode to allow toolbar to stick above the last node until the scroll position
is above the last node.
- Actually checking toolbar config now and setting float when flag is set.
- Gave float method for top toolbar a better name.

Change-Id: Ic39c5402fa7a05e13c5e81722d8729d93776d7e9
2012-07-20 15:28:44 -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
Catrope b23800a55b First stab at list indent/outdent
This works pretty well, the only problems I found are:
* when selecting multiple list items, only the first is in/outdented
* there's no special handling for child lists, so the behavior for
  in/outdenting list items that have a child list can look weird, but
  it's consistent

Also needs more documentation

Change-Id: I6f4f3725e57a590196d7d638a77b87ea85586dc8
2012-07-20 14:07:46 -07:00
Catrope 6703bfc265 Fix selectNodes bug where selecting </li><li> returned an empty result
* When ascending back up the stack, check for a start between two closings
* Also check for an end between two openings
* This introduces code duplication but selectNodes() is full of that
  already. I'll have to do a duplication cleanup soon
* Add test case for </li><li>
* Update existing test case that covered a </li>

Change-Id: Ifc80585ce0e0d6988bc54228602c69f0d519200a
2012-07-19 18:10:57 -07:00
Catrope c66724fbf1 After finding a zero-length selection between nodes, return immediately
Change-Id: I04568e053e82c6d6effc370de5edee5d749e3ae6
2012-07-19 18:09:12 -07:00
Catrope ce0371e8ae Fix bug with nested lists in getCoveredSiblingGroups()
For nested lists, this function would return multiple groups where one
was wholly contained in the other, use offsets to prevent that from
happening.

Change-Id: Ib03bb1c81712d805cc263c2975cc3942de63d2ed
2012-07-19 18:09:12 -07:00
Catrope d31b562dc7 Merge "Fixed issue where #sitesub was being shown even if it wasn't originally" 2012-07-20 00:44:18 +00:00
Catrope 015b85443f Merge "Converted some instances of "var\t" to "var "" 2012-07-20 00:43:02 +00:00
Rob Moen 5e27d6a7a2 Revised inspector iframe construction to allow multiple inspectors
to be added.  Create inspector elements in the propper document
scope.  Restore inspector css classnames to camel case for proof
that inspectors are being created in the correct document scope.
Previously, inspector elements created in the wrong document scope
would have css rules applied only if class names were lowercase.
Issue only surfaced in Webkit browsers.  Though, this implementation
is more future proof and will help prevent future inspector bugs.
Patch 3) Fixed global variable definition and mistake with
inspectorDoc

Change-Id: I36c0d078aea10d919689768878004a19f7f89b55
2012-07-19 17:29:15 -07:00
Trevor Parscal a0f537712e Converted some instances of "var\t" to "var "
Change-Id: I02154e0381d5ae65b482bbcfc21ac93d0bf30d86
2012-07-19 17:24:54 -07:00
Rob Moen 8d90fdd881 Bug 33088 - VisualEditor: Editing a part of text of a link doesn't work (or this shouldn't be allowed)
-Selection of part of a link now modifies selection to entire link
range on inspection.
-Retaining selection direction on new range
Only partial fix to bug as previous link annotation is not
yet properly cleared.

Bug 33053 - VisualEditor: Link creation should not include trailing
spaces, and should provide a suggestion based on selected text
-Created method to return a new range without outer spaces.
-Retaining selection direction on new range.
-Enhancement needed for link suggestion.

Bug 33108 - VisualEditor: Highlighted trailing whitespace should
not have styles applied
-Modified trim method to retain selection, added call to trim
range on annotate method.

Change-Id: I92f264e19350c62b7c2ac3cd9e78af0071afef5c
2012-07-19 16:15:07 -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
Catrope 326607f34d Merge "Fixed typo in checking for console.log capability" 2012-07-19 01:32:13 +00:00
Trevor Parscal fc63c771ff Fixed typo in checking for console.log capability
Change-Id: I4a3b88e4fd7d57344673572cae24eff5c6078574
2012-07-18 18:30:51 -07:00
Catrope 8ff9df6023 Merge "Renamed ve.ce.Document.css to ve.ce.DocumentNode.css to match it's contents" 2012-07-19 01:29:03 +00:00