Skip to content

Commit

Permalink
Add heroku link
Browse files Browse the repository at this point in the history
  • Loading branch information
interdoc committed Oct 5, 2019
1 parent 6737dd6 commit 141d579
Showing 1 changed file with 22 additions and 35 deletions.
57 changes: 22 additions & 35 deletions docs/usage.rst
Expand Up @@ -2,13 +2,7 @@
Usage
=====

Hello world.




How to use the project.

You can edit this page to improve the documentation. Just click on the text you want to edit. Then find your pull request `on GitHub <https://github.com/metatooling/interdoc/pulls>`__.

.. raw:: html

Expand All @@ -17,33 +11,26 @@ How to use the project.
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/medium-editor@latest/dist/css/medium-editor.min.css" type="text/css" media="screen" charset="utf-8">

<script>
var editor = new MediumEditor('body p', {
toolbar: {
buttons: ['b', 'h2', 'warning', 'pop']
},
extensions: {
// compact
'b': new MediumButton({label:'BOLD', start:'<b>', end:'</b>'}),
'h2': new MediumButton({label:'h2', start:'<h2>', end:'</h2>'}),
// expanded
'warning': new MediumButton({
label: '<i class="fa fa-exclamation-triangle"></i>',
start: '<div class="warning">',
end: '</div>'
}),
// with JavaScript
'pop': new MediumButton({
label:'POP',
action: function(html, mark, parent){
alert(html)
return html
}
})
}
})
var editor = new MediumEditor('body p');
editor.subscribe('focus', function(data, editable) { if (!editable.hasAttribute('data-original')) {
editable.dataset.original = editable.innerText};
});
editor.subscribe('blur', function(data, editable) {
index = editable.dataset.mediumEditorEditorIndex;
var xhr = new XMLHttpRequest();
xhr.open("POST", 'https://cors-anywhere.herokuapp.com/https://sleepy-harbor-00552.herokuapp.com/', true);
xhr.setRequestHeader('Content-Type', 'application/json');
data = {
index: index,
old_html: editable.dataset.original,
new_html: editable.innerHTML,
rendered_html_url: document.URL,
rendered_rst_url: document.evaluate('//a[@class="fa fa-github"]', document, null, XPathResult.ANY_TYPE, null).iterateNext().href
};
console.log(data);
xhr.send(JSON.stringify(data))});
</script>

0 comments on commit 141d579

Please sign in to comment.