Skip to content

Commit

Permalink
Merge pull request #11 from Banno/bubble-input-on-submit
Browse files Browse the repository at this point in the history
Bubble input event to notify of changes to the content
  • Loading branch information
rjpepmeyer authored Dec 10, 2019
2 parents 4f3aec9 + e5a89c2 commit 4344db1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plugins/codemirror/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ tinymce.PluginManager.add('codemirror', function(editor, url) {
//scroll to top of page
scrollTo(0, 0);

const sourceEditorTargetContent = editor.contentDocument;
var config = {
title: 'HTML source code',
url: url + '/source.html',
Expand All @@ -43,6 +44,10 @@ tinymce.PluginManager.add('codemirror', function(editor, url) {
buttons: [
{ text: 'Ok', subtype: 'primary', onclick: function(){
var doc = document.querySelectorAll('.mce-container-body>iframe')[0];
sourceEditorTargetContent.dispatchEvent(new Event('input', {
bubbles: true,
details: doc
}));
doc.contentWindow.submit();
win.close();
}},
Expand Down

0 comments on commit 4344db1

Please sign in to comment.