clipboard: fix RTL location of tooltip #661

This commit is contained in:
Sören Weber 2023-10-01 13:48:56 +02:00
parent 9538593530
commit 032b2556de
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

@ -155,7 +155,7 @@ function restoreTabSelections() {
}
function initMermaid( update, attrs ) {
var doBeside = false;
var doBeside = true;
var isImageRtl = false;
// we are either in update or initialization mode;
@ -551,7 +551,6 @@ function initAnchorClipboard(){
}
function initCodeClipboard(){
var isCodeRtl = false;
function getCodeText( node ){
// if highlight shortcode is used in inline lineno mode, remove lineno nodes before generating text, otherwise it doesn't hurt
var code = node.cloneNode( true );
@ -603,13 +602,17 @@ function initCodeClipboard(){
clip.on( 'success', function( e ){
e.clearSelection();
var doBeside = e.trigger.parentNode.tagName.toLowerCase() == 'pre' || (e.trigger.previousElementSibling && e.trigger.previousElementSibling.tagName.toLowerCase() == 'table' );
var inPre = e.trigger.previousElementSibling && e.trigger.previousElementSibling.tagName.toLowerCase() == 'pre';
var isCodeRtl = !inPre ? isRtl : false;
var doBeside = inPre || (e.trigger.previousElementSibling && e.trigger.previousElementSibling.tagName.toLowerCase() == 'table' );
e.trigger.setAttribute( 'aria-label', window.T_Copied_to_clipboard );
e.trigger.classList.add( 'tooltipped', 'tooltipped-' + (doBeside ? 'w' : 's'+(isCodeRtl?'e':'w')) );
});
clip.on( 'error', function( e ){
var doBeside = e.trigger.parentNode.tagName.toLowerCase() == 'pre' || (e.trigger.previousElementSibling && e.trigger.previousElementSibling.tagName.toLowerCase() == 'table' );
var inPre = e.trigger.previousElementSibling && e.trigger.previousElementSibling.tagName.toLowerCase() == 'pre';
var isCodeRtl = !inPre ? isRtl : false;
var doBeside = inPre || (e.trigger.previousElementSibling && e.trigger.previousElementSibling.tagName.toLowerCase() == 'table' );
e.trigger.setAttribute( 'aria-label', fallbackMessage(e.action) );
e.trigger.classList.add( 'tooltipped', 'tooltipped-' + (doBeside ? 'w' : 's'+(isCodeRtl?'e':'w')) );
var f = function(){