mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	provide context menu in text editor also with disabled spellcheck
This commit is contained in:
		
							parent
							
								
									3cf3fc13b9
								
							
						
					
					
						commit
						3386dace3b
					
				
							
								
								
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "trilium",
 | 
			
		||||
  "version": "0.39.3",
 | 
			
		||||
  "version": "0.39.5",
 | 
			
		||||
  "lockfileVersion": 1,
 | 
			
		||||
  "requires": true,
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
 | 
			
		||||
@ -6,7 +6,7 @@ const TPL = `
 | 
			
		||||
<div>
 | 
			
		||||
    <h4>Spell check</h4>
 | 
			
		||||
 | 
			
		||||
    <p>These options apply only for desktop builds, browsers will use their own native spell check.</p>
 | 
			
		||||
    <p>These options apply only for desktop builds, browsers will use their own native spell check. App restart is required after change.</p>
 | 
			
		||||
 | 
			
		||||
    <div class="custom-control custom-checkbox">
 | 
			
		||||
        <input type="checkbox" class="custom-control-input" id="spell-check-enabled">
 | 
			
		||||
 | 
			
		||||
@ -3,15 +3,16 @@ import optionsService from "./options.js";
 | 
			
		||||
export async function initSpellCheck() {
 | 
			
		||||
    const options = await optionsService.waitForOptions();
 | 
			
		||||
 | 
			
		||||
    if (!options.is('spellCheckEnabled')) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const {SpellCheckHandler, ContextMenuListener, ContextMenuBuilder} = require('electron-spellchecker');
 | 
			
		||||
    const {remote, shell} = require('electron');
 | 
			
		||||
 | 
			
		||||
    const spellCheckHandler = new SpellCheckHandler();
 | 
			
		||||
 | 
			
		||||
    // not fully disabling the spellcheck since we want to preserve the context menu
 | 
			
		||||
    // this will just get rid of the "red squiggles"
 | 
			
		||||
    if (options.is('spellCheckEnabled')) {
 | 
			
		||||
        spellCheckHandler.attachToInput();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    spellCheckHandler.switchLanguage(options.get('spellCheckLanguageCode'));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -9,7 +9,7 @@
 | 
			
		||||
                </button>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="modal-body">
 | 
			
		||||
                <table class="table">
 | 
			
		||||
                <table class="table table-borderless">
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <th>Homepage:</th>
 | 
			
		||||
                        <td><a href="https://github.com/zadam/trilium" class="external">https://github.com/zadam/trilium</a></td>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user