Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
initHackmdWithPenpal() {
const _this = this; // for in methods scope
const iframe = document.createElement('iframe');
iframe.src = `${this.props.hackmdUri}/${this.props.pageIdOnHackmd}?both`;
this.iframeContainer.appendChild(iframe);
const connection = connectToChild({
iframe,
methods: { // expose methods to HackMD
notifyBodyChanges(document) {
_this.notifyBodyChangesHandler(document);
},
saveWithShortcut(document) {
_this.saveWithShortcutHandler(document);
},
},
debug: DEBUG_PENPAL,
});
connection.promise.then((child) => {
this.hackmd = child;
if (this.props.initializationMarkdown != null) {
child.setValueOnInit(this.props.initializationMarkdown);
}