Add insertText to WebContents
This commit is contained in:
parent
5567baf335
commit
5b7d1a9890
6 changed files with 44 additions and 2 deletions
|
@ -1,3 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
var EventEmitter, Menu, NavigationController, PDFPageSize, binding, deprecate, getNextId, ipcMain, nextId, ref, session, wrapWebContents,
|
||||
slice = [].slice;
|
||||
|
||||
|
@ -53,6 +55,11 @@ PDFPageSize = {
|
|||
}
|
||||
};
|
||||
|
||||
// Following methods are mapped to webFrame.
|
||||
const webFrameMethods = [
|
||||
'insertText',
|
||||
];
|
||||
|
||||
wrapWebContents = function(webContents) {
|
||||
|
||||
/* webContents is an EventEmitter. */
|
||||
|
@ -95,6 +102,14 @@ wrapWebContents = function(webContents) {
|
|||
}
|
||||
}
|
||||
|
||||
// Mapping webFrame methods.
|
||||
for (let method of webFrameMethods) {
|
||||
webContents[method] = function() {
|
||||
let args = Array.prototype.slice.call(arguments);
|
||||
this.send('ELECTRON_INTERNAL_RENDERER_WEB_FRAME_METHOD', method, args);
|
||||
};
|
||||
}
|
||||
|
||||
/* Dispatch IPC messages to the ipc module. */
|
||||
webContents.on('ipc-message', function(event, packed) {
|
||||
var args, channel;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue