Commit graph

4383 commits

Author SHA1 Message Date
Inez Korczynski a609afe52f Port static method addAnnotationsToData from ve to ve2 2012-06-11 15:31:55 -07:00
Catrope dcdc1737ca Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-11 14:53:28 -07:00
Rob Moen 542131e080 Properly clearing link annotations now
Change-Id: I2342ad496566e6d7f6e39a30f70af1f886398069
2012-06-11 14:50:52 -07:00
Catrope b26649a2e8 Guard against passing undefined into ve.compareObjects(), was causing errors 2012-06-11 14:48:46 -07:00
Trevor Parscal 82c409ca18 Changed loading graphic, added focus on load
Change-Id: I2d91c25edc7b759f07fe1581953fa0e5baecb51c
2012-06-11 13:24:35 -07:00
Rob Moen 29c76e6dd4 Fix link annotation from inspector by changing link type to wikiLink
Change-Id: I5b3497755c6a13e2767f59cc5c95b3e4b43b3be7
2012-06-11 12:56:18 -07:00
Trevor Parscal a0d5cbd42a Animated the margin of the first heading and fixed animation of save dialog
Change-Id: If4a37aa9e35d9d507577643e4bd40ea4fa3dfad8
2012-06-11 12:28:31 -07:00
Trevor Parscal 17fff0d163 Fixed dependency on mw, now demo works again
Change-Id: I26599e065a521cf08a16f5a65e36960a692421e9
2012-06-11 12:11:07 -07:00
Trevor Parscal 21ff108c28 Bring link converter in line with Parsoid
Parsoid outputs rel="mw:wikiLink" or rel="mw:extLink", so we convert that to link/wikiLink and wiki/extLink respectively.

Also preserve the data-mw attribute; we probably need to do this more generally but this'll do for now.

Change-Id: I32e570bffa5a73a733a120d52cfd8b75d3191e02
2012-06-11 00:36:20 -07:00
Trevor Parscal c40dd953ca Remove stray debugger statement
Change-Id: Ie7c37e658d6d6bc15d5d7c24b2f5cd13945c5243
2012-06-11 00:33:13 -07:00
Trevor Parscal ce8efd6b15 Refactored veCore class into ve.init and ve.init.EditPageTarget
Change-Id: I52ef09aee38471ca49f3f4a845daf02e6dcc024c
2012-06-10 23:54:41 -07:00
Rob Moen 38e64418b5 Move inspectors into iframe loaded in contextView.
TODO- needs cleanup

Change-Id: I62d86260b48ef570ce18833dee3390ec9fff47e1
2012-06-08 17:17:11 -07:00
Trevor Parscal 2e1b304a48 Cleaned up styles for editor in both demo and sandbox/integration
Change-Id: I9b4a3727fd04b3c3ff3f297c6656db2592856173
2012-06-08 16:20:37 -07:00
Christian Williams 80194260f3 Undo and Redo
Change-Id: I2d7c1bfd164a42e5d52001054e52e47ca245ad18
2012-06-08 16:21:47 -07:00
Trevor Parscal a2231cb6ca jQuery expects a string for the data, not a DOM element
Change-Id: I16b6f00952a2d9e38d631409b9bf3dd7ada644e7
2012-06-08 16:00:30 -07:00
Trevor Parscal 89b2260bfc Revert "Support for basic text insertion - typing"
This reverts commit 21056ff5ec.

Change-Id: I86bb28d868b2c931f4b6e18ba5023a8a75b40231
2012-06-08 15:54:05 -07:00
Inez Korczynski 21056ff5ec Support for basic text insertion - typing 2012-06-08 15:31:29 -07:00
Trevor Parscal 3cef118240 Added real round-tripping, instead of canned HTML
Change-Id: I73cef900e0777352e34818396c1e5d6f218da967
2012-06-08 15:17:36 -07:00
Trevor Parscal d61045085a Fixed link conversions to match parser
Change-Id: I67838a8c05729e4d32e6e2dfca53c7d457143ce3
2012-06-08 15:17:18 -07:00
Trevor Parscal 20d1c290d4 Fixed multi-auto-wrapping issue and added tests to track regressions
Roan mostly wrote this

Change-Id: Id292c84a4da97d6608aa7c17ab6a4cf5a2e3f409
2012-06-08 15:16:55 -07:00
Trevor Parscal 402d6dc53a Added rendering for link/unknown
Change-Id: I47cdc8679c533f15059b290bf30ae74518dce724
2012-06-08 15:15:43 -07:00
Trevor Parscal 5969f55550 Delete HTMLConverter and update demo&sandbox
Also update the demo and sandbox for ve.{dm,ce}.TableSectionNode

Change-Id: I5a73a8250d283e8666b93561ce9e9374739936a5
2012-06-08 12:40:43 -07:00
Trevor Parscal faa58d1e4a Merge branch 'refs/heads/master' into dmrewrite 2012-06-08 12:29:57 -07:00
Trevor Parscal 2e0d4ef094 Make tableCell represent both <td> and <th>
Adding a 'style' attribute which is set to either 'data' or 'header'

This breaks even more tests because of missing style attributes

Change-Id: I0a75d8c1578b4414eeae8c484f6c4d6f8a59472a
2012-06-08 12:27:22 -07:00
Trevor Parscal c614d3391b Add ve.dm.TableSectionNode and ve.ce.TableSectionNode
Yes, this breaks a bunch of tests, because tableRows are now required to be inside tableSections

Change-Id: Idb52d988df69173647c85f7602344650456e078e
2012-06-08 12:26:45 -07:00
Trevor Parscal 5e6713eae5 Throw an exception when attempting to annotate a closing element
Change-Id: Ifd4e49ee05e74db8bec754a6c1f79c969c1f2eac
2012-06-08 12:23:59 -07:00
Trevor Parscal 5aa6f4b342 Fix bug in fixupInsertion()
When a text node was closed (either by encountering a non-text node or by reaching the end of the document), the fixupStack would not be processed. This led to attributes being dropped when nodes were split because of text being inserted into them

Change-Id: I41f6d20e0c1bfc8d8689b7e6325e724dd8156ab1
2012-06-08 12:23:58 -07:00
Trevor Parscal acdd5679ec Finish implementing ve.dm.Converter and document it
* Add code to handle elements and annotations
* Drop support for aliens from getDomElementFromDataElement() and move it into getDomFromData()
* Implement getDomElementFromDataAnnotation()
* Document a few functions

Change-Id: Ic6a418cbf9d7d1ad96299d7d3633970a876c6103
2012-06-07 21:58:56 -07:00
Trevor Parscal cc0c490502 Fix typo in LinkAnnotation
Change-Id: Idfb969a73c59aef1acf54edd61d555cdc295534c
2012-06-07 21:16:55 -07:00
Trevor Parscal f2b3df8027 Cleaned up some useless/unused functions
Change-Id: I6aa5d0ed3d21993ed653ee64b4928ef98874db2d
2012-06-07 15:02:40 -07:00
Rob Moen e1b8f9422d Fix bug in getAnnotationsFromRange where if the range length was 0
it would return no annotations.

Change-Id: Iec33366b2a1249122a21617d6681ae039557c2fe
2012-06-07 14:53:30 -07:00
Christian Williams 244551ff96 Updating model selection after cut and paste
Change-Id: Iefaec5a3d705c6caae76941bc05810152d870bb8
2012-06-07 14:48:46 -07:00
Trevor Parscal 453bec4555 Fixed alienInline and alienBlock conversion (was missing closings)
Change-Id: Ie8e51eb8d9a452c656aebf341071da5627dd80b5
2012-06-07 14:30:06 -07:00
Trevor Parscal fa9fe8b08a Added support for alienInline nodes
Change-Id: I15b9cbcdb66b966dca28edcb26bf5d54a4f17be6
2012-06-07 14:16:19 -07:00
Rob Moen 9fe6658a0e Put getSelectionRect method back in surface view.
Change-Id: Iaec899bec157ef39810d391b2ed51d4f8fe3be9d
2012-06-07 14:13:55 -07:00
Rob Moen 4b940c3b19 Init rangy in case of Toshiba
Annotate button redraws selection after annotation
Added contextView hooks to select listener in toolbar.

Change-Id: I598fe715dd84976862eed63e4f55cb6bc6e75b18
2012-06-07 14:04:39 -07:00
Christian Williams 1f86885d47 Fixing copy and paste
Change-Id: I57ead6a6d831aa739df49960f97cb2f91f672730
2012-06-07 14:03:48 -07:00
Catrope 9cab267911 Fix some JS errors in the ve.ui code
Change-Id: I57057369f56dc20b56231ed4bbe34816c3c718d7
2012-06-07 13:29:14 -07:00
Catrope 3c1de3dc4f Add ve.dm.Document.getBalancedData()
Change-Id: I2420ef5369b9eae053962898b64dd7324e714bbd
2012-06-07 13:17:57 -07:00
Catrope feac2f6069 Factor out element cloning into a getClonedElement() function
Change-Id: Id6024c15d4d9c9141bc4e1afa39fce29992b8647
2012-06-07 13:17:57 -07:00
Inez Korczynski 6704b01e30 Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-07 11:44:35 -07:00
Inez Korczynski 5c41fa2fb8 Define min-height for P and HX tags - needed when those tags are empty.
Change-Id: I0ba1c950cc06b3ff040c208c1b9a4970b2f73493
2012-06-07 11:44:05 -07:00
Trevor Parscal 18461387c0 Roan officially does not owe the team lunch (at this precise moment)
Change-Id: I90a6198da97ea90f60d9668c21d7386984a03ff0
2012-06-07 11:33:58 -07:00
Inez Korczynski ffd411b5e7 Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-07 11:26:48 -07:00
Inez Korczynski 22ebab2fa5 Simplify example document that we are currently using in our sandbox (now
it does not include Alien nodes and Images - because we are not going to
support them for June release).

Change-Id: I229e4b5f2881714252699f23aef164655fa8bcf6
2012-06-07 11:25:40 -07:00
Christian Williams f318d68966 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-07 11:17:14 -07:00
Christian Williams 88ae9b0826 Simplified demo HTML (no images or aliens)
Change-Id: If882086eeccf27a55f1ff7ae0d3657c17268c23e
2012-06-07 11:16:56 -07:00
Inez Korczynski 02f913a7db Added accidently removed registrations for events handling.
Change-Id: I6e5df649909b025f7e7aeb35ff9e8ff0b7fcd5f9
2012-06-07 11:10:08 -07:00
Inez Korczynski 97001e1301 Improvements to selection mechanism.
Change-Id: I031dd3493832034c985b15bf213cafe2c4813136
2012-06-07 11:03:22 -07:00
Inez Korczynski 95297a2c73 Delete from ce.BranchNode code that is not needed anymore.
Change-Id: I64f869a9fd54d089d2c6a31d827ddaccb9ece900
2012-06-07 11:02:59 -07:00
Inez Korczynski f711d78d4d Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-07 10:58:42 -07:00
Gabriel Wicke 1ca586e5f1 Improve interwiki config a bit
* Moved wikipedia default prefixes to environment
* Added 'addInterwiki' method
* Adjusted link handling normalizeTitle to reflect this

Change-Id: If5b2314cc36346b6da8649ed410457a612d80a22
2012-06-07 12:30:16 +02:00
Gabriel Wicke 2fa5baabbb Make it easier to configure the default wiki, and add support for mediawiki.org
* mw:Foo now loads pages from mediawiki.org
* The default prefix still is 'en'. You can switch this to 'mw' in ParserService.js.

Change-Id: I1208667e6114bd711b7988a8b3adb32ffab70969
2012-06-07 11:50:40 +02:00
Subramanya Sastry b665a2558f Fixed bugs handing/transforming quotes
- Three bugs that were messing up quote transformations.
- Now, the following cases are handled properly:

  * ''foo'''
  * '''foo''
  * ''foo''''
  * ''''foo''

  These tests (and other quote tests) have to be added to core parser
  tests file.

- One more parser test green.

Change-Id: I4f93e8910639f546bfc9304becab17d26d5529de
2012-06-07 01:37:45 -05:00
Christian Williams 51aa317df3 Undo and Redo support
Change-Id: Icdbebccefe3cc162b9ff6c0d978d5e4fc1f2c561
2012-06-06 20:28:06 -07:00
Inez Korczynski d96db8dce7 Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-06 18:50:02 -07:00
Catrope d8359da409 Change calls to getElementType() (which doesn't exist) to getType()
Change-Id: I894835a0178beddce480c48917700090b31c80b2
2012-06-06 18:03:55 -07:00
Rob Moen 72ee6bac1a Comment out robs selection test stuff
Change-Id: I251de0935f733915042684d186da57b43bc35c51
2012-06-06 17:50:28 -07:00
Rob Moen 232f2c58f7 Fix linkInspector tool
Change-Id: I89fa17b1a72c3f45bce5a11b49aa5445c5990f68
2012-06-06 17:50:01 -07:00
Trevor Parscal b62beed2e2 Added implementation for ve.dm.Converter.getDataFromDom
Change-Id: I8561d4a00ba630b86fb7bcd3e347fe2c6c2f6aa3
2012-06-06 17:47:27 -07:00
Rob Moen 8db70ed263 Annotation buttons now working
Created new document method to determine if a specific annotation
object is inside an annotation array.

Change-Id: Id645929cbf31030b8b0fcacb8dfb36e61aaad129
2012-06-06 17:06:37 -07:00
Christian Williams 77d5cae575 Consecutive spaces
Change-Id: I3f51ce0a2ee0a78e56c55de94bd45796b400680d
2012-06-06 16:29:02 -07:00
Catrope 5e47bdc57f Maintain a transaction-wide offset adjustment
This fixes a bug where the second replace operation in a transaction
would cause the rebuild of the wrong range, or the adjustment of the
wrong text node.

Change-Id: I9b1c68d84999d538fe10bb193f4dfdd694121d2a
2012-06-06 15:34:55 -07:00
Catrope 02b19f337f Add zero-length text nodes to empty content nodes
This is needed to make the results of certain transactions' tree sync
round-trip cleanly through the ve.dm.Document constructor

Change-Id: I2ab0758ec6bd7afba5b6645c7330f9fa2d45205d
2012-06-06 15:33:42 -07:00
Catrope ae3d31d447 Shallow-copy annotation objects in HTMLConverter
This fixes an annotation contamination issue that was causing Rob's
tests to throw exceptions

Change-Id: Ic5171d600b0b2ff97cc569e1e6f9488fab177c7c
2012-06-06 12:21:01 -07:00
Catrope e524152319 Fix typo in variable name
Change-Id: I6772555da86a186ec2421d01f82de14463061362
2012-06-06 12:20:05 -07:00
Rob Moen 337e9b8eee Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-06 12:02:22 -07:00
Rob Moen 21ee17a192 Fix up some tools to not break on selection, added some test selection
stuff to sandbox

Change-Id: Ic97144e634111c489507814c6634c66831726191
2012-06-06 11:51:19 -07:00
Catrope 1429a3da59 Rewrite newFromRemoval() using 'covered' mode
Change-Id: If0736aff6d194ec09c2a109f046dd6362ddc64fb
2012-06-06 11:47:35 -07:00
Catrope 1566306937 Add 'covered' mode in selectNodes
Change-Id: I4d24c011ce7a94bc75508dea410fb0ed9ebce6a1
2012-06-06 11:47:35 -07:00
Catrope 244349aedb Fix stupid typo in selectNodes()
Change-Id: I1e308c9f3a6e6eb8fe7fe8ae3c6abf7cc3a84d09
2012-06-06 11:47:35 -07:00
Catrope d39fb9dd1c Make pushReplace([], []) do nothing
Change-Id: Ifa8df99f376ce22add9d06e76831e8b661e6ddbf
2012-06-06 11:47:35 -07:00
Rob Moen 2439c0149a Created secondary method for getMatchingAnnotations
new static method looks for annotation in annotation object.
ve2 Cleanup on annotate method and surface model.
Partially revive UI tools by exchaning old method usage
for ve2 methods.

Change-Id: Id0ac58330292d76801bbcf1d71a919b493f8ab9e
2012-06-06 11:27:23 -07:00
Trevor Parscal 5d20f45120 Added getHtmlElementFromDataElement and getDataElementFromHtmlElement
Change-Id: Ie5f4fd86612b5a6c34b5843d1e9a521edc626a63
2012-06-06 10:17:51 -07:00
Gabriel Wicke 350e700d8f Add core-upgrade
Change-Id: I5ad0955e8272d376f009f89461bed310978b25e4
2012-06-06 15:58:17 +02:00
Gabriel Wicke a146fcb8ad Improve the handling of newlines for round-tripping
An improvement, but there still are some extra newlines inserted after
paragraphs. Example input:

-------

Foo:
{|
|foo
|}
-------

Extra newlines are inserted after the Foo: and the foo in the table. They are
not fed as tokens or text to the tree builder, so there is likely a bug in the
html5 library or JSDom.

Change-Id: I83eb6180e3cd1c4e7f9b15b31d339e1d32bccd3f
2012-06-06 10:17:03 +02:00
Gabriel Wicke 59fc634cce Update patched html5 library to version 0.3.8
Change-Id: I321d9a58ea1af33842a606fc8706938093a8330f
2012-06-06 10:17:03 +02:00
Subramanya Sastry fe6f289486 Merge changes I5d98c704,Ib8d3de75
* changes:
  A few tweaks to link round-tripping
  Use word diff if --color is enabled
2012-06-05 16:04:23 +00:00
Subramanya Sastry b095db4303 Simpler implementation of flatten.
* Possibly more efficient under heavy GC load -- untested.
* No change in time and memory use for single file parsing.

Change-Id: Id2f3f65cc0e5f38ed968bbda60b97e46523e700e
2012-06-05 10:47:46 -05:00
Gabriel Wicke dc3168cf6d A few tweaks to link round-tripping
* Moved the tail attribute to the second attribute (a bit cleaner)
* Disallowed newlines in the tail production
* Improved the selection of round-tripped href vs. generated content vs. href
  in the serializer
* renamed state.linkTail to state.dropTail

Change-Id: I5d98c704b6ea566011e22237786f8da17548570f
2012-06-05 17:26:27 +02:00
Catrope d378182bff Reapply typo fixes from c0e1991 , were undone in b0f6f64
Change-Id: If84e13b91781ed96d3bd9e94171e16020c65ea42
2012-06-05 06:54:35 -07:00
Catrope 528728558b Fix bug in selectNodes's logic for traversing back up the tree
Change-Id: I0fc5a2ad2c9a8d162e8ddbf3cc6d31684d364928
2012-06-05 06:50:09 -07:00
Gabriel Wicke d16032ae9a Track html syntax in block_tag production
Change-Id: If560523644f007485809762f12216e08fb3c3ed3
2012-06-05 12:39:56 +02:00
Gabriel Wicke cc96ff4f5e Very basic interwiki support
Pages titles with a wikipedia interwiki prefix now load the page from
corresponding Wikipedia. Links in a page then stay within the given language.

Note that Parsoid currently makes no effort to recognize localized namespaces,
so it won't render media files, categories etc correctly.

Change-Id: I7bc4102e81a402772ea23231170734d580ea15b9
2012-06-05 11:19:58 +02:00
Trevor Parscal b0f6f64d90 Made pushRetain do nothing if you give it 0 and throw an exception if you give it a negative length
Change-Id: Ib9955660b05a04503325ddb20f9e9a525b4d6832
2012-06-04 16:27:33 -07:00
Trevor Parscal 9111e34a0b Added nodeOuterRange to selectNodes
Change-Id: I9ef0c383fbb2515c752d2d3c52e8632aac73d811
2012-06-04 16:21:29 -07:00
Catrope c0e19915ef Typo fixes and missing 'var' in newFromRemoval()
Change-Id: Ibb984d862670b5386ff76fc55ef3322f695b6ae1
2012-06-04 16:07:16 -07:00
Catrope db793009be fixupInsertion() variable documentation and cleanup
Functional changes (fixes):
* Make writeElement() also update parentNode and parentType for openings
* Also add to fixupStack when opening a wrapper for a text node

Non-functional changes (cleanup&docs):
* Document all variables at the beginning of the function
* Group variables according to where/how they're used
* Move expectedType into writeElement()
* Kill node, duplicates parentNode unnecessarily
* Kill paragraphOpened, was misnamed and unnecessary
* Rename closedElements to reopenElements

Change-Id: Ie5b4e4f30b267943048fdc170accb29139039192
2012-06-04 16:07:16 -07:00
Catrope f7445b37b8 Retain attributes when reopening closed nodes
* Push entire elements onto openingStack rather than type strings
* When closing an element, build a clone of the opening and push it onto
  closedElements, then insert that clone when reopening the element

Change-Id: I8b0fb44394aed6c471dc6dacaab03e44c2333733
2012-06-04 16:07:16 -07:00
Catrope b167453f0d Add ve.dm.Node.getAttributes() to get a reference to the attributes object
Change-Id: Ic2463d4f7053a5f6defd212f04deb5ea71542843
2012-06-04 16:01:14 -07:00
Catrope 109624e8b3 fixupInsertion fixes, wrapping content works now
Change-Id: I1eee6afcffbf09955578b7f0534aa5b7234802df
2012-06-04 16:01:13 -07:00
Rob Moen fd5eb80dd7 Document annotate method in surface model.
Comment cleanup

Change-Id: Ifd3eeab9046f376529a827dfafdc28506845ac15
2012-06-04 15:06:37 -07:00
Rob Moen c338304d33 Rewrite annotate as more low level method in Surface model.
TODO: follow up with annotate tests

Change-Id: If0e68bd3a09840b1e5f3e8d85fd22a8c10134b58
2012-06-04 14:29:27 -07:00
Gabriel Wicke 92f753a365 Pre and link target improvements
* Don't explicitly add the newline in the pre, as we preserve newline tokens
  now. This avoids doubling of newlines when round-tripping.
* Use the sHref attribute even if the href contains spaces.

Change-Id: I8bec8fbfd6a7836bf2e5eec20869a0edd95c93b6
2012-06-04 14:03:05 +02:00
Gabriel Wicke ee2ddbd3cb Fix list handler issues
Lists interrupted by non-empty lines would not close the list properly.
Register for any token instead of just for newlines and close the list if no
listItem follows the newline.

Change-Id: I1743901e3db541bbeda78d17707db943e6ceb9b9
2012-06-04 13:38:43 +02:00
Gabriel Wicke f821eac102 Optionally round-trip sHref in data-mw
If the href would not denormalize, add a copy of the original href in data-mw
and use it to preserve non-conventional capitalization etc.

Change-Id: Ifef50eec7343b0e6b0ba66b6d19a8a3e8c9f8001
2012-06-04 12:28:05 +02:00
Gabriel Wicke e0809209ec Don't set the data-mw attribute if the object is actually empty.
Change-Id: I984f1b44bba67d7a9f1a709738d14c0ee02f69a9
2012-06-04 12:26:03 +02:00
Gabriel Wicke 2774e5aa6c Actually replace all underscores in wikilink target
Change-Id: I633f8d6e4f639aff90fd456600376b7c6515fd50
2012-06-04 11:48:59 +02:00
Gabriel Wicke 3f2c72f920 Fix padleft / padright (mis)use as substr
Change-Id: I0645e11c8ef8b550ad35300d1904788940fc748a
2012-06-04 11:30:45 +02:00
Gabriel Wicke 4533c274ca Fix a crasher in the serializer
A tail containing regexp syntax (a ? in [[:en:Main Page]]) would crash the
serializer. Use substr instead.

Change-Id: I8519aec9c07dfe31893d676b1c936a42d2af74a0
2012-06-04 00:00:54 +02:00
Gabriel Wicke 31522d3d49 Add ApiRequest
Change-Id: I5f2a1cb65223a68f10bc63903000248efca05586
2012-06-02 16:52:51 +02:00
Gabriel Wicke 63abd57fc8 Improve newline-before-paragraph round-tripping support
Change-Id: I9176a97f9695018650d9a63b89514c07e0d6be90
2012-06-02 16:39:33 +02:00
Gabriel Wicke d3975a8d03 Very basic round-trip test mode for the API
Returns both the resulting wikitext and the diff with the original input.

Change-Id: Iad25039beb054a84e1ad51ffa9fee924db49c60b
2012-06-02 16:20:54 +02:00
Gabriel Wicke 74135b295f Some more switch fixes
Change-Id: If1a6086348c45a73a941bc8e6728ef75d002be50
2012-06-02 15:04:20 +02:00
Subramanya Sastry 8f216af2f5 Handle link tails properly.
- Added a tail json attribute for wikiLinks
- During serialization, this attribute is used to strip the tail from
  the link target and render it after the link

  [[hen]]s ==> <a ... data-mw="{gc:1, tail: 's'}" ...>hens</a>
           ==> [[hen]]s

- 2 more roundtrip tests green

Change-Id: I84f3dabaf0271f7a67641a00148467daa8310eb0
2012-06-01 23:41:10 -05:00
Trevor Parscal 73c5dd8f1d Added ve.dm.Node.getOffset
Change-Id: I4fb99040af44c063ad3b6489f2fd895d843fcf0c
2012-06-01 17:44:01 -07:00
Christian Williams 3ef601f04e Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-01 16:38:43 -07:00
Christian Williams cf63a2dd36 Support for pasting into a range
Change-Id: I13e29caba4d912db2477a2c3c4edeca5d21d06b4
2012-06-01 16:38:27 -07:00
Rob Moen 3f3b525d56 Add MakeGlobalVariablesScript hook to add new global, vePageWatched.
This allows us to check the watchlist checkbox on save dialog.
Added watchlist toggling to ve save api.
Added some i18n messages to core integration.

Change-Id: Ibed8edb2c59ad49e1738c937c3bea518238d0845
2012-06-01 16:30:17 -07:00
Christian Williams 2bd615c6d2 Cut, copy, and paste now working with images
Change-Id: Ic3b99d39bd41a8fe39e015ca05d159a5a4ea2b15
2012-06-01 15:52:51 -07:00
Subramanya Sastry 413fc5e043 Fixed bug serializing wikilinks with implicit link text.
* Simple fix but greens 10 more roundtrip tests.

Change-Id: I7f82d788a10bd83e0e3215568c2168081c332c50
2012-06-01 17:25:21 -05:00
Inez Korczynski a2e7335ed6 Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-01 14:37:34 -07:00
Trevor Parscal 386faa5569 Fixed ve.dm.Transaction.newFromRemoval so it supports trimming off extra openings and closings
Change-Id: Icbcf4129a51aa92d47aa89738facd0d288337cbd
2012-06-01 14:34:59 -07:00
Inez Korczynski 8a35e6eafe Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-01 13:51:24 -07:00
Gabriel Wicke 16219ddc6d Fix up #switch a bit
* Re-establish the value-only default
* Fix value expansion

Change-Id: I32e62789b25bbe17a74c564e41e9101ad5528fb7
2012-06-01 22:15:43 +02:00
Gabriel Wicke e2301813ed Merge "Tokenizer backtracking cache bug fix and memory savings" 2012-06-01 12:06:00 +00:00
GWicke befd223476 Merge "First pass implementing a general tag minimization routine" 2012-06-01 11:15:48 +00:00
Gabriel Wicke ece2b0f810 Tokenizer backtracking cache bug fix and memory savings
* The state of syntax stops is now properly included in the cache key for the
  tokenizer-internal backtracking cache. This fixes some mis-parses when
  re-parsing a bit of text with different flags.
* Clear the backtracking cache after each toplevelblock. This drops the peak
  memory usage when expanding [[:en:Barack Obama]] from ~380M to ~110M.

Change-Id: Icdb879cae5907e4595903dd6acba2e686e8c2e4b
2012-06-01 12:53:49 +02:00
Trevor Parscal e7f03c6d70 More cleanup, removed ObjectAnnotation (they are inline elements now)
Change-Id: I2c53c145eed1a801392c954001de7641f928216c
2012-05-31 17:18:28 -07:00
Trevor Parscal ba8d1b46f2 Cleanup
Change-Id: Ida9c94d5aa410ee699b706492f444a6449922ede
2012-05-31 17:11:01 -07:00
Trevor Parscal 294abb0a38 Simplified converters data structures
Change-Id: I1734bc7e06462595ea2f27715948fbb3d9e552ad
2012-05-31 17:03:03 -07:00
Rob Moen 7d96b8426f Created save dialog in core integration
Stash content element styles and remove transitions
Working towards a cleaner saving experience

Change-Id: Ic67022456f46b2bef56a9b0ccfcf93c3283573c4
2012-05-31 16:56:40 -07:00
Trevor Parscal 042ffb4e3b Added foundation for new converter
* Added converters to all relevant node implementations
* Added new annotation objects with their own factory

Change-Id: I9870d6d5eac45083929d74d2e58917d0939ca917
2012-05-31 16:50:16 -07:00
Inez Korczynski 9edb38353c Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-31 15:52:01 -07:00
Trevor Parscal f6864b0c04 Changed use of "factory" to "nodeFactory" to make way for other kinds of factories
Change-Id: I96db0f28bb220f1c3b23990824e9523278cb8f9b
2012-05-31 15:20:58 -07:00
Trevor Parscal 32bddaf088 Added ve.dm.Transaction.newFromRemoval
Also:
* Refactored tests
* Added tests for ve.dm.Transaction.newFromInsertion
* Added tests for ve.dm.Transaction.newFromRemoval
* Fixed problems with ve.dm.Transaction.newFromInsertion
* Added ve.dm.Node.canBeMergedWith which is partially a port of ve.Node.getCommonAncestorPaths merged with canMerge from within ve.dm.DocumentNode.prepareRemoval from the old ve codebase

Change-Id: Ibbc3887d08286d8ab33fd6296487802d65b319fa
2012-05-31 14:39:34 -07:00
Subramanya Sastry 1c80e2d7f0 First pass implementing a general tag minimization routine
* This routine attempts to rewrite the DOM to maximize tag overlap
  and thus minimize tag uses.

* This takes as input a set of tags which participate in the
  minimization.

* Tested on the following example
  <b><i><u><s>BIUS</s></u></i></b><b><i><s>BIS</s></i></b><b><u><s>BUS</s></u></b><u><i>UI</i></u>
  with multiple combinations of the 2^4 possible variations of i,b,u,s
  tags: [], ['i','b','u','s'], ['i'], ['b','s'], ['i','b','u']

  - But, I am not fully sure if this implements the right behavior when
    only a subset of inline tags are provided.  Needs discussion and tweaking
	 as necessary.

* Also tested on few others:
  <b>B</b><b><i>BI</i></b><b><i><u>BIU</u></i></b><b><i><u><s>BIUS</s></u></i></b>
  <s><i><b>SIB</s></i></b><s><i><u>SIU</u></i></s><i><u>IU</u></i><i>I</i>

* The previous pairwise tag rewriting version fails on several of these
  examples, so this new version is a definite improvement.

* No change in parserTests run (203 passing before and after).

* Possible improvements that could/should be undertaken:
  - get rid of useless/idempotent add/remove of nodes that don't change
    the DOM.
  - ensure that node attributes post-restructuring are correct.

Change-Id: Ib4a8b39583fa96a2be880a77021ca81cefa06484
2012-05-31 12:10:28 -05:00
Catrope 2f18605a1a Fix buggy replace behavior when inserting content that contains nodes
Copy-pasting things like "text<IMAGE>moretext" failed spectacularly,
this commit fixes that.

* Check for content rather than structure in the inserted/removed data
* In the content case
** Run selectNodes() over the removal range, rather than just the cursor
*** i.e. no longer assume that content replacements only affect one node
** If there is structure involved, rebuild all affected nodes

Change-Id: I80e40b5b7c514a3fb105d57e4a17770d0fefaaea
2012-05-31 07:27:36 -07:00
Catrope f6ca37926d Add ve.dm.Document.isContentData()
Some of the replacement code was assuming that "does not contain
elements" and "is content" were the same. They're not any more, because
we have content nodes (like image) now, so I need a separate function
to distinguish between these cases.

Change-Id: I206ccdf082b7baddf99d382eb3cdd77ea34fb479
2012-05-31 06:19:34 -07:00
Catrope e92db86046 Fix bug in ve.dm.Document constructor for input ending with text
If the last element of the input data array was text, the resulting text
node would have length=0 rather than the expected length value.

Change-Id: I3d089a80b8a447a12ba411b2e11c1b84f14f2959
2012-05-31 06:17:23 -07:00
Gabriel Wicke 4ea6b8e2be Revert part of last template syntax tweak
Change-Id: I084e1210577f80c3b96020d57cfa5c68eb5d139b
2012-05-31 12:02:42 +02:00
Inez Korczynski 065494941e Add special handling in getOffset method for a case when cursor is inside slug - required in IE
Change-Id: I27ae78632e7b28921f5fe4214d2fee658c37b564
2012-05-30 18:11:23 -07:00
Rob Moen b59d49a80d Restrict edit access to VisualEditor namespace to sysops
To allow non sysops to save via VE, refactored ve save api
to use doEdit which bypasses namespace protection.
Add edit link in view nav for non sysop so that they may edit
Add View source link in dropdown for non sysops
Add Edit source link in dropdown for sysops
Cleaned up some of the integration core code
UI tweaks

Change-Id: Ib4249bc5fb7ffa6410e4f2d278aafbb871800981
2012-05-30 17:12:25 -07:00
Inez Korczynski 43a6abec2d Introduce two different types of slugs - inline and block - this is in order to fix bug in IE with placing cursor inside slug by clicking next to it
Change-Id: Idf31a742ee98067688becf46b357c25cd10ddbc6
2012-05-30 16:45:06 -07:00
Inez Korczynski f7fb4bee5c Refactoring and performance optmization to method getNodeAndOffset - previously named getDOMNodeAndOffset
Change-Id: I067331f539bc86779c98be38e6a56ca04137c70f
2012-05-30 15:19:39 -07:00
Trevor Parscal 46d26b9f22 Added getNodeFromOffset to ce
WARNING: This is not as fast as the implementation of getNodeFromOffset in dm

Change-Id: I5fbe9b6edc66169b9caaa6751fde1b7b752814d1
NOTE: ve.ce.getNodeFromOffset and ve.dm.getNodeFromOffset should be renamed to getBranchNodeFromOffset to clarify that they only return branch nodes.
2012-05-30 14:38:18 -07:00
Trevor Parscal 8328fc8786 Removed aliases for node type constants, on the client we have them already in Node
Change-Id: Id68dd43930a51a857e73af0215fd215c89e9bbbe
2012-05-30 14:38:18 -07:00
Inez Korczynski 5f9ea545cf Refactoring and performance optimizations to getOffset method in Surface view.
Change-Id: I8b57c9dc069894c82a6bafc5f282aefda505d061
2012-05-30 14:06:44 -07:00
Christian Williams e216a6f8ab Fixed scroll jumping when pasting
Change-Id: I9607dee6d1b0ca1820a9da5f48966310214e5edf
2012-05-30 13:06:19 -07:00
Christian Williams 11b1bd8884 Using string constants for node types
Change-Id: I2d18d4f54c776e299bc10206386b655605dae839
2012-05-30 11:41:31 -07:00
Gabriel Wicke c5d7e01944 Another tokenizer robustness improvement
This patch fixes a tokenizer syntax error encountered on
[[:en:Template:JacksonvilleWikiProject-Member]] and [[:en:Template:Infobox
former country]] by allowing optional whitespace before start-of-line template
syntax.

Change-Id: Ic214a731de58bf766e51f23d5e24ea2ce6788f58
2012-05-30 18:38:23 +02:00
Gabriel Wicke a133768781 Don't eat '}}' in generic attributes and similar productions
This fixes some syntax errors, at least one in Template:Geobox.

