Follows-up Ic0c6d190c9b78 which introduced a full linmod copy in a
scope that is also accessible by other closures (namely the
callbacks to jQuery.Deferred #done and #always, and setTimeout).
Though in theory engines may be able to garbage collect it,
I doubt it. Though browsers probably destruct the setTimeout
callback I know at least the closures pass to jQuery.Deferred
are not released by jQuery, so an engine would have to
understand these other functions well enough to know it doesn't
access the `data` variable.
Let's release explicitly to be safe.
Change-Id: I11000edcad4690dcce53b6e9d1a45bf2ab82fbcb
Objective:
* Prevent input while the inspector is animating open
Changes:
ve.ui.LinkInspector.js
* Disable and then re-enable the surface while the inspector is opening
ve.ce.DocumentNode.js
* Remove opacity changes on disable/enable
ve.init.mw.ViewPageTarget.js
* Change the opacity of the document when save dialog is open
Bug: 51075
Change-Id: Ic7910a666b33b41b57b035a15cf1f8c9264e7111
Objectives:
* Make option widget icons correctly placed in RTL
* Make embedded context toolbar correctly placed in RTL
Approach:
Use separate elements for icons within option widgets which have more
flexibility when rendering in either LTR or RTL when compared to CSS
background position. The simpler approach, using CSS background
position offsets, isn't cross-browser compatible at this time.
Changes:
ve.ui.OutlineItemWidget.js
* Remove custom icon implementation, using parent class implementation
instead
ve.ui.OptionWidget.js
* Add icon option, which adds an icon element only if an icon was
specified
ve.ui.MenuItemWidget.js, ve-mw/ve.ui.MWParameterResultWidget.js
* Add override for icon config option
* Document icon config as private
ve.ui.Context.js
* Add detection and special handling for positioning embedded context
toolbar when rendering in RTL
ve.ui.Widget.css
* Add styles for option widget's new icon option
* Add styles to make indentation still work for outline item widgets
* Adjust styles for menu item widget as per changes in option widget
ve-mw/ve.ui.Widget.css
* Adjust styles for parameter result widget as per changes in option
widget
Change-Id: Ibfa4b613e0fd7902f8a2c78b5717de402c5f82b8
We previously manually loaded CSS into these frames, which is flawed
because it completely bypasses ResourceLoader (so CSSJanus didn't flip
them, necessitating a bunch of hacks for RTL), and doesn't pull in
MediaWiki styles (so templates inside references don't render correctly).
Instead, this commit copies all styles from the main document into each
frame's document, inlining what it can.
Loading all styles in dialogs and inspectors caused some problems,
initially. We didn't namespace our styles for dialogs vs. inspectors
at all; the only reason inspector styles weren't being applied to dialogs
and vice versa was because we controlled which files were being loaded
in which context. This commit namespaces the inspector and dialog styles
where needed so they don't conflict and try to override each other.
Tested in Vector and Monobook, but not in Apex and not in RTL.
ve.init.mw.ViewPageTarget*.css:
* Namespace styles that are only intended for the main document
* Undo Monobook's font-size: x-small; in frames
*Dialog.js:
* Remove addLocalStylesheet() calls, we don't need those any more
** ve.ui.MWDialog seems to be unneeded now, we may want to remove it
*.css:
* Remove @noflip-ped RTL rules where they were just flipped versions of
their LTR counterparts
ve.ui.Dialog.css, ve.ui.Inspector.css:
* Namespace styles with .ve-ui-dialog-content / .ve-ui-inspector-content
ve.ui.Frame.css:
* Move the margin:0 and padding:0 here (were in the frame <body>'s style
attribute) and add background:none to prevent frames from getting
the skin's background (grey in Vector, a book in Monobook)
ve.ui.Dialog.js, ve.ui.Inspector.js:
* Add ve-ui-dialog-content / ve-ui-inspector-content class to the
frame's content <div> so we can restrict styles to only apply in
dialogs / inspectors
ve.ui.Frame.js:
* Replace infrastructure for @import-ing stylesheets with transplantation
* Remove code polling to see when the stylesheets were loaded
** We can't do this in the new approach AFAIK, since all styles in the
frame are either inlined or inaccessible due to the same-origin policy
** We also shouldn't need it because the browser should have cached the
styles when it loaded the main document
* Apply ve-ui-frame-body class to the frame's <body> so we can style it
** Move inline padding:0;margin:0; into ve.ui.Frame.css
** Move the ve-ltr/ve-rtl class up to the <body>
ve.ui.Window.js:
* Remove infrastructure registering stylesheet URLs to load
Change-Id: I4a37115301811ad860f4578344a04873ea8c2b69
Resolving this bug reveals a completely unrelated bug where hitting
enter while making a link prior to the input being focused, the
selected text gets replaced with a new line.
Bug: 51075
Bug: 49941
Change-Id: I61a90eeaa40b8b66886c17152544c46fa8ca396a
Whoops, merged too soon. The dropdown part of it doesn't
actually work right.
This reverts commit 3c51ebad93.
Change-Id: Ieafbf18ca8a43b07e33a787772abbc77aef63e4c
Conversion is apparently pretty slow on large articles, so put it inside
the setTimeout(). We still need to copy the data array synchronously
though.
Change-Id: Ic0c6d190c9b782f8c643d00d335f0e004d860bcf
* ve.ui.MenuWidget.js
MenuWidget no longer creates an embeded input element by default.
In the case of no configured input element, we bind the keydown
handler to window with addEventListner while using the useCapture
flag. This nicely prevents elements lower in the dom from triggering
( document node ) Supported in IE9 and above and all modern browsers.
* ve.ui.ListAction.js
Since MenuWidget is no longer stealing focus from the surface,
we no longer need to restore focus after a list item conversion.
This is the end goal, as browsers like Chrome like to scroll to
the top of elements that gain focus.
Bug: 50792
Change-Id: I5b6969bca1a58b040708f8ac9d3dc8b07ddf9e6b
Apparently they can't get their basic ECMAScript right. In 2013.
It doesn't come up that often, because you don't splice an array with
more than 256 elements every day. Only implemented in ve.batchSplice
for now, as that function does handle thousands of elements routinely.
Other callers of .splice() can simply use that instead.
Bug: 50385
Change-Id: I281a61d55c6f7df5f28627a1df80f2a001110607
Firefox 13 and 14 were the cause of links magically turning into [[./Foo]].
Once the immediate rush of deployment is over, we'll want to investigate as
to why and hopefully find a way to unblacklist FF.
Bug: 50720
Change-Id: I7a9dddb693091fa1e44b4325e77b9e4f55e5c193
The handler for the Edit tab already is in this conditional,
for edit section we were making the assumption that they only
ever appear on a view page, but that's wrong. They're also shown
on a diff against the latest revision of the page.
Bug: 50925
Change-Id: I802e548cbcdc03cfca66129466668854604bc3e7
* Only pass the oldid to the API from #load if we restoring from
oldid in the url. Otherwise load the latest version.
* Setting 'restoring' from mw.Target instead of mw.ViewPageTarget
so that we don't rely on mw.ViewPageTarget in mw.Target#load.
* Fix the API to not require 'oldid' to be passed.
* Fix the API to actually return the 'newrevid' property. It
was doing a no-op on a $result that is never used due to the
same variable being overwritten with the result of parseWikitext.
* Moved updating of wgCurRevisionId to mw.ViewPageTarget as it
belongs there (possible future inline editors probably act
on a different page than the main one). Also made it only
update if it isn't undefined, so that a null edit doesn't
result in wgCurRevisionId being unset.
Bug: 49943
Bug: 50441
Change-Id: I221e5038f95eadf6d87013e80f12394f0376a293
Show an inspector with inputwidget when the user clicks a math
node. The data of the math equation is shown in the
edit box, it can re-render the math tag image when
the inspector is closed, and save the change when
saving the page.
TODO:
* Change the icon from link to math
* Translate title by translatewiki in i18n
* Other further UI improvements
Change-Id: I4d7533af25186cc39cc4bc6a4326d222ffd6db19
This patch creates two files handling math node matching,
which are:
ve.dm.MWMathNode.js - a basic version of toDataElement
and toDomElement functions work
ve.ce.MWMathNode.js - math formulas in VisualEditor are
clickable and render as img tags
Change-Id: Ib909c5fb02e385c88050f42d02d207ab6a97d0dd
Any annotation could have a style attribute which has
a compound effect, and this also prevents roundtrip
errors. Button tool logic should prevent any annotation
from being applied twice which shouldn't be.
Bug: 49755
Change-Id: I8502a55cd2b195d28d0e2ecd63f15de670f80d60
Since we're now only loading the light-weight init on page load,
the section editing wasn't just deferred to after page load (like
it was before), but wasn't happening at all until you clicked
"Edit" (at which point the library loads). It only worked when
going back to "View" after "Edit".
Contrary to tab layout, edit section handling needs to be
accessible both in the top init and in the main target class
because we need to run it both at run time and after the user
has saved a page when we show them the updated page without
refresh. This is why we need to transfer the method at run time
and give the main class access to it as well.
Can't wait for bug 50707 to get rid of this mess...
Bug: 50731
Bug: 49993
Change-Id: Iab9c81222df7f1084179c3643d158374a89ca14b
This re-fixes the fix to the frame fix. fix fix.
Two things changed: Background position flipped to the right properly
(was somewhat off before) and text-alignment flipped as well.
Bug: 49613
Change-Id: I0aa317ef674537d20d7ed64e74eaa3cfe8030c8c
Added the wrong one, message "accesskey-ca-ve-editsource"
doesn't even exist. It worked locally but that was probably
a lucky race condition or cache.
Follows-up 10fd1a3, b21fe5f.
Bug: 50725
Change-Id: Ie87f8c6861dfe010c038ddb103aa5ea56cd57d24