Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove electron-remote to fix support on Electron 5+ #170

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 26 additions & 22 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,30 @@ <h3>Type some text!</h3>
<img height="33%"
src="http://pixel.nymag.com/imgs/daily/following/2016/05/12/12376681_1063072477089016_3145722177588178860_n.nocrop.w536.h2147483647.2x.jpg" />
</div>
</div>

<script>
import SpellCheckHandler from '../src/spell-check-handler';
import ContextMenuListener from '../src/context-menu-listener';
import ContextMenuBuilder from '../src/context-menu-builder';

window.spellCheckHandler = new SpellCheckHandler();
window.spellCheckHandler.attachToInput();
window.spellCheckHandler.currentSpellcheckerChanged.subscribe(() => {
document.getElementById('detectedLang').innerText = `Current language is ${window.spellCheckHandler.currentSpellcheckerLanguage}`;
});

window.spellCheckHandler.provideHintText('This is probably the language that you want to check in');
window.spellCheckHandler.autoUnloadDictionariesOnBlur();

let contextMenuBuilder = new ContextMenuBuilder(window.spellCheckHandler);
let contextMenuListener = new ContextMenuListener(async (info) => {
await contextMenuBuilder.showPopupMenu(info);
});
</script>
</body>

<script>
const {remote} = require('electron')
const SpellCheckHandler = require("../src/spell-check-handler");
const ContextMenuBuilder = require("../src/context-menu-builder");

window.spellCheckHandler = new SpellCheckHandler();
window.spellCheckHandler.attachToInput();
window.spellCheckHandler.currentSpellcheckerChanged.subscribe(() => {
document.getElementById(
"detectedLang"
).innerText = `Current language is ${window.spellCheckHandler.currentSpellcheckerLanguage}`;
});

window.spellCheckHandler.provideHintText(
"This is probably the language that you want to check in"
);
window.spellCheckHandler.autoUnloadDictionariesOnBlur();

let contextMenuBuilder = new ContextMenuBuilder(window.spellCheckHandler);

remote.getCurrentWebContents().addEventListener('context-menu', async (event, info) => {
await contextMenuBuilder.showPopupMenu(info);
});
</script>
</body>
</html>
5 changes: 4 additions & 1 deletion example/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ app.on('window-all-closed', () => {
app.on('ready', () => {
mainWindow = new BrowserWindow({
width: 580,
height: 365
height: 365,
webPreferences: {
nodeIntegration: true
}
});

mainWindow.loadURL(`file://${__dirname}/index.html`);
Expand Down
Loading