User talk:BrandonXLF/QuickEdit

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Suggestions[edit]

@BrandonXLF: I love the script but it does conflict with User:Uziel302/typo.js. I'd also like an 'Insert' dropdown menu below the editing screen just with very common characters like these:

J947(c), at 22:55, 7 February 2020 (UTC)[reply]

@J947: I'll see what I can do for the dropdown, there may also be other things and symbols I might want to use from the editor. In what way does it conflict with User:Uziel302/typo.js? Is it just because it adds a link beside the edit link?BrandonXLF (talk) 02:00, 13 February 2020 (UTC)[reply]
@BrandonXLF: From memory User:Uziel302/typo.js makes it so there is no edit links on CTI1C pages. However, QuickEdit still shows alongside the links produced by the other script. Can't really describe it in detail as currently there is nothing on CTI1C pages and it doesn't work on old revisions. J947(c), at 23:07, 13 February 2020 (UTC)[reply]

Add [quickedit] to the top section[edit]

Hello, I really like the script you made. But is it possible to add [quickedit] to the page title? So we can edit the top section of the page. thanks. --Hidayatsrf (talk) 05:51, 27 July 2020 (UTC)[reply]

Sorry, it turns out that my top-edit gadget is not activated in my preferences. Now it can be displayed. Btw. thank you for making this great script! Have a nice day.. --Hidayatsrf (talk) 06:00, 27 July 2020 (UTC)[reply]

Quick edit adds section number to edit summary[edit]

@BrandonXLF, I have the Mediawiki function to "Auto number headings" on. However when I edit a section, this also puts the section number in the edit summary, when it shouldn't. E.g. this edit, where it should've just linked "Suggestion", it instead linked "13 suggestion". Is it possible for this to be fixed, or should I just turn off auto number headings? — Yours, Berrely • TalkContribs 17:16, 7 March 2021 (UTC)[reply]

Berrely, should be fixed now. The section name is now taken from the wikitext itself instead of the heading. BrandonXLF (talk) 20:31, 7 March 2021 (UTC)[reply]

Quick edit has a weird bug with the reply tool in beta[edit]

@BrandonXLF: I found a strange bug when this is enabled with the reply tool, which is in beta. If both your script and the beta tool is enabled at the same time, then every time you type a few letters with the reply tool, another "quick edit" link will show up next to the original link. This can continue basically infinitely, so for example, for this new section, about 140 "quick edit" links showed up in the preceding section. Epicgenius (talk) 15:05, 3 May 2021 (UTC)[reply]

@Epicgenius:  Fixed BrandonXLF (talk) 15:30, 3 May 2021 (UTC)[reply]

Suggestion: shortcut to publish[edit]

ctrlenter or ctrlS or ... — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚  01:03, 23 June 2021 (UTC)[reply]

@Guarapiranga I've made it so if you press enter while in the edit summary, the form is submitted. This seems reasonable since this is how the wikitext editor does it. BrandonXLF (talk) 17:42, 16 July 2021 (UTC)[reply]
Thumbs up icon Thank you. — Guarapiranga  00:19, 18 July 2021 (UTC)[reply]

Divider disappeared from all the menus[edit]

@BrandonXLF: Hi, this change resulted in the divider before the "quick edit" item disappearing from all the menus for me. It seems like the culprit is this CSS:

[...] .ve-not-available .mw-editsection-divider [...] {
  display: none;
}

but actually I don't even see "|" character in the menus. The DOM I have is

<span class="mw-editsection-divider quickedit-section"></span><a class="quickedit-section quickedit-editlink">quick edit</a>

Jack who built the house (talk) 17:21, 12 August 2021 (UTC)[reply]

Yeah I accidently removed the | symbol. I was trying to fix the divider for the timeless skin, but I guess adding that class isn't an option. BrandonXLF (talk) 18:26, 12 August 2021 (UTC)[reply]
Ah right, looked quickly, didn't see the removal either. I thought it's some weird magic VisualEditor does :-D Jack who built the house (talk) 18:28, 12 August 2021 (UTC)[reply]

User should confirm losing changes[edit]

And since I'm here, I've always wanted the script to warn me when I'm about to close a quick edit form with changes made. If I'm editing a section and then click to to edit another, the previous edit form gets closed even if there were edits made in it. They get lost.

