mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
clipboard: ignore RTL for code #660
This commit is contained in:
parent
394ff3f7b2
commit
67264dba47
1 changed files with 4 additions and 3 deletions
|
@ -551,6 +551,7 @@ 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 );
|
||||
|
@ -604,16 +605,16 @@ function initCodeClipboard(){
|
|||
e.clearSelection();
|
||||
var doBeside = e.trigger.parentNode.tagName.toLowerCase() == 'pre' || (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'+(isRtl?'e':'w')) );
|
||||
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' );
|
||||
e.trigger.setAttribute( 'aria-label', fallbackMessage(e.action) );
|
||||
e.trigger.classList.add( 'tooltipped', 'tooltipped-' + (doBeside ? 'w' : 's'+(isRtl?'e':'w')) );
|
||||
e.trigger.classList.add( 'tooltipped', 'tooltipped-' + (doBeside ? 'w' : 's'+(isCodeRtl?'e':'w')) );
|
||||
var f = function(){
|
||||
e.trigger.setAttribute( 'aria-label', window.T_Copied_to_clipboard );
|
||||
e.trigger.classList.add( 'tooltipped', 'tooltipped-' + (doBeside ? 'w' : 's'+(isRtl?'e':'w')) );
|
||||
e.trigger.classList.add( 'tooltipped', 'tooltipped-' + (doBeside ? 'w' : 's'+(isCodeRtl?'e':'w')) );
|
||||
document.removeEventListener( 'copy', f );
|
||||
};
|
||||
document.addEventListener( 'copy', f );
|
||||
|
|
Loading…
Reference in a new issue