added: ctrl+click to open extrenal links
This commit is contained in:
		
							parent
							
								
									b174f7b727
								
							
						
					
					
						commit
						3afea22f9d
					
				
							
								
								
									
										18
									
								
								main.js
								
								
								
								
							
							
						
						
									
										18
									
								
								main.js
								
								
								
								
							| 
						 | 
				
			
			@ -940,6 +940,7 @@ function clickeditor()
 | 
			
		|||
	{
 | 
			
		||||
		var link = linkatpos();
 | 
			
		||||
		var tag = tagatpos();
 | 
			
		||||
		var word =  wordatpos();
 | 
			
		||||
		if (link)
 | 
			
		||||
		{
 | 
			
		||||
			loadnote(link);
 | 
			
		||||
| 
						 | 
				
			
			@ -950,6 +951,10 @@ function clickeditor()
 | 
			
		|||
			searchinlist(tags[tag.toLowerCase()])
 | 
			
		||||
			.then(loadnote);
 | 
			
		||||
		}
 | 
			
		||||
		else if (word.startsWith("https://"))
 | 
			
		||||
		{
 | 
			
		||||
			window.open(word, '_blank');
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1677,6 +1682,19 @@ function selectlines()
 | 
			
		|||
	md.selectionEnd = range.end;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function wordatpos()
 | 
			
		||||
{
 | 
			
		||||
	var words = md.value.split(/\s/);
 | 
			
		||||
    var i = 0;
 | 
			
		||||
    var word = "";
 | 
			
		||||
	while (i < md.selectionStart)
 | 
			
		||||
    {
 | 
			
		||||
		word = words.shift();
 | 
			
		||||
        i += word.length + 1;
 | 
			
		||||
	}
 | 
			
		||||
	return word;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function ontopbarclick()
 | 
			
		||||
{
 | 
			
		||||
	if (title.hidden)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue