Squash merge branch linting

This commit is contained in:
Ben Goldsworthy 2021-04-26 17:15:48 +01:00
parent 0c7c0d155b
commit c8950e6d1a
35 changed files with 15883 additions and 1769 deletions

View file

@ -4,8 +4,11 @@
* Edit: be careful to maintain version number near EOF
*/
/*eslint-disable no-undef */
(function () {
tinymce.create('tinymce.plugins.Footnotes', {
/*eslint-enable no-undef */
/*eslint-disable jsdoc/no-undefined-types */
/**
* Initializes the plugin, this will be executed after the plugin has been created.
* This call is done before the editor instance has finished its initialization so use the onInit event
@ -14,7 +17,8 @@
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
* @param {string} url Absolute URL to where the plugin is located.
*/
init: function (ed, url) {
init: (ed, url) => {
/*eslint-enable jsdoc/no-undefined-types */
ed.addButton('footnotes', {
title: 'footnotes',
cmd: 'footnotes',
@ -28,43 +32,33 @@
data: {
action: 'footnotes_getTags',
},
success: function (data, textStatus, XMLHttpRequest) {
var tags = JSON.parse(data);
var returnText = tags.start + ed.selection.getContent() + tags.end;
ed.execCommand('insertHTML', true, returnText);
success: (data) => {
const tags = JSON.parse(data);
const returnText = tags.start + ed.selection.getContent() + tags.end;
ed.insertContent(returnText);
},
error: function (MLHttpRequest, textStatus, errorThrown) {
console.log('Error: ' + errorThrown);
/*eslint-disable no-unused-vars */
error: (XMLHttpRequest, textStatus, errorThrown) => {
/*eslint-enable no-unused-vars */
/*eslint-disable no-console */
console.error('Error: ' + errorThrown);
/*eslint-enable no-console */
},
});
});
},
/**
* Creates control instances based on the incoming name. This method is normally not
* needed since the addButton method of the tinymce.Editor class is an easier way of adding buttons,
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this
* method can be used to create those.
*
* @param {String} n Name of the control to create.
* @param {tinymce.ControlManager} cm Control manager to use in order to create new control.
* @return {tinymce.ui.Control} New control instance or null if no control was created.
*/
createControl: function (n, cm) {
return null;
},
/**
* Returns information about the plugin as a name/value array.
* The current keys are longname, author, authorurl, infourl and version.
*
* @return {Object} Name/value array containing information about the plugin.
* @return {Object} Information about the Plugin.
*
* Edit: needs updating the version number manually
*/
getInfo: function () {
getInfo: () => {
return {
longname: 'Inserts the Footnotes short code.',
longname: 'footnotes',
author: 'Mark Cheret',
authorurl: 'https://cheret.org/footnotes/',
infourl: 'https://wordpress.org/plugins/footnotes/',
@ -73,6 +67,8 @@
},
});
/*eslint-disable no-undef */
// Register plugin
tinymce.PluginManager.add('footnotes', tinymce.plugins.Footnotes);
/*eslint-enable no-undef */
})();