Change-Id: I32338febe25d0833c1d9bc4de293cd15b4cbb7be
2012-05-30 17:37:10 +02:00
Gabriel Wicke 36084c5d93 Preserve original newlines in HTML and serialization
254 round-trip tests (up from 184) are now passing.

Also:
* tweaked runtests.sh slightly (use less -R instead of -r).
* made sure the EOFTk is preserved in phase 3 transforms

Change-Id: I1de22186bdb78e52019370e43f096877005b8f5a
2012-05-29 23:29:03 +02:00
Subramanya Sastry 8174c9dafc First attempt implementing rewriting rules on the DOM
- This is implemented as a post-processing pass.
- Might require additional checks to verify rewriteability.
- Implemented as a pair-wise tag DOM minimization strategy,
  i.e. it takes tag pairs (B, I) for ex, and attempts to
  normalize the tree just for those tag pairs.  Normalizing
  across multiple tags is implemented as pairwise rewriting
  across all pairs:  Ex:(b,i), (b,u),(i,u) for (b,i,u)
- Copied over attributes as part of rewriting, but some of the
  attributes lose their meaning on rewriting since tags are
  reordered (ex: sourcePosn, sourceTagPosn). How do we handle this?

Output examples and possible issues to fix:
   <i><b><u>biu</u></b></i><b><u>bu</u></b><u>u</u>
gets rewritten to:
   <u><b><i>biu</i>bu</b>u</u>

But, the equivalent wikitext form:
   '''''<u>biu</u>''''''''<u>bu</u>'''<u>u</u>
does not get rewritten because of parsing differences.
This wikitext gets parsed into:
   <i><b><u>biu</u>'''</b></i><u>bu<b>u</b></u>
The extra ''' token in the middle thwarts DOM rewriting.

However, a slightly different version:
   "'''''<u>biu</u>''<u>bu</u>'''<u>u</u>"
gets properly normalized to:
   <u>'''''biu''bu'''u</u>

An alternative, but fun strategy to play with is to use the following
two normalization primitives: S(wap) and M(erge).
- S rewrites T1(T2(x)) into T2(T1(x))
  (ex: <b><i>foo</i></b> ==> <i><b>foo</b></i>)
- M rewrites (T(x),T(y)) into (T(x,y)).
  (ex: <b>foo</b><b>bar</b> ==> <b>foobar</b>)

The current rewriting strategy could possibly be re-implemented as S-M
rewriting.  The problem to solve there would be to find an efficient
rewriting strategy that is guaranteed to lead to a normal form.  I may
not play with it now, but just documenting it for later (to play with
in my spare time).

This commit is just as a record of fun/experimental code where I get to
learn details of JS, wikitext, parsing, and DOM manipulation.  Next
version of this code will attempt to introduce minimal DOM restructuring
across multiple tags at once which can be more efficient.

gwicke: Removed now passing test from whitelist, and updated another whitelist
entry which is now improved.

Change-Id: Ie97bcb164eb62c34ba61aa76ba2f4c232aa713d8
2012-05-29 08:17:57 +02:00
Inez Korczynski 8a52b41076 Working (but dirty) implementation of getOffset, getDOMNodeAndOffset and handlers for keydown/mousedown - to be refactored very soon
Change-Id: I57923218fc8e5f3e1cdde339cdc1cb5e859cdedf
2012-05-25 23:52:52 -07:00
Inez Korczynski e5897dffa4 Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-25 23:36:54 -07:00
Inez Korczynski e9230968fe Set contenteditable=false for Alien wrappers (both inline and block)
Change-Id: I5fd8fcfd0b6d98b525a75b3818cc77e3aca833c9
2012-05-25 23:36:18 -07:00
Christian Williams 8db39d0bb5 Support for plain text paste
Change-Id: I60846900d61b50138fe06dacee4693166e59651e
2012-05-25 16:26:46 -07:00
Rob Moen 0227de8c8e Remove edit token Ajax api request, get edit token from wgUser on save
Change-Id: Idb51da271d3eca61230d9948fc82190383fc7143
2012-05-25 16:20:48 -07:00
Christian Williams 64b9b33eec IE and its silly events
Change-Id: I81f46eca20cc5197305cbd355751c4c90e3b670b
2012-05-25 16:12:58 -07:00
Christian Williams 83e7eddfaf Support for paste
Change-Id: Id0a3d5d421aef56eb3296a56d00686ef7d07b433
2012-05-25 15:46:58 -07:00
Rob Moen 4ca26f1805 Switch tabs from read to edit when loading editor.
On cleanup, switch tabs back

Change-Id: Iefb47536e21cd7763c0d75c976109aeb2cbecf50
2012-05-25 15:41:22 -07:00
Rob Moen 237c0fd21f Created VE parsoid API save action.
Save action
1) posts html to parsoid service in exchange for wikitext
2) saves wikitext
3) returns parsed content.
On save, VE is hidden and page content is replaced.
Demoing save in toolbar, followup commit will redesign save options

Change-Id: Ibfbe52de08e3483e1a33f0740c03f96ec2b7f90a
2012-05-25 15:27:58 -07:00
Inez Korczynski 1e5e14c2c1 Add method hasSlugAtOffset to ve.ce.BranchNode
Change-Id: Id107bf890710096bb49111ae3d0d60e3315ecb89
2012-05-25 13:44:12 -07:00
Trevor Parscal 14862a1212 Fixed bug in isStructuralOffset which didn't consider neighboring a non-content leaf to be a structural offset
This was caused by the fact that a non-structural leaf can not have children, which makes it appear incompatible as a sibling to an arbitrary structural element (like a paragraph) but since it can not contain content we can check that instead.

Change-Id: Ie3c58b4b43f2aa6921f8f82aa82511e231207854
2012-05-25 13:19:56 -07:00
Rob Moen 7b47af516a Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-25 12:52:46 -07:00
Rob Moen 61413c49eb Create base integration core module
Works on VisualEditor Namespace
Created VE api wrapper for parsoid service to roundtrip pages

Change-Id: I3f2967730c1a3ece31b7262a46bef31ea8b38613
2012-05-25 12:50:48 -07:00
Christian Williams 80ed03f2a2 Support for copying
Change-Id: Icf4665f9c48896e26cb536af033ca55410af49db
2012-05-25 12:02:56 -07:00
Gabriel Wicke b2adee0ae7 Basic rt support for indent pre variant
* Added a generic stx_v 'syntax variant' round-trip attribute
* For pre, use stx:'html' vs. no syntax annotation. This might not be 100%
  safe for arbitrary html input, so we might want to flip this to stx:'wiki'
  later.
* 181 round-trip tests passing

Change-Id: If6080917a3a7c069066db3db60efe59b1f6c28d8
2012-05-25 18:55:38 +02:00
Gabriel Wicke a31ccaabe4 Support definition lists with empty definition
Change-Id: I81c39a7e49f2ea7ce32cdd3600caeb5eb9f50d84
2012-05-25 15:40:32 +02:00
Gabriel Wicke 06b51b1f3f Properly round-trip dd/dt; 178 round-trip tests passing.
Need to track variable whitespace before elements to make some more tests
pass.

Change-Id: Ia86535d6f352e2ffe7965547cd506b0dbb6dfba2
2012-05-25 13:59:55 +02:00
Inez Korczynski 8f4f076340 Added handles for mouse events (down, up, move). Implemented method SurfaceView.getOffset and applied significant fixes to SurfaceView.getDOMNodeAndOffset.
Change-Id: I06cbfa9e0e7afc7aaf19d5cda8b91fe93aeb51f8
2012-05-24 20:55:45 -07:00
Inez Korczynski afe18a685a Fix methods getNearestStructuralOffset and getNearestContentOffset for case of passing offsets that are already structural or content
Change-Id: I23cd2daab9cef181b01131b3b9c6ead5ec47f9f4
2012-05-24 20:53:50 -07:00
Inez Korczynski b56b6bad6d Just for purpose of testing add some hardcoded border and cellspacing to all tables
Change-Id: I97ff937d7e7d6a91ee3f411d7f77d5e3798ba567
2012-05-24 20:51:31 -07:00
Inez Korczynski 6017050b3f Add class ve-ce-imageNode to all image nodes, also comment out mousedown event handler
Change-Id: I7565d8822bbe0547e731df1859cdde4ac78de6f2
2012-05-24 20:50:36 -07:00
Inez Korczynski d9bd47d8a6 Make example demo document even more complicated
Change-Id: I9e0406fed859c5d848a5ea52a906d24e1671f458
2012-05-24 20:49:29 -07:00
Trevor Parscal ea9191b5b4 Copied CSS styles from ve to ve2
Change-Id: Iabd5ee3edde5747952c4b78ef6e9cd5949016050
2012-05-24 15:15:29 -07:00
Christian Williams 0a3b5df6de Image nodes are not draggable
Change-Id: Ie1080045939af7c9b7ac8c30527ad6057fe7e3f6
2012-05-24 15:10:16 -07:00
Christian Williams 88e25e77f2 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-24 14:47:41 -07:00
Christian Williams 1cc8aca16d Using invisible space character in slugs
Change-Id: I36752f4bea96bad61dedfbbb4fc00422d773227b
2012-05-24 14:47:24 -07:00
Trevor Parscal f6eef19021 Added copying of .data( 'node' ) from old wrappers to new wrappers on wrapper updates
Change-Id: Ibd9535bd9ebb712910d963eedc5941f8512aaf8d
2012-05-24 14:01:42 -07:00
Trevor Parscal c8ccdb9813 Moved ve.ve.BranchNode.canNodeHaveSlug to ve.ce.Node.prototype.canHaveSlug
Change-Id: I6d5d9ca5a1c9878acb15e9526feb94986822b491
2012-05-24 14:01:17 -07:00
Trevor Parscal ebfafac3e2 Added missing documentation to methods in ve.ce.BranchNode
Change-Id: If6833e3d639e0455025762987b7f41a43892ca4a
2012-05-24 13:22:57 -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
Trevor Parscal 3ce705313e Replaced static array with real logic inside of ve.ce.BranchNode.canNodeHaveSlug
Also added more static config getters and fixed some typos in prototype definitions

Change-Id: Ib9093a625b944e6a4ca4da50c51fb475b5895b8d
2012-05-24 13:12:45 -07:00
Trevor Parscal e150ba2e54 Moved "is slug gable" functionality to a static method of ve.ce.BranchNode
Also optimized some query stuff

Change-Id: I5675258c6e276a1ba410dcf1ee111392140a04eb
2012-05-24 11:58:33 -07:00
Trevor Parscal c9dddf60da Made getRelativeOffset return -1 if no valid offset is found in document
Change-Id: If4cef5fe800b241c3efe1d27cdf01cd1ceef2248
2012-05-24 11:43:47 -07:00
Gabriel Wicke 6f62878c78 Resolve subpage links, and remove hack for H: titles
Change-Id: I6c9c64179274e5c1641a3b127ac3b273a3c5254e
2012-05-24 17:57:41 +02:00
Gabriel Wicke dc61f313a2 Notes on missing parser functions, more error reporting tweaks
Change-Id: Ib6ce60cf1b55671a6ff57aa47edb5787ec3aefea
2012-05-24 17:31:26 +02:00
Gabriel Wicke cc10aab54f Add self alias
Change-Id: I47682f407da6b554179611c7d0f63f882ab5a871
2012-05-24 17:16:35 +02:00
Gabriel Wicke 13ae7cda11 A few (partly hackish) improvements
* Very basic support attribute key-value pairs emitted from templates
* Add TALKPAGENAME stub implementation
* Only show 'no revisions' message for top-level pages

Change-Id: I4b4ac0c7b2c0531ac4b39f0f49f4217302576ab9
2012-05-24 16:30:26 +02:00
Gabriel Wicke 3e0e11b1d0 Sanity check for tokens being an array
Change-Id: Ia4e4071e1469c31e3b320d854500938bb0245f82
2012-05-24 14:35:58 +02:00
Gabriel Wicke 93ce7453f0 Fake fullpagename et al a bit better
Change-Id: I85ddf9e88e5f8ac274f371bea0879600997001e4
2012-05-24 11:05:31 +02:00
Gabriel Wicke cdd1eca42d Fix non-existing revision error reporting
Change-Id: I6b8687bcde98b92d9d6217a738a177db279fd006
2012-05-24 10:50:47 +02:00
Gabriel Wicke f03fc39d15 Report missing revisions when retrieving templates
Change-Id: I9f33acafc4d3fbd062125d824e2614dafd4cd5a0
2012-05-24 10:45:01 +02:00
Gabriel Wicke caf2fa663d Keep going on tokenizer errors
Change-Id: I76fab4528f89b425845aef1685b3a54ddfeceef4
2012-05-24 10:30:32 +02:00
Gabriel Wicke e70448e53a Use text/x-mediawiki content type, and handle tokenizer errors without --debug
Change-Id: I154cd344306aa05ada7ff30f631d487f39fa9739
2012-05-24 10:19:25 +02:00
Trevor Parscal 1ddaec8acb Added getRelativeOffset and several wrappers around it
Change-Id: Ifd10922366650165bc4c21ea8cfdd2f9b7163432
2012-05-23 17:43:24 -07:00
Inez Korczynski e86c053045 Define better example/testing article in Sandbox
Change-Id: I5df37d7e3477bd49e69f44c4902810bca66734b7
2012-05-23 17:32:22 -07:00
Inez Korczynski 5b52e5320a Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-23 17:22:23 -07:00
Inez Korczynski fdbf1ac870 Define better example/testing article in Sandbox
Change-Id: Id9ce12f8977b94aca98823fdcb86a0840565579d
2012-05-23 17:22:10 -07:00
Trevor Parscal 541d786ced Added optional "unrestricted" argument to isStructuralOffset
Using this argument will only return true if the offset is a place you can add any element to (hence the unrestricted part of it). This is good for testing if a paragraph could potentially be inserted there.

Change-Id: I6cc91da437c52493de03eb687b28966198270fea
2012-05-23 14:56:33 -07:00
Inez Korczynski fe1482e0c4 Added method proxy to ve.ce.Surface
Change-Id: I2373df4c738b49685a897c8e13acebdd7ccb3e00
2012-05-23 13:34:52 -07:00
Inez Korczynski bea881daca Refactor mechanism of adding slugs in before and after particular nodes in branch
Change-Id: I8b3f4a9b27ff09d569f366c32f96e7e8191487c0
2012-05-23 13:24:49 -07:00
Catrope cce32103ff Implement newFromInsertion()
Mostly just wraps around fixupInsertion()

Change-Id: I5c9128439b9ed29b112590c0004a749f9b529346
2012-05-23 12:45:28 -07:00
Catrope 3be3f55c91 Rough first stab at ve.dm.fixupInsertion()
This code still needs a lot of work, but it seems to work for most
cases. Things that still need to be done:
* Documentation and comments
* Handling of content and text nodes
** Use Trevor's isContent/canContainContent code which I don't have yet
* Preserve attributes when reopening closed elements
* Tests :)

Change-Id: I3bc16c964ef158693490a61ce12beb21e6fe2a9d
2012-05-23 12:45:28 -07:00
Catrope 9a1ec62f0d Remove pushInsert() and pushRemove()
The 'insert' and 'remove' operations weren't implemented in the
transaction processor and were a holdover from the old DM
implementation.

Also migrated the tests, especially those that asserted that consecutive
insert/remove operations were combined (this is no longer the case now
that they are replace operations)

Change-Id: I2379fe92b331c5316f70f4b695397da41581cce9
2012-05-23 12:45:27 -07:00
Christian Williams 32b9ccd0bf Moving alien node styling to CSS file
Change-Id: I21e4593b81669b48cec831236398866f89616f9a
2012-05-23 12:03:28 -07:00
Gabriel Wicke 4cc2d25e70 Fix a debug print reference error
Change-Id: Ic26d29aced4129c3dd718c4751dadb62a0be1a27
2012-05-23 20:52:45 +02:00
Trevor Parscal 9af03a29b1 Updated demo and fixed HTML converter
Removed hard-coding of alien nodes, now aliens are automatically used for anything unknown, and block or inline aliens are selected based on whether the parent element can contain content or not.

Change-Id: I5d2a521ead4f4c96cb44d084a5c160cc20d8048e
2012-05-23 10:15:44 -07:00
Gabriel Wicke d6af3b3375 Improve the serializer and its output display in the web service
Change-Id: Id3ca96846cad42517d7d4bada8f4bb250d54247b
2012-05-23 17:50:35 +02:00
Gabriel Wicke 95496c02db Add an extra newline before headings, and ignore favicon.ico requests
Change-Id: Ibacac3453afefa5dbe803c1e0260e8c943785f12
2012-05-23 17:17:54 +02:00
Gabriel Wicke 21286a50df Make sure pageName is set in the web service, and handle empty page name in parser function
Change-Id: I5d36eefecc2f35a860d00a8960004f8e651ed17c
2012-05-23 16:43:45 +02:00
Gabriel Wicke a862718ad8 Add some checks against undefined tokens returned from async transforms
Change-Id: Ie19537083b96b1b2e12e1c4b65a7a044753c18ac
2012-05-23 16:32:21 +02:00
Gabriel Wicke a4c5d43ff7 Fix an external link regression, and add server shell wrapper and setup docs
Change-Id: I9a4f7690e98313d003a2fec35324ed70556e6461
2012-05-23 16:25:42 +02:00
Gabriel Wicke b89f5071e5 Basic parser / serializer web service
* After installing Parsoid (sudo npm install -g in modules/parser), run 'node
  server.js' from the api directory and navigate to http://localhost:8000/ and
  follow the directions. You can start to navigate the English wikipedia at
  http://localhost:8000/Main_Page, or manually enter wikitext or HTML DOM to
  convert.
* Uses the express framework, could also use just connect
* Uses the cluster module to manage workers per-core and restart those on
  failure

Change-Id: I443f2996ed3df00826b038b7476a2f966ab0c425
2012-05-23 12:35:00 +02:00
Gabriel Wicke febb912ead No end delimiter after template row attributes
Change-Id: Iba304fb797d221e2d65ae055d266bff2f6301df8
2012-05-23 09:30:07 +02:00
Gabriel Wicke 39c6f42879 Link round-tripping and other improvements
* Changed RDFa for links according to
  http://www.mediawiki.org/wiki/Parsoid/RDFa_vocabulary
* Added basic support for internal/external link serialization
* Moved numbering of external links from tokenizer to LinkHandler
* Added round-tripping for generic HTML tags
* Replaced nowiki tag with <meta typeOf="mw:tag" content="nowiki"> and <meta
  typeOf="mw:tag" content="/nowiki"> for now.
* 154 round-trip tests passing (node parserTests.js --roundtrip).

Change-Id: I16c4db21b1b543ee57c73e569c83025b64664542
2012-05-22 13:36:06 +02:00
Trevor Parscal 86591e5325 Restructured static node rules
Change-Id: I7023e1f334694d59767491f1010e7c4c59c0ce54
2012-05-21 17:39:12 -07:00
Rob Moen 0b9411c531 Cleanup Sanxbox.js
Change-Id: Id8ba1aacecdbb5d31888e289d23ab03a16346c60
2012-05-21 17:03:57 -07:00
Rob Moen 95e06e96bf Prepare for MediaWiki integration
Create context instance in surface.
Move over getSelectionRect into ce.surface
Cleanup ve.surface contstructor class
Move linmod/html test objects to sandbox.js

Change-Id: I0cf602ef991100bf6128c68750b02a00566911dc
2012-05-21 16:06:30 -07:00
Rob Moen 7bf15b4377 Copy ui modules to ve2
Switch sandbox demo to use new ui modules
Update VisualEditor.php to use ve2 modules
SpecialPageSandbox working

Change-Id: I8261d6bf6ceb6ae7b7bfa5f61aec6a0121906765
2012-05-21 12:39:36 -07:00
Trevor Parscal c38a552442 Fixed case on mapping to $.toJSON
* Also made uses of JSON.stringify use ve.getHash

Change-Id: I05dc0374e05b72c798ae0fd44239e5f8bb45ca52
2012-05-21 12:21:07 -07:00
Rob Moen 272f502693 Modify getAnnotationsFromOffset to account for annotated leaf nodes.
Refactor remaining annotation methods
Refactor tests to use correct annotation types

Change-Id: Ia3ce42b3d11296b4d63277e0e2a1997d23236613
2012-05-21 12:02:04 -07:00
Rob Moen 3d5da75782 Merge branch 'master' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-21 11:01:16 -07:00
Gabriel Wicke 7e21b7380a Merge "Round-trip nowiki" 2012-05-21 17:16:56 +00:00
Gabriel Wicke fb7d5418a5 Round-trip nowiki
Change-Id: I5f7e6a43f5fdc1708ee710b2a601b20db733452c
2012-05-21 18:06:09 +02:00
Gabriel Wicke a6610e52c2 Serializer and table round-tripping improvements
* added stx: 'html' round-trip information for html tags
* added t_stx: 'row' info for row-wise table wiki syntax, and support for it
  in the serializer
* the first table row is implicit in wikitext
* renamed lastToken to prevToken in serializer
* strip first newline in an initial chunkCB

Change-Id: I014b046539d1b674d830551c5fd1b74a67f81993
2012-05-21 14:59:53 +02:00
Gabriel Wicke e069e7cb1c Merge "Support table captions and properly delimit the end of table options" 2012-05-21 12:51:58 +00:00
Christian Williams b7afcff62a Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-18 15:20:01 -07:00
Christian Williams 6d15028c68 Making showCursor work again!
Change-Id: I97e1570ffba368e570b69085daa2798b8b2725f9
2012-05-18 15:19:31 -07:00
Rob Moen f19c5917f2 remove hasChildren method as I was using it to debug something on
previous commit.  change traverseLeafNode test name to follow
ve2 test naming scheme

Change-Id: I8b953e3405f42cd58a80da676ac9b16d64f5e72d
2012-05-18 14:11:23 -07:00
Rob Moen e4a7a36761 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-18 13:48:03 -07:00
Rob Moen 62959bec7a ported traverseLeafNodes and tests to new dm
Change-Id: I98487267d6e3efc9e0c07a02b3d5acc8f8cdb4c6
2012-05-18 13:47:14 -07:00
Inez Korczynski 19a02f3798 Disable objectResizing and inlineTableEditing within execCommand
Change-Id: I06406bfd56e01e72b157fd8cb50da8d6173edc25
2012-05-18 11:40:22 -07:00
Inez Korczynski 32c2366dca Logic for adding 'slugs' before, after and between nodes in certain cases
Change-Id: I91a1c58bdb7819503a9eb24221d6a358c804b57e
2012-05-18 11:34:07 -07:00
Gabriel Wicke 54e75b93b7 Support table captions and properly delimit the end of table options
Change-Id: I15eb8df19528cfceadfee368370501b30f0e36a0
2012-05-18 10:46:43 +02:00
Gabriel Wicke c39eb36968 Use outerHTML to serialize unhandled DOM node in serializer
Change-Id: I37350712c9450c34025740a8d6de51344739c2b7
2012-05-18 10:03:16 +02:00
Gabriel Wicke 3c6d829708 Fix first bug caught by new roundtrip mode for parserTests
Change-Id: Id152fd29606d8ee34ac300945f41e2a5f48f087f
2012-05-18 09:55:22 +02:00
Trevor Parscal 4dd9a143ae Added newFromAttributeChange and newFromAnnotation
Change-Id: I1e85ccee3fa1591867fea52359508bfa99bad7df
2012-05-17 15:17:17 -07:00
Trevor Parscal 445006d4a8 Made tests a bit stricter before iterating over annotations
Change-Id: I7c7f11395cfb4ad392bad9380119b647c0c1b629
2012-05-17 14:58:01 -07:00
Trevor Parscal 43d62ee8a7 Refactored getMatchingAnnotations and it's tests, and added offsetContainsMatchingAnnotations
Change-Id: I9098ef8d9c7f3a4f5db112cfdcb9edb7ffd17b80
2012-05-17 14:37:29 -07:00
Rob Moen a937ad22f7 Fix getAnnotatedRange to return propper contained range.
Fixed tests

Change-Id: I305eb81644fb3c804455b4fc13bdabcce97ea471
2012-05-17 13:17:18 -07:00
Trevor Parscal 24c35b853f Whitespace fixes
Change-Id: I691c4e16cf22de8dce0858cdcad522d1f6cfef72
2012-05-17 11:27:25 -07:00
Trevor Parscal 08765feab3 Merged ve.dm.DocumentFragment and ve.dm.Document
* Also fixed lots of whitespace issues and some global variable introductions

Change-Id: Ia6c82ef0c3b5c4938cf72afa86da6d79e4cb385a
2012-05-17 11:23:56 -07:00
Trevor Parscal e8f15204e5 Added skeletons for transaction builders
Change-Id: Iabb2707d20c8b645ffef683f9d8160911c6dc92f
2012-05-17 10:51:01 -07:00
Rob Moen c2a89626d5 Rewrite getMatchingAnnotations to return a hashmap of matching anntations
in the new DM.  Change method name getAnnotationRange from offset to
getAnnotatedRangeFromOffset.  Write tests

Change-Id: I7028803065409e271ceced73e4803954d4a956dc
2012-05-17 10:46:27 -07:00
Subramanya Sastry ae4810b201 Renamed items to itemCount for better code readability.
Change-Id: I53851c07a4746928fddec4b3737136f081d49178
2012-05-17 12:32:46 -05:00
Subramanya Sastry 58da03bc85 Track list prefixes in the list start handler and use them to output
serialized text in list item handlers.

Change-Id: Ic7562d531d2313bedcf3b7450b4f28f02bc2b5a3
2012-05-17 12:12:46 -05:00
Gabriel Wicke e2815b516c Start to handle links
Change-Id: I1fb975910651820fd889d77152562fd4fbcb5db8
2012-05-17 14:32:56 +02:00
Gabriel Wicke b7fd4498a9 Use single _serializeToken handler for both DOM and tokens
Change-Id: I45e1d90b53a5ddc678f7744f27274bebcfc375fe
2012-05-17 13:20:39 +02:00
Gabriel Wicke 8dbc2f573f Simplistic wikitext round-tripping with parse.js --wikitext
Lists are a bit tricky, as nested lists are not wrapped in a separate list
item. Should work now though.

Change-Id: I2e5f29f6afa6bdd2d5e5c0c5d019b70c611b73d1
2012-05-17 12:44:46 +02:00
Trevor Parscal 58aa0e8137 Whitespace fixes and cleanup
Change-Id: Id2220009ed7af7e895990dd4bb373b43d6089b7b
2012-05-16 20:26:05 -07:00
Catrope bcd7431818 Remove getScope(), no longer used
Change-Id: I79e067a8e6b3eb151d3ebe1dfc3aaebe242aed39
2012-05-16 20:16:47 -07:00
Catrope 80db7a593e Rethink of structural replacement code
Splits and merges now work, or at least the tests for it pass

The strategy I used is to gather the affected ranges for each of the
following:
* removed stuff
* the entirety of each node touched by a non-zero removal
* if the inserted data busts out of its parent, the entirety of that
  parent node (the 'scope')
then get the covering range of all those ranges, and rebuild that.

Change-Id: I7c3b421abc0ba134157ac8b59042675bb1b5073c
2012-05-16 16:48:02 -07:00
Catrope 5e4f0293f2 Add ve.Range.coveringRange()
Change-Id: Ifd9932d7a9f9dae2354fa7aa75cee2e3e639ef42
2012-05-16 16:48:02 -07:00
Catrope 6f4b68274d Rename removeLevel to insertLevel
Change-Id: I339c830547d19af0b04927e1ebccd0468c9e2a20
2012-05-16 16:48:02 -07:00
Rob Moen fbaea888b9 Rewrite data model methods needed for ui tools
getAnnotationRangeFromOffset and offsetContainsAnnotation
which deprecated getAnnotationBoundaries, and getIndexOfAnnotation
write unit tests for proof

Change-Id: I6c0d4e3ca96dd569b1909cd22fce68c3a6fe382c
2012-05-16 15:55:01 -07:00
Gabriel Wicke 3414418b1f Don't eat newline tokens in the ListHandler
This fix only affects following transforms, of which there are few right now.
Also removed a stray token mutation in QuoteTransformer.

Change-Id: Id6d4adce944b06fc1a3651cfbf63fc2670125225
2012-05-16 23:14:21 +02:00
Gabriel Wicke 542921b5a3 Removed html5 parser patch no longer needed with 0.3.8
Change-Id: Id8c23d34e8cca49a360f536e792144a85a8468a3
2012-05-16 12:06:42 +02:00
Mark Holmquist 96ee9ad45c Add a new wikitext serializer, with limited functionality.
This isn't finished at all, but Gabriel wants to take a crack at it,
so here it is!

Change-Id: I9732aa141f7c69a28c8f5978cb18180e93cb9eda
2012-05-15 10:41:28 -07:00
Gabriel Wicke d918fa18ac Big token transform framework overhaul part 2
* Tokens are now immutable. The progress of transformations is tracked on
  chunks instead of tokens. Tokenizer output is cached and can be directly
  returned without a need for cloning. Transforms are required to clone or
  newly create tokens they are modifying.

* Expansions per chunk are now shared between equivalent frames via a cache
  stored on the chunk itself. Equivalence of frames is not yet ideal though,
  as right now a hash tree of *unexpanded* arguments is used. This should be
  switched to a hash of the fully expanded local parameters instead.

* There is now a vastly improved maybeSyncReturn wrapper for async transforms
  that either forwards processing to the iterative transformTokens if the
  current transform is still ongoing, or manages a recursive transformation if
  needed.

* Parameters for parser functions are now wrapped in abstract Params and
  ParserValue objects, which support some handy on-demand *value* expansions.
  Keys are always expanded. Parser functions are converted to use these
  interfaces, and now properly expand their values in the correct frame.
  Making this expansion lazier is certainly possible, but would complicate
  transformTokens and other token-handling machinery. Need to investigate if
  it would really be worth it. Dead branch elimination is certainly a bigger
  win overall.

* Complex recursive asynchronous expansions should now be closer to correct
  for both the iterative (transformTokens) and recursive (maybeSyncReturn
  after transformTokens has returned) code paths.

* Performance degraded slightly. There are no micro-optimizations done yet
  and the shared expansion cache still has a low hit rate. The progress
  tracking on chunks is not yet perfect, so there are likely a lot of unneeded
  re-expansions that can be easily eliminated. There is also more debug
  tracing right now. Obama currently expands in 54 seconds on my laptop.

Change-Id: I4a603f3d3c70ca657ebda9fbb8570269f943d6b6
2012-05-15 17:05:47 +02:00
Catrope d6cf4fff7f Add comment about bug that makes tests accidentally pass
Change-Id: I842ffe00bdad025797f9c71f550efd24d2ce39da
2012-05-14 23:16:28 -07:00
Catrope 7e1aa2336e Support splitting nodes in replace tree sync
This means inserting things like </p><p> are now synced correctly and
split the paragraph in the model tree. Merges (removing e.g. </p><p>)
aren't supported yet.

Also, this needs tests, Trevor tells me he's working on porting replace
tests from the old ve/ directory

