Commit graph

178 commits

Author SHA1 Message Date
James D. Forrester 82114467f1 Bump copyright notice year range to -2013 over -2012
199 files touched. Whee!

Change-Id: Id82ce4a32f833406db4a1cc585674f2bdb39ba0d
2013-02-19 15:37:34 -08:00
Catrope 819b3ded33 Move matching code from AnnotationFactory to ModelRegistry
ModelRegistry registers both annotations and nodes, and performs
matching on both at the same time. It also registers annotations with
the AnnotationFactory, and nodes with the NodeFactory.

Change-Id: I5e68e506a0e573cc0afe6304ccea058ffc20d1c8
2013-01-22 15:51:37 -08:00
Trevor Parscal 718e72d534 Disabled VisualEditor section edit link overrides by default
Server config: $wgVisualEditorEnableSectionEditLinks
Client config: mw.config.get( 'wgVisualEditor' ).enableSectionEditLinks

Change-Id: I859546475a32a686e318aa7108396606b5a0a78d
2012-12-12 15:35:33 -08:00
James D. Forrester a7157d0c62 Create first VE Technical Debt bug entry for tracking, resolution
Change-Id: I47690b97c19ecc25b0f235036142fef9a2514e96
2012-12-10 17:49:11 -08:00
Timo Tijhof a600310e4d (bug 42136) Use user prefs to set initial state of "Watch this".
* Don't show at all if user isn't logged in
* Use "watch pages I create" and "watch pages I create" prefs
* If the user is already watching it, use that

Also updated relevant onMakeGlobalVariablesScript hook,
it was using old globals still, the hook has context as
of MediaWiki 1.19.

Change-Id: Ic3daf32505a745b3cccd0663a03bbf7f3885be84
2012-12-06 15:04:13 -08:00
Timo Tijhof 381472ac99 init.Platform: Refactor parsed messages.
Rewrite VisualEditorMessagesModule:
* Replace copy-paste dump of user-css module with stuff for
  VisualEditor (class commend and module::$origin).
* Remove duplication between getMessages and getScript.
* Actually implement getModifiedTime so that the comment in
  getMessages() about cache invalidation is actually true
  Fixes bug 42670: ext.visualEditor.specialMessages cache broken

ve.init:
* Implement addParsedMessages and getParsedMessage so that we
  don't mix up plain messages with raw html messages (minoredit
  was previously overloaded in mw.msg storage with a parsed html
  message and retrieved though ve.msg, which is documented as
  retuning plain text, not raw html). This is now separated into
  a different method.
* Improved documentation of the other msg methods to emphasise
  their differences
* Removed redundant code in attachSaveDialog() that was
  (partially) already done in setupSaveDialog() and moved the
  remaining bits into it as well. Checked all callers of these and
  they are both only called from ViewPageTarget.prototype.onLoad
* Also implement them in the standalone platform implementation,
  with the html escaper based on mw.html.escape
* Update init.platform.getMessage to use undefined instead of
  discouraged 'if-in' statement.
* Add test suite.

demos/test:
* Re-run makeStaticLoader.php on test to add ve.init.Platform.test
* Re-run makeStaticLoader.php on demos and update i18n caller
  to use ve.init.platform.addParsedMessages (also moved out of the
  auto-generated block for easier updating)

Change-Id: I7f26b47e9467e850c08b9c217c4f1098590de109
2012-12-04 07:56:41 +01:00
Catrope 43684f88fc (bug 42172) Tag edits made by VE
Uses MW's built-in change tagging. Made this configurable so it can be
turned off if it looks like we're blowing up the tags system with the
volume of VE edits.

Change-Id: I63052d90772906e34021035de496a65fea7945f7
2012-11-26 21:39:11 +00:00
Catrope 4085c2f554 Ignore hidden-ness of visualeditor-enable preference
Needed to make the dark launch work

Change-Id: I1c6f22cb85fdd852bfcc9985d826032f128c6b82
2012-11-14 15:44:15 -08:00
Catrope 4d7952d55c Integration revamp for December release
* Remove VisualEditor namespace, and restrictions on it
** For MW.org these will be moved to mediawiki-config
* Add $wgVisualEditorNamespaces
* Add visualeditor-enable preference and respect it
* Use $skin->getTitle() rather than $wgTitle
* Remove "Sandbox" from i18n message
* Remove duplicate enforcement of VE namespace from JS

Change-Id: I956f68c2dde55e4063530fcc7c90eda048e0d78b
2012-11-05 12:46:14 -08:00
Catrope 7fe7182f43 New annotation API: Annotation and AnnotationFactory classes
Fleshes out ve.dm.Annotation to a class. Annotations in the linear model
will be instances of a subclass of ve.dm.Annotation. Annotations are
defined by subclassing ve.dm.Annotation and registering this subclass
with ve.dm.AnnotationFactory.

