Objective:
* Make outline widgets and fieldset layouts take up a little less space
Bonus:
* Fix option icons always showing up on the first item because the option
wasn't position relative
Changes:
ve.ui.Widget.css
* Add position: relative to option widgets
* Cleanup unused background properties for outline items
* Reduce padding for outline items
* Move icons to match padding changes
ve.ui.Layout.css
* Reduce margins for fieldset layouts, including using a negative top
margin to compensate for the overly tall legend
Change-Id: Ida6147b8171dcb4152ca9be0e099a5f9b81ac1c0
Apparently it's possible for a stylesheet's .cssRules to be accessible,
but for the individual items' .cssText not to be, in which case Firefox
throws a nice security exception that kills the entire editor.
Wrap all inspector of cssRules in a try-catch, and fall back to cloning
the ownerNode if anything weird happens.
Change-Id: I0187ad308e395e92aea587c00fd8d8eb0280822e
Listen to keyup to properly capture and respond to up and down arrows.
Rewrite calculation for scroll to better follow toolbar obscured cursor.
Bug: 48787
Change-Id: Ia46fb15ec9a8c07b3945b53a6545897ca23e59fa
Since the menu only shows while it's input is focused, input must be focused
prior to suggestions being popuplated. Fixes race condition where
look up request is near instantaneous.
Change-Id: Icf645d051415ac3ee9e15bc85f22f29dc9b64666
Objective:
* Cut off really long parameter names with ellipsis
Changes:
ve.ui.Widget.css
* Use ellipsis when option labels get too long
ve-mw/ve.ui.Widget.css
* Limit the size of a parameter result widget label - this is a hack, but
since there are strange bugs with using ellipsis together with % based
width, it's the best we can do for now
Bug: 50800
Change-Id: Idbfa336d2bba376b0d078fdd0ece65926d610d81
Objectives:
* Make context menu toolbar consistently sized and aligned, especially
in monobook
Changes:
ve.ui.Toolbar.css
* Remove vertical line between groups, just use whitespace
* Switch from padding to margins to avoid size calculation issues
ve.ui.Tool.css
* Remove tiny margin on button tools, tightening them up a bit
* Replace 50% 50% with center center
ve.ui.Context.css
* Switch from padding to margins to avoid size calculation issues
* Use different margins depending on text direction
* Reverse the 0.8em rule used in the dialog - this is a hack, it should
be cleanup up later with a better strategy for normalizing the size
of text within VE elements
Change-Id: If65f12382625efa33777e284bd23a94dc509436a
Reference counting indicates these styles are not in use, so they can now be safely garbage collected.
Change-Id: I432f73490eeb00ff414f150fcf26c718607bac95
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
* 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
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
Objective:
* Make the majority of link inspector, which is generic to any annotation, usable for other annotation inspectors
Change-Id: I1f7e9c13537105da7aa0351c9c92e8af5eb5a3f4
Just a proof-of-concept that this would work on Opera. I'm figuring out
what was this for initially...
This reverts commit 30dadb6c8c.
Bug: 47794
Change-Id: Ie4f1334e0beb7ba7d4f4aa3b42464fa219c4778c
Move all MW-specific files into the ve-mw directory, in preparation
for moving them out into a separate repo.
All MW-specific files were moved into a parallel directory structure
in modules/ve-mw . Files with both generic and MW-specific things were
split up. Files in ve/init/mw/ were moved to ve-mw/init/ rather than
ve-mw/init/mw ; they're still named ve.init.mw.* but we should change
that. Some of the test files for core classes had MW-specific test cases,
so those were split up and the test runner was duplicated; we should
refactor our tests to use data providers so we can add cases more easily.
Split files:
* ve.ce.Node.css
* ve.ce.ContentBranchNode.test.js (MWEntityNode)
* ve.ce.Document.test.js (some core test cases genericized)
* ve.dm.InternalList.test.js (uses mwReference test document)
* ve.dm.SurfaceFragment.test.js, ve.ui.FormatAction.test.js
** Made core tests use heading instead of mwHeading
** Updated core tests because normal headings don't break out of lists
** Moved test runners into ve.test.utils.js
* ve.ui.Icons-*.css
* ve.ui.Dialog.css (MW parts into ve.ui.MWDialog.css)
* ve.ui.Tool.css
* ve.ui.Widget.css (move ve-ui-rtl and ve-ui-ltr to ve.ui.css)
ve.dm.Converter.test.js: Moved runner functions into ve.test.utils.js
ve.dm.example.js:
* Refactored createExampleDocument so mwExample can use it
* Removed wgExtensionAssetsPath detection, moved into mw-preload.js
* Genericized withMeta example document (original version copied to mwExample)
* Moved references example document to mwExample
ve.dm.mwExample.js:
* Move withMeta and references example documents from ve.dm.example.js
* Add createExampleDocument function
ve-mw/test/index.php: Runner for MW-specific tests only
ve-mw/test/mw-preload.js: Sets VE_TESTDIR for Special:JavaScriptTest only
ve.ui.Window.js:
* Remove magic path interpolation in addLocalStyleSheets()
* Pass full(er) paths to addLocalStyleSheets(), here and in subclasses
ve.ui.MWDialog.js: Subclass of Dialog that adds MW versions of stylesheets
ve.ui.MW*Dialog.js:
* Subclass MWDialog rather than Dialog
* Load both core and MW versions of stylesheets that have both
ve.ui.PagedDialog.js: Converted to a mixin rather than an abstract base class
* Don't inherit ve.ui.Dialog
* Rather than overriding initialize(), provide initializePages() which the
host class is supposed to call from its initialize()
* Rename onOutlineSelect to onPageOutlineSelect
ve.ui.MWMetaDialog.js, ve.ui.MWTransclusionDialog.js:
* Use PagedDialog as a mixin rather than a base class, inherit MWDialog
bullet-icon.png: Unused, deleted
Stuff we should do later:
* Refactor tests to use data providers
* Write utility function for SVG compat check
* Separate omnibus CSS files such as ve.ui.Widget.css
* Separate omnibus RL modules
* Use icon classes in ViewPageTarget
Change-Id: I1b28f8ba7f2d2513e5c634927a854686fb9dd5a5
This actually fixes a hack done in a previous commit where an undocumented
surface option was being passed, but not always. And in some cases there
were uses of the popup which didn't really have a surface to pass in.
Change-Id: I08b5dc2dc879f6abd1b16d1d66ac1d8b5624f673
Objective:
* Allow browsing, searching and adding documented parameters
Changes:
ve.ui.MWTransclusionDialog.js
* Replace regular text input with ve.ui.ParameterSearchWidget
* Fix uses of $(), this.frame.$$ is correct
ve.ui.Dialog.css
* Change rules for addParameterFieldset to make search widget auto-size vertically
ve.ui.Widget.css
* Add styles for ve.ui.MWParameterResultWidget
ve.ui.MWParameterSearchWidget.js, ve.ui.MWParameterResultWidget.js
* New classes
* Provides a way to search and select parameter for a template
* Displays parameter label, name, aliases and description
*.php
* Links to new files and messages
Change-Id: Ie5dbe8c44ce5d64c4b49b09517fb66cd30dd7304
This fix adds a directionality property to the frame objects so directions
can be inherited and manipulated inside the frame <body> tags.
There are also several corrections to flipping positioning of panels
in the GridLayout and of the icons in fieldsets and labeled elements
so they appear properly (right instead of left).
I've added a 've-rtl' / 've-ltr' class to frame content divs to serve as
selectors for rtl fixes and general language fixes. Most CSS corrections
would likely be fixed when CSSJanus works in iframes, but the selectors
would still be useful.
This sets the stage for directionality inheritance inside iframes,
and fixes most of the problem with the Page Settings window in RTL wikis.
It also fixes all the labels with icons across VE interface.
Bug: 49613
Change-Id: I418e669b0999552167683352acb365a4249ab9cc
Per the TemplateData spec:
* Most message values can be null, though they're never undefined.
* 'deprecated' is actually {boolean|string}.
For us:
* Make #isParameterDeprecated always return a boolean
* Add #getParameterDeprecationDescription to get the explanation
of why a parameter is deprecated
* getParameterDescription doesn't need to pass 'null' for fallback
since that's the default fallback.
And it may return null or string.
* #getParameterSets returns an array of Set objects, not an array
of strings (see spec for more information).
Change-Id: Iee788bc8fa6f0545085a0f154b77b8176f770dd2
ve.ui.Surface.js
* Make local overlay a child of ve-ui-surface and a sibling to
ve-ce-surface elements.
** This keeps local overlays relative to their surface and eliminates the
need for insane z-indexes.
ve.ui.PopupWidget.js
* PopupWidget boundaries are now relative to ve-ce-surface and no longer
protrude out
ve.ce.Node.css, ve.ui.Window.css
* Removal or replacement of insane z-indexes.
ve.ce.FocusableNode.js, ve.ce.ProtectedNode.js, ve.ce.ResizableNode.js,
ve.ui.Context.js
* Translate offsets from local overlay
ve.init.mw.ViewPageTarget-monobook.css,
ve.init.mw.ViewPageTarget-vector.css
* Skin specific z-indexes for global overlay
ve.init.mw.ViewPageTarget.js
* Applied direction specific mw class to ce.Surface vs ui.Surface to
prevent mw content styles from being applied to ui elements.
ve.ui.Dialog.css
* Adjustments to surface inside of dialog so that relative offsets for
local overlays can be properly calculated.
ve.ui.Surface.css
* Explicitly force .ve-ui-surface to be relative so that it's children can
be relatively positioned.
ve.ui.Widget.css
* Removal of unnecessary font-size properties now that local overlay is
sibling of surface.
ve.js
* Added get relative position helper method to translate position offsets
from target parent
Bug: 50241
Change-Id: Ibadce404a2286bc5dcec48f0d9da89004dbbd867
Objective:
* Enable navigating search results using keyboard up and down keys
* Bubble up query input enter events
Changes:
ve.ui.SearchWidget.js
* Route query input events to emit
* Add handler for keydown events
* Support navigating through the list of results using vertical arrow keys
Change-Id: Ia2e4b27075a8ab2e29a69294e9f7847e8f5a3f83
Issues:
* Selected item is removed, but no select even was emitted
Changes:
ve.ui.SelectWidget.js
* On remove, emit select null when removing a selected item
* On clear, emit select null always
Change-Id: I1a94b0f8a841611b20e09f6c02f37fb9589e85c3
Changes:
ve.ui.SelectWidget.js
* Make getRelativeSelectableItem properly loop around
* Replace confusing and broken getClosestSelectableItem with getFirstSelectableItem since that's the only use case we had for it anyway
ve.ui.PagedDialog.js, ve.ui.LookupInputWidget.js
* Update calls to getClosestSelectableItem to use new method
Change-Id: I2399d01a45c43d1ad663ed6c6de156e796065306
Changes:
ve.dm.MetaList.js
* Auto-initialize index to the end of the list (like the docs claim) even when not providing an offset
ve.ui.MWCategoryInputWidget.js
* Cleanup fix for not offering to move the last category to the end
ve.ui.MWCategoryWidget.js
* Allow pressing cancel on the meta dialog after moving a category to the end without crashing
Change-Id: I45059bda022639f7942f1799a42ecf8a4d962df0
Break setUpSurface into a bunch of parts that setTimeout() each other.
This breaks the initialization of the editor as a whole up into the
following phases:
0) Receive AJAX response, parse HTML
1) Build linear model data
2) Build DM tree
3) Build CE tree, CE DOM, create surface
4) Initialize surface, some UI initialization
5) Launch sanity check, remaining setup, unlock editor
This is a bit hacky right now, we'll probably want to refactor later.
ve.dm.InternalList.js:
* Allow construction without a dm.Document
ve.ui.Surface.js:
* Allow construction based on a dm.Document
Change-Id: Ibf48a7e85cd7376c8f6205ed165ff57e71e34c35
Since format dropdown tool is the only tool where we actually lose
focus to the documentNode, we must restore focus so that firefox
and chrome will display a cursor after converting content branches.
Bug: 50338
Change-Id: I4059b2688565570e0efc21078035775b7aed49e1
As part of this, put the 'help' icon next to the beta icon, make the
text not greyed-out (now that it's an actual action) and provide the
link.
On hover, all three items get underlined, which is irritating, however.
Bug: 50476
Change-Id: Id65968072b7134f5864bbd96acf34fd0c23fe17c
Previous when the selection was collapsed and the cursor was in a block
slug we'd get a JS error thrown. This fixes that, though it could do with
a refactor in time.
Bug: 47947
Change-Id: I596ea9bc553f563e3dc7689c518c7d1319ac1dc3
Assumption about toolbar height never exceeding 88px is not correct. At
least in Chrome, after setting in advanced configuration font size to
"Large" instead of "Medium", the toolbar's height is 110px and part of it
is transparent. Because it is transparent user can see content behind it
when scrolled down, which makes for a not really good experience.
Change-Id: Ibdc2410cc4ab29bfe774961fc062d172386975d4
Objective:
* Fix issue where async behavior of addTemplate caused templates to be added in the wrong order
Bonus:
* Get rid of special adders for transclusion parts, just construct objects outside and use addPart
Change-Id: Ibe579f033873446376d72d3bd1b9f92d9f361de5
Parameter config is optional (both in the parent class and here),
this subclass forgot to add the fallback.
Though in a plain subclass the local fallback isn't needed
(parent class takes cares of it), in this case it is needed
since the constructor directly accesses config.multiline etc.
Change-Id: I3f9b73efb6c40a29efa221e1654b1247baaca281
Objectives:
* Use template data for templates added to a transclusion using
the list controls
* Cache template data between different instances of the dialog
* Allow placeholders to be replaced with templates asynchronously
* Save http request and abort pending requests on close
Also:
* Fix breakage of (unused) method getParameterAliases
(dont delete aliases)
* Remove unused method getTemplateSpec.
Bug: 49778
Change-Id: I391e51cb900ef5560455d6f3d4d2a8b99ed2b034
Ed & Roan:
Disable editing of references of which we are unable to find the
source (e.g. <ref name="x"> without a target, or when the target is
currently nested in something we don't yet process such as inside a
<references> block or a template).
Timo:
Improve UI to not be a regular focusable node where the inspector just
won't show up but add a not-allowed cursor and explanatory tooltip.
James:
Fix messages to refer to VisualEditor instead of "the" VisualEditor.
Change-Id: Ib2bca092ce13c9187fa8b27ad6a6404cae02aea2
Objectives:
* Split reference dialog (at least for now) an edit and an insert dialog
* Add reference search widget for selecting an existing source, or
choosing to add a new one
* Abstract reference names, don't allow editing them and generate them
when needed
* When editing groups, move the internal item and update all references
to it
* Resolve name conflicts when moving a reference to a new group by
generating a new list key
Bonus:
* Add getNodeGroups method to internal list
* Add getUniqueListKey method to internal list
* Add destroy functionality to ce.node to release events and references
Bug: 49733
Change-Id: Ib244ff6ad9b4cee1decfd9b9e1d3d4e9cdcfb78c
After a spirited discussion, localOverlay is getting some children.
* localOverlayBlockers - UI elements that are meant to prevent
interaction with the element. This includes Phantoms and
Highlights.
*localOverlayControls - UI elements that are meant to be
interacted with in order to modify the element. This includes
resize handles and drag marker.
*localOverlayMenus - UI elements that should always position
above all other controls. This includes the context menu.
Bug: 50159
Change-Id: Ic69c2ad275389a31c9fbaf47f3665dcdbb7ac2af
Objectives:
* Make options unable to be selected or highlighted when disabled
* Add default styles for selected state
* Fix line-height for option labels
* Use default cursor when field is disabled
Change-Id: I8a535cd6b259b092c2abce27ddb10882cdde6cf5
Objective:
* Make the escape key close dialogs, like pressing the X button
* Auto-focus the iframe on window open
Bonus:
* Add ESCAPE and SHIFT to ve.Keys and use instead of hardcoding numbers
* Use ve.Keys in some other places too
Bug: 49809
Change-Id: Ibf1fce5e24efcd83d9e1465c3cdaac24ff3fb45d
Omitting the offset causes insertMeta() to automatically use the
end offset, so we don't need to compute it in two places. The two
computations were also slightly different.
Change-Id: I55543fdd113a6a986899c093733191df948acb2e
We need to normalise titles so 'user:foo_bar' == 'User:Foo bar', and
we also need to some HTML attribute removal as links from Parsoid
will have href and rel set (again, this should be fixed in by Parsoid
when the do the merging at their end).
Bug: 49985
Change-Id: I5fb5bfc69c344ca4ce4803d7b6116074648a8d7e
Objectives:
* Associate models with tools, rather than dialogs and inspectors
* Move tool/model association utilities to ve.ui.ToolFactory
* Obliterate the view registry
Notes:
The only special case for leaving modelClasses definitions in place is
for the linkInspector. It uses these for selection expansion.
Because tools can now override the static canEditModel method, we can
dynamically evaluate a model, rather than be restricted to only
comparing classes. This will be useful for disabling editors for models
that are for some reason incomplete or otherwise broken and cannot be
safely edited.
Change-Id: I7adf254990112d90f1f808593a9111afc7a116b5
Because of the z-indexes of major elements of the mono book
skin, and because the overlay containers are appended to the
body, the overlays can't be positioned between the surface and
the toolbar. Before this fix, the overlays are appearing beneath
the surface. This fix will retain proper positioning of the overlays
between the surface and the toolbar for Vector, and will overlay
everything in Monobook.
Later, we will have the overlay container more tightly integrated
with the surface to avoid this stacking problem.
Change-Id: Ibb1553099cc1e35e6a0928a99b584885508ca5b6
Re-label the headings in the MWFormatDropdownTool with MW-specific
headings per bug 43334, reduce the size of the dropdown's contents a
little to make the headings less vibrant, and move the H1 option to the
end of the list to further discourage its use.
Note that there are some issues with the underlying structure here and our
ability to split the repos into VE-core and VE-MW will need this to be
refactored.
Bug: 43334
Change-Id: I5a58b4dcebd6ceae0ffcd24f663429f25bdc3db9
Use the 'all' mode of SurfaceFragment#getAnnotations to correctly
handle the selections which include linked and non-linked text
in the LinkInspector.
Bug: 50208
Change-Id: I1cab7f3cc4fc9589eced01ad38c59fe5b9622a57
Local overlay z-index is positioning overlay items (phantoms, etc)
above the floated toolbar. The overlay container is a sibling to the
toolbar's parent and is later in the DOM. z-indexing is
unnecessary and has been removed.
Bug: 50096
Change-Id: Ib46f66b1d1bea36d761f793e9966e09db6e675ca
It was discovered that nested iframes inside firefox do not fire load
events: http://osdir.com/ml/dev-apps-firefox/2010-03/msg00134.html
Since we no longer care when the iframe is loaded, changing the frame
onLoad method name to load and manually calling it was sufficient.
Bug: 50115
Change-Id: I65c0c404a2a384566701b1c6b1bb978e0b99c90d
We calculate an overlap offset for when the popup widget has been moved
to avoid going out of the viewport, but that offset is only applied to the
body and not the callout.
Change-Id: Ib9d08d60ccfa6562378640c526faf1e8363abbba
Due to some sort of mysterious race condition (probably deferred reflow)
calling this.$menu.show() set style="" rather than style="display:block;"
because Firefox believed the parent was still hidden.
Work around this by removing display:none; from the context's CSS rules.
We don't need it because we always manually .hide() these things anyway.
Bug: 50073
Change-Id: I29e210aba9a6265d8364ff8ae49408cb4c2428b9
Fixes (follows-up I1b48ef5240, I6daff5c596):
* Invalid html passed to jQuery constructor.
* Use prop() instead of attr() for boolean values.
* Use append() instead of html() when appending nodes instead
of parsing html.
* Rename shadowed variable name clash 'mw' to 'mwData'.
* Fix odd construction where we parse '{}' to create an empty
object.
* Have ve.ce.MWReferenceListNode#update perform changes off-document
in a detached tree.
* Fix deep property access that can fail. mwData is set to
either JSON parse of data-mw attr or empty object.
Accessing mwData.attrs.group needs to be guarded by whether
mw.attrs is indeed set.
* Have `mw` and `about` attribtue in references list roundtrip
(especially mw which can data we aren't editing/re-creating).
* Add missing 'refGroup' property to MWReferenceListNode's
data element (similar to what MWReferenceNode already has).
Change-Id: I67e4f378ccd04e97361d8e58ae57db5353075756
* changes:
Fix incorrectly written CSS that was affecting all table cells on the page instead of cells in mwMetaDialog only
Fix for rendering block images
Follows-up I99acbd1699:
* "Parent method" comment
* Remove redundant slice() call to convert arguments to array,
native JavaScript methods that take array-like arguments such
as Function#apply and Array#slice are both compatible with
the Arguments objects, no need to convert it. Most invocations
already did this right but a few were recently introduced again.
* Removed silly "Document dialog." descriptions.
* Removed a few redundant "@method" tags in the near vicinity
of code I changed.
* Fixed function invocation to be either on one line or
one parameter per line. Having all arguments on one line
but the name + "(" looks confusing as it suggest there
is only 1 parameter. Same as object literals:
so:
{ foo: 1, bar }
or:
{
foo: 1,
bar: 2,
}
not:
{
foo: 1, bar: 2
}
Change-Id: I379bc2b32603bcf90aba9b4cd0112e7f027d070e
* Optimise initialisation by building the tree from the bottom up
and applying the class last.
* Actually document the dialog. Documenting it as "Document dialog"
is useless and confusing. If there is no documentation yet, leave it
empty so it is included in jsduck's optional "no_doc" warning list.
* Remove the redundant "Call" prefix in the parent method description,
we don't do this else where either.
Change-Id: I99acbd1699b2c99a2c9b58f34dc1e07bea58203d
Objectives:
* Introduce new icon for a reference
* Repurpose existing reference icon for references block
Change-Id: I1bfcdbeda3b9730d62d6b264ef72921e93623f7e
Previously pageExists thought matchingPages was an indexed object when
in fact it was an array. This didn't manifest as a bug as we subsequently
check the normalised URL in the correct manner (using indexOf), but it
did remove the optimisation of not running mw.Title if there was an exact match.
Change-Id: Ic616cbfa0d7ed5447e032dd1f772779db2dc19e5
Previous condition was put in as part of I9ed6f9fb as a
temporary fix for bug 42842. However this code was causing
the popup widget to not appear for items at the start of
the document. It appears the bug it was put in to fix
has since been fixed elsewhere.
Bug: 49421
Change-Id: I8bcdea0f7a6951216bf8368865d23ef6246880ea
The transclusion dialog lets you completely delete all templates
within it. If this happens we should delete the node completely, or
not insert it if it's a new instance.
Bug: 49831
Change-Id: Ic5d4fbf73f3d1be9cf877bc8b98096de9e98991a
Without these properties set, the layout is collapsed into a 0x0px square due to the
parent having overflow-x: auto; and no width/height set.
Change-Id: I77aef8afa3327b11f453196badcdfad3f51f7c3d
The check for the toolbar not overlapping the last branch node
'fixes' an edge case where the user has scrolled too far, and
the viewport is shorter than the last branch. A more common
problem caused by this is that if the last branch is very tall
the toolbar disappears whenever you scroll past it.
Bug: 48662
Change-Id: I1c7662f2b6f1ced6f80dec16c6ed69a8cc0c06c8
Removed inherited (and often wrong) documentation, replaced direct
usage of onApplyButtonClick with more standard onClose handling,
and one case of calling the wrong parent method.
Change-Id: I86ed16860e996b42c141a6499eefb9084d759a72
"Template" parts should be labeled with a normalized version of what you would actually write inside a set of curly brackets.
Change-Id: I4b9c541a01da86cb078d38012e5a9fead2fa233c
Objectives:
* Clear this.titles when resetting, otherwise results are shown once and
then blacklisted forever.
* Attach done() before always(), so done() gets called first and not
after always() has dereferenced the request object.
* Remove use of imaginary variables like this.loading, which were never
set, and were referencing even more imaginary methods on other imaginary
objects like this.request.abort()...
Change-Id: Ifbe74346f68b6a91f425b56a2696fd1e46b61e02
If the query is cleared, we should still clear all items and abort any
loading that may be going on. We should still not try and load results
for an empty query though.
Change-Id: If23c6e0469247b1c1c47ab85b9a5a010e8a4fe26
Objectives:
* Allow adding content or templates within a transclusion
* Add template placeholder to model and view which resolves to nothing
when saving (thus disappearing if not resolved)
Changes:
*.php
* Add links to new messages and files
ve.ui.OutlineControlsWidget.js
* Organize controls into "adders" and "movers"
ve.ui.Widget.css
* Add styles for adders/movers sections of outline controls
* Make adders appear on hover to reduce clutter
ve.ui.Icons-*.css
* Add icon for "add item"
ve.ui.Dialog.css
* Add styles for add template fieldsets
* Make placeholder items in the outline italic
ve.ui.PagedDialog.js
* Pass adders config to outline controls
ve.ui.MWTransclusionDialog.js
* Add support for adding content and templates
ve.dm.MWTransclusionModel.js
* Add addPlaceholder method
ve.dm.MWTemplatePlaceholderModel.js
* New class, pretty much an empty part
* Using this makes the UI much easier to work with - no need to special
case the outline control for new items
* Because it's not supported specifically in
ve.dm.MWTransclusionModel.getPlainObject, it produces nothing and goes
away naturally on apply
Change-Id: I3478560fb53ba2ccd3fb26bafb6a61e6415565eb
Objectives:
* Make get$$ work with empty jQuery selections
* Reset the $items selection when clearing a group
Changes:
ve.Element.js
* Add existing context property to possible solutions
ve.GroupElement.js
* Reset this.$items after detaching them
Change-Id: I73b46649d7ecd5045941086c4e1bb3241c8f4ef3
Added return boolean to ve.dm.Surface#breakpoint to indicate if
and transactions were pushed to the big stack. Use this value in
MWMetaDialog to see if we need to undo on close.
Added tests for ve.dm.Surface#breakpoint.
Bug: 49630
Change-Id: Ieb2e9e361afe057af93c4d374acc85df58bfb4c3
matchingPages contains titles with spaces, but .toString() returns titles
with underscores, so normalizing with .toString() is incorrect. Use
.getPrefixedText() instead.
This caused a bug in the link dialog where, if the link was an internal
link pointing to an existing page with a space in its name, the "New page"
section would be displayed but would be empty, and the link's target would
be displayed in the "Existing page" section but colored red.
Change-Id: I59d8b87b996d80da1b25124b942bd2b72ef50845
Move post-qunit task to qunit.done event which fires both on
success and failure.
Define pre-qunit + qunit as a group test 'unit', so they can
be run from the command line (previously 'grunt qunit' would
fail) as 'grunt unit'.
Also add override comment to css file using non-standard
property so csslint passes again (follows-up b2fbe35).
Bug: 49431
Change-Id: I5079d00a63d43276a12dd78c306bb3819470631d
Objective:
* Allow editing reference groups and names in the reference dialog
Bonus:
* Modify attribute transaction builder to support multiple attribute
changes in a single transaction
Changes:
ve.ui.MWReferenceDialog.js
* Load ref name and group from model
* Save ref name and group, if changed, to model
ve.ui.ListAction.js, ve.ui.Transaction.test.js, ve.ce.ResizableNode.js
* Update use of newFromAttributeChange to newFromAttributeChanges
ve.dm.SurfaceFragment.test.js
* Add test for new changeAttributes method
ve.dm.InternalList.js
* Missing new line at end of file
ve.dm.Transaction.js
* Change newFromAttributeChange to accept an list of attribute changes and
produce a single transaction that applies one or more attribute changes
at once
ve.dm.SurfaceFragment.js
* Fix bug in getCoveredNodes where the wrong mode name was being used
* Add changeAttributes method, which applies attributes to all covered
nodes and allows filtering of which types of nodes the attributes are
applied to
ve.dm.MWReferenceNode.js
* Actually write key and group back to DOM
* Separate onRoot functionality into addToInternalList so it can be called
separately (similarly onUnroot/removeFromInternalList)
ve.ce.MWReferenceListNode.js
* Clone internal item CE node before appending to avoid rendering bug.
*.php
* Add links to messages and sort them
Change-Id: Ic4121e4fcfc09265d5863af6f078cdeb77926c8e
Objectives:
* Allow reordering items in outline widgets using an outline control
widget
* Use an outline control widget to reorder transclusion parts
Changes:
ve.ui.SelectWidget.js
* Emit add and remove events
ve.ui.OutlineItemWidget.js
* Add movable config options
* Add isMovable method
ve.ui.OutlineControlsWidget.js
* New class
* Displays move up/down buttons which are synchronized with an outline
widget
* Doesn't actually move items (since an outline widget is probably
data-driven) just emits events
ve.ui.Widget.css
* Add disabled style for icon button widgets
* Add styles for outline controls widget
ve.ui.Icons*.css
* Add missing icon styles
ve.ui.Dialog.css
* Add styles for outline and controls in editable paged dialogs
ve.ui.GroupElement.js
* Fix bug where items are insertions are in the wrong place when "moving"
them
ve.ui.PagedDialog.js
* Add editable config option which shows outline controls under the
outline
* Pass through movable config option when creating pages
ve.ui.MWTranclusionDialog.js
* Configure paged dialog outline as editable
* Add initialize method to connect outline controls widget events
* Make addPart method automatically add parameters when templates are
added
* Add handler for outline controls move event which re-orders parts
* Make parts movable (params are automatically ordered, so they aren't
movable)
ve.dm.MWTransclusionModel.js
* Add addPart method and use it within the addContent and addTemplate
methods
* Fix documentation lies
* Add getPartFromId method
*.php
* Add links to new files and messages
Change-Id: I919d4c3e9b85d07a97a99c0b2e8739a859bdf2b1
Objectives:
* Get rid of the border and ensure pixel-perfect positioning of the input.
* Always render the arrow on the top right of the category item
* Make the popup positioning based on the arrow div's position and size
Bug 49420
Change-Id: I3ad4ff1c41e6108161b5b7c8718c676eb850de68
Objectives:
* Make category popup show "Category" rather than missing message -
this is more similar to other popups like inspectors, which identify
what that thing is that you are working on
* Fix alignment of icon and label in category popup
Changes:
ve.ui.Widget.css
* Make popup title align properly with the remove button
ve.ui.MWCategoryPopupWidget.js
* Update message key
*.php
* Add new message
Change-Id: Ia8051125bbc9bde47ceb931e1ebf42b2955481ff
Objectives:
* Rename just about every use of "template" to "transclusion"
* Make a proper data structure for transclusions
* Abstract away template data
* Use more template data in the user interface
* Allow adding parameters
* Allow removing templates, parameters and content
Changes:
ve.ui.Dialog.css
* Add rule to place add param controls on a single line
ve.ui.MWTemplateDialogs.js
* Move template spec loading into transclusion class
* Add remove button for parts and parameters
* Add parameter adding form
* Use template data for labels and descriptions
ve.dm.*
* Add new transclusion data structures
*.php
* Add links to new files
*.*
* Rename all things "template" to "transclusion"
Bug: 39598
Bug: 49403
Change-Id: I3bcf924a3e179cb65f19e833277a39dfd3dad8bd
Objectives:
* Remove the whole toolbar subset thing, it's up to the creator of the
subsurface to know what is and is now allowed, and the commands were
still passing through unfiltered
* Correctly separate initialization from opening - fix issue where opening
the reference dialog multiple times will keep adding more and more
controls
Changes:
ve.init.Target.js
* Remove getToolbarSubset method
ve.ui.MWReferenceDialog.js
* Add toolbar tools and surface commands configs to reference dialog,
including the things that are safe to use in references
* Move creation of field sets and reused controls to initialize method
to prevent re-creation each time the dialog is opened
* Move static initialization stuff to the top near the other static stuff
Change-Id: I1c8577d17c506bac76e61b2b036655c59ef5a218
Turns out that by skipping the last item, the following logic which
depended on that item being in the existing items list failed to keep
it's grubby hands off it.
Yes, I know I +2'd it. Shame on me too.
Bug: 48556
Bug: 48565
I93ce05f7cbb28313a3f0827539f0528c366aeb7e
Change-Id: If48e001b92c217bee0a35b6da41d1c1ff0e3271c
Was previously only set on form submission, but there was no button so
you had to press the Enter key
Bug: 48555
Change-Id: I256d2b21bc2306959f6d6a0373386054b21dadfe
getLookupMenuItemsFromData() constructed a regex from user input
without escaping. I don't *think* there are any injection
vulnerabilities here but at the very least it triggers exceptions
when the input is, say, a backslash. Instead, use .lastIndexOf() which
allows us to efficiently check whether a string starts with a certain
prefix.
getLookupCacheItemFromData() was stripping out the Category: prefix
using a regex that hardcoded Category: (so failed to detect localized
prefixes) and used global replacement, which meant that strings with
multiple occurrences of 'Category:' were handled incorrectly. Instead,
use mw.Title to strip the prefix. Also move away from .map() because we
may need to drop a result if it doesn't pass mw.Title validation.
this.categoryPrefix still has a few legitimate uses left, so keep it
around but set it to the localized namespace prefix rather than Category:
Change-Id: I6547f9df2e94fe81f6aefb9286e547425137344b
Objective:
* Add an event to single line text input widgets to detect when the enter
key has been pressed
Changes:
ve.ui.TextInputWidget.js
* Retain value of multiline config option
* Add key press handler to detect pressing of enter key
* Emit 'enter' event when enter key is pressed if input is single line
Bonus:
* Add missing documentation for multiline config option
Change-Id: Id9c64343f4a2ea8f0f45213fd2b59ca87c805b24
Objective:
* Prevent undefined and null from being converted to 'undefined' and
'null' when given to setValue by converting them to empty string instead
Changes:
ve.ui.InputWidget.js
* Move all sanitization to one place
* Improve sanitization by adding cases for undefined and null
Change-Id: I8817a8fcac271e560a9e49887c68a035293866d4
Objective:
* Add functionality to paged dialogs to work with the pages and select
them programmatically
Changes:
ve.ui.PagedDialog.js
* Keep track of the current page name
* Add setPage method, which is can be used publicly and is also used
internally when items in the outline are selected
* Add a page content config option which auto-appends to the inside of
the page
* Add removePage method for removing pages by name
* Add getPageName method which gets the current page name
Change-Id: I2a2f0c329d274796b8c9e7572ecff8294f472f7f
Of course CSS is perfectly standardized and wonderful, so we need a bunch
of duplicative and non-standard rules.
Also fix the mixin in MWCategoryWidget
Change-Id: I24da0ddb29d2886c450da362fee47d22da8e631d