MWTransclusionNode will preserve TemplateData <style> in its generated content.
Disable TemplateStyles stylesheets in the original page content, and reenable
them when the surface deactivates.
Remaining TODO: if multiple copies of a template with deduplicated styles are
on the page, and the one containing the actual <style> is removed, all will
lose their styling.
Bug: T197563
Change-Id: Ibd8939eef7d8eb532719f4ee0ce200600449ef81
Depends-On: Ia9f2afcdba5456238e3ef444c202c9b0c78838bf
Refactoring in 92c4e23 didn't account for the case where there are multiple
tabs and source mode isn't NWE, which caused the "edit source" tab to just be
a page- navigation that always discarded changes. onEditTabClick handles this
case fine, so just always bind the handler.
Bug: T199655
Change-Id: I3dca87a7a3b0ea88ef0008be89cd1f6007167916
If the wiki runs on a host that contains a port number, section edit
links would always reload the page, and the "Add section" tab would
not work.
As it happens, my local testing wiki runs on localhost:3080.
It is an unfortunate naming mishap:
* mw.Uri#host is equivalent to location.hostname
* mw.Uri#getHostPort is equivalent to location.host
In this case, we have to compare the port too, otherwise a setup (my
setup ;) ) where one starts up another wiki on localhost:3081 to test
cross-wiki features would fail.
Change-Id: Ib7de4ba3c3a84888f24186af03bd9dcced131051
What happens when an edit tab is clicked is spread across handlers in
DesktopArticleTarget and DesktopArticleTarget.init. Consolidating the logic
into the handler in DesktopArticleTarget.init makes it easier to understand.
It could be moved further into DesktopArticleTarget, but the init handler has
to exist to activate the target in the first place.
This patches a hole where clicking "edit source" while in visual mode would
sometimes not switch to source mode, because it didn't think it was changing
the current section.
Also, fix a typo in the documentation.
Bug: T198272
Change-Id: I12d958b6af1b9fa9aca68b498eb2a1a2d76b5a82
aeb4f2f2b7 added a #wpTextbox1 to the wikitext surface, which confused our
existing teardown check. This confusion only became apparent in single-tab
mode, when using the wikitext editor.
Bug: T197615
Change-Id: I98e64e7135aaf6f8fda441a91e6cbc4bac6cea39
We already do it after save, but not if the editor is closed without
saving.
This behavior is a bit awkward for non-existent pages (redlinks),
since MediaWiki normally doesn't display them in view mode (all links
point to action=edit). But this seems less weird than not allowing the
editor to be closed.
Bug: T122388
Bug: T168338
Change-Id: Id9ee41356f011dfbfa6e8744b8d9076f8eacaf39
Not checking this results in handlers blocking click actions for "read" after
the teardown of the target.
Bug: T197445
Change-Id: I3a962c66c82a0e48ca54bf2f0b822a9a005da54c
Previously, we changed it on every load, which also occurs when
switching editor modes. That caused it to not be restored when editor
was closed.
Bug: T197490
Change-Id: Icb20c38309fd440553d5245d865b05145542313f
We were scrolling to the edited section when we saved the page, and otherwise
reverting scroll position to the top if we just abandoned the edit. This
unifies these cases, so any section-edit which leaves the editor will scroll
to the section being edited. (If section==new and the edit is abandoned, it'll
scroll to the last section on the page.)
Bug: T194631
Change-Id: Ic2aca68b3127c435545644912b96212bcfa6648d
Cite's a08febb0afa2d changed the rules for adding the Cite button to the
toolbar – it now requires a placeholder slot in the toolbar, rather than
finding the link tool and adding itself after that. As ve.init.mw.Target
was updated for this it kept working on desktop, but MobileArticleTarget
completely overrides the toolbar, and was missed.
Bug: T195191
Change-Id: I55c9de9e736bb83f5f05028f2fc07af0ad996050
Pressing escape will close toolbar dialogs (find/symbols/etc) if they're open
instead of trying to teardown the editing surface.
Bug: T190068
Change-Id: I27080649392f17344c901269029368fa0b3c2963
Override #addSurface instead of #getSurfaceConfig, so that the
$overlayContainer option only applies to the "main" surface of the
Target rather than all of the surfaces (including those in
TargetWidgets).
Bug: T194433
Change-Id: I61c609e2d52814b4547fb5292a0bfb237c4c218f
Just generate the standard wiki skin markup for categories. Adjust linkcache to always know
whether links are hidden categories. (It previously knew *sometimes*,
depending on whether a MWCategoryWidget had interacted with that category.)
Make the save dialog preview use the same method as the bottom-of-editor preview.
Bug: T194092
Change-Id: I37fea15eaef0a5847f27ce41dd92370a4bf353b6
New changes:
14bcc9256 Give toolbars groups names
Local changes:
Give toolbars groups names
Also create an empty placeholder group for reference tools.
This allows targets to specify if they should show them.
Depends-On: Iccaf35cf941cb47ad55e8d98373461f5eaff5fed
Change-Id: I0bace5e5fe05f9c214d57a74c478b48a7dcaec3b
Pass through the current document when available, otherwise
assume the current surface's document.
Also add a getter for getPageName, so that can vary based
on the target document.
Bug: T193856
Change-Id: Ifdc951fdc6a43b924d102e3fcd7e59e52023757b
When the user is viewing the last stable revision of a page which has
newer unreviewed revisions, FlaggedRevs wants us to open the latest
(unreviewed) revision of the page for editing.
Use the JS config variable 'wgFlaggedRevsEditLatestRevision', provided
by FlaggedRevs since change I4c9804fe2c4924e28770807881379ddca4fd8b76.
Also add an extra comment about loading latest revisions in general.
Bug: T165283
Depends-On: I4c9804fe2c4924e28770807881379ddca4fd8b76
Change-Id: Ic47491e690153d0ad87ce64bfc9e7a28a06fc6e2
When we set up the new section title input and possibly set its value
(preloading from URL query, or from autosave), the "Save" button on
the toolbar must already exist, because we try to enable it.
Bug: T192901
Change-Id: I3bba86a8c8a9b81014d425db256ff49f06bdaea6
Ensures that auto-save data is cleared after
creating a new article, or restoring a revision.
Bug: T192770
Change-Id: I348b8522c1a935d7db1243ba8fcbd5b24e3383a2
These are not specific to desktop.
Also make the static builders static, and move VE target specific
code to caller, such as the click handler.
Change-Id: Ib7e769e3d6d339b9e66e1bc924480b0b0d5db17d