MediaWiki:Gadget-PreloadEditor.js: Difference between revisions
MediaWiki interface page
More actions
ReisuDesign (talk | contribs) No edit summary |
ReisuDesign (talk | contribs) No edit summary |
||
| Line 41: | Line 41: | ||
}); | }); | ||
const page = response | 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 | 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 | 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 | field.exclude && field.exclude.category || '' | ||
); | ); | ||