Jump to content
Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
If you make an edit, a temporary account will be created for you.

MediaWiki:Gadget-PreloadEditor.js: Difference between revisions

MediaWiki interface page
ReisuDesign (talk | contribs)
No edit summary
ReisuDesign (talk | contribs)
No edit summary
Line 41: Line 41:
             });
             });


             const page = response?.query?.pages?.[0];
             const page =
    response &&
    response.query &&
    response.query.pages &&
    response.query.pages[0];
             if (!page || page.missing) return null;
             if (!page || page.missing) return null;


Line 442: Line 446:
                     .prop(
                     .prop(
                         'selected',
                         'selected',
                         String(option.value) === String(value ?? '')
                         String(option.value) === String(value === undefined ? '' : value)
                     )
                     )
                     .appendTo(select);
                     .appendTo(select);
Line 477: Line 481:


         getEditorContent() {
         getEditorContent() {
             if (this.editorView?.state) {
             if (this.editorView && this.editorView.state) {
                 return this.editorView.state.doc.toString();
                 return this.editorView.state.doc.toString();
             }
             }
Line 658: Line 662:
             const variables = new Set(['PAGE']);
             const variables = new Set(['PAGE']);


             if (this.analysis?.variables) {
             if (this.analysis && this.analysis.variables) {
                 this.analysis.variables.forEach(name => {
                 this.analysis.variables.forEach(name => {
                     variables.add(String(name).toUpperCase());
                     variables.add(String(name).toUpperCase());
Line 2,140: Line 2,144:


             const excludeCategory = this.textInput(
             const excludeCategory = this.textInput(
                 field.exclude?.category || ''
                 field.exclude && field.exclude.category || ''
             );
             );