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
* 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
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
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
* 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
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
* 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
* Added style for monobook
* Added monobook to whitelisted skins
* Made ve.init.mw.ViewPageTarget resilliant to vector and monobook-like skins
Change-Id: Ia39e034229204ae5f1f70dce5d74c6c4db42277b
* 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
* 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
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
This hook tried to enforce $wgNamespaceProtection , but that's a core
config variable that's already enforced by MediaWiki itself
Change-Id: I15a40d92e0296eb60054d9845d5c42b880a8f278
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
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
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