Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as RoosterJs from 'roosterjs';
let contentDiv = document.getElementById('contentDiv') as HTMLDivElement;
let editor = RoosterJs.createEditor(contentDiv);
onPluginEvent(event: PluginEvent) {
if (event.eventType == PluginEventType.KeyPress) {
let keyboardEvent = event.rawEvent;
if (keyboardEvent.which >= KEY_0 && keyboardEvent.which <= KEY_9) {
let text = NUMBERS[keyboardEvent.which - KEY_0] + ' ';
this.editor.insertContent(text);
keyboardEvent.preventDefault();
}
}
}
}
let contentDiv = document.getElementById('contentDiv') as HTMLDivElement;
let myPlugin = new MyPlugin();
let editor = createEditor(contentDiv, [myPlugin]);
import * as RoosterJs from 'roosterjs';
let contentDiv = document.getElementById('contentDiv') as HTMLDivElement;
let editor = RoosterJs.createEditor(contentDiv);