Commit graph

1036 commits

Author SHA1 Message Date
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