Also some kind of integration with other user scripts, including my Convenient Discussions, on that part would be nice. Not sure how this can look like, but maybe firing an event using mw.hook('quickedit.edit').fire(some_representation_of_section, callback_to_edit), then checking the contents of some variable... Just a scratch:

// QuickEdit
mw.hook('quickedit.edit').fire(sectionId, openEdit);
if (window.quickEditWaitForConfirmation) {
  window.quickEditWaitForConfirmation = false;
  return;
} else {
  openEdit();
}

// Convenient Discussions
mw.hook('quickedit.edit').add((sectionId, openEdit) => {
  if (areThereCommentForms(sectionId)) {
    window.quickEditWaitForConfirmation = true;
    if (confirm('Do you want to close the CD comment form and open a QuickEdit edit form? The changes will be lost.')) {
      openEdit();
    }
  }
});

Jack who built the house (talk) 17:46, 12 August 2021 (UTC)[reply]

I think I'm going to change it so you can edit multiple sections at once. As for the hook, I think might do something along the lines of a quickedit.discardSection for when the HTML of a section is being discarded, either because the entire page is being replaced with new HTML or because an editor is opened in a section, BrandonXLF (talk) 06:50, 15 August 2021 (UTC)[reply]

"Minor edit" checkbox is unhandy[edit]

I would suggest moving the "Minor edit" checkbox under the summary field even if it eats some space. A well-developed habit of wiki users, I believe, is to look for that checkbox under the summary field. I find myself forgetting to check that box just because my semi-automatic thinking when making an edit ignores its existence. And even if I remember about it, it's a long way to move the mouse to at the right side of the screen. Jack who built the house (talk) 17:52, 12 August 2021 (UTC)[reply]

I don't know about adding a dedicated row just for the minor edit checkbox. Maybe something like the new DiscussionTools where the label for the summary is moved above it and the watch page checkbox is on the same line could work? Anyways, instead of moving your mouse you can always use tab when in the summary box to move to checkbox, but I guess that's not all that intuitive. BrandonXLF (talk) 06:54, 15 August 2021 (UTC)[reply]
instead of moving your mouse you can always use tab when in the summary box to move to checkbox
Note that currently pressing Enter doesn't submit the form if the focus is on the checkbox (unlike in the standard editing interface). Jack who built the house (talk) 20:44, 19 September 2021 (UTC)[reply]

Possible implementation of the toolbar[edit]

How the result looks in CD

Oh, and if you ever think "OK, our tool is lightweight, but damn, that toolbar button would be useful, maybe adding just a bit of the standard toolbar wouldn't break things much?", you can implement the toolbar quite easily like I do in Convenient Discussions, see the code. Probably you won't need the most of it; feel free to consult. Jack who built the house (talk) 22:22, 14 August 2021 (UTC)[reply]

Yeah I'll add it, I'm surprised how easy it is. I would also like to try to get code mirror to work while I'm at it. BrandonXLF (talk) 07:07, 15 August 2021 (UTC)[reply]
As for CodeMirror integration—there were problems with that in 2019, but they could be resolved by now, see phab:T214989. Jack who built the house (talk) 05:46, 17 August 2021 (UTC)[reply]

Using QuickEdit for the whole page[edit]

Hey, just a quick idea: would it be feasible for this script to add a page tab through which you could edit entire pages through the script? It is a real help (thank you again for it!), but you cannot use it on small pages without any sections (for example, for most MediaWiki interface messages or category pages). It could go either into ‘More’ menu in Vector or next to #ca-edit, whatever you think is best. If needed, you can limit it by mw.config.get( 'wgPageContentModel' ) === 'wikitext'. stjn 19:08, 15 August 2021 (UTC)[reply]

Autocomplete in summary field[edit]

Hello, i have a suggestion to add an id attribute (e.g. "wpSummary") to the summary field, which will enable history autocomplete. Thanks. Serhio Magpie (talk) 04:36, 22 August 2021 (UTC)[reply]

Script should update wgRevisionId config value[edit]

Hi, I believe the script should set the wgRevisionId and wgCurRevisionId config values after rendering the new page content like DiscussionTools or my Convenient Discussions do. The fact that your script doesn't do this leads to issues like this in CD: I saved a comment using QuickEdit, but then CD notified my about a new comment in the thread... that can already be seen above the notification. This happens because CD doesn't know that the revision that is currently rendered is the latest revision, not the old one.