Change-Id: Ic5050849d7d007a1696dc36548654979aedb53a8
2012-05-14 21:46:39 -07:00
Catrope 59f74de3b8 Fix bug causing replacement tree sync to adjust the wrong node
The tree sync for content replacements was adjusting the parent of the
text node affected, rather than the text node itself. This was because
it called getNodeFromOffset(), which returns branch nodes. Switched it
to use selectNodes() in leaves mode

Change-Id: I50a9be18151a1b75815ab19b787b16b6be385bf9
2012-05-14 21:42:53 -07:00
Catrope 2008858830 Fix bug in selectNodes: input (0,0) returned []
This was because the while loop was never entered as end >= left was
true from the start. Convert the while loop to a do-while loop to make
sure it runs at least once

Change-Id: I9c6436a7b296e65a36b8301095b6edd00507d321
2012-05-14 21:41:08 -07:00
Trevor Parscal e28a1a188a Fixes typo, need to check if object is empty, not if it's an object
Related to: 14a4c7b780

Change-Id: Iede66d1e01ed010705362611e90fb4b13e7e4a1c
2012-05-14 17:22:37 -07:00
Trevor Parscal 14a4c7b780 Fixed annotation processing to support leaf nodes and detect more errors
Also added lots of tests

Change-Id: I45fe4fb569d9050d7d79f71f777d82f5b34fdd11
2012-05-14 17:16:30 -07:00
Trevor Parscal 94613589e0 Removed more trailing whitespace in multi-line comment blocks
Continues cleanup work done in e0de881a8a

Change-Id: I7165a8f8c4b468793d936fe695de92335c106271
2012-05-14 17:16:30 -07:00
Rob Moen 68414e4d28 give array bulider loop better names
Change-Id: I67f5b89b3e58f052c197732a1298c60ec6b8fd89
2012-05-14 16:48:10 -07:00
Rob Moen ca48a4a8a1 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-14 16:44:08 -07:00
Rob Moen d2fc95fa52 Optimize getAnnotationsFrom dramatically by less object manipulation
Now returning an empty array when a non annotated character is found
in the range.  No longer looping through each annotation, simply
comparing to previous characters annotations and trimming differences.
Write additional test.

Change-Id: I41d2422a931a74325693edca409aed6d5da20ba8
2012-05-14 16:40:49 -07:00
Catrope 5b398f95f8 Fix botched rename: opReplacement -> opInsert
Change-Id: I34091dbbc9a46466823ee7407f151fd67112ee03
2012-05-14 15:12:44 -07:00
Trevor Parscal e0de881a8a Removed trailing whitespace in multi-line comment blocks
JSHint and various git tools complain about this, so let's just do away with them altogether

Change-Id: I731866bd21f1ee0088fb0a71df3abf92692aca23
2012-05-14 15:05:09 -07:00
Trevor Parscal 03be3c0668 Removed debugger statement from 5b9a2645a6
Change-Id: I047b0c89a7420a86b9350a8d0c0fc8aec695227f
2012-05-14 14:34:50 -07:00
Rob Moen 17b58db5c6 Optimize getAnnotationsFromOffset with ve.getObjectValues
Change-Id: I2150335b6f0fa305c1d1bc93e50d30d874c76345
2012-05-14 11:34:08 -07:00
Trevor Parscal f40e4f2f9d Added ve.getObjectValues
Could maybe be optimized with map or something?

Change-Id: I033804e893bfa93f991dee9efefaa2c2d1740627
2012-05-14 11:31:18 -07:00
Trevor Parscal d7febe6009 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-14 11:15:02 -07:00
Trevor Parscal 1363e7ff89 Added ve.getObjectKeys which falls back to Object.keys if present
Change-Id: I9eedf93239b22497fe6fe6497e20b1fe0525de9c
2012-05-14 11:14:54 -07:00
Rob Moen b8302c715f Rewrite getAnnotationsFromOffset to work with new Linear Model.
Properly init variables in getAnnotationsFromRange
Polish up tests.

Change-Id: Idc231998ce27e3a1c64363e862da22c837ea2ca2
2012-05-14 10:47:48 -07:00
Rob Moen bd9a0b6fba Rewrite DocumentFragment getAnnotationsFromRange method
Write unit tests for getAnnotationsFromRange

Change-Id: I82ff15e97378c07e5c555a72231da4161a72993c
2012-05-11 16:14:46 -07:00
Catrope 5b9a2645a6 Port getScope() from the old VE code and add tests for it
Change-Id: I8c34fed919e60fa1b8cb6a13cb9ca98f3e695421
2012-05-11 16:03:46 -07:00
Catrope 43c2393c03 Remove outdated comment
Change-Id: I3a5db50aafa01d07bfb34359dfbe73812b3a7ab5
2012-05-11 16:03:46 -07:00
Trevor Parscal db0e050b39 Renamed uses of "replacement" to "insert"
Change-Id: I69ad0f84e8fefe1715339068b7685958f8f8546f
2012-05-11 15:25:01 -07:00
Christian Williams 13f26682da Removing data from annotations when empty, more tests for HTMLConverter
Change-Id: I3c3e234e9392e4afdcb4c8bc748aaa74a1fb30ca
2012-05-11 14:07:20 -07:00
Trevor Parscal 9cdfb84f9b Added tests to getRelativeContentOffset
Also fixed a typo in the implementation

Change-Id: I86855795009e34d42a3a5857addc5ccb6366130f
2012-05-11 12:14:29 -07:00
Rob Moen 469a55bde4 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-11 10:31:12 -07:00
Rob Moen ced54d06a9 Write better test for DocumentFragment getAnnotationsFromOffset
Fix errors in example test data
Remove whitespace

Change-Id: Ibb2b5c0851d6abac9974035753b95354b3c8dd5e
2012-05-11 10:29:09 -07:00
Catrope ca17ea0943 Port structural replace code from the old VE code
This makes TransactionProcessor work for regular replacements, as well
as insertions and deletions of self-contained pieces of data. This does
NOT yet work for inserting and deleting unbalanced data
(splitting/merging nodes).

I've tested this from the console for insertions and deletions and
simple replacements, but I haven't tested wrappings. We should write a
bunch of unit tests for this some time :)

Change-Id: Ic2fd75d1cf2e127bc9ae58debce67576be2c912f
2012-05-10 20:20:42 -07:00
Catrope 3cc22b00cb Use index and indexFromNode (from selectNodes()) in DocumentSynchronizer
This makes insertions work (using indexFromNode), and eliminates the
indexOf() call (using index)

Change-Id: Ibfa77353af99534edc324c0e314c8b95c5136d8b
2012-05-10 20:20:42 -07:00
Catrope 6652f7573b Add indexInNode to selectNodes() output
This is for the case where we have a zero-length range in between two
siblings, and we need to know what index that corresponds to in order to
be able to insert nodes there (rebuildNodes() will use it for this
purpose)

Change-Id: I357d1cd665667a76f955a10b8d9d2810976cdbd7
2012-05-10 20:20:42 -07:00
Catrope 379bc8da3c selectNodes() fixes:
* Initialize startOffset to 0 not 1, don't know what I was thinking
* Use currentFrame for nodeRange instead of parentFrame, don't know what
  I was thinking there either
* If the returned node has no parent (is the document node), don't
  attempt to access parentFrame and don't set index

Change-Id: Iad969a7c29436cdf4151ead7e9d3d8e2a30befb3
2012-05-10 20:20:42 -07:00
Catrope 7eeb6c7cac Throw an exception when DocumentFragment gets unbalanced input
Change-Id: Ie891bd7ea4d9e9b1c84e7a0390f1af39c0e55fd4
2012-05-10 20:20:42 -07:00
Trevor Parscal 1475100a22 Ported isContentOffset, isStructuralOffset, isElementData, containsElementData and getRelativeContentOffset
Tests for all but getRelativeContentOffset are done too

Change-Id: Iee953647ec89e13259ae2a402c50c809f93bc655
2012-05-10 17:20:57 -07:00
Catrope 8834145f9e Fix nodeSelectionEqual() so it doesn't explode when a and b have unequal lengths
Change-Id: Idb84bc1238576c711a201cdbf05f63a7b603a819
2012-05-10 16:42:58 -07:00
Catrope 9b6402801a Fix the selectNodes() bug that Inez reported
Selecting a zero-length range at the start or end of a text node
(e.g. (1,1)) would return the text node's parent instead of the text
node

Change-Id: I7fe089bf66b93185dd3415eff53aa7e04e3ffdb2
2012-05-10 16:42:58 -07:00
Catrope f79e56b4f1 Document the stack properties used in selectNodes()
Change-Id: Ibaf178830a0b7b99a4ab1c0ec09283bd3dd552e0
2012-05-10 16:42:58 -07:00
Catrope ec449d168a Fix startOffset computation in selectNodes()
* Needs to be initialized to 1, not 0
* Needs to be stored *after* left is incremented to account for an
  opening

Change-Id: I7978ae241578a8a17120e494684e6e93626a8529
2012-05-10 16:42:58 -07:00
Catrope 38a9b8b301 Fix typo in selectNodes()
Change-Id: I320728bafa289290c4c2a91fee736a8afb17be80
2012-05-10 16:42:58 -07:00
Catrope 13b79d309c Add 'index' and 'nodeRange' to selectNodes() output
Change-Id: I38712545b713cc24663ebec3fe3e5c8741b4fad7
2012-05-10 15:03:23 -07:00
Trevor Parscal d4363c04f4 Don't set classes on non-wrapped elements
* Text nodes do not have a wrapper to set classes on
* Use CSS class names that are equivalent to JS class names, swapping . with -

Change-Id: I49c877dd5c9b5dd2a9afad3137f12b14883043a1
2012-05-10 14:54:33 -07:00
Catrope c256ea7d71 Fix fatal error in parse.js
Trying something trivial like echo 'Hello world' | node parse.js
would throw TypeError: Function.prototype.apply: Arguments list has wrong type

Change-Id: Ia0a1154b0f3edbfb1f228a1d2072fced1b147141
2012-05-10 12:04:57 -07:00
Gabriel Wicke b1bd0d73ec Don't eat end token in ListHandler, and lazier Quote handler registration
* Setting the rank on tokens is still used currently, but will be phased out
  in favor of setting it on chunks. Tokens will be immutable to allow sharing
  and caching without a need for cloning.
* Only register for newline and end tokens in QuoteTransformer when active.

Change-Id: I2c45bc7e4a105219a1404ab221eed7f242128f1e
2012-05-10 09:47:53 +02:00
Inez Korczynski 3848e77c33 Basic support for Alien node in HTMLDom -> LinMod converter
Change-Id: Ie9b08027c58694022a7b01609d25d720bfb35873
2012-05-09 23:04:57 -07:00
Inez Korczynski 41a7451ea2 Store reference to view node (ve.ce.Node) in jQuery data of it's wrapper
Change-Id: I84920b20346b4ef5e1203d834bf4c3fb9657ae69
2012-05-09 22:43:46 -07:00
Inez Korczynski 1a4e488b06 Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-09 22:40:51 -07:00
Inez Korczynski ee39e837b8 Get Alien node (leaftnode) working - it reads its content from attribute
'html'

Change-Id: Idd84da9af61369277df18fee577032de765b1205
2012-05-09 22:36:25 -07:00
Trevor Parscal 1798a478e7 Massive refactor of node trees, generalizing lots of previously dm only stuff
Change-Id: I9dbb7094f86338ea2e725ad29f66e9e4ca2b52ed
2012-05-09 21:11:09 -07:00
Christian Williams 0848eaca04 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-09 18:36:05 -07:00
Christian Williams 3d289365bc Images and tables working with HTMLConverter
Change-Id: I2e45eeddf031d00b006498f9b2fb4840a2f6df44
2012-05-09 18:35:05 -07:00
Trevor Parscal 44b311920e Cleanup/refactor/documentation work for ve.dm.DocumentSynchronizer
Change-Id: I5f70460e0d4496c91d92b83025fdf9ae1d9dece6
2012-05-09 17:14:15 -07:00
Rob Moen d417c571a4 * Ported getAnnotationsFromOffset into DocumentFragment
* Wrote unit test for getAnnotationsFromOffset

