HTML DOM has annoying behavior for <pre>s where .innerHTML eats the
first newline in a <pre>. Work around this by explicitly adding a
newline in the data->DOM converter if the <pre> already contained a
newline.
There is a separate bug in Parsoid that causes the newline to be lost
anyway, filed as bug 42666
Change-Id: Ia26cd4a4c61afbe439b0562deb7f24ee8b8147d7
DocumentNode element loses focus when the context is opened.
When clicking out of the context into window, polling error
occurs.
Change-Id: Ie8f8af763d221c59e47e8c240653f8b817c26f64
ve.ce.Surface
* Used getModel() as per TODO
* Simplified code by pre-calculating 2 statements that were being used 4 times each
* Re-structured logic so that simple insertion and deletion are only possible if next and previous have a range, triggering complex change otherwise
* Added some documentation
ve.ce.SurfaceObserver
* Added checks for whether rangy found a branch node within the document or not before accessing it's node via .data() and made it so we are only performing DOM > document range conversion if we did
* Removed some commented out code
Change-Id: Iaaf30a5b201710ab4235e775f18808a8d512f1f9
ve.IndentationAction
* Fix incompatibility with working with multiple nodes by using surface fragments
* Bug was caused by unindent causing rebuilding, which for all groups other than the first meant their nodes were detached and broken
ve.ListAction
* Employ unindent in a loop to remove all list levels
This is all still a bit hacked together, the use of surface fragments saved us this time, but we need to refactor this code. Badly. Next year.
Change-Id: Idddef35230b04d64cf8338d53bbab730fadec2fc
This will prevent inline alien phantoms from appearing while dragging. This was a usability enhancement identified by Inez/Christian.
Change-Id: Idf046db72e25875e899f5926ab7d50d2f514586b
Detecting contextChange events was making assumptions about the previous state, and causing a mess of problems.
Solution: detect contextChange events in a smarter way.
We also now emit contextChange event when moving to a different node. This helps fix other issues because it's possible for the selection to be the same, but the node at that range to change, and that's a context change for sure. Example would be changing the heading level.
Change-Id: I99d6fa94fae76aa940077abc9b5beacd38eb7b0b
This prevents memory waste when switching between read and visual editor tabs, which happens entirely on the client.
Change-Id: I31b50accac38d72a9367b9035504552dc0150104
Which for now is just "not when creating a new page". This is
already strictly enforced in the MediaWiki backend through EditPage.php, but not reflected in the Save dialog of VE yet.
Now the checkbox for Minor edit matches the logic for EditPage.
Change-Id: I9c659845feebb3e9bbf8e13ee67be27c6adb4321
Use mw.config wgCurRevisionId for oldie instead of uri query.
That way it also set on regular views, and as a bonus it the
normalised value (e.g. if on a page with oldid in query but the id
doesn't exist or is somehow invalid, it won't use it).
Centralise page existence logic in JS and rename Target.oldId to
Target.pageRevId (to further indicate that it is always set, not
just on oldId views. To detect an oldId view, do a boolean check
on value from currentUri.query.oldid directly).
In PHP Api, move oldid logic to execute() method instead of
locally from the getHTML call. That way it is always set, avoids
hitting this bug in other methods instead of just getHTML().
Since the mw.Target constructor now retrieves the ID from
mw.config directly, the second argument was removed.
Change-Id: I223235a6ea8b4178c50beeaaedb709b2de7cf0b5
Had to make the retrieval of the Save dialog html template
asynchronous due to mw.user.getRights being asynchronous.
Entire block indented, ignore whitespace changes.
Also:
* Fixed 2 cases where ve.msg value was interpreted as HTML
instead of adding a text node directly.
* Alphabetically sorted the dependencies (after adding
user.options and mediawiki.user).
* Removed redundant inline jshint comment, multistr is already
tolerated from the central .jshintrc file.
Change-Id: Ie09bb5c8bdbfbb3ec0d4983b74d0697b941153e0
ApiVisualEditor
* Including notices in response to parse actions
ve.init.mw.ViewPageTarget
* Added styles for editNoticeButton and editNotices
ve.init.mw.ViewPageTarget
* Added toolbarEditNoticeButton and toolbarEditNotices
* Combined toolbarEditNoticeButton and toolbarSaveButton setup
* Moved toolbar buttons setup to onLoad (it could vary per-parse now)
* Added tearDownToolbarButtons which fires on deactivate
* Renamed some instances of teardown to tearDown
* Added click handler for toolbarEditNoticeButton
* Added toolbarEditNotices setup method, called on load
* Made notices fade in and out, in by default on load if any
* Made notices hide when save dialog is opened
ve.init.mw.Target
* Added storing of notices on parse
icons, alert, ve.ui-Icons
* Added alert icon
VisualEditor.i18n, VisualEditor
* Added notices button message
Change-Id: I581bf5a005a9c18422f952d71064d17d0ba9b540
Context should be 'mw', not 'mw.msg'.
Also updated to using ve.bind instead and documented that ve.msg
cannot ve.bind because the reference 've.init.platform.getMessage'
does not exist yet at run time of the ve.js file.
Change-Id: I7eb692bdc4b63cc44fab118054d8eea05c2a71ff
When the content rendering stuff was moved to ve.ce.ContentBranchNode the onUpdate methods being used to update the DOM wrapper in ve.ce.HeadingNode was overlooked, so heading were not rendered on update anymore.
Change-Id: I994b8c43123c3cd02b9a550d5d7eac7d5052418e
* Permits longer page titles in suggestions without changing
the width of the dropdown.
* Addresses (Bug 40675)
Change-Id: Ie76a551970a040074b86c49bb44bda640ecd4845
The logic in ve.ui.LinkInspector.onUpdate was very flawed. This patch makes it so:
* When something happens, if there's an inspector open then so long as the selection hasn't changed the inspector is updated (such as the window being resized)
* If the selection does change, the inspector is closed
* If there's no inspector open, we try to show a menu of available inspectors
Change-Id: I859123a5fcd36bc2afb2e578f81f30a944c8583a
ve.ce.Surface
* Added ve.ce.Surface.adjustCursor, which replaces repetitive and buggy code that was handling left and right arrow key presses
* New method only affects the selection target, so it won't collapse the selection on you - this was what caused bug 42401
* Made hasSlugAtOffset() actually return a boolean
ve.dm.Document
* Fixed turn-around issue in ve.dm.Document.getRelativeOffset - if the offset is already valid and we can't move in the direction we want, we should just leave it be, not turn around
* Since this method was being used by ve.ce.Surface to correct the cursor position on arrow key presses, it was causing the strange cursor jumping when you pressed an arrow key while at the edge of a document
ve.dm.SurfaceFragment
* Fixed typo where getAnnotationRangeFromSelection was preserving selection direction, but checking the wrong properties
ve.dm.Document.test
* Added tests that verify turn-around issue is fixed
Change-Id: Iba55cfc3d531e7d1333b78c94912ff22179aace8
Allows suggest tool to open immediately and provide new page and
external link suggestions for link inspector.
Resolves (Bug 42341)
Change-Id: I79bc3e31033b5c38c3ed6ab23e601476cb17ba8f
ApiVisualEditor
* Added basetimestamp and starttimestamp to all methods where appropriate
* Added new serialize method which converts HTML to Wikitext
ve.init.mw.ViewPageTarget
* Added edit conflict handling
* Moved form value reading code into getSaveOptions method
* Prevented edit warning from appearing while submitting
ve.init.mw.Target
* Added serialize and submit methods
* Fixed some documentation
* Added support for baseTimeStamp and startTimeStamp
VisualEditor.i18n
* Added edit conflict confirmation box message
VisualEditor
* Included new edit conflict message to resource loader module
Change-Id: I002c5aa23704c1c46ef46fa1970a4254614b9eb1
ve.ce.Surface.handleDelete did not support inline elements. This patch resolves this by detecting them and using programatic delete instead of native browser delete.
Change-Id: I73215df88519450965be35d9e04cf4e621d1e90d
Moved annotation rendering from ce.Textnode into the new
ce.ContentBranchNode class. This allows us to render annotations that
span across multiple nodes.
* Add ce.ContentBranchNode, inheriting ce.BranchNode
* Make ce.{Paragraph,Heading,Preformatted}Node inherit ce.ContentBranchNode
* Made ce.ContentBranchNode render its child nodes with anntations,
using .getAnnotatedHtml() on the child nodes
* Put a default implementation for .getAnnotatedHtml() in ce.LeafNode
* Override this in ce.TextNode to do escaping and whitespace handling
* Removed rendering code from ce.TextNode (this.$ is now unused there)
* Removed ce.TextNode.onUpdate() and ce.BranchNode.clean(), now unneeded
* Have ce.BranchNode propagate update events from children, so
ce.ContentBranchNode can rerender when its children change
* Update tests, add test case for escaping of &<>'"
Change-Id: I4600e984b287c6ff9267f4281d2f09bab9e1ad95