ve.dm.AnnotationFactory keeps track of which annotation classes are known,
and has code to match an HTML element to an annotation class, for use in
the converter.

Change-Id: I68802bdb8736ced1f9e04ee49c623944b448141c
2012-10-12 15:07:02 -07:00
Trevor Parscal eabe5e6f61 ve.dm.SurfaceFragment: Implement wrapNodes and wrapAllNodes
Change-Id: I378f0aad0286a6c90adeb4602a57d6617154e8b6
2012-09-24 21:11:16 +02:00
Timo Tijhof c8ed44fb07 Refactor ve.getHash: Stabilize cross-browser differences; + unit tests
* Replaces c8b4a28936

* Use Object() casting to detect objects instead of .constructor
  (or instanceof). Both .constructor and instanceof compare by reference
  the type "Object" which means if the object comes from another window
  (where there is a different "Object" and "Object.prototype") it will
  drop out of the system and go freewack.

  Theory: If a variable casted to an object returns true when strictly compared
  to the original, the input must be an object.

  Which is true. It doesn't change the inheritance, it doesn't make it inherit
  from this window's Object if the object is from another window's object. All it
  does is cast to an object if not an object already.
  So e.g. "Object(5) !== 5" because 5 is a primitive value as opposed to an instance
  of Number.
  And contrary to "typeof", it doesn't return true for "null".

* .constructor also has the problem that it only works this way if the
  input is a plain object. e.g. a simple construtor function that creates
  an object also get in the wrong side of the if/else case since it is
  an instance of Object, but not directly (rather indirectly via another
  constructor).

* Added unit tests for basic getHash usage, as well as regression tests
  against the above two mentioned problems (these tests fail before this commit).

* While at it, also improved other utilities a bit.
 - Use hasOwnProperty instead of casting to boolean
   when checking for presence of native support.
   Thanks to Douglas Crockford for that tip.
 - Fix documentation for ve.getHash: Parameter is not named "obj".
 - Add Object-check to ve.getObjectKeys per ES5 Object.keys spec (to match native behavior)
 - Add Object-check to ve.getObjectValues to match ve.getObjectKeys
 - Improved performance of ve.getObjectKeys shim. Tried several potential optimizations
   and compared with jsperf. Using a "static" reference to hasOwn improves performance
   (by not having to look it up 4 scopes up and 3 property levels deep).
   Also using [.length] instead of .push() shared off a few ms.
 - Added unit tests for ve.getObjectValues

Change-Id: If24d09405321f201c67f7df75d332bb1171c8a36
2012-08-27 00:14:02 +02:00
Trevor Parscal 9c782b29b3 Added monobook support
* Added style for monobook
* Added monobook to whitelisted skins
* Made ve.init.mw.ViewPageTarget resilliant to vector and monobook-like skins

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

Change-Id: I8a57918912499f9453a5692ff45a04a16ed34cde
2012-08-15 16:35:52 -07:00
Timo Tijhof b5a12d0167 Register QUnit tests suites in MediaWiki to run from Special:JavaScriptTest
* Also update test/index.html with latest minimalistic format
* Update test suite hardcoded paths to match the definition in
  VisualEditor.php for ResourceLoader
* Issues:
 - 'jquery/jquery.json.js' should not be loaded directly,
   using a dependency instead.
 - Load scripts from the <head> in test/index.html so that
   code that depends on document being ready is catches instead of
   silently being ignored.

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

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

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

Change-Id: I895b256325db7c8689756edab34523de4418b0f2
2012-07-19 13:25:45 -07:00
Trevor Parscal 9a0380c67d Removed Special:VisualEditorSandbox and refactored demo
Also renamed ext.visualEditor.editPageInit to
ext.visualEditor.viewPageTarget

Change-Id: I8bdd04b3442067e87bccbc60dd4947aae1c7dfd2
2012-07-18 17:57:50 -07:00
Catrope f9f9328275 Remove userCan hook that had no effect
This hook tried to enforce $wgNamespaceProtection , but that's a core
config variable that's already enforced by MediaWiki itself

Change-Id: I15a40d92e0296eb60054d9845d5c42b880a8f278
2012-06-18 17:42:11 -07:00
Trevor Parscal 76bca4f520 Added veaction param which auto-initializes the editor
Made edit tabs rendered on non view pages work correctly by routing them to the view page with an extra param that auto-initializes the editor

Change-Id: I4fd9106c8b45c6fc79af9ccb44e18944e9b9d8b9
2012-06-18 14:13:26 -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 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
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
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
Catrope 3112448bde Make canUserEditPage() static
This shuts up a strict standards notice

Change-Id: I59ce775169965531dd10051418c927b769613abb
2012-05-31 02:41:21 -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
Rob Moen 7d9e2d62a3 Restrict ext.visualEditor.core to the VisualEditor namespace in the hook
Change-Id: I169052bd9a1a38ab0352cca4bf8006a66db381f0
2012-05-25 16:34:25 -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