Change-Id: Ie88b15ac6c16838b2d2bf9a2d83ca2952f5df817
2012-05-09 16:31:56 -07:00
Trevor Parscal a0178fd3bb Cleanup and renaming
Change-Id: Ie0b742029f95e1475d58bb38b790bae3110259b0
2012-05-09 15:27:18 -07:00
Catrope 17f4dc220a Don't use data.length in selectNodes()
I was using data.length to check if the range was out of bounds, but
this is a problem when using selectNodes() inside of tree sync code
(which happens when performing rebuilds). While tree sync is in
progress, the model tree and the linear model don't match, so we
shouldn't be looking at the linear model for information about the model
tree. Instead, get the length of the DocumentNode and use that.
`

Change-Id: I11a378544ce1281a89cdcd4363c5cb1bf56f3434
2012-05-08 18:31:51 -07:00
Catrope 00950f3a67 Add rebuild action to DocumentSynchronizer
Change-Id: I379ceef3829026c4b4157e59243b7663b6c7ab2f
2012-05-08 18:31:51 -07:00
Catrope 94697a3241 Emit an 'update' event in addition to an 'annotation' event
Change-Id: Idab673bce4fa4b10816d753020adae40598c8b7a
2012-05-08 18:31:51 -07:00
Catrope 09631f1466 Make TransactionProcessor actually use DocumentSynchronizer
Change-Id: If0ac69026fa34430d811de5f7ca0748d9b1e01cc
2012-05-08 18:31:51 -07:00
Catrope 22c88f77c3 Add a 'siblings' mode to selectNodes(), and add tests for it
Change-Id: Ib3fd3ee5aba7aab7c26193a2a9c48612f624862a
2012-05-08 18:31:50 -07:00
Adam Wight 0a7f0b7630 List markup is created during the sync23 phase.
This makes it possible to transclude list items from a template.

Note: "5 quotes" test is broken by this patch, it appears that ListHandler
newline processing is changing some state which mysteriously affects the
QuoteTransformer.  This is ominous, hopefully there's a simple explanation...

gwicke: fix a bug in tokenizer triggered by definition lists like this:
**; foo : bar

Change-Id: I4e3a86596fe9bffcbfc4bf22895362c3bf742bad
2012-05-08 11:39:36 +02:00
Trevor Parscal d061b62a72 Added some documentation to ve.dm.DocumentSynchronizer constructor
Change-Id: Ib24f0101e60b34af292d46d3ea866859a89a18f5
2012-05-07 19:43:34 -07:00
Trevor Parscal d43ee569ac Cleanup of HTMLConverter
Change-Id: I145bfbbb8b759ea33eef291b53daf935e97ac341
2012-05-07 19:43:03 -07:00
Trevor Parscal 123c64cbd5 Added more tests for selectNodes
Change-Id: Ibd9672fb9b6ce682905d20f9346fada6fb47b380
2012-05-07 19:03:59 -07:00
Catrope 4d9299b808 Fix bugs in selectNodes(), tests pass now
Also fix one instance of bad expected data in a selectNodes test

Change-Id: Ie226b237cf537143bce2f6b1e531b9067b140cb4
2012-05-07 17:03:42 -07:00
Catrope 32c65cdaa8 Change 'leaf' to 'leaves' and document it
Change-Id: I09d5995d3d9bf82670802f0efe849f40be2a18a3
2012-05-07 17:03:42 -07:00
Trevor Parscal f4fcf9663e Added documentation and tests for ve.dm.Document.selectNodes
Also:
* Broke node lookup method out into ve.dm.example.lookupNode
* Added ve.dm.example.nodeSelectionEqual

Change-Id: I437cdd3f3154d10782f03f78df6d5c457ecfc845
2012-05-07 15:15:21 -07:00
Inez Korczynski 82ef058cb7 Add two more cats to demo/example article
Change-Id: I25757965ffdfceed2c85c9d76ce58af3d23716f2
2012-05-07 14:30:05 -07:00
Catrope ad5ee8f822 First implementation of selectNodes()
Currently only implements mode=='leaves', i.e. traverse all leaf nodes.
Seems to work from casual testing, but is missing unit tests. See also
other TODO comments in this commit

Change-Id: I41292c21c627a18af7985e8ef9e23c7b14252b21
2012-05-07 13:57:58 -07:00
Catrope 93d6adb5f2 Add an isWrapped property and make getOuterLength use it
This gets rid of the length == outerLength-2 hack in getDataFromNode()
and will make it easier to implement similar logic in selectNodes()

Change-Id: I1294350b67ca3eefde2b7fe9fea0bc6d8b90f772
2012-05-07 12:00:07 -07:00
Christian Williams 1ef380984f Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-04 20:44:10 -07:00
Christian Williams 6e7588a33b Support for new annotation format
Change-Id: Ib873981792d2cb4d78a3e4805287c48b3de78558
2012-05-04 20:22:05 -07:00
Trevor Parscal e34ec4b479 Added canHaveChildren and canHaveGrandchildren to all nodes
Change-Id: Ibe53292f7269736750e03da49e5bb5913c0124ab
2012-05-04 17:50:54 -07:00
Trevor Parscal 1d74945dfc Fixes for Roan's crazy half-baked commit
Change-Id: Ic104debc3a941e4cf8e4dca19633dcad04a0fe0a
2012-05-04 16:13:54 -07:00
Christian Williams 28eb0c82e5 Adding HTML DOM -> Linear Model converter
Change-Id: Iae109d75e64321a7fe4ee8492d79ef5481716246
2012-05-04 15:47:41 -07:00
Catrope d11af2b687 Queue and deduplicate events in DocumentSynchronizer
Change-Id: I90577cd078c3d0b6706f5f827b66b46a450e7086
2012-05-04 15:42:35 -07:00
Rob Moen d42e738636 - Optimize surface model and write unit tests
Change-Id: I8de24c840c5aa2d4232e6e2cc5f72cbd30be96b4
2012-05-04 15:29:47 -07:00
Inez Korczynski 0562d83f2f Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-04 15:20:47 -07:00
Inez Korczynski bab1a9672c Fix method getDocument in dm.Surface and start using it
Change-Id: I613b1e938cd0d8f3a6ac8a48121901287c8fc5af
2012-05-04 15:20:14 -07:00
Catrope 2baeb5532d Initial stab at DocumentSynchronizer
Change-Id: I7176fd7235a82a6314bf431d00870d9ddb40f370
2012-05-04 15:18:07 -07:00
Trevor Parscal dc27d8acb4 Refactored dom wrapper functionality in ce nodes
* Moved implementation of getting and updating a DOM wrapper to ve.ce.BranchNode
* Updated ve.ce.BranchNode tests
* Renamed ve.NodeFactory.createNode to ve.NodeFactory.create
* Added  ve.NodeFactory.lookup which gets the constructor of a type
* Added attribute pass-through to ve.dm.BranchNodeStub

Change-Id: I8f5b7d3d3ae616cc5f39828b24b655163d782ae5
2012-05-04 13:31:14 -07:00
Trevor Parscal d2480baed0 Removed bubbling update events in dm and ce node trees and splice events from ce branches
The bubbling update events are not needed with ce or dm, but were once upon a time useful for es, this just eliminates some unused cruft that was costing extra function call overhead.

Change-Id: Ia16d0f4cd74c84cded5caecada33ee83d0882f30
2012-05-04 12:28:32 -07:00
Trevor Parscal 9887dbd96f Split Broke DefinitionListNode out of ListNode and DefinitionListItemNode out of ListItemNode
* Makes it simpler in the linear model because we don't have to use style: "item" for regular list items and style: "definition" for definition lists
* Enforces correct nesting through existing node rules systems
* Updates tests accordingly

Change-Id: I64d80af938e325f1961226505bdc386bb35ccdda
2012-05-04 11:56:32 -07:00
Catrope 11a3b6886b Implement basic replace processor
* Implement basic TransactionProcessor.replace(), only does content
  replacements
* Add ve.dm.Document.containsElementData()
* Fix bug in attribute()
* Write basic tests for attribute() and replace()

Change-Id: Ie9c22aec3f2631be5b0bd66790408ad283565491
2012-05-04 11:09:10 -07:00
Gabriel Wicke 909633ea08 Improve template / tplarg precedence in tokenizer
Change-Id: If9b24b42ea223e0f30f906a83496d73ec60c4a0d
2012-05-04 13:17:06 +02:00
Gabriel Wicke 8a30f76370 Use upright option, including the 0.75 default width
Change-Id: Iacdf6173e0ee8f58ca4385fd9b2cde77b2fdf3c4
2012-05-04 11:15:35 +02:00
Trevor Parscal a9b26c8b55 Removed recursive rendering calls in favor of 100% event driven updates
Change-Id: I636222518e4cbeddb1c02901b79a9dcb09eeb952
2012-05-03 17:19:01 -07:00
Rob Moen 014084fc65 - fix demo styling for docs list
Change-Id: I5e5d16fe9a002e3cafd01138ad9b92ff987178d6
2012-05-03 16:27:28 -07:00
Rob Moen 0cd31fba2e rename surfaceModel to model in ce.Surface
Change-Id: I5d49915b4645464729ab1e4552982cbd38f712b1
2012-05-03 16:14:54 -07:00
Rob Moen b05347ac4e removed margin-top for documentNode
Change-Id: I6e888ca858bc2d9e6772150715b10ab157f84b46
2012-05-03 16:07:51 -07:00
Rob Moen bead2050b9 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-03 16:04:47 -07:00
Rob Moen da65ad48c8 - extend surface model and surface view with event emitter
- added surface view base methods
- enabled toolbar in ve.Surface

Change-Id: Ib6a62ef2509712f812f262283c45bb30c8f97ef1
2012-05-03 16:02:21 -07:00
Christian Williams 99e841d31a Making document contenteditable
Change-Id: If79bb8c69431e07de2a42cc5b565b3093c29c4cd
2012-05-03 15:42:02 -07:00
Inez Korczynski 1ecb762d35 Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite
Conflicts:
	modules/ve2/ve.Surface.js

Change-Id: I1c81426203f01fa2f698819bf6c63a3afd1239c9
2012-05-03 15:02:04 -07:00
Inez Korczynski d01d27cc09 Get more tags/nodes working in the demo
Change-Id: I5335fbbe15d010a73a06f24bc56ebb3c3c6bd2d7
2012-05-03 15:00:34 -07:00
Rob Moen cdcca3eeb2 Move linearModel object into sandbox.js
Change-Id: Ia87e6fb13abab31f14f997f8ba7a9b631f6fb667
2012-05-03 14:27:36 -07:00
Rob Moen 56dff6dacb Added new node types
Change-Id: I6b5f2e5a7dbdb7c59b4799d44f7924c5594c0e34
2012-05-03 14:22:09 -07:00
Inez Korczynski 6224c60075 Rendering works in very basic version
Change-Id: I8789860fe82f2e7db1e503889e20ce51de57bfa2
2012-05-03 14:02:35 -07:00
Inez Korczynski 06ca808b65 Missing keyword: new
Change-Id: Id65d30d702e991620e0d454fa000c438f4738b41
2012-05-03 13:32:23 -07:00
Rob Moen 7bcb65e036 - Port surface constructor into dmrewrite.
- Create document model object linear model instead of wikidom

Change-Id: I16307c290ead3e4b29dfbd1b76759e4c19c3fc8b
2012-05-03 13:23:21 -07:00
Trevor Parscal 7b7ff5a503 Added ve.dm.Surface, ve.ce.Surface, ve.ce.Document
Change-Id: I382730e1a9f1abcb4b42499267c8dcaf76fc64e1
2012-05-03 13:21:13 -07:00
Trevor Parscal b1b9fb5133 Added tests for getDataFromNode
Change-Id: Ic762832dcdda3bdaf92dbd989659235fdff73596
2012-05-03 13:11:36 -07:00
Inez Korczynski 619f10108c Minor fixes to getHtml method in TextNode
Change-Id: I53c873b6e307d53cc87c2e111ab99f694972b17b
2012-05-03 11:11:46 -07:00
Inez Korczynski a1db1537ad Minor fixes to getHtml method in TextNode
Change-Id: I4d0b1a0295071ead413d68945310d3a4ef6fe7e4
2012-05-03 10:11:39 -07:00
Gabriel Wicke 57dfd89383 Handle upright option properly
Change-Id: I831fcccf874f9a0505e88eb76d269b1d2f68e3e0
2012-05-03 16:15:34 +02:00
Gabriel Wicke c4fc7508a7 Add basic # REDIRECT handling
Change-Id: I71f659201c1d5de4a528ddfac7f65bf20a89f97d
2012-05-03 15:54:36 +02:00
Gabriel Wicke 6ab017308b Only specify the width for thumbnails to keep the aspect ratio
Change-Id: I4e55ff719da6cb58f396ad6043e46acaed4a504d
2012-05-03 15:36:42 +02:00
Gabriel Wicke 6139398494 Reduce debugging overhead a bit, and provide default internal image size
Change-Id: I345af8c5905a5fa747f9ed342ba2ba8c1026d044
2012-05-03 14:49:55 +02:00
Gabriel Wicke 6e21f6bb27 Forward-port Cite extension
* Adapted Cite extension to use current interfaces and token formats
* Improved TokenCollector

Change-Id: I20419b19edd9bbad2c2abf17a2ff1411b99c0c04
2012-05-03 13:22:01 +02:00
Inez Korczynski 09c7393901 Minot fix
Change-Id: If10f9135f9bf33af17be6f8a2db59433d9898944
2012-05-02 22:32:34 -07:00
Inez Korczynski a3b32b6615 Big refactoring to TextNode to make it work with new format of storing
annotations.

Change-Id: If84fcfdd04ff42e9b2449e1c8186d64fec4fb1ac
2012-05-02 22:28:57 -07:00
Inez Korczynski 9f11f437d2 Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-02 19:29:49 -07:00
Inez Korczynski d81b972cdf Very dirty but working version of getHtml method for TextNode (with bunch
of tests that are passing now).

Change-Id: Ie76bd59bc0a5e10e2a3b3e014b2d0e4701fcc368
2012-05-02 19:29:03 -07:00
Trevor Parscal 64d56971a9 Removing unused code
Change-Id: I23213531eeef95110d0a3d1e2476449c580b55b7
2012-05-02 17:05:22 -07:00
Trevor Parscal b7b2fc1179 Made render for ce leaf nodes abstract and added a test for it
Change-Id: Iee228d5f1a18a5c9618680fa81ab132a85472fa6
2012-05-02 15:59:43 -07:00
Trevor Parscal 947c3ddf22 Fixed incorrect class name for method typo
Change-Id: I82390896ef7136bfc8ed8734d8bd9014e756af5e
2012-05-02 15:59:15 -07:00
Trevor Parscal d412c8c159 Removed unused method (using factory instead)
Change-Id: I0ed9260d261b7e4c19e5d57f70331aef1a341cdf
2012-05-02 15:58:40 -07:00
Trevor Parscal 16e12debdc Added ve.getHash and ported ve.Json
Change-Id: I4a5d86426902e0473cdb0f98c3d121eed607f93c
2012-05-02 15:23:01 -07:00
Inez Korczynski ff40652099 Get rid of range parameter in ve.ce.TextNode.prototype.getHtml as it is
not being used anyway.

Change-Id: I7c54d35001fa0db6d7ab9d12f35ab2d841016f0d
2012-05-02 14:21:41 -07:00
Inez Korczynski dd6094842e Created a test file for ve.ce.TextNode and fixed some minor issues.
Change-Id: Ifbf6b7ba2a27eedf6d5d4f6cb06b98c38eb52c5b
2012-05-02 14:18:02 -07:00
Trevor Parscal b4313ae262 Moved getOffsetFromNode to ve.dm.BranchNode
* Also updated a call to getOffsetFromNode in ve.dm.Document

Change-Id: Ief8f9e532e39cd1051d7f3b6df6ed341747098e5
2012-05-02 14:06:35 -07:00
Trevor Parscal fd28fff50f Added test for replaceDomWrapper and onSplice in ve.ce.BranchNode
* Also fixed calls to addListenerMethod
* Also routed adding children in the constructor of ve.dm.BranchNode to the splice method
* Renamed types of ve.dm stub nodes to avoid collisions (since we have to register ce nodes by the same names for them to be generated by onSplice)

Change-Id: Ia2e75cf0a62186cc0e214683feb25c619590318a
2012-05-02 13:58:50 -07:00
Trevor Parscal 8bd0d385eb Added test for whitespacePattern, getDomText and getDomHash in ce
* Also fixed some naming typos in the units under test

Change-Id: I17f753a122f94dd16f7783f60b5c0eb1c6d3e480
2012-05-02 12:54:42 -07:00
Trevor Parscal fee375cf4e Removed global variable introduction
Change-Id: I331b19cafeb20610f7b42bacaff20757a342dffc
2012-05-02 12:37:30 -07:00
Trevor Parscal 676ffa4dbc Ported getDomText and getDomHtml from ve to ve2
Change-Id: I3547d95c2749543eae745722ceddaa0a969e4e80
2012-05-02 12:28:27 -07:00
Trevor Parscal 1d94af144a Added update handlers to heading, list, list item and image ce nodes
* Also renamed convertDomElement to replaceDomWrapper in ve.ce.BranchNode
* Also added extra documentation for node rules

Change-Id: Ia8ac6be34e2b021be96974ac1ba9119bd8077d60
2012-05-02 11:30:37 -07:00
Trevor Parscal 94f53dc6c7 Made text nodes not rely on a wrapper
By using this.$ as a selection of contiguous top-level nodes (text or otherwise) we can avoid wrapping each text node in a span

Change-Id: I141c2df8f13646db3fff0da93d218c2dcf154c8a
2012-05-02 10:58:14 -07:00
Trevor Parscal f1505a0e62 Merge remote-tracking branch 'origin/master' into dmrewrite
Change-Id: I43a3cd999ec0a5d3d05ee1e5bb71c450d485bc01
2012-05-02 10:17:44 -07:00
Trevor Parscal 158c9f7692 Consolidated before/after attach/detach events
Change-Id: I4220715ac4505152fb30ac2d5664a0ffb2b846f5
2012-04-30 19:50:45 -07:00
Trevor Parscal dcd0fa38c6 Fix variable name typo
Change-Id: Icfd42a5ee00e14f2485a93a5817f0f7f3e701234
2012-04-30 19:48:54 -07:00
Trevor Parscal cac3c6efd0 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-04-30 19:39:02 -07:00
Trevor Parscal 370070dfa2 Lots of ce porting, got text nodes fully supported
* Fixed constructor of ve.ce.BranchNode which was calling the wrong method to perform an onSplice and with the wrong arguments
* Removed/renamed events emitted from ve.ce.BranchNode.onSplice
* Reintroduced .$ to all ce nodes
* Ported over functionality for DOM node type variance used in headings, lists and list items
* Moved the old ve.ce.Content guts to ve.ce.TextNode
* Added getOffsetFromNode and getDataFromNode to ve.dm.DocumentFragment
* Added setDocument and getDocument to dm nodes

Change-Id: I185423ba2f1a858dde562cb2f5bc3852aec930db
2012-04-30 19:38:42 -07:00
Catrope d9cd1392fc Add TransactionProcessor tests, and fix TP to make them pass
* Add .process() and its helpers from ve1
* Fix applyAnnotations()
** Use data[i] rather than data[j]
** Don't add empty annotation objects for no reason
** Remove empty annotation objects
*** I thought this wasn't needed, but it is needed for clean rollbacks
* Remove unused second parameter in applyAnnotations() call

Change-Id: Ia338f62d2eaf2a76f8ef653eead05bc44757a122
2012-04-30 19:06:20 -07:00
Trevor Parscal 35af704173 Added initial ce nodes
Change-Id: Ibdcb4502a8fdc5b1a6c22ae0e9c42c86b3a7d4dc
2012-04-30 17:36:22 -07:00
Trevor Parscal c2d4a2d928 Added basic ve.ce nodes
* Also removed beforeSplice and afterSplice in favor of just plain splice which is the same as afterSplice used to be - beforeSplice was never used and it was making things more complex looking than needed

Change-Id: Icbbc57eac73a2a206ba35409ab57b3d1a49ab1a5
2012-04-30 16:58:41 -07:00
Trevor Parscal aaa322642b Added ve.ce.NodeFactory and tests
Also added tests for initialization of factories at ve.ce.factory and ve.dm.factory

Change-Id: Ic6ac74aab86ecdfd4f094d9bb1fa16de930387b7
2012-04-30 16:36:02 -07:00
Trevor Parscal a667425874 Moved canHaveChildren and canHaveGrandchildren back to ve.NodeFactory
This is generally useful information, not only for dm

Change-Id: I9511467285e9594b4a7aa659bf65bb0417da25a1
2012-04-30 16:25:44 -07:00
Trevor Parscal 9b2098cb56 Added documentation to static rules on ve.dm nodes
They are used by ve.dm.factory so this might make it easier for people to understand what's going on.

Change-Id: I490627e3bfc55ca9c96fdc4f5d047737b6a3db8c
2012-04-30 15:47:54 -07:00
Trevor Parscal 2cee2adb6d Split node factory into dm specific implementation
* Added support for asking if a given node type can have children or grandchildren and what types of nodes can be it's parent or child
* Removed canHaveChildren methods from leaf and branch nodes and converted use of them to depend on factory to read static rules from constructor lookup by type

Change-Id: I9769f95647066576416bacb791c4b68dd0285b35
2012-04-30 15:42:36 -07:00
Trevor Parscal 0d4fb6fdb5 Got rebuildNodes tests working
* Moved node tree assertion to ve.dm.example
* Added rebuildNodes test
* Fixed some typos in rebuildNodes

Change-Id: I4853ded4b062aaa3758435093368bc23667ca3bf
2012-04-30 13:42:32 -07:00
Trevor Parscal 8ce7fd0c85 Fixed length calculations and added tests for node tree
Image nodes are leafs, so providing an empty array to their children/length "contents" constructor argument ends up setting the numeric length to [], which casts to an empty string in arithmetic, causing all further calculations to be concatenations instead of additions.

Change-Id: I40e1ea2295f6095318bc4c24185cadfdfb684557
2012-04-30 13:23:46 -07:00
Trevor Parscal 139210df0d Added getOuterLength override to ve.dm.BranchNode
Also fixed use of getElementLength which should be getOuterLength

Change-Id: I794a4624fca60b3f2e2dde7f8c51db2da526436b
2012-04-30 12:38:15 -07:00
Trevor Parscal 4d03be0301 Added comments and tests for canHaveChildren
Change-Id: I0b9538a89cba4c36d1a8af7395476b9612d18637
2012-04-30 11:57:45 -07:00
Trevor Parscal 7de381ea14 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-04-30 11:38:37 -07:00
Trevor Parscal 489794c89c Renamed rootNode to documentNode and added tests
Within ve.dm.DocumentFragment it makes more sense to call the root node (which is always a document node) a document node, especially since there may be a different node used as a root.

This commit also adds test for getDocumentNode and getNodeFromOffset which uses the offset map.

Change-Id: Ic4609233cedc41f7e5a5f8fdb0e6178652c95554
2012-04-30 11:37:48 -07:00
Catrope 80decda935 Mostly-finished TransactionProcessor
Change-Id: I7d2cd684fafa16c85d0d9c9ad2b6d42d7e6f1448
2012-04-30 11:26:22 -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
Trevor Parscal a774b3dbf6 Added test for getOffset map
And fixed ve.dm.DocumentFragment constructor to generate a correct offset map which creates references to branch nodes only

Change-Id: If9e515be0c63d272bfed9bf4da625a48edd36f48
2012-04-27 17:16:29 -07:00
Trevor Parscal eeded0eb1d Renamed batchedSplice to batchSplice
Change-Id: If7b2b56f9eb79f810461fc49bbdc9aa860461662
2012-04-27 15:09:10 -07:00
Trevor Parscal 0245f6a6a8 Fixes for 44fe109f14 which mistakingly added .children to a few uses of batchedSplice
Change-Id: I2c876a66b64c6f1ae3cbd1577b7e1102618997ba
2012-04-27 15:08:15 -07:00
Trevor Parscal 44fe109f14 Added test data and fixed test suite links
Change-Id: Idb5de70b58c525a67f16b21f7adc53214af9b486
2012-04-27 14:59:52 -07:00
Gabriel Wicke 2291fe8364 Reduce the need for token cloning slightly
Change-Id: I31c71bddca4855afdffc3fe5c8d759cfa1994d86
2012-04-27 23:12:25 +02:00
Trevor Parscal f19897fefa Merge "Build out ve.Surface constructor to support multiple editor instances Now setting up multiple toolbars per config Tools & Modes are now configurable per toolbar per instance Base elements are created on demand and no longer id specific Note: There are some bugs with multiple instances." 2012-04-27 21:01:10 +00:00
Gabriel Wicke 5fb2c46073 Clone cached tokens, and fix switch for empty needle
Change-Id: I63946e5a56f6fd7dd30d00b12d36032dd1dd0017
2012-04-27 15:59:01 +02:00
Gabriel Wicke ed8cb54831 Simplify transformToken slightly, and fix JSHint warnings
Change-Id: I95769ed063ea855a9109148f5db83ea43f423e56
2012-04-27 15:31:30 +02:00
Gabriel Wicke 2d7b4a2a59 Make .to more consistent and add optional parentCB arg
* parentCB (if set) is called with { async: true } if expansion is going to be
  asynchronous.
* Strings are handled efficiently
* all value parameter chunks can now be converted using .to().

Change-Id: Ib013e1bc3d8e7f692009038209db6a056887326e
2012-04-27 13:57:23 +02:00
Gabriel Wicke fd1a67aa16 Add .to('text/plain/expanded', cb) support and convert ifeq to use it
Change-Id: I99c78de12fed41ba36811402f7ecacb420391d70
2012-04-27 12:18:30 +02:00
Gabriel Wicke 30a83d7fd7 Accept wikilink parameters with dangling equal ('|arg=|')
Change-Id: Ib4f6d186da2a74522b17c377dac5c9a7de7e5861
2012-04-27 11:35:00 +02:00
Gabriel Wicke 1d70e7b81c Disable preformatted text from indents in template args
Change-Id: I84144d3fab6541ed264d9b092806c8bf9de6e8b2
2012-04-27 10:45:08 +02:00
Trevor Parscal 42eaba05e7 First go at ve.dm.Document and ve.dm.DocumentFragment
Change-Id: I6099ec0dbdac8d00cdde138b6b9a1b3a5781daea
2012-04-26 19:44:44 -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 94479bd79d Build out ve.Surface constructor to support multiple editor instances
Now setting up multiple toolbars per config
Tools & Modes are now configurable per toolbar per instance
Base elements are created on demand and no longer id specific
Note: There are some bugs with multiple instances.

Change-Id: Id0bbbca2d1b76fd2db3f3b0f9abd90194930b610
2012-04-26 11:56:47 -07:00
Gabriel Wicke 56d6757f67 Fixes for the template fetch retry feature
Change-Id: Id36cb02c535d07f4f2cdd54ae682b6a144a2faa9
2012-04-26 20:31:23 +02:00
Gabriel Wicke 027d77e0c9 Fix --wikidom and --linearmodel parse.js options; retry on template fetch failures
Change-Id: I444397936fd87971fe085df4b467089367e9ffa6
2012-04-26 19:51:00 +02:00
Gabriel Wicke 3be4992782 'Obama finally expands' ;) Misc fixes and documentation updates
* [[:en:Barack Obama]] can now be expanded in 77 seconds using 330MB RAM,
  while it would prevously run out of RAM after ~30 minutes. Wohoooo!
  The token transform framework rework really paid off.
* 303 parser tests are passing in the new record time of 5.5 seconds. Two more
  tests are passing since these tests expect the day of the week to be
  Thursday.  Won't be the case tomorrow.

Change-Id: I56e850838476b546df10c6a239c8c9e29a1a3136
2012-04-26 18:18:08 +02:00
Gabriel Wicke 8ff810659a Rename text/wiki and tokens/wiki to text/x-mediawiki and similar
Change-Id: I70113629f4633685cd6db3914303a15e4c79a50a
2012-04-25 20:19:43 +02:00
Gabriel Wicke 814511f523 Remove dead parser pipeline code
Change-Id: I802f1798d5163c1ce82d648f739c2e79b17eda41
2012-04-25 17:12:32 +02:00
Gabriel Wicke 5a3f5544a5 Merge "Biggish token transform system refactoring" 2012-04-25 15:07:44 +00:00
Demon 5feb5ebcbf Merge "Fix typo" 2012-04-25 14:51:47 +00:00
Gabriel Wicke 8368e17d6a Biggish token transform system refactoring
* All parser pipelines including tokenizer and DOM stuff are now constructed
  from a 'recipe' data structure in a ParserPipelineFactory.

* All sub-pipelines of these can now be cached

* Event registrations to a pipeline are directly forwarded to the last
  pipeline member to save relatively expensive event forwarding.

* Some APIs for on-demand expansion / format conversion of parameters from
  parser functions are added:

  param.to('tokens/expanded', cb)
  param.to('text/wiki', cb) (this does not work yet)

  All parameters are additionally wrapped into a Param object that provides
  method for positional parameter naming (.named() or conversion to a dict
  (.dict()).

* The async token transform manager is now separated from a frame object, with
  the frame holding arguments, an on-demand expansion method and loop checks.

* Only keys of template parameters are now expanded. Parser functions or
  template arguments trigger an expansion on-demand. This (unsurprisingly)
  makes a big performance difference with typical switch-heavy template
  systems.

* Return values from async transforms are no longer used in favor of plain
  callbacks. This saves the complication of having to maintain two code paths.
  A trick in transformTokens still avoids the construction of unneeded
  TokenAccumulators.

* The results of template expansions are no longer buffered.

* 301 parser tests are passing

Known issues:

* Cosmetic cleanup remains to do
* Some parser functions do not support async expansions yet, and need to be
  modified.

Change-Id: I1a7690baffbe8141cadf67270904a1b2e1df879a
2012-04-25 16:51:36 +02:00
Demon 28e44b1d0f Merge "Add --wikidom flag to parse.js" 2012-04-25 14:18:59 +00:00
Catrope 47969e20a1 Add --wikidom flag to parse.js
Also remove unused import of DOMConverter

Change-Id: I1eabe6bf9935970c1f049681b52e867a510ea77a
2012-04-23 15:01:12 -07:00
Catrope 69df3eefbc Implement ve.NodeFactory and add tests
Change-Id: I34fdf24c0099072fe5f7178400abbc323be975d4
2012-04-23 11:46:30 -07:00
Catrope a239b73746 Don't instantiate classes in ve.extendClass(), it's unnecessary
Change-Id: Iebb9c871750a19a806ebdd911e1ef476a0acaddc
2012-04-23 11:46:30 -07:00
Catrope e84b6b656b Rename ve.dm.NodeFactory to ve.NodeFactory
Change-Id: Ic2a0389ca4855ac1afc3fb9a151145fea2b4795e
2012-04-23 11:46:30 -07:00
Catrope d1d70ddf3e Add a note that I need to implement insert and remove as replace
Change-Id: Id076921707bf6295a6bbac3264fa0074178e9321
2012-04-23 11:46:30 -07:00
Trevor Parscal 3d6391419d Added more nodes and removed canHave[Grandc|C]hildren methods
Replacing them with static members on each node type

Change-Id: I455debf880bef4e280eea072364f5f57308ec2b1
2012-04-20 16:34:47 -07:00
Trevor Parscal 8ce68e1ac8 Merge "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 23:29:21 +00: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
Trevor Parscal 29d1ebeca7 Merge "Put a space in the toolbarDropdownTool-label div for default Addresses dropdown tool ui inconsistency on load" 2012-04-20 22:56:36 +00:00
Trevor Parscal 5eca12cca2 Added skeleton class for ve.dm.NodeFactory
Roan will finish the rest

Change-Id: I8da5c493b13f00ca9abdc94ef20e0d2923893d28
2012-04-20 14:40:31 -07:00
Catrope d4d2ae88ad Update lengthDifference in ve.dm.Transaction.pushReplace()
This makes the tests pass

Change-Id: Iede7f47183378d80419f616ff62732a07d136d87
2012-04-20 11:29:30 -07:00
Catrope 0a43cf1f32 Remove documentation for nonexistent parameter
Change-Id: I3237eca92d5962a415c596da84cd3f51d3d8cebb
2012-04-20 11:29:30 -07:00
Catrope 08f792a198 Remove the parameter from the ve.dm.Transaction constructor
It's not being used at all, and it's broken because
this.lengthDifference is set to zero regardless of what length
difference the operations passed into the constructor might cause

Change-Id: I3b7a312a1920347e7bf34df88a05bf6f2ff11f7d
2012-04-20 11:29:30 -07:00
Catrope d93f2f2bab Copy ve.dm.Transaction.js from modules/ve
Change-Id: I629376bfa935ff120d93d8cfc020884524a0ae2f
2012-04-20 11:29:30 -07:00
Trevor Parscal b004b22241 Added tests for all exceptions
We are now checking for the exception messages as well.

Change-Id: I3a306ce9fe82afe6fd1e46a2e4da4d0a70952688
2012-04-19 18:05:48 -07:00
Trevor Parscal 9a3784301b Improved test coverage for ve.dm.BranchNode.splice and ve.dm.TwigNode.splice
* Changed splice to check all elements about to be inserted are allowed before inserting any of them so that catching an exception leaves you in a sane state
* Fixed the order of execution of parent class constructors in ve.dm.LeafNode and ve.dm.TwigNode so that canHaveChildren and canHaveGrandchildren produce correct values and added tests to ensure these methods are correctly inherited in subclasses
* Added tests that check for exceptions when adding nodes that can have children to nodes that can not have grandchildren
* Added test that check for events being emitted before and after splicing, including that beforeSplice should be emitted even in cases where a splice fails and throws an exception because the nodes are incompatible (but afterSplice is not called in this case) since beforeSplice might modify the nodes in some way before the compatibility tests are run

Change-Id: Id12aea995a42c26ff63a74ae3d31f2bf455759e3
2012-04-19 17:45:58 -07:00
Trevor Parscal f081c0932a A few fix ups for fd49e8d
* Moved getParent and getRoot from ve.dm.Node back to ve.Node
* Fixed use of getElementLength that should have been changed to getOuterLength, but was changed to getLength (oops)

Change-Id: Ibe5b855aef533dcd493f762a8a02c6a11ce6e7de
2012-04-19 16:47:40 -07:00
Trevor Parscal fd49e8df32 Added more tests for ve.*Node and ve.dm.*Node classes
In this commit several methods (child node add/remove and parent/root modification) were also moved to ve.dm.BranchNode ve.dm.Node respectively. ve.Node and ve.BranchNode are immutable. ve.dm.Node and ve.dm.BranchNode are mutable. Other subclasses of ve.Node and ve.BranchNode should implement functionality to mimic changes made to a data model.

Change-Id: Ia9ff78764f8f50f99fc8f9f9593657c0a0bf287e
2012-04-19 16:03:59 -07:00
Rob Moen 8398696fe0 Put a space in the toolbarDropdownTool-label div for default
Addresses dropdown tool ui inconsistency on load

Change-Id: I855ac15e939fa895adb67daaeb45aadbac01f10b
2012-04-19 15:31:09 -07:00
Rob Moen 1a68c42049 Modify VE constructor to have the default set of tool configuration
Configuration options are to extend base options in the constructor.

Change-Id: Ic430a6489d8cf9a703e374c3f416feaf0e3d2521
2012-04-19 15:14:57 -07:00
Trevor Parscal c9ce7dbffe Added some basic coverage for ve.*Node classes
* prototype.canHaveChildren
* prototype.canHaveGrandchildren
* prototype.getType
* prototype.getParent
* prototype.getRoot
* prototype.setRoot
* prototype.attach
* prototype.detach

Change-Id: I920f7c9504e467f4818df537608760165c28d432
2012-04-19 14:43:58 -07:00
Trevor Parscal b16ed2b12d Setup tests, which are still empty
Had to fix a few namespace typos too

Change-Id: I3ebdc418f374bd3e151c516e1c0cfe85398772f0
2012-04-19 14:17:59 -07:00
Trevor Parscal 7ea475ebcf Initial commit of data model rewrite
Ground-up rewrite of the data model. Putting this in the ve2 directory for now so we still have the old code floating around.

Main changes so far in this rewrite:
* Renamed hasChildren() to canHaveChildren()
* Added canHaveGrandchildren()
* Added a new node type TwigNode that can have children but not grandchildren (so all of its children must be LeafNodes)
* Implemented push/pop/shift/unshift as wrappers around splice()
* Renamed getElementType() to getType(). Nodes now take a string as a type, and the element stuff is gone and won't be back
* Removed clearRoot(), replaced it with setRoot( this ) where needed

Change-Id: I23f3bb1b4a2473575e5446e87fdf17af107bacf6
2012-04-19 13:54:34 -07:00
Gabriel Wicke e2ca8c24c7 Delay some token duplication until actual mutation happens
This is a bit better than cloning tokens wholesale, but not by much. There is
a lot of potential for much better per-token caching with reduced token
cloning. Need to map out all dependencies besides token attributes expanded
from template parameters or other scoped state. Even if tokens themselves
don't need transformation, they might still need to be considered for other
token transformers, so simply keeping the final rank won't quite work even if
the token itself is fully transformed. As a minimum, a shallow clone would
need to be made and the rank reset (as in env.cloneTokens).

Change-Id: I4329113bb21750bae9a635229ed1b08da75dc614
2012-04-18 17:53:04 +02:00
Gabriel Wicke bf84638bc0 Add tokenizer cache and clone token state on mutation
* Added an LRU cache (using the lru-cache node module) for tokenizer output
* Mutation of nested attributes now replaces the containers. A shallow copy of
  tokens is sufficient to isolate token transformations. Need to investigate
  if we can actually get away without isolation and re-transformation for most
  ordinary tokens.

Change-Id: I9136b1d7a1fbcc538183a319d4ecaa290d616fdf
2012-04-18 14:40:47 +02:00
Catrope 80e383c346 Merge "Removed line-height from preview panel" 2012-04-17 21:05:48 +00:00
Catrope fa9e02cfad Merge "Improved the appearance of the warning at the top of the editor" 2012-04-17 20:36:44 +00:00
Gabriel Wicke aaca5eac7d More tweaks: safesubst and image options
* Ignore safesubst for now
* Remove an unneeded whitelist entry
* Make sure the caption is not lost for thumbs (fix to last commit) and remove
  debug print

Change-Id: I243584ed0838cf7c3b4110fe9cdf869272477312
2012-04-17 11:02:52 +02:00
Gabriel Wicke 7fe5a86b60 Improve image option handling
Change-Id: If1376766f41ff1288bfe2af19beecd3299c09a01
2012-04-17 10:46:20 +02:00
Catrope bd900a4bd4 Add ve2 directory for rewriting code in
Change-Id: Id71ba248c73baa05e5fbeb8ad91f9225c1d1f412
2012-04-16 19:38:13 -07:00
Catrope 4b6e1401a3 Fix typo
Function was renamed but error message wasn't updated

Change-Id: I61a9effa8dedcbdbc75c5c6842fb05f909561327
2012-04-16 12:20:16 -07:00
Gabriel Wicke afa5b95bc1 Don't work around html5 library tokenizer attribute reordering
The HTML5 parser we are using to normalize expected HTML output in parserTests
reverses the order of attributes (see
https://github.com/aredridel/html5/pull/53 for the fix). Remove whitelist
entries concerned with this and use the proper order in external image
attributes.

Change-Id: If1868cae05396a150757c85a20473ab756cbcd97
2012-04-16 17:09:06 +02:00
Gabriel Wicke c688b039de Collected tweaks
* less verbose logging in noinclude processing and template expansion
* Give priority to the processing of templates transcluded from transclusions
  to get closer to depth-first processing. This serves to minimize memory
  usage from queued-up tokens.
* Increase the maximum outstanding requests per template retrieval. 10000
  amazingly proved too low a limit on some big pages.
* Only process a single template request callback at a time for now
* Add a debug print in the treebuilder wrapper
* Don't treat multiple comments on a single line as a single comment to match
  the PHP parser's behavior

Change-Id: I9a86b6d7bec3b9e1f17415daf1bf74170240721a
2012-04-16 15:47:03 +02:00
Gabriel Wicke 1bf8a9e5e1 Small tweak in comment about onlyinclude forcing buffered expansion
Change-Id: Ib324e24c51c97e07e6737bf23f16db07043b69ab
2012-04-16 15:42:29 +02:00
Gabriel Wicke efd4c026ea Disallow &lt; and &gt; in external link urls
Change-Id: Id865c3d46b33b182bb5b244e77e815c0afd7fa49
2012-04-16 15:36:56 +02:00
Gabriel Wicke 25523f4cf0 Implement urlencode parser function
Change-Id: I4fca3134c9c3eb9a7d6f3360be6de054fb47477c
2012-04-16 14:54:03 +02:00
Gabriel Wicke 421ef44621 Match the empty string as whitespace too
Change-Id: I1a8ed882021804f62855b9db4368270feebbfc16
2012-04-16 14:48:39 +02:00
Trevor Parscal 387b3160ca Merge "Add and update an offset map in DocumentNode" 2012-04-13 23:48:57 +00:00
Catrope 7465b670e1 Add and update an offset map in DocumentNode
This has some TODOs still but I want to land it now anyway, and fix the
TODOs later.

* Add this.offsetMap which maps each linear model offset to a model tree node
* Refactor createNodesFromData()
** Rename it to buildSubtreeFromData()
** Have it build an offset map as well as a node subtree
** Have it set the root on the fake root node so that when the subtree
   is attached to the main tree later, we don't get a rippling root
   update all the way down
** Normalize the way the loop processes content, that way adding offsets
   for content is easier
* Add rebuildNodes() which uses buildSubtreeFromData() to rebuild stuff
* Use rebuildNodes() in DocumentSynchronizer
* Use pushRebuild() in TransactionProcessor
* Optimize setRoot() for the case where the root is already set correctly

Change-Id: I8b827d0823c969e671615ddd06e5f1bd70e9d54c
2012-04-13 16:46:02 -07:00
Rob Moen efb8384c1e Merge "Cleanup terms used in annotation method" 2012-04-13 21:37:07 +00:00
Gabriel Wicke 08453199df Increase number of callbacks per reactor iteration to 4
In experiments this dropped the memory consumption further, and reduces the
queuing overhead in the node reactor.

Change-Id: I9409b6ca863b43b7557663bbec9572365059c078
2012-04-13 14:50:36 +02:00
Gabriel Wicke 06ae53fdfe Drastically reduce memory usage for template-heavy pages
Only call back a few callbacks per reactor iteration from the template fetch
request queue. This changes the expansion pattern from a (memory intensive)
breadth-first expansion to something quite close to depth-first expansion.
Additionally, retrieved pages are quickly added to the page cache so that a
lot of request queuing is avoided in favor of synchronous expansion from the
cache. On pages like Barack Obama that previously ran out of memory after
consuming node's 1.6G heap limit, expansion now runs in relatively constant
100-300M resident (so far, still running).

Change-Id: Ie34a1eeff00d868416de45ef8d289898258f560c
2012-04-13 14:31:03 +02:00
Gabriel Wicke df050e4481 Convert external link syntax stops to stack
Eat unbalanced external link parts within template parameters. This does not
produce the same output as the PHP parser
(try echo '{{YouTube}}' | node parse.js), but preserves a level of sanity.
Need to check how common this is for external links. If it is rare enough,
moving the ']' after the parser function manually would fix the rendering for
the YouTube case.

Change-Id: I597d808efff36baa22191e7946a0061cc31120e8
2012-04-13 11:08:42 +02:00
Rob Moen d37a325f44 Cleanup terms used in annotation method
Change-Id: I509a1f1b680cc8a2973188f0ed7c7d67b8a15f4f
2012-04-12 16:37:23 -07:00
Rob Moen 1fa462ce92 Fix up FormatDropdownTool
Effectively stopping & starting polling prior to conversion
Getting Selection from model
Reselecting after conversion (TODO: modify selection to entire block ?)

Change-Id: I9ba331b5393bf568cc8d137646b43244ae2640a8
2012-04-12 16:21:10 -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
Trevor Parscal 51b479f04f Improved the appearance of the warning at the top of the editor
Change-Id: I38e2295f38ab8be101dba2dca251ed27ae65e5c2
2012-04-12 13:40:01 -07:00
Robmoen 3e6e736cc0 Merge "Removed unused fake cursor div" 2012-04-12 18:53:17 +00: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
Gabriel Wicke 5bb2d96869 Token stream transform improvements
* add past paths for empty arguments etc
* cache attribute token transform pipelines
* fix bugs in TokenCollector and NoIncludeOnly handler, and improve its
  efficiency by only registering for 'end' tokens on demand
* Remove empty reset methods from a few handlers
* Add a simple 'ap' debug print function that makes it easy to only print some
  debug prints by temporarily changing 'dp' to 'ap'
* Improvements and bug fixes in AttributeExpander

Change-Id: Ie69729c8f62d48bba922712e44ebce484c621c50
2012-04-12 15:42:09 +02:00
Gabriel Wicke 3124deca2c Track inclusion status on CachedTokenPipeline
Non-include attribute pipelines are not cached for now. Adding separate
caching for non-include attribute pipelines is very likely worth it, but
deferred for now.

Change-Id: I13f949d9f0a04536f9ccfcb73a2be69c5c08be01
2012-04-12 10:21:50 +02:00
Erik Moeller 9f5a45f138 Add simple warning to indicate that VE is still in early dev.
Change-Id: Iea2abf9660556eca1d981fbbaab30d75a813e92d
2012-04-11 18:32:45 -07:00
Trevor Parscal f6a8619b95 Removed unused fake cursor div
This was an artifact from experimentation with multiple cursors long long ago in a land far far away

Change-Id: I14491c4adbd40bb8df4b1c31725cb1621351bef2
2012-04-11 14:56:15 -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
Gabriel Wicke 23331abf21 Merge "Set inclusion flag for attribute transform managers too" 2012-04-11 20:47:01 +00: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
Gabriel Wicke efa41370d3 Set inclusion flag for attribute transform managers too
Change-Id: Ice15d8fde6de4a3e850a028db9917e976218fc43
2012-04-11 21:55:52 +02:00
Gabriel Wicke bff43938f6 Support noinclude/includeonly/onlyinclude in attributes
Fun test case:
{|
|-<includeonly>
foo
</includeonly>
|Hello
|}

Change-Id: I353bb287d3967ade549fbcb4ae64511a1f1f7e36
2012-04-11 17:37:25 +02:00
Gabriel Wicke 9ae572cca0 Fixes to template expansion / token transform managers, 296 tests passing.
* Convert isNoInclude logic to positive isInclude throughout and set it
  properly on attribute pipelines. Also don't cache non-include pipelines.
* Add a --pagename parameter to parse.js, which sets the page name in the
  environment. This is then returned by {{PAGENAME}}. Not the final solution,
  but useful for taxobox testing as taxons are selected based on PAGENAME.
* Add rudimentary pagenamebase parser function

Change-Id: If9c0be4c255200d0f2a30f02e5619437b4fd8f12
2012-04-11 16:34:27 +02:00
Gabriel Wicke bbae66cd69 Nominate more HTML5 sectioning and heading elements for block-level treatment
Block-level (in HTML4 lingo) elements are not wrapped into paragraphs.

Change-Id: I4a01c9721be30b526172952915d528dea79e2f30
2012-04-11 12:53:49 +02:00
Gabriel Wicke 5a33099875 Improve template tokenization in template arguments
Taxobox tables now render pretty much correctly.

Change-Id: I5a0564138ff0c688d8a5a69b7867646fd3763946
2012-04-10 16:40:49 +02:00
Gabriel Wicke 577ef1f916 Add some support for alignment of thumbs
Change-Id: I70570f48423628f7a87a35647698a66a5f413088
2012-04-10 12:11:59 +02:00
Trevor Parscal cf59563f50 Removed line-height from preview panel
This is not needed because the line height is no longer being forced in the editable view

Change-Id: Ic759e6e15dd6f2462cb6dbc26ba0f245821e1c15
2012-04-09 14:42:08 -07:00
Gabriel Wicke 403be4af42 Add basic thumb rendering support
* DOM based on Wikia's thumb output: HTML5, clean caption without magnify
  icon.
* basic RDFa annotations, but most options additionally in data-mw object-
  might want to move more (or all?) of those into RDFa data using meta tags.
* no support yet for framed or other formats, image scaling etc
* also tweaked some config options in the environment

Change-Id: Ie461fcdce060cfc2dec65cc057709ae650ef3368
2012-04-09 23:04:26 +02:00
Gabriel Wicke f99cb06e10 Merge "Improve parameter tokenization support especially for table rows" 2012-04-09 21:04:08 +00: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 5827843182 Merge changes from branch ce-poll
Change-Id: Id7602ed33a09720c53310a032d2824395b82ff7f
2012-04-06 17:11:35 +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
Gabriel Wicke dbdd320348 Improve parameter tokenization support especially for table rows
Change-Id: I961d69e228b96adc69ea9acb3733d13f5898602d
2012-04-05 16:00:26 +02:00
Gabriel Wicke de4fb0c8c4 Merge "Remove behaviors var in tokenizer, now handled in token handler" 2012-04-05 13:57:13 +00:00
Christian e48aca43b9 Merge "Updated CSS classes and rules for CE, which for the most part uses native elements" 2012-04-04 21:08:47 +00:00
Gabriel Wicke 7a35e5db16 Remove behaviors var in tokenizer, now handled in token handler
Change-Id: I68eeff3f05ce29c13e347c2cd7ea6519e58b0e03
2012-04-04 21:17:29 +02:00
GWicke da60861be8 Merge ""magic words" are tokenized and used to set parser.environment flags" 2012-04-04 19:11:03 +00: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
Adam Wight a85ed36efa "magic words" are tokenized and used to set parser.environment flags
behavior switches are converted to tokens which set parser.environment flags during the async transformation stage.

The next step would be for handlers in the sync23 stage to generate the TOC, section edit links, and so on according to these directives.

No tests written, because the switches are consumed and don't appear in rendered html.  We can test the magic word layout controls individually, once they're implemented.

Another small change was to store option flags directly in the environment object, not that it makes much difference.

Change-Id: I863fbf4be1a17d2f6c31158298dd301f19ae1137
2012-04-04 11:25:29 -07:00
Adam Wight b234edba88 As much as I have loved writing Makefiles... I've replaced its functionality with package.json, mostly so we can avoid non-node dependencies. This is one of the recommended practices. We should consider moving tests/parser into modules/parser/tests, other node projects keep all module code in one directory.
Explained in the README how to use npm to load the dependencies and run tests.  Too bad about NODE_PATH...

Don't try to find parserTests.txt in assorted places--if it isn't present, fetch from gerrit.  You can symlink from core if you're developing on both parsers, and the fetch script will not overwrite.

Use __dirname in parserTests.js to allow the script to run independent of current working directory.

Change-Id: I4c8b884e91f4fdeae385c7697aff768bdd199dd5
2012-04-04 11:02:58 -07:00
Gabriel Wicke e3a745a024 Improvements for template / -argument precedence; support for empty params
Change-Id: Id0894ccbedfa47fa3658817ca65119a2af76be3e
2012-04-04 16:29:47 +02:00
Gabriel Wicke 2037215185 Disallow '[' in generic attribute names
This avoids interpreting something like

! [[foo|bar]]

as

<th [[foo=''>bar]]</th>.

Change-Id: If59708fa90eb0117a15b2b6446890d1ae19a857c
2012-04-04 14:31:11 +02:00
Gabriel Wicke f588d2a7aa Fix table headings in template parameters
Change-Id: Icdfc5655968fc845230ad7638124309d6b8c1ada
2012-04-04 12:54:34 +02:00
Gabriel Wicke b8d980a229 Don't eat newline / space in template parameters
..so that block_lines can match.

Change-Id: I4c464dc44249f40e4aa280df35fb726bfce3a745
2012-04-04 11:22:31 +02:00
Trevor Parscal 606d97da99 Merge "Add HTML DOM -> linear model converter" 2012-04-03 17:52:55 +00:00
Gabriel Wicke 47de122a95 Improve support for table / template interaction
Match pairs of {{!}} or | for template productions, but not a mix of the two.
Example:

{{#if:1|{{!}}-
{{!}} {{#if:1|style="color: red"{{!}}|}}
}}

Note that the style parameter ends up as the *key* of an empty-valued
attribute on the table cell currently.

Change-Id: I5f9357dd1645ef97b0af89f32e8d92ae49218c72
2012-04-03 18:48:35 +02:00
Gabriel Wicke 0fe062fbe1 JSHint cleanups and parser function argument handling improvements
Parser functions which only accept positional arguments now return both the
key and value of arguments. Complete attributes (key and value) for templates
and the like from parser functions are not yet supported though.

Change-Id: I3f81bb35acd27186222ce6d5217e820042527c01
2012-04-03 18:10:48 +02:00
Trevor Parscal 519d225d2f Cleanup of white space, missing semi-colons, line breaks, etc.
Change-Id: Ifa96a9f70fa8d149a4c403521aaa88a3e0546ef0
2012-04-02 15:28:26 -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
GWicke b7db83e09a Merge "Magic links and behavior switch tokenization by Ori Livneh" 2012-04-02 16:43:13 +00:00
Gabriel Wicke f662690d02 Shorten data-mw-rt to data-mw and clean up whitelist
Instead of a proliferation of data-mw-* attributes, it should be easier to
stash all private / non-semantic round-trip information in a JSON object
stored in data-mw.

Change-Id: Id200a6a8789fa152f29ea530e5a24b6ee7b4b285
2012-04-02 18:12:49 +02:00
Gabriel Wicke 5248fd31e8 Magic links and behavior switch tokenization by Ori Livneh
Commit first patch by Ori, lets 288 parser tests pass. Yay!

Change-Id: Iac8c3d1ad1984900350b20f7e725c40618a1e8ba
2012-04-02 17:31:34 +02:00
Trevor Parscal 19f3d5c107 Added ve.Surface, a wrapper around an editor instance
* This high level surface object is responsible for creating & managing editor instances
* Revised Sandbox demo to invoke in this way.

Change-Id: I4043779af9a2ab964deaf26079a992e82ebeef27
2012-03-29 15:55:33 -07:00
Trevor Parscal c44ef066b9 Replaced es with ce for Sandbox and main demo
* Configured VisualEditorSandbox to use es
* Reconfigured the ce demo to share the sandbox module
* Removed es demo
* Renamed ce demo to ve (es is broken anyways)

Patchset 2: squashed in https://gerrit.wikimedia.org/r/3953

Change-Id: If8d13bf7011616d222be78899b23186859d5ed70
2012-03-29 15:43:59 -07:00
Catrope 8dc994f037 Add HTML DOM -> linear model converter
Also, in ParserPipeline:
* Import the LM converter and expose it through getLinearModel()
* Fix getWikiDom() to actually work (still unused)

In parse.js:
* Add --help option that prints usage information (was unreachable)
* Add --linearmodel option to output linear model JSON instead of HTML

Change-Id: Ic534e03ff40a7c9117bb63f0c635a4213d5e3406
2012-03-29 12:47:14 -07:00
Catrope 7a726b0278 Add tree synchronization for replace
To handle replace operations that are not themselves consistent (these
are common, for instance when replacing an opening element in one place,
then replacing the closing element somewhere else), we process
subsequent replace operations inside the first one until things are
balanced again, then issue a single rebuild for the whole thing.

Change-Id: Ide4613f046fabfeeef383138c39e350b1b710033
2012-03-26 02:51:30 -07:00
Catrope 826437950c adding clearState function for tools and using clearState if no selection exists
Originally committed in SVN as r114418 by Christian, missed the git
conversion

Change-Id: I56e91c170670519fa2b482a4b7f30cdcbc8ff163
2012-03-22 14:22:15 -07:00
Roan Kattouw 3b193a1e57 Fully revert r114142, was previously reverted in Collection only 2012-03-21 20:45:24 +00:00
Sam Reed 1bab092ead Fix many more occured typos 2012-03-19 14:54:43 +00:00
Rob Moen e5df79229d make clear button tool work with annotate method in ce surface 2012-03-16 22:20:16 +00: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
Rob Moen 277e239796 CE surface has no hidden input, removed input focus 2012-03-16 22:00:42 +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
Gabriel Wicke 5ef2074251 Enable support for block-level wiki constructs in template arguments. This
gets a bit closer to supporting table fragments passed through template
arguments. Next, we'll need a way to indicate start-of-line position to
enable sol block-levels in template parameters. 

Example:

{|
{{#if: true|{{!}}Table cell|}}
|}
2012-03-15 11:43:49 +00:00
Roan Kattouw 05333b1f3d Put the invert state / method (commit or rollback) in the TransactionProcessor object and no longer pass it as a parameter to each operation. This makes it easier for operations to execute other operations. 2012-03-14 21:02:36 +00:00
Roan Kattouw bf5ea06db5 Factor out process() into nextOperation() and executeOperation() 2012-03-14 21:02:34 +00:00
Roan Kattouw 2c43a34f74 Rewrite the rebuild action to take two ranges rather than a node and some data. 2012-03-14 21:02:31 +00:00
Roan Kattouw 37a59016e8 Break out pushAction() into separate functions for each action. This will allow me to change the rebuild action to take totally different parameters. 2012-03-14 21:02:29 +00:00
Roan Kattouw bd9a86dd55 Remove the offset adjustment feature from DocumentSynchronizer. It gets in the way when I try to use this class in TransactionProcessor. 2012-03-14 21:02:27 +00:00
Roan Kattouw 1e17285afb Move computation of missing offset from pushAction() to synchronize(), and only compute offsets for actions that require them. This also fixes an issue where offsets computed by pushAction() would be adjusted incorrectly by pushAction(). 2012-03-14 21:02:26 +00:00
Roan Kattouw 7dd2b8b725 Make DocumentSynchronizer clear the queue after it's done with it 2012-03-14 21:02:24 +00:00
Gabriel Wicke 7e22020398 Convert syntactical break flags for templates from counters to the stack
variant to fix the precedence for {{!}} (break on these inside table content,
but not in template options within tables).
2012-03-14 16:30:59 +00:00
Gabriel Wicke 77a61dd687 Improve support for {{!}}, and don't produce a pre for indented tables. 2012-03-14 10:58:11 +00:00
Gabriel Wicke 835914b2de Support {{=}}. 2012-03-14 09:07:01 +00:00
Inez Korczynski f87709d6bb Use <h[1-6]> tags for rendering headings (instead of divs) 2012-03-14 00:51:04 +00:00
Rob Moen d77c0b91dc fix dropdown tool to use selection from ce surfaceView 2012-03-14 00:29:41 +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
Gabriel Wicke 2195c31abf Move link types to data-mw-rt, and support some more template tokenization
edge cases. For example, the PHP parser treats | foo | = bar | as | foo = bar |,
believe it or not ;)
2012-03-13 12:32:31 +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 350a53fd93 rework context icon positioning for CE surface using new getSelectionRect method 2012-03-12 22:14:43 +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
Gabriel Wicke 4cd8b302ac Improved template tokenization. The parser can now template-expand
[[:en:Barack Obama]] without exceeding 1.7GB of memory (which is the node
limit).
2012-03-12 17:31:45 +00:00
Gabriel Wicke 3c5fe2523c Tolerate more newlines and spaces in templates, and support templates and
comments in urls.
2012-03-12 14:31:06 +00:00
Gabriel Wicke ae4ab7a39c Refactor syntactic stops into an object and add a stack variant for option
values.
2012-03-12 13:08:43 +00:00
Alexandre Emsenhuber 99a31bacbc svn:eol-style native 2012-03-11 18:38:27 +00:00
Roan Kattouw 29f416937e Fix some usages of splice.apply in the data model to use
ve.batchedSplice(). Added FIXME comments for occurrences outside of DM
2012-03-10 00:31:28 +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
Trevor Parscal 2f9fcde16e Removed duplicate static methods and members that were copied to ve.dm - lets just leave them in ve.dm.DocumentNode for now. 2012-03-09 21:54:00 +00:00
Trevor Parscal 15b3515a1b Updated QUnit 2012-03-09 21:50:24 +00:00
Roan Kattouw b13d0a849d Add a check for the length of unwrapOuter, and add a test for each
exception
2012-03-09 01:44:31 +00:00
Roan Kattouw bc600b34be Make prepareWrap() use the data from the model rather than the unwrap
parameters. This fixes the case where rolling back a list unwrap would
restore the list items without their attributes
2012-03-09 01:14:41 +00:00
Roan Kattouw 04910777d9 Fix stupid typos so wrapEach actually works 2012-03-09 00:38:34 +00:00
Roan Kattouw ab26581b2e Fix cursor adjustment in replace() 2012-03-08 23:21:28 +00:00
Roan Kattouw 5054ed320e Implement prepareWrap and add tests for it 2012-03-08 23:21:26 +00:00
Roan Kattouw 9b66749575 Add documentation for to-be-written prepareWrap function 2012-03-08 23:21:24 +00:00
Roan Kattouw d978797fca Add a very simple transaction builder for content replacements 2012-03-08 23:21:21 +00:00
Roan Kattouw cac9971299 Implement the replace operation for the linear model 2012-03-08 23:21:20 +00:00
Roan Kattouw 46dbb30b7a Factor the batched splice code out from ve.insertIntoArray() into a
separate function
2012-03-08 23:21:18 +00:00
Roan Kattouw 93deba7b5c Add replace operation 2012-03-08 23:21:17 +00:00
Trevor Parscal becb1daa39 Added more tests for ve.dm.DocumentSynchronizer and fixed some bugs along the way 2012-03-08 19:35:51 +00:00
Gabriel Wicke ffc9383096 Temporary fix for template tokenization, especially needed for
[[Template:Cite core]].
2012-03-08 14:24:04 +00:00
Alexandre Emsenhuber 62e8312535 svn:eol-style native 2012-03-08 12:27:02 +00:00
Gabriel Wicke 39017dd769 Percent-encode spaces in URLs, so that they are recognized as valid URLs later
on.
2012-03-08 11:53:15 +00:00
Gabriel Wicke 7518db8197 A few fixes to parser functions and template expansion. Trim whitespace off
template arguments, let the last duplicate key win and fake pagenamee slightly
better.
2012-03-08 11:44:37 +00:00
Gabriel Wicke 51023feaa4 Improvements for image option handling. 2012-03-08 10:03:22 +00:00
Gabriel Wicke b1e131d568 A bit more documentation and naming cleanup in the tokenizer wrapper. 2012-03-08 09:00:45 +00:00
Trevor Parscal 459c4fa271 Added some basic tests for resize and insert. Fixed some bugs in both of those code paths along the way. 2012-03-08 00:52:30 +00:00
Trevor Parscal de0f83643b Typo in file name 2012-03-07 23:48:58 +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
Trevor Parscal 55cf0c8ada Added sketch for ve.dm.DocumentSynchronizer which is a utility object for queueing up actions to be performed on the model tree such as deletion, insertion, rebuilding, resizing and updating of node. Using this approach, we can collect actions across multiple steps, and then normalize them to avoid duplicate work and mutate the model tree in a single step. 2012-03-07 20:21:32 +00:00
Gabriel Wicke f02ff95aa3 Token representation clean-up. Now all tokens are differentiated using
constructors instead of type attributes.
2012-03-07 20:06:54 +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
Gabriel Wicke f157093a41 Delegate responsibility for resetting the token rank to transforms, if full
re-processing in a phase is wanted. By default, after a token type change or
the return of multiple tokens only the remaining transforms with higher ranks
are applied.

Updated a few comments as well.
2012-03-07 19:29:53 +00:00
Gabriel Wicke 1f8c43b9e2 A few minor documentation updates. 2012-03-07 18:42:26 +00:00
Gabriel Wicke 5f618103d7 Set allTokensProcessed flag for async callbacks from the template expander. 2012-03-07 17:36:33 +00:00
Gabriel Wicke e5a1116817 Start re-transformation as soon as possible in TokenAccumulator._returnTokens
to maximize IO concurrency. Signal that all tokens are fully transformed to
callbacks called from TokenAccumulator._returnTokens. The result should be a
single re-transformation when entering the callback chain, and only if the
transform does not signal that it took care of full transformation itself.
Template expansion would set this flag, as the nested transform pipeline
processes all tokens to the end of phase async12.
2012-03-07 16:29:06 +00:00
Gabriel Wicke 656524dbbc Fixes for multi-transformer expansion in AsyncTransformManager. Added argument
to callback which lets transforms indicate if their returned tokens are fully
processed for their phase. If not, the callback re-processes them so that any
remaining transforms are applied.
2012-03-07 15:39:18 +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
Gabriel Wicke af03eb4f29 Improve generic attribute expansion before external link processing, and make
wgUploadPath configurable. Also change the hard-coded fall-back image sizes to
sensible defaults. This breaks three parser tests until image size retrieval
from the wiki is implemented.
2012-03-06 18:02:35 +00:00
Gabriel Wicke 227103e12c Accept empty table cell attribute sections, and consider percent-encoded %2525
valid. 270 tests passing.
2012-03-06 14:32:45 +00:00
Gabriel Wicke 2efcd3cd57 Reworked percent encoding handling for URIs to get closer to the 'url
construction' part of the HTML5 spec:
http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#url-manipulation-and-creation

Removed a few whitelisted test cases that are now passing directly.

The encoding canonicalization could also be moved to the Sanitizer. Doing this
early in token stream processing however has the advantage of providing further
transformations uniform data to work with. We could even consider to move this
even further into the tokenizer.
2012-03-06 13:49:37 +00:00
Rob Moen 809df81282 enable CE demo toolbar, added annnotation and renderDomNode methods 2012-03-05 22:08:35 +00:00
Gabriel Wicke 19fe9726a2 Fix invalid external link representation. 268 tests passing. 2012-03-05 18:06:29 +00:00
Rob Moen da5a148f9c prevent insert for stand alone command key. 2012-03-05 17:57:54 +00:00
Gabriel Wicke a9ebc1d986 Support external images wrapped in a clickable link using bracketed external
link syntax. 265 tests passing.
2012-03-05 16:23:00 +00:00
Gabriel Wicke 7f7202e89c A few improvements to external link and image handling. 264 tests passing. 2012-03-05 15:34:27 +00:00
Gabriel Wicke 7b0c807710 Change wikilink tokenization strategy to split on pipes. This makes it
possible to support template / template argument expansion in image options,
and causes little trouble for wikilinks. Non-image wikilinks with multiple
text pipes are quite rare in the dumps, and concatenating description tokens
with a plain '|' is quite easy. 261 parser tests passing.
2012-03-05 12:00:38 +00:00
Rob Moen 714f15cef7 minor changes: remove whitespace and add semicolons 2012-03-03 00:17:15 +00:00
Gabriel Wicke 3e6f1b6bea Use some options primitively. 2012-03-02 14:19:33 +00:00
Gabriel Wicke 167dbdb0fa Parse image options. 2012-03-02 13:36:37 +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
christian 3f1ed0be6d adding cut-copy-paste 2012-03-01 22:27:23 +00:00
Inez Korczynski 8120b0b624 Cleanup for JSLint 2012-03-01 22:14:14 +00:00
Inez Korczynski 45cd5a11d0 Explicitly pass parameter global=true to getOffset method 2012-03-01 20:52:22 +00:00
Inez Korczynski 5dc284efaf Added getSelection method to Surface 2012-03-01 20:49:21 +00:00
Gabriel Wicke 8b7ba9051b Add productions for image option tokenization, and prepare to call those from
the LinkHandler token stream transformer.
2012-03-01 18:07:20 +00:00
Gabriel Wicke b1a7119a46 Hack up some rudimentary image rendering. Using jshashes for the md5, and
a few hard-coded image image sizes ;) 262 tests passing.
2012-03-01 13:51:53 +00:00
Gabriel Wicke d4faf9eaf4 More work on wiki link rendering and general wiki title / namespace
functionality.
2012-03-01 12:47:05 +00:00
Inez Korczynski 3bb7f81714 Migreate text input method from playground to ce and ce demo 2012-03-01 01:28:39 +00:00
Sam Reed fc49422e1d More image compression of extensions with WMF interest 2012-02-29 22:02:03 +00:00
Gabriel Wicke 4b9bd45b82 Start to move wikilink expansion to a separate async token transformer. 2012-02-29 13:56:29 +00:00
christian 13fe37193a re-enabling native browser spellcheck 2012-02-28 23:43:38 +00:00
Gabriel Wicke b8bb503199 Actually commit onlyinclude, as already announced in r112592. 2012-02-28 13:24:35 +00:00
Rob Moen f6f05241c7 fixed my typo follow up r112555 2012-02-28 01:37:38 +00:00
Rob Moen 78eedb8c74 cleanup previous commit. follow up r112552 2012-02-28 00:46:23 +00:00
Rob Moen 37ffc61c19 prototype RTL text mode cursor handling. Need to complete the unicode regular expression, and make helper methods for RTL boundary 2012-02-28 00:35:17 +00:00
christian 7053e0517c prevent dragging and dropping text - can be removed later if operation supported via model 2012-02-27 21:56:56 +00:00
Rob Moen 0575db24f7 added a left positioning to input to properly position ime context menu 2012-02-27 19:44:02 +00:00
Rob Moen ed35395ba2 fix typo which prevented readInterval from stopping onBlur 2012-02-24 17:41:22 +00:00
Rob Moen dab0396b54 minor fixes: removed whitespace, added semicolon 2012-02-24 00:49:28 +00:00
Rob Moen 8cf2fe9f33 follow up to r112276, fixed bug which prevented word selection 2012-02-24 00:32:44 +00:00
Trevor Parscal 7baae71363 very minor fixes 2012-02-24 00:05:29 +00:00
Rob Moen 26ab5f7408 Fixed bug when moving cursor with click. Calling showCursor after input regains focus prevents browser from freakishly scrolling 2012-02-24 00:04:21 +00:00
Rob Moen 297d41bb63 Rework general input to no longer clear during IME. Polling interval for non keyDown text comparison. Chunked text insertion for all normal keys which makes nice transactions and clears input. 2012-02-23 23:20:47 +00:00
Trevor Parscal 7366a22046 Added support for respecting new lines in pre-formatted blocks - using Shift+Enter will show this in action! 2012-02-23 01:18:01 +00:00
Trevor Parscal 696f5cb2a0 Replaced "set" and "clear" method for attribute transactions with "replace" method, which allows correct reversion. Also fixed list item tools to correctly use the new function signature. 2012-02-22 21:23:28 +00:00
Gabriel Wicke 3227903d48 Follow-up to r112116, accidentally committed from subdirectory. 2012-02-22 16:41:01 +00:00
Gabriel Wicke 3568dfee14 Add some support for functionhooks in test parser and parserTests.js, and
tweak a few parser functions.
2012-02-22 15:59:11 +00:00
Gabriel Wicke d7da324272 Basic fall-through support for #switch parser function 2012-02-22 14:57:50 +00:00
Gabriel Wicke 491ad5ffef Cleanup and commenting. 2012-02-22 13:13:18 +00:00
Gabriel Wicke 9b3313d923 Speed up flatten slightly by avoiding garbage for already flat arrays. Also,
use simple string concatenation instead of arrays as the strings tend to be
few and short.
2012-02-22 11:25:44 +00:00
Gabriel Wicke 8dde1f77b4 Reduce debug print overhead, roughly a 10% speed-up on parserTests. 2012-02-21 18:49:43 +00:00
Gabriel Wicke 058c4213a4 Remove some more unused code and tidy up some more. 2012-02-21 18:26:40 +00:00
Gabriel Wicke 416126c041 Fix the bug in the inline_breaks replacement, and write another switch-based
version, which is slightly faster and shorter. Performance is improved by
about 5% for parserTests.
2012-02-21 17:57:30 +00:00
Gabriel Wicke 18a04f7581 Tidy up and comment the tokenizer a bit more. Start to move code into
mediawiki.tokenizer.js module, and pass a reference to parse(). Faster
inline_breaks production using a JS function which seems to be generally
correct, but still breaks five tests when enabled. Seems to be some weird
interaction with peg.js, possibly something to do with caching.
2012-02-21 17:21:42 +00:00
Gabriel Wicke 8718bd65bc Add list of HTML5 and deprecated HTML3/4 elements in preparation for
end-of-potential-extension rules; Support indented tag-wrapped pre blocks.
2012-02-21 14:44:56 +00:00
Gabriel Wicke ffec77273a Comment and minor code tweaks. 2012-02-21 11:24:20 +00:00
au ea15bffb27 Revert "* Always sort attributes (+1 test pass)."
This reverts commit 45ca281da8eef8030bdd1986418cb914fc9a717c.
2012-02-20 22:26:12 +00:00
Gabriel Wicke 5806705733 Push transformer setup a bit further into the attribute pipeline. 2012-02-20 12:56:00 +00:00
Gabriel Wicke 8eddb4ec6b Add some comments to the Sanitizer 2012-02-20 11:14:53 +00:00
Gabriel Wicke 71e95bd54b Set up token stream transformers from a map of phases per input content type.
Not yet applied to attribute pipeline creation. 249 tests passing.
2012-02-20 11:07:21 +00:00
au 9c55f5e8b7 * Always sort attributes (+1 test pass).
The performance impact for .sort is quite small (12.079s => 12.158s)
  and Sanitizer is probably one of the more accessible places to do this.
2012-02-18 21:01:07 +00:00
au aa589d989b * Rudimentary CSS validation; +4 tests pass. (Bug 2304, 3244). 2012-02-18 20:16:23 +00:00
Gabriel Wicke 4d80b8daa8 Detail comments about next steps and divide parser functions in those that
need more information from the wiki and readily implementable items.
2012-02-17 10:23:14 +00:00
Gabriel Wicke 059ff94bc4 Reject match for invalid urlencoded code points. 2012-02-16 13:57:56 +00:00
christian 8b3bc2e439 turning off native spellcheck for now 2012-02-15 23:42:43 +00:00
Gabriel Wicke dc1d30fcb5 Tweaked template parameters a bit further, and made the self-closing tag
protection a bit less trigger-happy.
2012-02-15 15:56:11 +00:00
Gabriel Wicke 089413298c Protect self-closing tags in generic attribute production. 2012-02-15 13:23:50 +00:00
Gabriel Wicke 5e94a238fc Prepare for the support of tables (and later generally block-level elements)
in template parameters. 244 tests passing.
2012-02-15 11:51:29 +00:00
Gabriel Wicke 774a3189c8 Improve support for generic attribute names coming from
templates/templateargs.
2012-02-15 10:19:39 +00:00
Gabriel Wicke 1ce6f5a3c4 Improve support for single-line attributes with preprocessor support. 243
tests passing.
2012-02-14 21:25:52 +00:00
Gabriel Wicke f02b3d91c6 Port urlencoded char support to preprocessor-supporting link target
production, and remove old link_target production.
2012-02-14 21:08:25 +00:00
Gabriel Wicke 001194b140 Replace console.log with console.warn in all debug statements 2012-02-14 20:56:14 +00:00
Trevor Parscal 5f033c9bfe Changed the way widths are calculated when rendering lines of text. Now we let the browser do it's normal layout thing, and use a set of floated divs to figure out the effective line width. Using this technique, we pretty much support floating content from a rendering perspective. Interaction is still a problem however. 2012-02-14 20:30:40 +00:00
Gabriel Wicke f42b379e52 Fix named wikilink options (image options really) in template arguments, and
speed up template parameter parsing by eliminating some backtracking. 238
tests passing (unchanged).
2012-02-14 15:45:18 +00:00
Gabriel Wicke 64f63b3714 request is automatically installed by jsdom. Follow-up to r111459. Thanks
Hashar!
2012-02-14 14:15:50 +00:00
Gabriel Wicke 466e8e54ad Tweak comment about request module 2012-02-14 14:01:13 +00:00
Inez Korczynski d5ad9a9ad4 New approach to text input and IME (part I) 2012-02-13 22:45:18 +00:00
christian 0e6fe86a05 Commenting out fake cursor for now, fixing paste binding 2012-02-13 19:51:39 +00:00
christian c532488b40 creating showFakeCursorAt method and cleaning up code 2012-02-13 19:48:05 +00:00
Inez Korczynski 3ee4da941d Render real <b> and <i> tags insteaf of <span>s 2012-02-13 19:38:31 +00:00
Gabriel Wicke 0b8d1b0387 * Add custom toString methods for tokens to aid debugging
* Convert all attributes into strings in Sanitizer
* Use strict comparison against empty string in tokenizer
* Add very simple sitename parserfunction
* 138 tests passing
2012-02-13 17:02:23 +00:00
Gabriel Wicke 9945175416 Reformat Date.replaceChars 2012-02-13 14:23:48 +00:00
Gabriel Wicke 0b40741e1c Strip trailing newlines from included templates 2012-02-13 14:17:03 +00:00
Gabriel Wicke 025f9cddb3 Prefix all internal data- attributes with data-mw- and adjust the whitelist
and test output normalization accordingly. 235 tests passing.
2012-02-13 13:54:07 +00:00
Gabriel Wicke b1617b1d71 Add some support for ideographic spaces in external links, support the
int: namespace alias and perform some normalization on the MediaWiki namespace
prefix.
2012-02-13 13:35:46 +00:00
Gabriel Wicke 55ddb4fd66 Remove WikiDom default serialization and --html argument from parse.js
wrapper. HTML ist now the only supported format. The DOMConverter is now no
longer used. Roan, feel free to remove / butcher it for direct HTML to linear
model conversion.
2012-02-11 17:59:17 +00:00
Gabriel Wicke a122e51eec Move data-* annotations into separate object on tokens, that is then
serialized into a single data-mw-rt attribute if present. Update parserTests
to ignore this attribute for comparisons with expected parser output.

A few more tweaks and notes are thrown into this commit too. 233 tests are
passing now.
2012-02-11 16:43:25 +00:00
Inez Korczynski 0ce3c67872 Working prototype of insertion of the text with annotations 2012-02-11 01:04:14 +00:00
Inez Korczynski 001a432fa3 Get rid of console.logs 2012-02-10 22:27:17 +00:00
Inez Korczynski b3453dc71c Add new method: getDOMText 2012-02-10 22:19:12 +00:00
christian f0e60248fb fake cursor demo 2012-02-10 18:18:35 +00:00
Alexandre Emsenhuber bfa0a28968 svn:eol-style native 2012-02-10 16:57:02 +00:00
Inez Korczynski acd819b28b Fix showCursorAt method - missing "break;" 2012-02-10 05:39:28 +00:00
Gabriel Wicke aff30be131 Some comments and reshuffling in the grammar, and a typo in the
AttributeExpander.
2012-02-09 22:27:45 +00:00
christian ed7dc80db9 reorginization of event handlers 2012-02-09 22:11:33 +00:00
Brion Vibber d0abf39168 ve.js isn't the edit surface, that's es.js :) 2012-02-09 22:04:06 +00:00
Brion Vibber 9ffa60477e local variable 2012-02-09 21:56:48 +00:00
Brion Vibber 8eddf06713 bugzilla is on https only (though it will redirect) 2012-02-09 21:55:43 +00:00
Brion Vibber dd075b0f87 local variable 2012-02-09 21:48:20 +00:00
Gabriel Wicke 6e33255503 Improve support for preprocessor functionality in attributes; Support
multi-line xmlish tags with preprocessor stuff in attributes.
2012-02-09 16:36:29 +00:00
Gabriel Wicke 16ded7d955 Fix a bug in wikilink with trail tokenization. 2012-02-09 14:06:35 +00:00
Gabriel Wicke 6983481561 Move attribute expansion back to separate handler, as this makes it easier to
only expand used branches selected by parser functions. Template (and
-argument) expansion is simply registered before general expansion.

Additionally, a few more simple time-based magic words are added in
ParserFunctions.
2012-02-09 13:44:20 +00:00
christian ffad7ef3d8 removing beforepaste event for now. it was hyper 2012-02-09 08:41:36 +00:00
christian 6a23449ecb using transact 2012-02-09 07:39:43 +00:00
Inez Korczynski 3f843bb1a6 First implementation of IME for content editable 2012-02-09 00:51:59 +00:00
christian f84fc1cbf1 paste handler no longer causes fast viewport shift when pasting 2012-02-08 23:37:52 +00:00
christian 13921a0468 layout tweaks 2012-02-08 22:50:34 +00:00
christian e3e3150399 using execcommand to undo cut - model controls mutation 2012-02-08 18:06:03 +00:00
Gabriel Wicke 3f7c1499cd Enable support for general preprocessor functionality in attribute keys and
values. This includes comments, templates and template arguments.

This also replaces the specialized expansion logic in the TemplateHandler. The
removal of link validation lets one more parser test fail for now. External
link target validation will need to be implemented in the token stream handler
for links. This is noted as TODO in
https://www.mediawiki.org/wiki/Future/Parser_development#Token_stream_transforms.
2012-02-08 15:10:30 +00:00
christian cdbe9a7d13 fixing scroll after paste 2012-02-08 07:18:15 +00:00
christian df78da31ca removing offset override 2012-02-08 06:55:12 +00:00
christian 212d4d7559 adding overflow hidden to allow clicking on floated elements 2012-02-08 06:31:51 +00:00
christian 1dd6d8f2b5 working on getSelection and getOffset for triple click 2012-02-08 06:28:38 +00:00
christian 75bec9fba1 cut support 2012-02-08 02:12:21 +00:00
christian 2d058f7a4d copy and paste support 2012-02-08 00:47:51 +00:00
Inez Korczynski 746e603184 Implement: surfaceView.showCursorAt(int n) 2012-02-08 00:30:40 +00:00
Inez Korczynski beda113281 Delete scanBoundaries method from Content, as it does not make sense anymore for content editable approach 2012-02-08 00:26:18 +00:00
Inez Korczynski 2d531ed213 Get getSelection in contenteditable working 2012-02-08 00:02:08 +00:00
Inez Korczynski a046c0d2cf Cleanup Surface.js - only functionality that is needed for content editable 2012-02-07 22:59:30 +00:00
Inez Korczynski db0aea6965 Make paragraphs in content editable use real <p> tags 2012-02-07 22:22:49 +00:00
Inez Korczynski 0ced900973 Added missing CSS and PNG so ce demo does not complain anymore. 2012-02-07 22:03:39 +00:00
Inez Korczynski e0c10cdfff Cleanup ve.es.Content.js for ContentEditable and setup toolbar as empty (as there is no working functionality for now) 2012-02-07 22:02:11 +00:00
Alexandre Emsenhuber f162145298 svn:eol-style native 2012-02-07 19:13:19 +00:00
Gabriel Wicke 157c495a9e Normalize the title in localurl. 232 tests passing. 2012-02-07 12:26:00 +00:00
Gabriel Wicke b4892102a4 Clean up transform callback interface 2012-02-07 11:53:29 +00:00
Gabriel Wicke 1f6db903e9 Pluck a few low-hanging fruit in external link tokenization, and add a simple
localurl parser function implementation. 230 parser tests now passing.
2012-02-07 10:28:23 +00:00
Gabriel Wicke cf8b7bf45d External links don't nest. 2012-02-07 09:38:28 +00:00
christian 2a076da93a removing outline from contenteditable 2012-02-07 02:01:26 +00:00
christian be552732c0 tweaks to margins 2012-02-07 02:00:08 +00:00
Inez Korczynski 9173608afb Adapt ContentEditable code to new schema of directories and files 2012-02-07 01:43:49 +00:00
Trevor Parscal 8078b0f8a2 Fixed backspace - another issue related the r110805 (or as we are now calling it, "The Great Code Migration of 2012") 2012-02-07 01:11:32 +00:00
Trevor Parscal d172b220b7 Minor fixes (line length breaking, jshint nagging, etc) 2012-02-07 00:42:16 +00:00
Trevor Parscal fb09439ae6 Fixed image file links from sandbox.css to images supplied by es and ui packages 2012-02-06 23:55:58 +00:00
Trevor Parscal 6dcc39fe11 Migrated es.* to new ve.* namespace which is more structured, and will make it easier to keep data model, edit surface, user interface and content editable work separated cleanly 2012-02-06 23:50:56 +00:00
Gabriel Wicke 53bf4f2bd0 Temporarily disable the sanitizer and start to support preprocessor
functionality (comments, templates, template arguments) in arbitrary
attributes. The grammar for this is still quite rough, will need to
consolidate that area.
2012-02-06 19:15:44 +00:00
Gabriel Wicke c26243989e Improve toJSON handlers to include all properties 2012-02-06 19:12:29 +00:00
Gabriel Wicke 0bea9fdfbb Fix nowiki tokenization regression introduced r110495 2012-02-03 13:10:04 +00:00
Gabriel Wicke 26f2026cff Add custom JSON serializers for tokens that include a type attribute 2012-02-03 13:09:01 +00:00
Gabriel Wicke 8c75aa1a7a Remove type attribute for tag tokens. 2012-02-01 18:37:48 +00:00
Gabriel Wicke 689f697a93 Push token format conversion a bit further along, and add defines that were
missing in last commit.
2012-02-01 17:03:08 +00:00
Gabriel Wicke a5cc10a06b Change token format to plain strings for text tokens, and specific objects for
other tokens. This is only the first half of the conversion. The next step is
to drop the type attribute on most tokens and match on the constructor in the
token transform machinery.
2012-02-01 16:30:43 +00:00
Gabriel Wicke dd3707ded5 Remove some modules normally bundled with node.js from dependencies, and
remove some older ones that are only used in currently-dead code.
2012-02-01 10:32:33 +00:00
Gabriel Wicke e65c6502c0 Add source for #time implementation in comment 2012-02-01 10:14:01 +00:00
Roan Kattouw 935cae67c6 As promised, reorganize insert() so the order of cases makes more sense (from simple to complex) 2012-01-31 17:14:16 +00:00
Gabriel Wicke 14a8a13678 A few more debug helpers including a --trace mode for light debugging. Some
improvements to parser functions on the way to support the cite extensions.
Preparation for generic template and template arg in attribute support. 222
parser tests now passing.
2012-01-31 16:50:16 +00:00
Roan Kattouw 6832be68ed Fix test #30: was failing because getScope() was broken and insert() didn't account for the case of inserting something like </list><list> at a structural offset. All tests are now passing, yay!
* Fix getScope()
** Drop the -1 which caused the result to be off by one level
** Prevent JS errors from occurring if bad input causes the loop to try to traverse up above the root node
* insert()
** Detect the case where the input data tries to close the containing element; in that case, we'll get scope != node
** Move the getNodeFromOffset() and getScope() calls up and out of the conditionals
** Remove unnecessary parent==model conditional, no longer needed now that getScope() can safely handle things that try to traverse too far up
** Add some comments to explain what's going on. I'll restructure this function a bit more shortly
2012-01-31 16:43:21 +00:00
Neil Kandalgaonkar 2688f823ef added dependencies to README 2012-01-31 00:56:07 +00:00
Neil Kandalgaonkar f0b934ef2e first pass at an API method that returns wikidom. Shells out to node. Some issues with XML API result formatting but works fine in JSON 2012-01-31 00:02:48 +00:00
Gabriel Wicke 7cd94df47d A few minor tweaks to reduce memory usage 2012-01-27 13:32:44 +00:00
Trevor Parscal 94f7d79eb7 Skip traversal of leaf nodes if there aren't any children 2012-01-23 18:46:31 +00:00
Gabriel Wicke 4e6a54560a * Emit token chunks for top-level block elements by patching the source of the
tokenizer
* Fix a bug uncovered by this
* Increase the number of outstanding listeners on a single download to 10000
2012-01-22 23:21:53 +00:00
Gabriel Wicke 7ea4d7d3db A few parser function fixes and maximum template expansion in environment
config.
2012-01-22 19:32:28 +00:00
Gabriel Wicke 561cf3c237 Bug fixes and a first stab at a #time parser function. You can expand the main
page like this:

cd extensions/VisualEditor/modules/parser
echo '{{:Main Page}}' | node parse.js
echo '{{:Main Page}}' | node parse.js --html
echo '{{:Main Page}}' | node parse.js --debug

Even the date-based includes work somewhat, although they don't yet accept
passed-in dates.
2012-01-22 07:07:16 +00:00
Gabriel Wicke 60e45bb739 A bit of template expansion bug fixing and parser function documentation 2012-01-22 01:27:22 +00:00
Gabriel Wicke e8a7034acf Add some commandline switches to parse.js. Supports switching on/off debug
mode and a selection of html/WikiDom serialization.
2012-01-21 22:42:54 +00:00
Gabriel Wicke 785a4af76f Implement a few parser functions. 220 parser tests now passing. 2012-01-21 20:38:13 +00:00
Gabriel Wicke 1a6546fbca Support empty template arguments and default values in arg expansion 2012-01-21 03:03:33 +00:00
Gabriel Wicke fdd048b3b2 Remove a few stray debug prints and disable debugging in parse.js 2012-01-20 22:21:33 +00:00
Gabriel Wicke 145df2655c * NoInclude and IncludeOnly improvements
* Tokenizer support for templates and template args in template arguments and titles
* Async attribute expansion fixes
2012-01-20 22:02:23 +00:00
Gabriel Wicke 348cac6cf0 Fix a bug in TokenCollector, and misc tweaks for template expansions. 2012-01-20 18:47:17 +00:00
Gabriel Wicke 7cc8e69147 Collapse all requests per template into a single outstanding request using an
event-emitting TemplateRequest object and a request queue.
2012-01-20 02:36:18 +00:00
Gabriel Wicke fc2088bb21 Add some rudimentary noinclude / includeonly support and fix up
TokenCollector.
2012-01-20 01:46:16 +00:00
Gabriel Wicke c15e0d4167 Minor cleanup in TemplateHandler 2012-01-20 00:49:27 +00:00
Gabriel Wicke d0ece16c86 Fix async template expansion, so we can now render simple pages with templates
directly to WikiDom from enwiki using a commandline like this:

  echo '{{User:GWicke/Test}}' | node parse.js

Wohoo!

Complex pages with templates won't render properly yet, as noinclude /
includeonly and parser functions are not yet implemented. As a result, the
parser will run out of memory or hit the currently low expansion depth limit
as it tries to expand documentation for all templates.
2012-01-19 23:43:39 +00:00
Gabriel Wicke 2233d0a488 Eventify parser tests and parse.js commandline wrapper to actuallly allow
async template fetching. Async expansion is not yet fully debugged, but at
least the preconditions for that are now there.
2012-01-18 23:46:01 +00:00
Gabriel Wicke 5b8054636e Make template fetching somewhat functional on node with Inez' help, but
disable it by default in parserTests as it tries to fetch all sorts of parser
functions and is not yet fully supported in parserTests. The next step will be
to build a list of parser functions (to avoid fetching them as templates) and
pushing the event interface into parserTests.
2012-01-18 19:38:32 +00:00
Gabriel Wicke 4bd4307924 Fix comment to reflect the actual regexp/spec in the JS version as well. 2012-01-18 19:35:13 +00:00
Gabriel Wicke 14e6728cc4 Add the start of a minimal sanitizer stage, that only strips IDN ignored
characters from host portions of links hrefs for now. This module needs to be
filled up with pretty much everything Sanitizer.php does, including tag and
attribute whitelists and attribute value sanitation (especially for style
attributes).

We'll also need to think about round-tripping of sanitized tokens.
2012-01-18 01:42:56 +00:00
Gabriel Wicke 336be4f617 Eat '[[[' as plain text token, makes it 212 passing. 2012-01-18 00:23:17 +00:00
Gabriel Wicke 178adbc342 Accept IPv6 (and IPv4) addresses in the tokenizer, so another test passes. 2012-01-18 00:00:47 +00:00
Gabriel Wicke e7381da5b8 Trim whitespace off template titles and argument names. 209 parser tests now
passing.
2012-01-17 23:18:33 +00:00
Gabriel Wicke f50fecf1e3 Fix template argument expansion. 200 parser tests now passing. 2012-01-17 22:29:26 +00:00
Gabriel Wicke 34025251a3 Clean up 'END' token handling a bit. 2012-01-17 20:01:21 +00:00
Gabriel Wicke 7f579398c7 Use isBlockTag in DOMPostProcessor 2012-01-17 18:30:22 +00:00
Gabriel Wicke 6bd7ca1e75 Misc improvements, now 196 parser tests passing.
* Add handler for post-expand paragraph wrapping on token stream, to handle
  things like comments on its own line post-expand
* Add general Util module
* Fix self-closing tag handling in HTML5 tree builder
2012-01-17 18:22:10 +00:00
Gabriel Wicke f4081bef08 First template expansion tests start working, and a bug fix in
DOMPostProcessor paragraph wrapper. 187 parser tests now passing.
2012-01-14 00:58:20 +00:00
Gabriel Wicke 196d704e8e Template expansion now enabled and somewhat working, but template fetching
still fails all the time.
2012-01-13 18:48:25 +00:00
Gabriel Wicke 32c9bccd7c Results of early template expansion debugging. Still disabled by default, but
getting closer.
2012-01-11 19:48:49 +00:00
Gabriel Wicke 6b6ec2933d More work towards template expansion.
* Created AttributeTokenTransformManager for generic attribute conversion, and
  removed { title, template argument {key, value} } expansion from
  TemplateHandler.
* Added caching for attribute and input sub-pipelines. Especially attribute
  pipelines would otherwise be recreated for each attribute value and key.
2012-01-11 00:05:51 +00:00
Gabriel Wicke 5ec30252f1 More token transform and pipeline setup refactoring to support template
expansion better.
2012-01-10 01:09:50 +00:00
Gabriel Wicke 287604c422 A bit of cleanup in ParserPipeline, with better and more consistent support
for multiple input types.
2012-01-09 19:33:49 +00:00
Gabriel Wicke becf3cb7ea Add generic 'collect all tokens between delimiter tokens and call a transform
function on it' util for synchronous transformation phases. This can be used
to implement parser hooks (aka extension tags) besides other things.
2012-01-09 18:13:45 +00:00
Gabriel Wicke e99d7a2a55 Two batteries worth of token transform manager refactoring.
* TokenTransformDispatcher is now renamed to TokenTransformManager, and is
  also turned into a base class
* SyncTokenTransformManager and AsyncTokenTransformManager subclass
  TokenTransformManager and implement synchronous (phase 1,3) and asynchronous
  (phase 2) transformation stages.
* Communication between stages uses the same chunk / end events as all the
  other token stages.
* The AsyncTokenTransformManager now supports the creation of nested
  AsyncTokenTransformManagers for template expansion.
  The AsyncTokenTransformManager object takes on the responsibilities of a
  preprocessor frame. Transforms are newly created (or potentially resurrected
  from a cache), so that transforms do not have to worry about concurrency.
* The environment is pushed through to all transform managers and the
  individual transforms.
2012-01-09 17:49:16 +00:00
Gabriel Wicke 6601c544e6 Handle default for template arg expansion, add template fetch functionality
and tweak a few minor things in the grammar and QuoteTransformer.
2012-01-06 17:19:14 +00:00
Gabriel Wicke f0c844f28f Add template expansion handler skeleton, not yet functional. Also note
improvements needed in the tokenizer template handling.
2012-01-06 14:30:55 +00:00
Mark A. Hershberger 381551e039 w/s 2012-01-04 17:46:24 +00:00
Mark A. Hershberger 3a9a4cf322 re r106536 remove !transparent 2012-01-04 17:44:14 +00:00
Gabriel Wicke 2e35171fd1 Fix quote handling and tweak the whitelist a bit. 'any' token registrations
are now merged with specific registrations by rank. Not yet clear if that is a
good idea overall, need to check use cases when implementing template expansion
and other functionality.

183 parser test now passing.
2012-01-04 14:09:05 +00:00
Gabriel Wicke 6cd95fea37 Fix up constructors in EventEmitter inheritance and tweak a few more comments. 2012-01-04 12:28:41 +00:00
Gabriel Wicke e3ae9a702b Fix JSHint warnings (mostly about comment indentation) from r108012. 2012-01-04 11:06:24 +00:00
Gabriel Wicke 4c4a24f0a0 Hook up the DOMPostProcessor using events as well, and rename the subscription
methods to tell a story. Also document idea on how to dynamically configure
the pipeline depending on event registrations in comment.
2012-01-04 11:00:54 +00:00
Gabriel Wicke f0399d2ec5 Clean up comments in TokenTransformDispatcher and mark private methods with
underscore.
2012-01-04 09:48:24 +00:00
Gabriel Wicke ee79158e53 Add trailing newline in commandline parser wrapper 2012-01-04 08:42:53 +00:00
Gabriel Wicke 29362cc53c Rename ParseThingy to ParserPipeline and fix up broken WikiDom generation and
commandline runner.
2012-01-04 08:39:45 +00:00
Gabriel Wicke bd98eb4c5a Land big TokenTransformDispatcher and eventization refactoring.
The TokenTransformDispatcher now actually implements an asynchronous, phased
token transformation framework as described in
https://www.mediawiki.org/wiki/Future/Parser_development/Token_stream_transformations.

Additionally, the parser pipeline is now mostly held together using events.
The tokenizer still emits a lame single events with all tokens, as block-level
emission failed with scoping issues specific to the PEGJS parser generator.
All stages clean up when receiving the end tokens, so that the full pipeline
can be used for repeated parsing.

The QuoteTransformer is not yet 100% fixed to work with the new interface, and
the Cite extension is disabled for now pending adaptation. Bold-italic related
tests are failing currently.
2012-01-03 18:44:31 +00:00
Neil Kandalgaonkar 9d198ecad6 when nothing to undo or redo, grey out appropriate buttons - fix bug #33112, based on patch from ashish.dubey91@gmail.com 2011-12-31 01:44:34 +00:00
Neil Kandalgaonkar 20374b5911 fix substr for IE, followup r107464 2011-12-30 21:51:03 +00:00
Gabriel Wicke 8e00a72d0a Improvements to link trail handling, and two tweaks to the whitelist. 182
tests now passing. 

Link trails depend on language-dependent positive character classes in the PHP
parser. These classes all seem to disallow punctuation implicitly and list
differing plain text characters instead, so it might be possible to get away
with identifying a common class of non-trail punctuation instead. This would
help to keep the tokenizer independent of configurations, which is very
desirable for caching and simplified external parsing.
2011-12-30 12:47:06 +00:00
Gabriel Wicke 11ece76b7b Fix suffix handling for wiki links. 2011-12-30 09:35:57 +00:00
Gabriel Wicke b3a0270d69 Remove env and load grammar in tokenizer constructor. Re-add property hack to
keep parserTests running for now. Really need a different pipeline for html
serialization or a reference to the HTML DOM.
2011-12-28 17:04:16 +00:00
Gabriel Wicke 3a63fb118e Add a few comments inline, and remove unneeded html serialization as we are
only interested in WikiDom output in this parser wrapper.
2011-12-28 13:46:52 +00:00
Neil Kandalgaonkar 8fbf36e63e put add terminal token inside tokenize method (will pull it out again for streaming interface) 2011-12-28 01:37:15 +00:00
Neil Kandalgaonkar 6103646ec8 remove need to add newline at end of input 2011-12-28 01:37:11 +00:00
Neil Kandalgaonkar 4158f82d7e refactor parser to ParseThingy in different module, can be invoked with command line utility parse.js 2011-12-28 01:37:06 +00:00
Neil Kandalgaonkar d91a67ba99 nodeName not defined 2011-12-28 01:36:54 +00:00
Neil Kandalgaonkar 962d1262fc create tokenizer without need to modify namespace with PEG source 2011-12-28 01:36:36 +00:00
Gabriel Wicke 33e60dd4d9 Update comments a bit. 2011-12-22 12:37:24 +00:00
Gabriel Wicke 9ee0e660ec Fix regression introduced by r107060 for regular table cells. Good to have a
test suite ;)
2011-12-22 12:09:25 +00:00
Gabriel Wicke a94d0ec10c Re-add support for row-only tables. 2011-12-22 11:58:32 +00:00
Gabriel Wicke 1c7fe0eb34 Refactor table productions to support table fragments in templates (table
start / row / table end). The old productions are not deleted yet to make it
easy to compare the output on more complex articles. 181 tests passing after
adding two table tests with whitespace-only differences to the whitelist.
2011-12-22 11:43:55 +00:00
Gabriel Wicke 2845ba9552 Handle noinclude and includeonly at start of line, so that syntax after it
still matches as if it actually was preceded by a newline.
2011-12-21 11:38:50 +00:00
Mark A. Hershberger 752130ab74 Bug 33113 - Have buttons that are grayed out disabled completely
Author: joan.creus.c@gmail.com
2011-12-17 23:58:21 +00:00
Gabriel Wicke 3a631db6d9 Fix ranges for annotations in implicit paragraphs within branch nodes. 2011-12-16 19:36:04 +00:00
Gabriel Wicke cc06551f2e Rename table_header production to table_heading. Those non-natives strike again. 2011-12-16 19:24:59 +00:00
Gabriel Wicke 605ed23fd2 Fix attributes in table headings. 2011-12-16 19:22:13 +00:00
Gabriel Wicke 08255ff3e6 Small bug fix to heading level, spotted by Mike from localwiki- thanks! 2011-12-15 23:59:35 +00:00
Gabriel Wicke a04744b2ec Add some more attribute remapping capabilities to the DOMConverter, and clean
up some grammar formatting.
2011-12-15 17:33:07 +00:00
Gabriel Wicke e98dd9e722 Implement 1-char-minimum width for annotations, and some additonal minor
cleanup.
2011-12-15 11:05:52 +00:00
Gabriel Wicke 22ba27295b Clean up the DOMConverter a bit. 2011-12-15 10:55:30 +00:00
Gabriel Wicke e72dee76e4 Follow-up to r106208 and r106207. Both good catches, thanks Yair! As this code
is in its early stages and nowhere near deployment, please Be Bold and just
commit things like this directly! IMHO it makes more sense to fully review this
once it settles down a bit.
2011-12-15 10:13:50 +00:00
Gabriel Wicke 3585bd9c8e Accept row-only tables. The parser now eats [[en:Barack Obama]] as-is. Hooray! 2011-12-15 00:39:28 +00:00
Gabriel Wicke 6df94a34a1 Less lust for urls 2011-12-15 00:26:22 +00:00
Gabriel Wicke ce2ee067f7 Minor tweak to wiki link production 2011-12-15 00:12:58 +00:00
Gabriel Wicke 377226a120 Comment out a stray console.log 2011-12-14 23:44:58 +00:00
Gabriel Wicke 574abd9774 A collection of small bug fixes to the grammar, Cite, the Token format
converter and the HTML DOM -> WikiDom converter. The tokenizer now digests all
parserTests.
2011-12-14 23:38:46 +00:00
Trevor Parscal 0342eb034d Fixed help panel content where we claimed the alt key was to be used for word/block selection, but it should have been ctrl/option key - also changed clt to ctrl. 2011-12-14 19:15:02 +00:00
Trevor Parscal 64754b8200 Added autocapitalize="off" attribute to text area input so IOS doesn't capitalize everything. 2011-12-14 18:54:36 +00:00
Gabriel Wicke dc77d73ad5 Add ability to pass through JSON data to WikiDom in data-json-* attributes,
and fix parser to actually parse the Barack Obama article except for one table
with nested templates at the start-of-line.
2011-12-14 17:25:09 +00:00
Gabriel Wicke f6e4267fca Handle a few more element types, and reset offset for each leaf node. Not sure
if the latter is correct, as the documentation at
https://www.mediawiki.org/wiki/Visual_editor/Software_design#Data_Structures
and the actual sample WikiDom in the editor sandbox seem to disagree on this
point.
2011-12-14 16:22:27 +00:00
Gabriel Wicke 6676a47008 Add implicit level attribute to WikiDom headings. 2011-12-14 15:55:58 +00:00
Gabriel Wicke 3018ca690b Improve WikiDom conversion: Handle text and annotations in branch nodes as
paragraphs and treat list items as branches.
2011-12-14 15:40:40 +00:00
Gabriel Wicke a09aa4d599 Add rough HTML DOM to WikiDom conversion. You can see serialized WikiDom of
parser tests using 'node parserTests.js --wikidom'.
2011-12-14 15:15:41 +00:00
Gabriel Wicke 5f80d30428 Clean up access to document and body after building the tree. 2011-12-14 09:40:49 +00:00
Gabriel Wicke 30749b8d8d Update comments a bit and add a note on things to improve in API. 2011-12-14 09:33:25 +00:00
Neil Kandalgaonkar 932eade938 add buglist ang bug reporting links to feedback form 2011-12-14 01:32:07 +00:00
Trevor Parscal 74ff2981cf Added blur handler for window which resets the shift key tracker 2011-12-13 23:22:19 +00:00
Trevor Parscal 8e10485a0c Fixes issue with r106123 where creating new links wasn't working anymore with the button 2011-12-13 23:15:31 +00:00
Trevor Parscal fef6d5525e - Added auto-link selection when opening the link editor without selecting any text
- Resolves bug #33049
2011-12-13 23:12:27 +00:00
Gabriel Wicke 55ff272847 Comment TokenTransformDispatcher. 2011-12-13 20:13:09 +00:00
Gabriel Wicke 44deefe303 Minor tweak to comment. 2011-12-13 18:55:44 +00:00
Gabriel Wicke c61b32eaa7 Clean up and comment the Cite extension a bit. 2011-12-13 18:45:09 +00:00
Trevor Parscal 7e3401b777 Renamed, merged and disabled some example documents 2011-12-13 17:49:42 +00:00
Trevor Parscal acb7d042d2 Updated icons (includes new help icon) 2011-12-13 17:39:36 +00:00
Gabriel Wicke feee9ded9f Convert the Cite extension to a token stream transformer.
This required a few further additions to the TokenTransformDispatcher. In
particular, there is now an 'any' token match whose callbacks are executed
before more specific callbacks. This is used by the Cite extension to eat all
tokens between ref and /ref tags. This need is very common, so should be
broken out to an intermediate layer in the future.

In general, the requirements for the TokenTransformDispatcher API are now
clearer, and the API should likely be cleaned up / simplified.
2011-12-13 14:48:47 +00:00
Gabriel Wicke 8e55e79b67 Rename TokenTransformer to TokenTransformDispatcher. 2011-12-13 11:45:12 +00:00
Gabriel Wicke 8231511217 Replace custom object copy with $.extend. 2011-12-13 11:18:15 +00:00
Neil Kandalgaonkar 420342be88 change args for feedback and api -- all optional, in array. 2011-12-13 10:28:44 +00:00
Gabriel Wicke 39aedd4378 Improve comments in QuoteTransformer. 2011-12-13 10:25:18 +00:00
Inez Korczynski 4dfbd527a2 Add "New document" to VisualEditor demo/sandbox 2011-12-13 08:08:02 +00:00
Neil Kandalgaonkar fb5998f1b6 remove flash-of-unstyled-content, consolidate base HTML for the sandbox in sandbox/base.php 2011-12-13 04:06:02 +00:00
Erik Moeller aa161bb64a Adapt title of feedback page to project page title conventions on
mediawiki.org
2011-12-13 03:15:56 +00:00
Neil Kandalgaonkar f9fbeee43e add feedback link to visual editor 2011-12-13 02:46:31 +00:00
Inez Korczynski f27be7c238 Better implementation of history panel 2011-12-13 00:56:29 +00:00
Trevor Parscal f379eac294 Moved toolbar floating code to sandbox.js - using a wrapper instead of a spacer to avoid resize events causing scroll events which cause a nasty loop 2011-12-12 23:41:15 +00:00
Inez Korczynski 74d194d703 Extend content of example article: "Direct manipulation interface" 2011-12-12 23:04:37 +00:00
Inez Korczynski 5f3b4cedb9 Fix typo 2011-12-12 22:55:37 +00:00
Inez Korczynski 135adbf443 Make purgeHistory method work in SurfaceModel with new data structure 2011-12-12 22:51:32 +00:00
Inez Korczynski e592a243b6 Pretty dirty, but working implementation of history panel for VisualEditor 2011-12-12 22:50:57 +00:00
Trevor Parscal db8f9e675c Fixed scroll jumping issue in Chrome (at least) 2011-12-12 22:33:49 +00:00
Gabriel Wicke 0ad08b9ae3 Add a README file pointing to the wiki documentation. 2011-12-12 22:30:11 +00:00
Trevor Parscal 7b3ae79451 Added help view with keyboard shortcut info 2011-12-12 22:09:15 +00:00
Gabriel Wicke a8fa9433c4 Convert quote handling (italic/bold) to a core extension operating on the
token stream. This is the first token transformation exercising the
TokenTransformer class as its dispatcher. Template expansions, wiki link
formatting, tag sanitation and extensions should be able to use the same
dispatcher by registering for specific token types.

The parser performance is very slightly improved as the token stream is only
traversed once.
2011-12-12 20:53:14 +00:00
Trevor Parscal 3d7cd9c59c Made es an explicit global object 2011-12-12 15:31:04 +00:00
Gabriel Wicke 752b0990b2 Refactor parserTests somewhat into a class-like structure, and wire up the
TokenTransformer.
2011-12-12 14:03:54 +00:00
Gabriel Wicke d616f07a79 Don't re-build the wiki tokenizer for each test. This speeds up the full
parserTests.js run slightly from 7-8 minutes to about 14 seconds ;)

A few very minor tweaks to the grammar are also thrown into this commit.
2011-12-12 10:47:42 +00:00
Gabriel Wicke 89c5e0cafb Follow-up to r105859: Add missing new. 2011-12-12 10:09:13 +00:00
Gabriel Wicke 9ebce5839a Further development of the TokenTransformer framework. 2011-12-12 10:01:47 +00:00
Inez Korczynski 62a589e185 Fix bug: cursor is not visible when you click outside of surface and then click back in the surface at the same offset where cursor was before 2011-12-10 10:33:00 +00:00
Erik Moeller 0759c2879c Followup r105634; use the label "Edit link" for link inspector 2011-12-10 08:09:42 +00:00
Erik Moeller 03c0532fc7 Swap order of indent/outdent in the toolbar consistent with common
word processor implementations.
2011-12-10 07:17:44 +00:00
Inez Korczynski 224fc98449 Temporary fix for insert method in TransactionProcessor 2011-12-10 02:19:21 +00:00
Inez Korczynski 37d3b7ceac Add calls to 'breakpoint' method in ListButtonTool 2011-12-10 00:06:37 +00:00
Inez Korczynski 4e39b41727 Make ctrl+y execute redo 2011-12-10 00:02:47 +00:00
Inez Korczynski 364a1a94b9 Simple implementation of undo/redo functionality that works. 2011-12-09 23:52:41 +00:00
Trevor Parscal 36159e7597 Fixed inspector positioning (above/below) 2011-12-09 23:33:16 +00:00
Trevor Parscal dabb992d50 Don't allow control+K to open the inspector unless there's a selection length of > 0 2011-12-09 23:23:43 +00:00
Trevor Parscal 080dfcbc4e Moved return false to inside the condition for escape key 2011-12-09 23:15:27 +00:00
Trevor Parscal eb0a82a8af Added escape keyboard shortcut to close inspector 2011-12-09 23:13:46 +00:00
Trevor Parscal 87fab9b7c6 Made accept button disabled when no change has been made 2011-12-09 23:11:49 +00:00
Trevor Parscal a698c5dada Added accept button
Made close button not save
2011-12-09 23:04:55 +00:00
Trevor Parscal 3076bf7e95 Fixed clear button - has to clear the input or it will get re-applied 2011-12-09 22:00:29 +00:00
Trevor Parscal a48d2a5787 * Added shortcut for links (ctrl/cmd + K)
* Added title attributes for tools
2011-12-09 21:16:42 +00:00
Trevor Parscal cb7eb1f033 Fix focus/select bug in link inspector 2011-12-09 21:04:50 +00:00
Trevor Parscal f09e6e7303 Update child leaf nodes on attribute change, not the parent 2011-12-09 21:00:56 +00:00
Trevor Parscal ec2bf0b1ce Update the preview panes when loading different documents 2011-12-09 20:56:49 +00:00
Trevor Parscal 77429444f7 Fixed typo - close not hide 2011-12-09 20:48:38 +00:00
Trevor Parscal 3edaaf390d Moved refocusing on surface view input up to es.Inspector 2011-12-09 20:46:12 +00:00
Trevor Parscal ef35fc2be2 Reset location input between opening the link inspector 2011-12-09 20:44:41 +00:00
Trevor Parscal 4b764f7524 Auto-focus on location input when opening the link inspector, auto focus on surface view input when closing 2011-12-09 20:41:40 +00:00
Trevor Parscal 49041942cc Added support for loading multiple documents in the demo/sandbox 2011-12-09 20:40:26 +00:00
Inez Korczynski 31cd3281ca Fix onMouseDown event handler for IE8 (still double and triple click does not work) 2011-12-09 20:29:37 +00:00
Trevor Parscal c416185a0b Made drop down format menu close when clicked 2011-12-09 19:07:06 +00:00
Trevor Parscal c1ca3af44b Moved $form to es.Inspector and added submit -> close handler 2011-12-09 19:01:05 +00:00
Inez Korczynski 4a31a6b265 Fix bug in enumarete method of ListView 2011-12-09 02:07:23 +00:00
Trevor Parscal 2e0a0e0243 Fixed logic for popping up inspector only with selection 2011-12-09 02:00:45 +00:00
Trevor Parscal f26bec23c9 Removed done button 2011-12-09 01:56:19 +00:00
Trevor Parscal 4ea117d7a6 Added es.Inspector and es.LinkInspector - and a whole bunch of other changes (some are hacks) to get a link inspector working nicely 2011-12-09 01:28:44 +00:00
Inez Korczynski 81b4fc561d Get rid of console.log 2011-12-08 23:52:35 +00:00
Inez Korczynski 22c461a55b Implemented indent and outdent functionality. 2011-12-08 23:45:07 +00:00
Inez Korczynski 47e76f21d1 Fix bug in enumerate method in case of mixed list (number and bullet for example) 2011-12-08 23:43:54 +00:00
Inez Korczynski bc4fc1249c Fix bug in ListButtilTool - cursor position was adjusted when it shouldn't be 2011-12-08 22:16:05 +00:00
Inez Korczynski f55bd4b77c Emit cursor event after listing on unlisting leaf nodes 2011-12-08 22:03:27 +00:00
Gabriel Wicke 80d5067813 Add a TokenTransformer dispatcher class. This class provides subscriptions by
token type, and supports asynchronous token expansion (for example for async
template expansion). This code is not yet tested or used. The interface for
token insertion from transformation functions will be expanded as needed.
2011-12-08 14:37:31 +00:00
Gabriel Wicke c2b69e2486 Clean up newline handling. Emit a NEWLINE token for each
non-{comment,pre,nowiki} newline.
2011-12-08 14:34:18 +00:00
Gabriel Wicke abc2254110 A bit of comment clean-up and wrapping of tree building into try/catch block
to actually count failures.
2011-12-08 11:40:59 +00:00
Gabriel Wicke 92fdf99384 Further renaming, this time from pegParser to pegTokenizer. 2011-12-08 10:59:44 +00:00
Gabriel Wicke 76bc477038 Rename html5TokenEmitter to HTML5TreeBuilder, and the contained Tokenizer to
TreeBuilder.
2011-12-08 10:37:18 +00:00
Gabriel Wicke 19a1f0850f Tidy up the grammar a bit. 2011-12-08 10:33:23 +00:00
Inez Korczynski 5a060d42ec Update selection after unlisting list items 2011-12-08 06:40:36 +00:00
Inez Korczynski 7c7c230595 Get unlisting and listing to work 2011-12-08 04:18:15 +00:00
Inez Korczynski ed44f13aa0 Revert r105509 and r105507 - taken approach is not gonna work 2011-12-08 03:14:10 +00:00
Inez Korczynski 8fece3a241 Temporary fix for transact method to accept array of transactions. 2011-12-08 01:17:08 +00:00
Inez Korczynski 7da531b59e Pass array of transactions to transact method if all those transactions are part of one "interaction" 2011-12-08 01:09:52 +00:00
Trevor Parscal fceda78696 Made preview panes look better 2011-12-08 00:34:05 +00:00
Trevor Parscal 70d5beec71 Changed which elements had user-select: none so that people can copy the wikitext generated by the editor 2011-12-07 23:37:21 +00:00
Trevor Parscal f9fd3b1db2 Fixed wikitext serailizer - extra newlines should be after the list not the list item 2011-12-07 23:35:11 +00:00
Trevor Parscal f42915ac0f Added vertical margin in calculation of menu position 2011-12-07 23:25:13 +00:00
Inez Korczynski 44f8d155b1 When wraping any leaf node in list item make sure to convert it to paragraph first. 2011-12-07 23:16:29 +00:00
Trevor Parscal 8a5ff02cea Fixed headings, lists and list items - listening to the model now, as we should have been 2011-12-07 23:13:57 +00:00
Inez Korczynski f226380f36 Add 'term' and 'defintion' to regex (one that is responsible for deleting all listitem styles from an item) in ListItemView.setClasses method. 2011-12-07 23:12:33 +00:00
Inez Korczynski 91f9572e4b Do not redraw selection if nodes were not added. 2011-12-07 23:05:21 +00:00
Trevor Parscal 22efd982aa Added extra newline after wikitext list 2011-12-07 23:00:00 +00:00
Inez Korczynski d06c7efe0b Refactor class ListButtonTool. Method list now works. 2011-12-07 22:57:17 +00:00
Trevor Parscal 8ef6e4b24e More adjustments to the style of the history panel 2011-12-07 22:52:20 +00:00
Trevor Parscal 04ecb6796a Fixed the layout of the sandbox and demo 2011-12-07 22:50:55 +00:00
Trevor Parscal 4e985a111c Added highlighting for the current index 2011-12-07 22:43:53 +00:00
Trevor Parscal 19c7e874d6 Shortened the names of operations 2011-12-07 22:37:41 +00:00
Neil Kandalgaonkar c0a02cd6c3 undo almost working, still anomalies in selects (particularly first) 2011-12-07 22:28:07 +00:00
Trevor Parscal fdeb042a91 Back, by popular demand, the great side-by-side preview! 2011-12-07 21:17:34 +00:00
Inez Korczynski 45d821b2ec Small cleanup to IndentationButtonTool class 2011-12-07 20:06:04 +00:00
Trevor Parscal 8505b3b566 * Simplified context menu
* Added typeOnly option to getIndexOfAnnotation
* Fixed overly-strict checking for annotations in toolbar
2011-12-07 19:16:40 +00:00
Trevor Parscal 51e68abf08 JSHint fixes 2011-12-07 18:29:02 +00:00
Gabriel Wicke 3742d70abd Add some documentation to syntax flags 2011-12-07 15:54:55 +00:00
Gabriel Wicke 545ca1809f Convert template argument production to generic inline with syntactic stop.
Fix a bug in generic inline production. Nested multi-line templates are now
parsed okayish.
2011-12-07 15:39:39 +00:00
Gabriel Wicke 902db40a1f Process template arguments into an object. 2011-12-07 14:46:07 +00:00
Gabriel Wicke 51a40e4dbc Follow-up to r105423: Fix off-by-one bug. 2011-12-07 11:56:12 +00:00
Gabriel Wicke 49c286a67b Fix a bug in doQuotes (bitten by surprising JS sort() behavior), and improve
tag-only-line handling. 180 parser tests now passing.
2011-12-07 11:51:24 +00:00
Trevor Parscal 0d78a63da0 Revert of all the modifications I made to es.TransactionProcessor - things were getting exponentially worse with each commit - I think I need some sleep 2011-12-07 02:22:06 +00:00
Trevor Parscal 893d337c48 Fixed issue with inserting data that starts with closing elements 2011-12-07 02:13:43 +00:00
Trevor Parscal 38bc605f66 Fixed scope issue when inserting at structural offsets 2011-12-07 01:38:10 +00:00
Inez Korczynski b5d822ec1d Minor fix: incorrect refactoring 2011-12-07 01:13:08 +00:00
Inez Korczynski 0ec2775621 Make ListView.enumerate method clear ListItemView.$icon when item is not 'number'. 2011-12-07 01:12:04 +00:00
Trevor Parscal 45634a8208 Added support for inserting tab and newline characters 2011-12-07 01:10:25 +00:00
Inez Korczynski 8424681948 Refactored code for "listing" 2011-12-07 01:02:36 +00:00
Trevor Parscal f0c20d7a51 Fixed cut - now cut copy and paste work 2011-12-07 00:51:26 +00:00
Trevor Parscal 909b3674be Update node when it's attributes are changed 2011-12-07 00:06:30 +00:00
Trevor Parscal b1f54c5ae5 Refactored annotation of content - now there's an annotate method in surface view 2011-12-06 23:48:47 +00:00
Trevor Parscal ee1caca875 Only act on selection change if it changed 2011-12-06 22:45:38 +00:00
Trevor Parscal 68a0026f56 Disabled console logging 2011-12-06 22:14:48 +00:00
Trevor Parscal c863ab63e3 Adjusted the demo document a bit - disabled tables for now 2011-12-06 22:13:52 +00:00
Trevor Parscal e61e66856c Fixed issue in transaction processor's insert method - no need for a special case for structural offsets anymore 2011-12-06 22:04:18 +00:00
Gabriel Wicke 418a5067c6 Parse attributes in tables using generic attribute production. Some table
tests still do not pass as the MW table output reorders attributes ;)
2011-12-06 22:03:21 +00:00
Trevor Parscal 7ed901d74c Bypass processing if there's no annotations 2011-12-06 21:28:21 +00:00
Gabriel Wicke 3d06707152 Slightly speed up inline tag productions using guards and grouping; Fix list
processing function.
2011-12-06 18:35:05 +00:00
Gabriel Wicke ea8f226fd5 Remove ext and references special cases, now subsumed by generic XML tag
productions. Document issue around special tokenizer mode for other extension
tags.
2011-12-06 16:44:27 +00:00
Gabriel Wicke e7de089d5b Decode urls and html entities, 163 tests now passing. 2011-12-06 13:17:14 +00:00
Gabriel Wicke a72a9e55a3 Don't match internal links with url as target. 161 passing. 2011-12-06 12:26:57 +00:00
Gabriel Wicke 2b5cc67bf5 Further tweaks to headings. 157 tests now passing. 2011-12-06 11:59:41 +00:00
Gabriel Wicke f4d123886e Convert heading rules to single rule that figures out the level. This saves a
lot of backtracking and inline break complexity.
2011-12-06 11:06:05 +00:00
Neil Kandalgaonkar dbe4890ed6 Simplified transaction model, introduced isPartial for some deletes 2011-12-06 01:52:38 +00:00
Neil Kandalgaonkar e3fc95f41a Revert r104884 "no longer track selections in states. Also makes the 'combine' parameter obsolete"
This reverts git-svn commit e4e3468605c97bd5e611fdf8fc80c04e034e4eb4.
This reverts svn commit r104884
2011-12-06 01:52:34 +00:00
Inez Korczynski 8b1c0ff4ee Fix for turning single elements in tables cells into listItems 2011-12-06 00:49:00 +00:00
Inez Korczynski 959963cf6e Prototype of code that wraps nodes as listItems (inside a list) 2011-12-06 00:42:15 +00:00
Trevor Parscal 1b89cbb79d Moved the menu of a drop down tool to be inside the drop down tool itself 2011-12-06 00:10:30 +00:00
Trevor Parscal 2810f79605 inArray returns an index, -1 is failure not 0 or a falsey value 2011-12-05 22:55:39 +00:00
Inez Korczynski a22eadee54 Fix toolbar for IE8 and IE9. Fix mouse button detection for IE8 and IE9. 2011-12-05 22:01:06 +00:00
Trevor Parscal accc605e8a Fixed annotation tool - data is used generically outside, shouldn't have changed that 2011-12-05 21:39:54 +00:00
Inez Korczynski 8ec3fb5b81 Bunch of fixes for IE8 2011-12-05 21:37:38 +00:00
Trevor Parscal 7cf6990af3 Added comments to code 2011-12-05 21:10:19 +00:00
Inez Korczynski 5be5d276a4 Removed empty lines 2011-12-05 20:46:53 +00:00
Trevor Parscal fc3015b260 Moved es.Tool to base classes 2011-12-05 20:42:45 +00:00
Trevor Parscal 8d5c83d87b Prevent inserting unless there was an effective input, such as text being typed - this is done by checking the length of the range of the selection - if it's non-zero then there wasn't any input (because selecting text in the editor fill the input and selects it) 2011-12-05 20:40:35 +00:00
Inez Korczynski 0938f24c5b Use getContentText method to get text of selection 2011-12-05 20:32:05 +00:00
Inez Korczynski 09c0557929 Fix for getContentText method. Do not treat content offsets with annotations as elements. 2011-12-05 20:10:50 +00:00
Trevor Parscal 2d7d4866bc Fixed misnamed method, and off by one issue when getting content data from a document 2011-12-05 20:08:49 +00:00
Gabriel Wicke 33e19f7275 Recognize block-level elements independent of case; Ignore toc and section
edit links in tests. 148 parser tests passing.
2011-12-05 20:03:24 +00:00
Trevor Parscal 07af0cab63 * Moved getContent and getText from leaf nodes to document model nodes
* Renamed getContent to getContentData
* Renamed getText to getContentText
* Added getElementData
2011-12-05 19:41:04 +00:00
Trevor Parscal 4bcc31846b Fixed font size in overlays when embedding in mediawiki 2011-12-05 18:42:58 +00:00
Trevor Parscal 02c88fcddf Prevent cancel link from changing url 2011-12-05 18:38:12 +00:00
Trevor Parscal f9bb9cf586 100char line breaks 2011-12-05 18:31:39 +00:00
Gabriel Wicke 9ed9cb31bd Fix template argument handling somewhat. 2011-12-05 17:58:11 +00:00
Gabriel Wicke 1760210d13 Fixes to tables, headings and misc smaller stuff. Tracked down an issue caused
by improperly caching of production results, which interfered with the
flag-dependent inline_break production.
2011-12-04 19:23:24 +00:00
Inez Korczynski ba5abf6bbd Set: svn:eol-style => native 2011-12-04 02:59:53 +00:00
Inez Korczynski f361648059 Added indentation tool (indent, outdent) 2011-12-04 02:54:33 +00:00
Inez Korczynski 78451cb00a Added partial support for copying functionality 2011-12-03 01:30:44 +00:00
Inez Korczynski e683199853 Avoid using global variables 2011-12-03 00:53:37 +00:00
Inez Korczynski 1f3604a959 Optimization for toolbarView. Count data for all toolbars (currently two) once, and do it not more often than 50ms. 2011-12-02 23:01:21 +00:00
Trevor Parscal babf3eb9fb Made heading labels less verbose 2011-12-02 22:21:58 +00:00
Trevor Parscal 667e145706 * Fixed empty drop down not being the right size
* Added previews for formatting menu
2011-12-02 22:20:26 +00:00
Trevor Parscal f463a3a6bb Added a history icon 2011-12-02 21:54:27 +00:00
Trevor Parscal a555f307f0 Removed unused icon 2011-12-02 21:48:07 +00:00
Trevor Parscal ea1d57146a Updated icons 2011-12-02 21:46:48 +00:00
Trevor Parscal 12ead70876 Added visible breaks to to toolbar groups 2011-12-02 21:31:49 +00:00
Trevor Parscal 3d678ea3bd Integrated menuView into format drop down tool 2011-12-02 21:25:19 +00:00
Inez Korczynski 01180e4f8f Rename function and comment it 2011-12-02 20:41:43 +00:00
Inez Korczynski a9a53a00a8 Initiali implementation of number and bullet buttons for lists. 2011-12-02 06:43:26 +00:00
Inez Korczynski 31585463ed get rid of console.logs 2011-12-02 01:37:23 +00:00
Inez Korczynski 21d78b3c3e getAnnotationsFromRange should return list of annotations even if there are elment offset in between of them 2011-12-02 01:36:12 +00:00
Inez Korczynski 0ef949eed3 Small refactoring of updateState in FormatDropdownTool 2011-12-02 01:22:51 +00:00
Trevor Parscal 8c93a66308 Fixed menu positioning 2011-12-02 00:35:48 +00:00
Trevor Parscal 172c4815b3 Fixed example panel visibility bug 2011-12-02 00:32:20 +00:00
Trevor Parscal 8a58fb5189 Added es.MenuView 2011-12-02 00:30:50 +00:00
Inez Korczynski 874e8aa40a Missing changes for FormatDropdownTool support 2011-12-02 00:02:16 +00:00
Inez Korczynski 634b647dc0 Implemented es.FormatDropdownTool.prototype.updateState 2011-12-01 23:53:15 +00:00
Trevor Parscal 380f016840 * Split the result of getAnnotationsFromRange to provide full, partial and all lists
* Fixed tools to use this data correctly
2011-12-01 23:25:56 +00:00
Inez Korczynski 2686b383d9 Added FormatDropdownTool, so now you can switch leaf nodes from paragraphs to pres for instance 2011-12-01 23:24:21 +00:00
Trevor Parscal 8dc7f148df Fixed clear button to only clear testStyle and link annotations, and also only be enabled when these kinds of annotations are in the current selection 2011-12-01 23:10:09 +00:00
Trevor Parscal 9c08361de9 Select 1,1 by default on load of demo/sandbox 2011-12-01 23:06:29 +00:00
Trevor Parscal ef87d55317 Made context icon not appear while dragging selection 2011-12-01 23:00:35 +00:00
Trevor Parscal 00d62c5ebd Update context menu on scroll and resize 2011-12-01 22:50:55 +00:00
Inez Korczynski 1db55a8242 Added pretty solid implementation of prepareLeafConversion method 2011-12-01 22:45:32 +00:00
Trevor Parscal 0cb7387b6f Added example dialog (still hacking here)
Added link tool to toolbar
2011-12-01 22:43:50 +00:00
Trevor Parscal 7a5eccea44 Using unique event for cursor state changes - this also fixes the infinite loop that occurred when selections were made 2011-12-01 21:44:46 +00:00
Trevor Parscal b1ab785ffc Removing unused icons 2011-12-01 21:37:02 +00:00
Trevor Parscal 3b780a15ef Updated icons 2011-12-01 21:35:54 +00:00
Inez Korczynski 02f2e47e91 Very early version of convertLeafs method (still does not work perfect due to problems wiht selectNodes method) 2011-12-01 21:10:37 +00:00
Neil Kandalgaonkar c8aa352cb0 misc fixes to pass jslint - catch default cases, make sure callbacks whose values are checked always return them, etc. 2011-12-01 19:08:32 +00:00
Neil Kandalgaonkar 71542b45d7 no longer track selections in states. Also makes the 'combine' parameter obsolete 2011-12-01 19:08:28 +00:00
Neil Kandalgaonkar 0f12bd9b59 get rid of separate undoState function 2011-12-01 19:08:24 +00:00
Neil Kandalgaonkar b7cc76acd8 hasTransaction -> hadTransaction 2011-12-01 19:08:18 +00:00
Neil Kandalgaonkar d82a706170 undoes changes, cursor still does not move properly 2011-12-01 19:07:40 +00:00
Gabriel Wicke 63c728924b Use pegjs from npm 2011-12-01 15:23:23 +00:00
Antoine Musso 5ab379f479 fix vim modeline 2011-12-01 15:19:37 +00:00
Gabriel Wicke 0ce1e9fcf3 Add a quick html entity decoding hack, and document need for general decoder. 2011-12-01 14:39:55 +00:00
Gabriel Wicke d00743ad79 Improve external links and definition lists, now 133 tests passing ;)
Also add printwhitelist option to test runner, provides js code copy/pastable
to whitelist.
2011-12-01 14:25:59 +00:00
Inez Korczynski da9b4070fe Added undo and redo buttons to toolbar 2011-12-01 01:33:13 +00:00
Trevor Parscal 9879b8abe7 Added undo and redo icons 2011-12-01 01:29:32 +00:00
Inez Korczynski 7bc84d8cf4 getIndexOfAnnotation is method of DocumentModel. not DocumentView 2011-12-01 01:10:38 +00:00
Trevor Parscal 0f123a6d2f Removed unneeded condition 2011-12-01 01:03:34 +00:00
Trevor Parscal 85526a7d46 Normalize selection before use! 2011-12-01 01:01:27 +00:00
Trevor Parscal f9ad5bed54 Pick up annotations from the character on the left of the cursor 2011-12-01 00:58:51 +00:00
Trevor Parscal f098a24c8a Moved things around - only doing insertion annotation loading when needed 2011-12-01 00:55:33 +00:00
Inez Korczynski 7815c98052 clearInsertionAnnotations and addInsertionAnnotations when appropriate 2011-12-01 00:53:58 +00:00
Inez Korczynski a5fdfffc3b Seperate ClearButtonTool from AnnotationButtonTool 2011-12-01 00:37:17 +00:00
Trevor Parscal bc13cf2588 Made buttons not change focus 2011-12-01 00:28:09 +00:00
Trevor Parscal 7c7583fcd6 Fixed invalid symbol 2011-12-01 00:24:57 +00:00
Trevor Parscal b3790de52d Filter out insertion annotations that aren't textStyle or link 2011-12-01 00:21:59 +00:00
Trevor Parscal 18681cb758 Added insertion annotation functionality 2011-12-01 00:16:50 +00:00
Trevor Parscal 0b061e9cc5 Changed example context menu items 2011-12-01 00:04:59 +00:00
Trevor Parscal ee282bf430 Added disabled class for clear button 2011-11-30 23:58:32 +00:00
Trevor Parscal b9bfad9988 Added disabled icon for clear 2011-11-30 23:56:46 +00:00
Trevor Parscal 049b82fb98 Moved images to es 2011-11-30 23:54:12 +00:00
Inez Korczynski dfc33b332c Refactoring of Toolbar tools 2011-11-30 23:51:06 +00:00
Trevor Parscal 12a20a5fe7 Limited select event emitting to when selection changes 2011-11-30 23:50:32 +00:00
Trevor Parscal a442fd4bb0 Split name and label functionality of toolbar config 2011-11-30 23:40:33 +00:00
Trevor Parscal 3a6220e922 Fixed selection update on resize 2011-11-30 23:36:44 +00:00
Trevor Parscal dc575227f6 Fixed a typo 2011-11-30 23:33:07 +00:00
Trevor Parscal 12531f59ad Fixed image links and switched to using inline block for toolbar 2011-11-30 23:29:54 +00:00
Trevor Parscal 319cc6a624 Moved toolbar view styles 2011-11-30 23:21:17 +00:00
Trevor Parscal 306ebb936a Made context icon update with selection updates 2011-11-30 23:19:56 +00:00
Trevor Parscal 10f4f0bd2c Removing unused styles 2011-11-30 23:18:09 +00:00
Inez Korczynski 55c24023f2 Refactoring of Toolbar tools 2011-11-30 23:05:06 +00:00
Inez Korczynski c157c26d90 Refactoring of Toolbar tools 2011-11-30 23:00:19 +00:00
Trevor Parscal f218b15ff1 Fixed floating issues with toolbar 2011-11-30 22:44:11 +00:00
Trevor Parscal e540c87d98 Added toolbar view to context menu (needs some work) 2011-11-30 22:35:06 +00:00
Trevor Parscal 0b72dcba33 Fixed context menu positioning 2011-11-30 22:30:35 +00:00
Trevor Parscal b18fffdcf0 Moved more styles around 2011-11-30 22:15:03 +00:00
Trevor Parscal d2d73166a8 Removed soft undo stuff 2011-11-30 22:06:19 +00:00
Trevor Parscal caf1bb0e0b Split context view styles out of surface styles 2011-11-30 20:45:24 +00:00
Trevor Parscal 9ab792704d Fixed image links 2011-11-30 20:42:59 +00:00
Trevor Parscal 57434fa734 Moved styles 2011-11-30 20:39:49 +00:00
Trevor Parscal 086b4f46ca Fixed context menu position when scrollTop is non-zero 2011-11-30 19:55:44 +00:00
Trevor Parscal edd7e6e76d Added support for RegExp when using the clear method in prepareContentAnnotation 2011-11-30 19:21:33 +00:00
Inez Korczynski cb38a7527b Added title attributes for ButtonTool and DropdownTool divs 2011-11-30 18:24:54 +00:00
Gabriel Wicke 82e31ffd42 Do not allow newlines in various attributes 2011-11-30 15:12:53 +00:00
Gabriel Wicke 821162484e Allow inlines in the term part of ; term : definition 2011-11-30 14:53:28 +00:00
Gabriel Wicke f758894de7 Let another test pass by swapping the default order of italic/bold for '''''.
Minor test output cosmetics.
2011-11-30 13:54:57 +00:00
Gabriel Wicke e0fca805a6 Expand tabs in grammar. 2011-11-30 13:42:26 +00:00
Gabriel Wicke 2bb512a4de A bit of tokenizer grammar clean-up and additional expected-html
normalization. 99 parser tests now passing.
2011-11-30 13:40:17 +00:00
Gabriel Wicke 127d8c8621 Simplify DOM paragraph wrapping postprocessor 2011-11-30 12:28:45 +00:00
Inez Korczynski 72ec73c063 Placeholder for FormattingDropDown and ClearButton in Toolbar 2011-11-30 08:07:22 +00:00
Inez Korczynski 4d3e38756f Make Bold and Italic toolbar buttons works (when clicked) 2011-11-30 07:42:10 +00:00
Inez Korczynski af39b6dc47 Make toolbar buttons Bold and Italic reflect state of current selection 2011-11-30 07:35:59 +00:00
Inez Korczynski 9aa9188798 Create separated classes for each toolbar tool (so far only bold and italic). Use CSS classes instead of img tags for toolbar buttons styling. 2011-11-30 07:10:15 +00:00
Trevor Parscal dee9a0df01 * Using DOM for more of the icon style
* Fixed double-selection rendering issue
2011-11-30 01:23:37 +00:00
Trevor Parscal cc04f0f830 More example tweaks 2011-11-30 00:51:11 +00:00
Trevor Parscal d926cc7165 Fixed some display issues 2011-11-30 00:48:46 +00:00
Trevor Parscal 68c5487c61 Added clear button to menu 2011-11-30 00:35:58 +00:00
Trevor Parscal 3b954819ea Moving images back to where they were 2011-11-30 00:25:17 +00:00
Trevor Parscal 69d986d2ec Added images to menu buttons 2011-11-30 00:19:27 +00:00
Trevor Parscal b3e669d988 Moved images 2011-11-30 00:15:43 +00:00
Trevor Parscal f49ae59e47 Renamed bullet icon 2011-11-30 00:13:07 +00:00
Trevor Parscal 149598e5bc Renamed bullet icon 2011-11-30 00:12:51 +00:00
Trevor Parscal 119700856d Added more example menus 2011-11-30 00:06:46 +00:00
Trevor Parscal 62be093c65 Added example menu items 2011-11-29 23:48:11 +00:00
Trevor Parscal 9d34341beb Added es.ContextView 2011-11-29 23:29:02 +00:00
Inez Korczynski 0c814b4d61 Fix revision r103997 2011-11-29 21:34:56 +00:00
Inez Korczynski ffdf68c50b Put $input (textarea) in the same place where cursor is (so it can follow its position nicely) 2011-11-29 21:32:41 +00:00
Trevor Parscal 165ef639bd Darkened the borders of the toolbar and editor panes 2011-11-29 21:11:30 +00:00
Gabriel Wicke f0edc5cb9a Fix a few more tests by allowing inline content inside links. 76 now passing. 2011-11-29 18:43:27 +00:00
Gabriel Wicke ae0b5f9af4 * Split paragraph handling between tokenizer and DOM postprocessor for better
html markup handling. 
* Remove global 'use strict' declarations from html5 parser. 
* Add trailing whitespace handling in dt

Overall, 55 parser tests are now passing.
2011-11-29 15:11:51 +00:00
Inez Korczynski fb9348dbb9 Use spacer element for floating toolbar instead of relaying on padding-top of next sibiling. 2011-11-29 01:13:50 +00:00
Inez Korczynski dc7e601ef0 Make toolbar float nicely in demo and in MediaWiki sandbox special page. 2011-11-29 00:58:40 +00:00
Trevor Parscal 2ecd479349 Moved some styles over to the demo 2011-11-29 00:09:37 +00:00
Trevor Parscal 3b18667821 Fix for empty content rendering issue 2011-11-29 00:00:02 +00:00
Inez Korczynski 77486cf8f2 Support select all (ctrl/metakey + a) on mac 2011-11-28 23:54:22 +00:00
Trevor Parscal 7c9140d4b4 Fixed margins so they look/work right on both demo and sandbox 2011-11-28 23:53:34 +00:00
Inez Korczynski c80b1d5fb0 Fix the problem with disappearing selection/ranges elements 2011-11-28 23:29:09 +00:00
Inez Korczynski 6a1bd05703 Support for select all (ctrl+a) 2011-11-28 22:47:07 +00:00
Trevor Parscal 9c98969fa9 Removed setting contentLength from data.length - adding nodes adjusts the contentLength automatically 2011-11-28 22:38:30 +00:00
Inez Korczynski 41a4b432db Cursor should always have height set dynamically within showCursor method so those two CSS propety are not relevant anymore. 2011-11-28 22:01:12 +00:00
Inez Korczynski 6e36c7c439 Put cursor directly in body element. This way it still can be positioned absolutly but without risk that some other element using position other than "static" (like #bodyContent) will change positioning context. 2011-11-28 21:58:46 +00:00
Trevor Parscal e4faa39ab3 Fixed z-index issue in special page 2011-11-28 20:57:01 +00:00
Trevor Parscal 111ce5ada3 Initial MediaWiki Integration 2011-11-28 20:28:28 +00:00
Gabriel Wicke b16c295b98 Consider dl as a block-level element. 2011-11-28 16:54:58 +00:00
Gabriel Wicke d3f0196df7 Add primitive HTML comparison to detect passing parser tests. The expected
HTML is parsed using a HTML parser and re-serialized, and the output compared
to the serialization of the new parser's dom. Newline normalization is a
cheap hack for now, need to improve that later.
2011-11-28 11:10:39 +00:00
Gabriel Wicke 6b8c109cf0 Separate block-level tags in tokenizer to delimit inlines and avoid wrapping
block-level in paragraphs.
2011-11-25 17:41:26 +00:00
Gabriel Wicke 859379a635 Improvements to nowiki/pre interaction. Will need to distinguish block-level
tags from inline HTML tags next.
2011-11-25 15:02:44 +00:00
Gabriel Wicke dd5cd59ac6 Better HTML, pre and blocklevel handling. Hackish source formatting for easier
comparison with parserTest results.
2011-11-25 12:47:03 +00:00
Gabriel Wicke 5b3a4497aa Add generic HTML tokenization and nowiki handling. 2011-11-25 10:59:43 +00:00
Roan Kattouw 5ac817a6f4 Fix bugs in prepareContentAnnotation() related to structural offsets, and add a test. Also add parenthesis to the if statement mixing || and &&, for clarity 2011-11-24 16:27:40 +00:00
Roan Kattouw 815029f6db Fix the prepareContentAnnotation test cases added in r104102 2011-11-24 16:13:19 +00:00
Roan Kattouw d98a7bd373 Refacor things to use getCommonAncestorPaths() 2011-11-24 15:55:54 +00:00
Roan Kattouw 6f3c407314 Introduce es.DocumentNode.getCommonAncestorPaths(), with tests 2011-11-24 15:34:12 +00:00
Gabriel Wicke 6c36ddcbce Follow-up to r104164: Clean-up comments, remove old italic/bold productions. 2011-11-24 14:20:56 +00:00
Gabriel Wicke dee262658f Add MediaWiki-compatible quote handling including quirks and overlapped
structures like ''[[Link|Link text'']]. This is another transform on the token
stream.
2011-11-24 13:56:30 +00:00
Roan Kattouw e91d7ddaaf Remove unused variable index in es.TransactionProcessor.insert() 2011-11-24 13:38:48 +00:00
Inez Korczynski ea29c15f32 Added formatting dropdown to toolbar - but it does not work yet. 2011-11-24 01:02:19 +00:00
Trevor Parscal 30ede21d46 No need to fallback to zero, delay must be non-zero for the setTimeout to be run 2011-11-24 00:01:11 +00:00
Trevor Parscal 1b633ede21 Took time-buffered actions out of a timeout if delay is undefined or 0 2011-11-23 23:57:54 +00:00
Trevor Parscal c1a3d4095f Got rid of optimize() - now performing consecutive-type operation merging on the fly 2011-11-23 23:54:36 +00:00
Trevor Parscal b8b3ed57e2 Added time-buffer to emitting updates 2011-11-23 23:42:41 +00:00
Trevor Parscal a7a771e06c Another major performance improvement for updated annotated retentions 2011-11-23 23:40:38 +00:00
Trevor Parscal ff5ba54115 Switched to a WAY faster method of updating annotated retained regions 2011-11-23 23:37:27 +00:00
Trevor Parscal dab042b52f Prevented classes from being removed and reset when they didn't actually change 2011-11-23 23:22:59 +00:00
Trevor Parscal 1fa9dfef3c Made class replacement catch spaces too, so we don't keep adding more and more spaces each time we update the class of a heading 2011-11-23 23:17:34 +00:00
Trevor Parscal 22c70e0154 * Added node updates for annotation+retain transactions
* Added time-buffered updates for selection/cursor
2011-11-23 22:21:46 +00:00
Trevor Parscal fc17703f01 Added combine arguments where needed 2011-11-23 22:00:01 +00:00
Inez Korczynski a4c71510d3 Early stage implementation of toolbar 2011-11-23 21:50:47 +00:00
Gabriel Wicke baf55875b9 Re-add modified wiki list handling to tokenizer. 2011-11-23 14:27:51 +00:00
Inez Korczynski 1cdd4ed0d3 Fix off by one bug in getRelativeContentOffset 2011-11-23 09:04:06 +00:00
Inez Korczynski 69b11c3399 Build VisualEditor toolbar dynamicly based on configuration. 2011-11-23 07:11:31 +00:00
Inez Korczynski 8c200c94aa Initial separation of toolbar code into ToolbarView 2011-11-23 01:19:11 +00:00
Trevor Parscal ed463eb075 Added soft undo/redo 2011-11-23 00:59:57 +00:00
Trevor Parscal 9beda20191 Routed selection through the SurfaceModel 2011-11-23 00:36:46 +00:00
Trevor Parscal 20da830a26 Rewrite of undo/redo - now completely implemented in es.SurfaceModel 2011-11-22 22:59:05 +00:00
Trevor Parscal df88d82181 Using the full word Difference instead of Diff 2011-11-22 22:57:23 +00:00
Trevor Parscal 6b19489742 Added new line at the end of the file 2011-11-22 22:56:49 +00:00
Inez Korczynski 1186949675 Fix bug in deletion: callback for traverseUpstream should get parent of current node, not of the node from which traversal started. 2011-11-22 20:11:23 +00:00
Inez Korczynski 2d8440132e Fix setInterval bug in IE (in IE setInterval doesn't take 3rd parameter) 2011-11-22 19:59:18 +00:00
Gabriel Wicke 694b998f24 Minor improvement to italic/bold, documentation on failed modularization of
static parser functions.
2011-11-22 16:51:05 +00:00
Inez Korczynski b60a82c50e Make toolbar float when scrolling the page 2011-11-22 07:17:08 +00:00
Inez Korczynski 0fef27aae7 Fix bug with selecting words 2011-11-22 02:23:39 +00:00
Trevor Parscal 56d05ce855 Reverted an issue in r103873 - fall through was intentional 2011-11-22 01:25:15 +00:00
Trevor Parscal 5bb01d20ef Backing out history integration for now 2011-11-22 00:26:50 +00:00
Trevor Parscal ee12891dbe Added support for meta key (mac command key) for undo/redo 2011-11-21 23:54:57 +00:00
Trevor Parscal 70147a166d Fixed breaks in a switch being inside ifs, causing them not to properly terminate the switch 2011-11-21 23:53:37 +00:00
Trevor Parscal 631323b9bd * Refactored es.HistoryModel to always be working from a single array rather than a buffer and an array
* Added support for associating a selection with a state
2011-11-21 23:51:37 +00:00
Inez Korczynski 68ea54fcf3 Bind ctrl+z to history undo and ctrl+y to history redo. 2011-11-21 23:25:43 +00:00
Inez Korczynski 392d911c3d States is an array of array of transaction, so one more iteration is needed. 2011-11-21 23:10:31 +00:00
Trevor Parscal e0f746d3d5 Installed HistoryModel into SurfaceView 2011-11-21 22:59:40 +00:00
Inez Korczynski db7b4dff64 Auto scroll to cursor is showCursor method 2011-11-21 22:55:48 +00:00
Trevor Parscal 6f8d229416 Cleaned up some issues with scoping, line ending, variable redeclaration, etc. 2011-11-21 22:43:56 +00:00
Trevor Parscal 779a63f486 * Switched to using JSON for hashing, allowing us to use the native JSON.stringify where available, which is much faster
* Added a bunch of utility functions for working with character data and annotations
* Got toolbar button states to follow selection of more than one character
2011-11-21 22:32:22 +00:00
Trevor Parscal 9590783f50 Added emitting selection on mouse move 2011-11-21 22:07:03 +00:00
Inez Korczynski f840fb7a1f Created generic function 'handleDelete' that is used for content deletion initiated with backspace or delete keys. 2011-11-21 21:50:14 +00:00
Gabriel Wicke d1b0293569 Fix comment token conversion and serialization 2011-11-21 09:22:30 +00:00
Inez Korczynski 61cfdb58fb Improve logic for moving cursor up and down - especially in case of initialBias - code has to be refactored. 2011-11-19 03:07:27 +00:00
Inez Korczynski 77ff26d61d Improve logic for moving cursor up and down - especially in case of initialBias - code has to be refactored. 2011-11-18 23:21:33 +00:00
Inez Korczynski ed299c01d9 Reset value of initialBias and initialLeft states after pressing backspace/delete/enter or typing text 2011-11-18 20:09:13 +00:00
Inez Korczynski bd92a3aaf8 Improve logic for moving cursor up and down - especially in case of initialBias. 2011-11-18 19:57:53 +00:00
Inez Korczynski bf1b9a881f Improve logic for moving cursor up and down - especially in case of initialBias. 2011-11-18 19:48:43 +00:00
Gabriel Wicke 65afd9b610 Improve internal link handling 2011-11-18 14:48:32 +00:00
Gabriel Wicke d744e65c48 Add missing token adapter. 2011-11-18 14:00:14 +00:00
Gabriel Wicke b750ce38b8 Add node.js-compatible HTML5 parser and hook it up to the PEG tokenizer.
Builds a DOM tree (jsdom) from the tokens and then serializes that using
document.innerHTML. This is all very experimental, so don't be surprised by
rough edges.
2011-11-18 13:57:07 +00:00
Roan Kattouw 35a99b4be0 Make es.TransactionProcessor.remove() handle deep merges correctly, and add test cases. The code is still a bit rough and ugly and needs a bit more work, but I'll clean that up later; at least it works now. 2011-11-18 10:17:35 +00:00
Inez Korczynski 2d4c253f5e Place cursor in correct place after deleting selected content. 2011-11-18 08:10:56 +00:00
Inez Korczynski 535139919b Support for "backspace" and "delete" when content is selected - also better support for typing when entire node is selected. 2011-11-18 07:52:28 +00:00
Inez Korczynski 85cf0c27e2 Implementation of static function es.DocumentViewNode.getSplitableNode 2011-11-18 06:49:00 +00:00
Inez Korczynski 9bfee0642c Temporary handle listitems merging/spliting logic in SurfaceView until it will be fixed in transaction preparation (prepareRemoval) 2011-11-18 06:45:11 +00:00
Inez Korczynski 9df503e788 Proper handling for "delete" & "backspace" keys 2011-11-18 06:43:42 +00:00
Inez Korczynski d02ed50211 Proper handling for "enter" key 2011-11-18 06:17:14 +00:00
Inez Korczynski 307ab3506b Start from removing selected content if there is any when typing 2011-11-18 05:51:50 +00:00
Inez Korczynski d0d8e35f34 Code cleanup in SurfaceView - no any major changes 2011-11-18 05:44:24 +00:00
Inez Korczynski 44d42babe6 Comment out line that is throwing "Object has no method" when trying to assign output of method to "index" variable, which is not used later anyway. 2011-11-18 05:35:08 +00:00
Inez Korczynski 383e4e324a Added static function es.DocumentNode.traverseUpstream 2011-11-18 05:18:48 +00:00
Trevor Parscal 098c9118f2 Added first node preservation when rebuilding 2011-11-18 00:26:54 +00:00
Trevor Parscal a9d29af962 Using overwrite instead of build and swap method for line data in es.ContentView objects - this way line data is valid between renders 2011-11-17 23:43:53 +00:00
Trevor Parscal 48e7f4c3c6 Initial checkin of new es.HistoryModel (needs tests) 2011-11-17 22:44:11 +00:00
Trevor Parscal 6fded56cec Renamed es.Transaction to es.TransactionModel 2011-11-17 22:42:18 +00:00
Roan Kattouw 117c785d85 Improve the merging logic in prepareRemoval() to also allow merging nested nodes, e.g. by deleting </p></li><li><p> 2011-11-17 19:23:15 +00:00
Trevor Parscal 2497e96ccc Added documentation to getScope and made it a little less confusing to read 2011-11-17 19:19:02 +00:00
Trevor Parscal c3521b00fd Fixed the last of the rendering to much bugs - now things are rendered when needed only 2011-11-17 19:05:06 +00:00
Trevor Parscal a0d7c14238 Fixed passing global offset to emit event, preventing render from re-rendering because it thought the render-from point was well past it's length 2011-11-17 18:54:52 +00:00
Trevor Parscal 284082b5d3 Simplified documentation 2011-11-17 18:26:00 +00:00
Trevor Parscal 5784d5f6f5 Added some new documentation for the new merging rules 2011-11-17 18:23:53 +00:00
Trevor Parscal 824cea173a Fix for r103479 - had sign backwards! :( 2011-11-17 18:16:02 +00:00
Trevor Parscal b93a69c1bc Addressing another issue in r103447 - minor adjustment to loop 2011-11-17 18:14:14 +00:00
Trevor Parscal e30c2f8135 Addressed some issues identified in review of r103447 - this could be cleaner, but it's trying to be optimized so the UI doesn't flicker during a remove/insert (such as splitting a block) 2011-11-17 18:11:48 +00:00
Trevor Parscal 38d6673e09 Fix for issue identified in review of r103377 - this will make it so insertion at a structural offset will work even if the parent isn't the document 2011-11-17 18:05:14 +00:00
Roan Kattouw f8fd9fd840 Add an extra offset parameter to selectNodes() and use it in the recursion, so the results of recursive calls don't need to have their globalRanges translated 2011-11-17 18:00:16 +00:00
Trevor Parscal 43de57840e Commented out some console.log statements 2011-11-17 17:59:15 +00:00
Roan Kattouw 41ace08026 Replace prepareRemoval() with a fixed-up version of my rewrite (which was commented out previously) 2011-11-17 16:44:44 +00:00
Gabriel Wicke 11e487d8c0 Flatten inline token lists before merging text into text tokens. 2011-11-17 15:43:31 +00:00
Gabriel Wicke ea87e7aaee Convert PEG parser to tokenizer for back-end HTML parser. Now emits a list of
tokens, which for now is still completely built before parsing can proceed.
For each top-level block, the source start/end positions are added as
attributes to the top-most tokens. No tracking of wiki vs. html syntax yet.
2011-11-17 15:26:02 +00:00
Roan Kattouw be994da373 Make selectNodes() also descend (recurse) into child nodes when only the start or only the end is in the middle of a child node. Without this, it was stuff like ranges with only openings and no closings. 2011-11-17 15:01:47 +00:00
Roan Kattouw 2c21250c70 Make selectNodes() not return an empty array when encountering a zero-length selection in a structural location (we don't do this for zero-length selections in content locations either, and the empty array is breaking an assumption I was making in my prepareRemoval rewrite) 2011-11-17 14:50:38 +00:00
Roan Kattouw 61082fa3c1 Whitespace fix 2011-11-17 14:43:11 +00:00
Trevor Parscal 566ff61283 Reduced (dramatically) the number of re-renders on insert (but there's still more duplication being done atm, especially on load) 2011-11-17 08:03:14 +00:00
Inez Korczynski 8f459b5f01 Improve handling for enter, backspace, delete 2011-11-17 00:28:40 +00:00
Trevor Parscal a55f52c2c7 Made it so <p>|</p> is not considered to be a structural offset 2011-11-16 23:57:12 +00:00
Inez Korczynski 17cad00776 Added support for enter key in elements with attributes - like headings, listitems. 2011-11-16 23:34:58 +00:00
Trevor Parscal b89d7d7eeb Removed some accidental globals 2011-11-16 23:32:57 +00:00
Inez Korczynski 62e399ef2e Added splitRules for DocumentView 2011-11-16 23:19:29 +00:00
Inez Korczynski a5a09d42d8 Minor fix. 2011-11-16 23:18:22 +00:00
Inez Korczynski 243189a009 Basic support for enter key in heading and paragraphs 2011-11-16 23:16:02 +00:00
Inez Korczynski 3bf8a244f1 Added basic support for deleting selection with delete key. 2011-11-16 22:01:41 +00:00
Inez Korczynski fe3ef45f56 Improved support for combination of ctrl/alt/metakey + up/down/left/right - especially for mac vs. windows. 2011-11-16 21:59:22 +00:00
Inez Korczynski 13775c5116 Added basic support for deleting selection with backspace. 2011-11-16 21:25:48 +00:00
Trevor Parscal 5f4a2b2141 * Added support for inserting content at a structural offset
* Broke rebuildNodes into 2 parts so insert can use just buildNodes when inserting whole nodes
* Added getIndexFromOffset to es.DocumentModelBranchNode objects, which returns an index of a child node from an offset
2011-11-16 20:39:48 +00:00
Trevor Parscal 5b12384431 Fixed issue in processing removal transactions - globalRange is now defined always, so we need to check for range instead 2011-11-16 20:01:12 +00:00
Inez Korczynski a43288be29 Support for moving cursor up and down by "unit" distance when control key pressed down. 2011-11-16 19:51:02 +00:00
Roan Kattouw 5de3778803 Drop droppable (oh, how meta!) attribute introduced in r103211. Will convert prepareRemoval() later 2011-11-16 19:28:13 +00:00
Roan Kattouw 17df2a174a Fix breakage in prepareRemoval() from r103271 and demonstrated by the tests in r103356. Also add, in a comment, a somewhat functional rewrite of prepareRemoval() to be used after we drop droppability 2011-11-16 19:17:58 +00:00
Roan Kattouw 27ddd1263f In selectNodes(), also set globalRange for fully-covered nodes. There is no sane value for range in this case, but there sure is a sane value for globalRange so we might as well return it. I also use this in my prepareRemoval() fixes in my next commit 2011-11-16 19:02:23 +00:00
Trevor Parscal 3ac24949ce Fixed incorrect registration object being used 2011-11-16 18:54:05 +00:00
Trevor Parscal e559922da0 Fixed incorrect symbolic name being used for nodeRules registration on tableCell and tableRow model nodes. Roan noticed this in r103211 2011-11-16 18:17:24 +00:00
Roan Kattouw 9060cd6161 Fix stupid mistake that broke traverseLeafNodes() in IE 2011-11-16 12:51:31 +00:00
Inez Korczynski ace69887ee Fix typo: "annotation" => "annotations" 2011-11-16 06:13:17 +00:00
Trevor Parscal 3ec0976f5d Made leaf nodes listen for updates from their content views and emit updates themselves in response. 2011-11-16 00:24:46 +00:00
Trevor Parscal 8a2e8b4aab Rewrote prepareRemoval to support dropping nodes that are considered droppable (not tableCells) and are covered completely by the range - otherwise nodes are stripped of content 2011-11-16 00:03:17 +00:00
Trevor Parscal a7cdee541c Fixed typo - insert/remove operations have a data property, not a content property. 2011-11-16 00:02:27 +00:00
Trevor Parscal cc8e1d02fc Changed nodes to selectedNodes for clarity 2011-11-16 00:01:35 +00:00
Trevor Parscal 455afe25be Added a "droppable" bit to each model so that prepareRemoval can avoid dropping table cells (for instance) when removing nodes that are completely covered (which it can't do yet) 2011-11-15 19:01:47 +00:00
Trevor Parscal 4f1f6699ee Tweaks to make jshint happy 2011-11-15 18:42:34 +00:00
Trevor Parscal 79ef19da42 Fixed documentation and use of es.arrayIndexOf to match the actual API of $.inArray (value, array, fromIndex). Renamed function to inArray to reduce confusion about how the function works. 2011-11-15 18:17:26 +00:00
Trevor Parscal a4e3b3922d Using jQuery.inArray implementation of indexOf instead of our own
Fixed a wrong class name bug
2011-11-15 17:54:52 +00:00
Roan Kattouw 5d619ac6cf Fixed the last array indexOf call that I could find 2011-11-15 16:27:14 +00:00
Roan Kattouw eff198ff1d Move .indexOf() from es.DocumentModelBranchNode to es.DocumentBranchNode and use it in .traverseLeafNodes() 2011-11-15 16:24:33 +00:00
Roan Kattouw c484afe87a Fix IE-specific test breakages. Two tests were broken because Array.prototype.indexOf() was used, another one because Array.prototype.splice() is broken in IE:
>>[1,2,3].slice(0).length
3
>>[1,2,3].slice(0, undefined).length
0
2011-11-15 16:21:45 +00:00
Roan Kattouw ec8e92029a Followup r103161: make reverse work 2011-11-15 13:23:04 +00:00
Roan Kattouw f7ef40fb7a Rewrite traverseLeafNodes() with an iterative traversal, and add support for from. Support for reverse is not implemented yet. 2011-11-15 12:55:31 +00:00
Roan Kattouw 7d8741e6e3 Add a wrapper for Array.prototype.indexOf(), needed for my traverseLeafNodes() rewrite 2011-11-15 12:54:18 +00:00
Roan Kattouw fee2d48b2b Add very basic implementation of traverseNodes(), with tests. This doesn't respect the from parameter (so tests 3-6 fail); I will rewrite it from recursive to iterative so it can support that. 2011-11-15 11:12:06 +00:00
Roan Kattouw 32c04b3e41 Add es.compareArrays(), needed for test cases I'm about to add 2011-11-15 11:10:21 +00:00
Trevor Parscal a7c1524fe0 Added empty method to es.DocumentBranchNode called traverseLeafNodes 2011-11-15 01:31:46 +00:00
Inez Korczynski 098f2ae616 Refactor moveCursor code 2011-11-15 01:30:39 +00:00
Trevor Parscal ff07930171 Added test for prepareRemoval which fails atm, because strip doesn't drop nodes that are covered completely. Also cleaned up some comments in prepareRemoval 2011-11-15 01:15:21 +00:00
Trevor Parscal 0e1d3c08fd Added split rules to view classes 2011-11-14 23:59:36 +00:00
Trevor Parscal 8a884ee3b8 Fixed emitting updates when deleting content from the inside of a node 2011-11-14 23:47:07 +00:00
Trevor Parscal 2494c40297 Moved transaction processing code to new class, es.TransactionProcessor 2011-11-14 23:04:36 +00:00
Trevor Parscal 96a8598ec5 Added scope function to transaction processing so inserting </p></li><li><p> works
Fixed off-by-one in splicing dom nodes into view branches
2011-11-14 21:54:53 +00:00
Trevor Parscal dcbc801f0f Don't render deleted nodes 2011-11-14 20:04:46 +00:00
Trevor Parscal e93d050d6f Only re-render nodes that were inserted 2011-11-14 20:00:40 +00:00
Trevor Parscal 5b1298a6ca Removed alert() - dude, use console.log, and don't leave it in the SVN plz! :P 2011-11-14 19:52:05 +00:00
Inez Korczynski 1359c19cbb Add comments for mouse interaction states 2011-11-14 19:51:04 +00:00
Trevor Parscal 773d97cb1d Using splice.apply because it's faster and actually works (the loop was incorrect anyways) 2011-11-14 19:51:00 +00:00
Trevor Parscal 71c3f7d1a7 Fixed documentation for inheritance 2011-11-14 19:50:28 +00:00
Trevor Parscal 872d2bdb9d Fixed onAfterSplice in es.DocumentViewBranchNode to update the DOM correctly
Fixed issue where events were being listened to from this instead of this.model
Added rendering calls after structural changes
2011-11-14 19:50:04 +00:00
Trevor Parscal 521a0644ff Added extra condition to prevent undefined object errors 2011-11-14 19:48:25 +00:00
Trevor Parscal fabaff5fc1 Fixed order of operations and added missing attach operation to splicing nodes in a model branch 2011-11-14 19:47:44 +00:00
Inez Korczynski 5acd21638a Support for moving cursor with control or alt pressed down 2011-11-11 03:06:47 +00:00
Inez Korczynski c03e5fbc49 Minor fix 2011-11-11 00:28:25 +00:00
Inez Korczynski 807d9530ac Added support for word selection when shift + ( ctrl || alt ) pressed 2011-11-11 00:26:30 +00:00
Inez Korczynski 8b3880d524 Improvements to selecting with mouse (double, triple clicks) 2011-11-10 23:30:29 +00:00
Inez Korczynski 662907a5df Make getWordBoundaries returns null if given offset refers to element data. Also if given offset is beginning of the word then search for not beginning of the word offsets around (and other way round). 2011-11-10 21:43:28 +00:00
Trevor Parscal 713a80596d Added es.DocumentLeafNode, which like es.DocumentBranchNode is a mixin-like class (we may want to switch to using a more natural composition mechanism than es.extendClass in the future) - now es.DocumentNode also has an abstract method called hasChildren which returns a boolean and can indicate if a node is a leaf or a branch. 2011-11-10 19:26:02 +00:00
Roan Kattouw a4f71ace69 Rewrite the remove() function in es.DocumentModel.operations such that the tests added in r102564 pass now 2011-11-10 15:50:59 +00:00
Roan Kattouw f3eab4dec2 Fix JS error when getElementType() is called on a document node 2011-11-10 15:13:57 +00:00
Roan Kattouw 94b30ed0cc Fix doc comment 2011-11-10 14:00:46 +00:00
Roan Kattouw 14b56c1202 Fix selectNodes(), can't recurse into leaf nodes because they aren't DocumentBranchNodes and don't have the selectNodes function. The pattern of certain functions just not existing for leaf nodes is starting to annoy me, I'll discuss this with Trevor. 2011-11-10 13:51:01 +00:00
Roan Kattouw aa7a6e2605 Add globalRange property to the output of selectNodes(), which translates the range property to be relative to the root rather than to the node. Update tests for this, and fix the test case numbering for selectNodes 2011-11-10 13:15:55 +00:00
Alexandre Emsenhuber fa172d1592 svn:eol-style native 2011-11-10 11:51:42 +00:00
Trevor Parscal a8b80bc1fd Added very basic support for highlighting formatting tools when the cursor is over content which is formatted that way 2011-11-10 01:28:01 +00:00
Inez Korczynski 8daf92ee48 Support for word selection with keyboard 2011-11-10 01:23:21 +00:00
Inez Korczynski 4b34eaad0e Support for selecting words and nodes with mouse 2011-11-10 01:13:56 +00:00
Trevor Parscal 92443d5f9d Improved optimization, was previously limited to merging sets of 2 2011-11-09 23:39:11 +00:00
Trevor Parscal 6c745687fc Fixed prepareRemove to work again after getNodeFromOffset was changed. 2011-11-09 23:38:36 +00:00
Inez Korczynski 915104d6f2 Another way of supporting double and triple clicks in VisualEditor 2011-11-09 23:36:56 +00:00
Inez Korczynski 7fcdcb41df Added support for double click (to select word) and triple click (to select entire node) in VisualEditor 2011-11-09 22:01:42 +00:00
Roan Kattouw 69d2fe7dfe Fix selectNodes() behavior for structural offsets (i.e. offsets between two openings/closings). There are no test cases for this yet but I'll write some after Trevor finishes his massive test data change 2011-11-09 21:15:01 +00:00
Gabriel Wicke ef3c84bd2e Extract text from inline elements for better testing. Slightly improved
handling of comment-only lines. Change pre to leaf content model.
2011-11-08 16:08:05 +00:00
Inez Korczynski 18b97268fc Fix standard problem when writing backward loops 2011-11-08 01:00:31 +00:00
Inez Korczynski a0acc98bcb Fix for offset being passed within update event. It has to be local - as ContentView operates on local offsets for line ranges. 2011-11-08 00:59:55 +00:00
Inez Korczynski d3b7188e7e Delete all our own undo/redo support. It was just experiment / proof of concept - that confirmed transactions works well and we will get back to it later. 2011-11-08 00:15:54 +00:00
Inez Korczynski 2fb840236c Basic support for "pre" elements (space at the beginning of the new paragraph in wikitext) 2011-11-07 23:46:30 +00:00
Gabriel Wicke 18ead89b37 Improved paragraph, br, comment parsing and switched headings to
generic inlineline with syntactic flags.
2011-11-07 23:09:30 +00:00
Inez Korczynski 4c8746d661 Add CSS class 'es-viewBranchNode-firstChild' to all first childs of ViewBranchNode 2011-11-07 22:38:01 +00:00
Inez Korczynski e0111da8d5 Special CSS styling for paragraphs in lists 2011-11-07 22:33:40 +00:00
Inez Korczynski bcaa5c2945 Add CSS class 'es-ViewBranchNode-firstChild' to all first childs of ViewBranchNode 2011-11-07 22:29:28 +00:00
Inez Korczynski 6f5719e736 This is supposed to be a event name, not a variable 2011-11-07 21:34:29 +00:00
Inez Korczynski d01cdd859d ListItem now is a branch instead of being leaf. So it contains children - usually it would be just Paragraph, but in some cases Table as well (as Wikitext allows to have HTML table in list item) 2011-11-07 21:30:13 +00:00
Trevor Parscal 02694c630d Removed unused function 2011-11-07 21:16:32 +00:00
Gabriel Wicke 944d010eb2 Indentation cleanup in PEG parser and Html serializer 2011-11-07 21:05:37 +00:00
Gabriel Wicke aa31a5ebce Same rename for the Wikitext serializer, before I forget. 2011-11-07 20:38:47 +00:00
Gabriel Wicke c3a0c56e56 rename definition{term,description} to just {term,description} 2011-11-07 20:36:34 +00:00
Gabriel Wicke 4fcc6c9a09 Fix jshint warnings. 2011-11-07 20:31:30 +00:00
Trevor Parscal c4719565ea Defining a function inside another can be done using normal function syntax, var is not needed. 2011-11-07 19:57:41 +00:00
Inez Korczynski 88e964263b This is supposed to be a event name, not a variable 2011-11-07 19:44:56 +00:00
Trevor Parscal 187eca34eb Added render from offset support 2011-11-07 19:42:36 +00:00
Trevor Parscal ab44388220 Changed from emphasis to emphasize 2011-11-07 19:28:47 +00:00
Gabriel Wicke 71891131c3 Grammar improvements
* replaced regexp stack with a set of break rules for inline content within
  specialized parse contexts, switched more rules to generic
  inlineline/inline/block rules.
* don't consume end-of-line for proper start-of-line matching
* added some pre support
* still no conversion of inline elements to annotations
2011-11-07 14:39:12 +00:00
Inez Korczynski 7b303e178b Very simple support for undo/redo (with keyboard only: ctrl+z/ctrl+y) 2011-11-05 02:06:51 +00:00
Inez Korczynski e1b0126b03 Minor 2011-11-05 01:06:59 +00:00
Inez Korczynski cc6fc80bee Support for deleting text with backspace and delete 2011-11-05 00:59:20 +00:00
Inez Korczynski b4b043e06e Very basic support for content (typing on keyboard) insertion 2011-11-05 00:49:48 +00:00
Inez Korczynski 97649e62ee Minor fix 2011-11-05 00:20:22 +00:00
Inez Korczynski 2d7f927b4e Small fix for cursor up (in first line) and down (in last line) 2011-11-04 23:49:50 +00:00
Inez Korczynski 39ecdbcd00 Minor fix 2011-11-04 23:32:46 +00:00
Inez Korczynski 70e6b72ba3 Cleanup for moveCursor and showCursor code 2011-11-04 23:28:40 +00:00
Trevor Parscal 40c71ede72 Added support for definition and term list items 2011-11-04 23:09:10 +00:00
Trevor Parscal b2fcdf952a Fixed some jshint issues 2011-11-04 22:04:51 +00:00
Inez Korczynski 22892f2ab0 Fix cursor and selection 2011-11-04 21:40:17 +00:00
Trevor Parscal 23e0651e0b Added documentation for es.Transaction 2011-11-04 21:06:06 +00:00
Trevor Parscal add7c23191 Added es.Transaction.optimize and added in a test that neilk sent a patch for 2011-11-04 20:38:47 +00:00
Roan Kattouw 124a36b942 Add a metric ton of (mostly generated) selectNodes tests, and change selectNodes a little bit to make them pass 2011-11-04 20:27:23 +00:00
Trevor Parscal 1f1db3fc43 Line-break and variable redeclaration cleanup 2011-11-04 20:26:08 +00:00
Roan Kattouw 0801ec93a5 Change something that appeared to be a bug in the removal code 2011-11-04 20:17:42 +00:00
Inez Korczynski f9b0cfae9a Basic support for cursor up and down (with and without selectiong/shift key down) 2011-11-04 18:50:39 +00:00
Trevor Parscal b13b805f2b Comment cleanup 2011-11-04 18:37:07 +00:00
Trevor Parscal 44ea20c406 Using getElementType instead of relying on .type property of es.DocumentModeNode objects 2011-11-04 18:33:06 +00:00
Inez Korczynski 7d87500f4a Fix cursor and selection 2011-11-04 17:46:30 +00:00
Trevor Parscal fcb3644f35 Reorganized a few methods to reduce duplication, improved documentation 2011-11-04 17:07:44 +00:00
Trevor Parscal fbacdfc98a Reorganized a few methods to reduce duplication, improved documentation 2011-11-04 17:07:34 +00:00
Trevor Parscal ff0ac9754c Removed unused file 2011-11-04 16:41:34 +00:00
Gabriel Wicke 06ca9f12fe Rename definitiondata to definitiondescription, minor fixes 2011-11-04 12:25:01 +00:00
Gabriel Wicke 7e5c196732 Some more progress for tables and definition lists 2011-11-04 12:06:49 +00:00
Gabriel Wicke 83a80bad49 Fixes for definition lists 2011-11-04 11:08:11 +00:00
Gabriel Wicke 85def70a8a Add basic list serialization to HtmlSerializer
* Added 'definitionterm' and 'definitiondata' styles to support definition
  lists, and special-case handling in the serializer to wrap both in dls.
2011-11-04 10:02:59 +00:00
Gabriel Wicke 63398b5749 Update parserTests to latest serializers 2011-11-04 07:45:05 +00:00
Inez Korczynski c30698b7ae Minor changes 2011-11-04 00:21:29 +00:00
Trevor Parscal fd7b7e7223 Cleaned up some comments 2011-11-03 23:42:34 +00:00
Trevor Parscal 2d97794312 Added more key codes for the Apple command key to catch firefox and right command on webkit 2011-11-03 23:32:58 +00:00
Trevor Parscal b636d9a52b Refactored some of the tree sync code to be reusable 2011-11-03 23:19:36 +00:00
Inez Korczynski 0c34c71fe6 Minot optimization 2011-11-03 22:51:30 +00:00
Inez Korczynski 2b6c8dacac Fix minor bug 2011-11-03 22:49:14 +00:00
Inez Korczynski d48b30227e Fix minor bug 2011-11-03 22:46:44 +00:00
Inez Korczynski 05ba0a0782 Improved version of keyboard & mouse selection 2011-11-03 22:42:20 +00:00
Trevor Parscal f327ebf39f Line breaks 2011-11-03 22:03:28 +00:00
Trevor Parscal 8058b454a5 Fixed some documentation 2011-11-03 21:52:06 +00:00
Trevor Parscal 764f2b0e65 Reorganized model nodes into branches and leafs 2011-11-03 21:48:40 +00:00
Inez Korczynski 5f533f0a1d Implementation of selecting elements with mouse and fix for drawSelection method in DocumentViewBranchNode (it was off by one) 2011-11-03 20:27:57 +00:00
Trevor Parscal 91f0cd2d6b Renamed expandContentData to getExpandedContentData 2011-11-03 20:01:39 +00:00
Trevor Parscal 7e825a15fb Fixed lots of bugs in the serializers, Wikitext and HTML look good 2011-11-03 19:39:12 +00:00
Trevor Parscal cf5be16248 Cleaned up some unused files, added type to es.DocumentModelNode objects for serialization purposes, and added getPlainObject to es.DocumentModelNode which also uses the newly migrated es.DocumentModel.expandContentData 2011-11-03 19:01:55 +00:00
Trevor Parscal f525e88058 Fixed some typos from copy-paste errors 2011-11-03 18:25:04 +00:00
Trevor Parscal d3e5a6c557 Refactored and updated serializers to use latest version of WikiDom. Also updated tests to use range objects for annotations. Switched to using namespacing for annotations, now there's textStyle/*, link/* and object/* spaces where all types are in. 2011-11-03 18:15:24 +00:00
Trevor Parscal 6f53a48e87 Using content.range.* instead of content.* for start and end properties of content objects when converting from plain objects into flat data 2011-11-03 16:33:10 +00:00
Gabriel Wicke a8838dab18 Start by handling paragraphs, at least a bit. 2011-11-03 15:16:05 +00:00
Gabriel Wicke 0d30a5528e First combination of WikiDom serializers with existing parser in
tests/parser/parserTests.js.

* Removed var from es in es.js to allow node.js to access it as global. Only
  alternative solution appears to be a node-specific 'exports' construct:
  http://nodejs.org/docs/v0.3.1/api/modules.html
* Added es.Document.js and es.Document.Serializer.js in es/bases. Not sure if
  this is the desired location.
* Changed es.extend to es.extendClass in the serializers
* Modified the first parser test to include the WikiDom modules and call the
  new HTML serializer
2011-11-03 13:55:48 +00:00
Trevor Parscal 19408d8ab2 Added joinWith parameter to es.JsonSerializer 2011-11-02 23:34:05 +00:00
Trevor Parscal d307212dda Moved repeatString to es and removed es.Document.Serializer, since the rest of it's functionality are already in es.Html 2011-11-02 23:26:43 +00:00
Trevor Parscal 836d07da9b Moving es.Html back to es/ directory 2011-11-02 23:11:57 +00:00
Trevor Parscal bec50ddd94 Moving es.Html back to es/ directory 2011-11-02 23:11:36 +00:00
Trevor Parscal 063868d376 Removed using custom elements for heading views, just using divs now - if we have to switch the level we don't want to have to trash the whole thing and rebuild it 2011-11-02 23:01:35 +00:00
Inez Korczynski 6763fe1542 Minor comments cleanup 2011-11-02 22:55:02 +00:00
Inez Korczynski 4a1167117b Make drawSelection in ContentView works without parameter range being passed and the same for DocumentNode. Define getElementLength and getContentLength as methods in DocumentViewNode. 2011-11-02 22:53:14 +00:00
Trevor Parscal e9488b637a Made regex less specific, so it catches levels that are not officially supported, but also shouldn't get stuck in the dom if for some reason they get added at some point. 2011-11-02 22:47:16 +00:00
Trevor Parscal d35fe7a407 Made regex less specific, so it catches levels that are not officially supported, but also shouldn't get stuck in the dom if for some reason they get added at some point. 2011-11-02 22:46:35 +00:00
Trevor Parscal c70a23fc8d Fixed incorrect class name 2011-11-02 22:42:30 +00:00
Trevor Parscal 2beef6040d Fixed shadowed variable 2011-11-02 22:28:05 +00:00
Trevor Parscal 461e9fced7 Moving serializer code into it's own folder 2011-11-02 22:24:36 +00:00
Trevor Parscal 393a65f186 Moving more serializer code over to VisualEditor 2011-11-02 22:23:00 +00:00
Trevor Parscal 996088f03e Moving more serializer code over to VisualEditor 2011-11-02 22:22:54 +00:00
Trevor Parscal 0afde82d5f Moving more serializer code over to VisualEditor 2011-11-02 22:22:47 +00:00
Trevor Parscal 46e566f70d Moving more serializer code over to VisualEditor 2011-11-02 22:22:40 +00:00
Trevor Parscal 5d5a023ee7 Copying serializer code to VisualEditor extension 2011-11-02 22:00:38 +00:00
Trevor Parscal fec2b6d6a9 Copying serializer code to VisualEditor extension 2011-11-02 22:00:31 +00:00
Trevor Parscal 33bbcd9c98 Copying serializer code to VisualEditor extension 2011-11-02 22:00:25 +00:00
Inez Korczynski 10703f697b Get rid of 'debugger' 2011-11-02 21:47:20 +00:00
Trevor Parscal 5bae153214 Moving parser stuff back into the modules folder (oops) 2011-11-02 21:45:57 +00:00
Trevor Parscal 2b499d5990 Reorganized modules by javascript namespace 2011-11-02 21:31:45 +00:00
Trevor Parscal 0061fa9a62 Copying jquery and qunit to VisualEditor extension 2011-11-02 21:29:53 +00:00
Trevor Parscal 6a23492d4f Copying jquery and qunit to VisualEditor extension 2011-11-02 21:29:47 +00:00
Trevor Parscal a795ad5e76 Copying jquery and qunit to VisualEditor extension 2011-11-02 21:29:39 +00:00
Brion Vibber 213ee7d4a8 followup r101685: the peg definition 2011-11-02 21:09:19 +00:00
Brion Vibber 56a75ccca7 Copy several of the experimental JS parser bits from ParserPlayground to VisualEditor. They'll need retooling to hook up with the wikidom stuff. 2011-11-02 21:07:51 +00:00
Brion Vibber d3abcde2b0 Copy wikidom lib/hype into VisualEditor/modules 2011-11-02 21:00:55 +00:00
jenkins-bot 2b352c577c Merge "(bug 45029) Transactions for metadata modification." 2013-02-15 01:28:44 +00:00
Ed Sanders 67e9d5d1dd (bug 45029) Transactions for metadata modification.
Have created builders for insertion, removal, and single element replacement.

In adding Document.getMetadata which is nearly identical to Document.getData,
the two functions have been refactored to use a common static method
getDataSlice, with this.data/this.metadata as an argument.

Document.spliceMetadata has been added. It is essentially spliceData with
the data/metadata synchronisation issue.

Metadata cursor position is now tracked in the TransactionProcessor. Cursor
advancement has been moved to a function so the metadata cursor can be reset
every time the data cursor is moved.

There were unhit bugs in the TransactionProcessor run test section, where
the data being loaded into the test documents wasn't always being deep-copied,
and the assert was looking at getData instead of getFulldata (which wouldn't
be able to test metadata changes).

Change-Id: Ieb20ab3e7827bc7ff04148f147da6728eb1eb666
2013-02-14 17:27:27 -08:00
jenkins-bot 92e5f94e41 Merge "Add user interface widgets" 2013-02-14 19:04:59 +00:00
jenkins-bot a1bd1db241 Merge "Use .static.isMeta to communicate meta-ness" 2013-02-14 18:47:48 +00:00
Trevor Parscal d0ff691f9e Add user interface widgets
* New! Button and InputLabel widgets
* Using new buttons in the demo
* Moved styles around to generalize input styles

Change-Id: Ic42e133f8fe0fffcb61374c09dd5668db82a4799
TODO: Use these buttons other places! (like ve.init)
2013-02-13 18:04:04 -08:00
jenkins-bot 385606d6fe Merge "Added new icons" 2013-02-14 00:09:53 +00:00
Trevor Parscal d42a52bb59 Added new icons
Icons needed for upcoming generated content editor.

* Parameter (big and small)
* Parameter Set
* Source (big and small)
* Template (big and small)

Change-Id: I9c5df7970e3f0991ac6a66590212f40d83af9c0a
2013-02-13 16:06:29 -08:00
Inez Korczyński f0bc9935d2 (bug 41199) Fix the problem with placing cursor by clicking next to article content.
The specific use case is when user clicks on the left side of the inline alien node which
is at the beginning of the line or on the right side of the inline alien node at the end of
the line. This fix does not cover Monobook.

Change-Id: Ib24b03e30e753850698ed6b10be49b4f2642c92b
2013-02-13 15:36:45 -08:00
jenkins-bot 6b51b0f635 Merge "Annotate newly inserted target text as a link." 2013-02-11 20:00:26 +00:00
jenkins-bot 8d274c19e6 Merge "Implement inline documentation examples." 2013-02-09 01:50:44 +00:00
Timo Tijhof 62aeb254d9 Implement inline documentation examples.
Refactored the (previously unused) eg-iframe file to be a
template with 2 placeholders for script and styles.

The previous version was just the basic version to execute
javascript code, but that's not good enough since we need a
whole bunch of classes to be loaded.

A bash file processes the template into proper html, with the
help of the makeStaticLoader maintenance script we already had.

Updated demo.css, cleaned up redundant properties restyled
slightly to be more like the Vector skin and less "raw".

Fixed default $IP path in makeStaticLoader.php to work with simple mediawiki core installs having the extension in the
regular extensions directory, and prefixed __DIR__ so it
doesn't rely on the directory you call it from.

Change-Id: Ic789121dfeca08d9db69564d2ad2e52b3fa45de9
2013-02-08 17:47:10 -08:00
jenkins-bot 5ee7b12119 Merge "ve.dm.DocumentSlice does not extend ve.Node" 2013-02-08 23:22:22 +00:00
Trevor Parscal 9eed973ca5 ve.dm.DocumentSlice does not extend ve.Node
Change-Id: I11d28d6eb1c7db1d6b5796ec36c8e9a6f46b7c9e
2013-02-08 14:11:11 -08:00
Catrope 28512c9488 Use .static.isMeta to communicate meta-ness
This gets rid of the meta-specific hack in ve.dm.Document

Later on, I want to use this to get rid of meta-specific hacks in the
converter too, by pushing some of that logic into the ModelFactory.

Change-Id: I1dbee1654fa32d9c7cd521ec325b2553cde219d1
2013-02-07 17:17:34 -08:00
Rob Moen 4d3ccb7b99 Annotate newly inserted target text as a link.
Fixes (Bug 44086)

Changes:
ve.ui.LinkInspector.js
- Annotate fragment for affected range.
- Fragment returned by insertContent was a zero length range, therefore
no content was being annotated.  It is questionable whether insertContent
should return the affected range or not.
- Also changes behavior of editing existing link annotations so that the cursor is after the annotation rather than covering it when the inspector is closed

Change-Id: Ic53b9844f84781cad05ac1f63964c9aaf7de68c3
2013-02-07 16:06:08 -08:00