You do

api('get', {
	action: 'parse',
	page: mw.config.get('wgPageName'),
	prop: ['text', 'categorieshtml']
})

I suggest you to request also revid, modules, and jsconfigvars.

Why also modules and jsconfigvars? Because this way, if the user added some wikitext that requires loading some additional modules (for example, syntax highlighting with the <syntaxhighlight>...</syntaxhighlight> tags), you will be able to load them.

So, you can write prop: ['text', 'categorieshtml', 'revid', 'modules', 'jsconfigvars'] and then do

var parse = r.parse;
mw.config.set({
  wgRevisionId: parse.revid,
  wgCurRevisionId: parse.revid,
});
mw.loader.load(parse.modules);
mw.loader.load(parse.modulestyles);

All the best, Jack who built the house (talk) 21:45, 4 September 2021 (UTC)[reply]

Last section on eswiki can't be edited[edit]

I don't use your script (while I like it it's redundant for me) but I stumbled upon an issue while testing for conflicts: your script does not work for last sections on eswiki due to w:es:MediaWiki:Common.js#L-395. Alexis Jazz (talk or ping me) 03:44, 4 May 2022 (UTC)[reply]

BrandonXLF, huh, I forgot to ping. Anyway, in addition to the above, QuickEdit breaks or causes other things to break when there are collapsible sections. When QuickEdit is used on the mobile site, strange things happen as the QuickEdit link doesn't stop the section from collapsing. When collapsible sections are enabled in User:Alexis Jazz/Bawl, QuickEdit breaks. Your script requires a click event to propagate all the way up to <body>. Changing body.on('click', clickHandler); to $('.mw-editsection').on('click', clickHandler); seems to fix it. Alexis Jazz (talk or ping me) 22:49, 10 May 2022 (UTC)[reply]

Support for non-existing pages[edit]

I’ve recently written a script that allows me to use QuickEdit on any page, even without any sections available (via ‘edit top’ functionality that QuickEdit supports right now). But it obviously fails for pages in MediaWiki namespace that technically don’t exist yet on a wiki like this:

jQuery.Deferred exception: res.query.pages[res.query.pageids[0]].revisions is undefined getPageInfo/<@https://en.wikipedia.org/w/index.php?title=User:BrandonXLF/QuickEdit.js&action=raw&ctype=text/javascript:43:14

I’ve not found an API request that would pull the correct text for these pages, but I thought it might be something good to write about in case someone else might find it. stjn 15:32, 14 September 2022 (UTC)[reply]

Stjn, thanks for the inspiration: User:Alexis Jazz/Factotum.js (Diff 1111940769).Alexis Jazz (talk or ping me) 20:20, 23 September 2022 (UTC)[reply]

Customization of the edit link[edit]

Is there a way to change the edit link of "quick edit" to something else i.e. '✏' in your personal js? Asking as I'm not the most experienced in js and it does't look as great on FANDOM wiki's

- Thanks, CK 2601:282:117F:4200:5DD8:25E2:6156:BC19 (talk) 17:43, 18 September 2022 (UTC)[reply]

Hotkeys[edit]

@BrandonXLF: I think the script should have some convenient hotkeys, like hotkey for saving, or to tick on minor edit checkbox. Plantaest (talk) 02:03, 11 December 2022 (UTC)[reply]

The script should fire the wikipage.content hook on the preview[edit]

Without that, quotations and similar elements are missing from the preview in English Wiktionary. Jack who built the house (talk) 02:29, 5 August 2023 (UTC)[reply]

Summary preview[edit]

The text can be previewed, but not the edit summary. That would be helpful because you aren't always sure you haven't messed up the markup there. Jack who built the house (talk) 02:30, 5 August 2023 (UTC)[reply]

Edit summary has no section if the section has a translation marker or HTML comment[edit]

  1. Quick-edit mw:Help:CirrusSearch#Substitutions for some metacharacters.
  2. Check the summary.

Expected: the section name is there.
Actual: no section name is there. Jack who built the house (talk) 10:03, 9 August 2023 (UTC)[reply]