traceability update 2.5.4d2

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2469883 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
pewgeuges 2021-02-06 01:57:25 +00:00
parent 6706ba811e
commit cee486702c
9 changed files with 849 additions and 551 deletions

View file

@ -15,15 +15,19 @@
textArea.val(textArea.val().substring(0, start) + replacement + textArea.val().substring(end, len));
}
/**
* adds a new button to the plain text editor
* adds a button to the Classic Editor text mode
*
* @edit 2.5.4d1 try to fix uncaught reference error of “QTags is not defined”
*
* @since 2.5.4d1 try to fix uncaught reference error of “QTags is not defined”
*
* @reporter @dpartridge
* @bugreport https://wordpress.org/support/topic/qtags-addbutton/
* @link https://wordpress.org/support/topic/qtags-addbutton/
*
*
* @link 2.5.4 correct label to singular
*/
if ( QTags ) {
QTags.addButton( 'MCI_Footnotes_QuickTag_button', 'footnotes', MCI_Footnotes_text_editor_callback );
QTags.addButton( 'MCI_Footnotes_QuickTag_button', 'footnote', MCI_Footnotes_text_editor_callback );
}
/**

View file

@ -1,63 +0,0 @@
<?php ?>
<script type="text/javascript">
/**
* adds a tag in at the beginning and at the end of a selected text in the specific text area
* @param string elementID
* @param string openTag
* @param string closeTag
*/
function MCI_Footnotes_wrapText(elementID, openTag, closeTag) {
var textArea = jQuery('#' + elementID);
var len = textArea.val().length;
var start = textArea[0].selectionStart;
var end = textArea[0].selectionEnd;
var selectedText = textArea.val().substring(start, end);
var replacement = openTag + selectedText + closeTag;
textArea.val(textArea.val().substring(0, start) + replacement + textArea.val().substring(end, len));
}
<?php
/**
* adds a new button to the plain text editor
*/
function load_footnotes_quicktag_inline() {
/**
* Adds a check to ensure the quicktags script is available
* preventing undefined error if no quicktags script
* @author Erica Franz
*/
if ( wp_script_is( 'quicktags' ) ) { ?>
// And now the footnotes button
QTags.addButton('MCI_Footnotes_QuickTag_button', 'footnotes', MCI_Footnotes_text_editor_callback);
<?php }
}
add_action( 'admin_print_footer_scripts', 'load_footnotes_quicktag_inline' );
?>
/**
* callback function when the button is clicked
* executes a ajax call to get the start and end tag for the footnotes and
* adds them in before and after the selected text
*/
function MCI_Footnotes_text_editor_callback() {
jQuery.ajax({
type: 'POST',
url: '/wp-admin/admin-ajax.php',
data: {
action: 'footnotes_getTags'
},
success: function (data, textStatus, XMLHttpRequest) {
var l_arr_Tags = JSON.parse(data);
MCI_Footnotes_wrapText("content", l_arr_Tags['start'], l_arr_Tags['end']);
},
error: function (MLHttpRequest, textStatus, errorThrown) {}
});
}
</script>
<?php ?>

View file

@ -1,46 +0,0 @@
note-for-developers.txt
2020-12-19T0609+0100
Last modified: 2021-01-04T1734+0100
Footnotes plugin for WordPress, v2.2.6 and later
Support for custom templates
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
Since v2.2.6, Footnotes supports custom templates.
Custom templates may be loaded from a sibling folder 'footnotes-custom'
or since v2.4.0 from a folder 'templates/footnotes/' in the active theme.
Priority order:
1. active theme
2. sibling folder
3. internal
See footnotes/class/template.php:67..116
A. Active theme
‾‾‾‾‾‾‾‾‾‾‾‾
Please create a folder 'templates/footnotes/' in your child theme and
store all your public custom templates for Footnotes directly therein.
Existing homonymous templates are loaded instead of their counterparts in
wp-content/plugins/footnotes/templates/public/.
B. Sibling folder
‾‾‾‾‾‾‾‾‾‾‾‾‾‾
Please make a sibling of the "footnotes" folder called 'footnotes-custom' and
the same internal structure and file names as 'footnotes/templates/public/'.
Example for custom tooltips:
footnotes-custom
└── templates
└── public
├── footnote.html
└── tooltip.html
The timing parameters in the inline jQuery script 'tooltip.html' are already
configurable in the dashboard > Referrers and tooltips > Tooltip timing.