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 link = linkatpos();
 | 
				
			||||||
		var tag = tagatpos();
 | 
							var tag = tagatpos();
 | 
				
			||||||
 | 
							var word =  wordatpos();
 | 
				
			||||||
		if (link)
 | 
							if (link)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			loadnote(link);
 | 
								loadnote(link);
 | 
				
			||||||
| 
						 | 
					@ -950,6 +951,10 @@ function clickeditor()
 | 
				
			||||||
			searchinlist(tags[tag.toLowerCase()])
 | 
								searchinlist(tags[tag.toLowerCase()])
 | 
				
			||||||
			.then(loadnote);
 | 
								.then(loadnote);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							else if (word.startsWith("https://"))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								window.open(word, '_blank');
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1677,6 +1682,19 @@ function selectlines()
 | 
				
			||||||
	md.selectionEnd = range.end;
 | 
						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()
 | 
					function ontopbarclick()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (title.hidden)
 | 
						if (title.hidden)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue