Posting will work.
But what about local storage?
<script>
function everySecond () {
var s = $("#idEditor").html ();
if (s != localStorage.mediumEditorText) {
localStorage.mediumEditorText = s;
console.log ("everySecond: saved " + s.length + " chars in localStorage.mediumEditorText.");
}
}
function startup () {
console.log ("startup");
if (localStorage.mediumEditorText === undefined) {
localStorage.mediumEditorText = "";
}
$("#idEditor").html (localStorage.mediumEditorText);
var editorBody = new MediumEditor (".divEditor", {
placeholder: {
text: "This is a good place to tell your story..."
},
toolbar: {
buttons: ["bold", "italic", "underline", "strikethrough", "anchor", "h2", "h3", "orderedlist", "unorderedlist", "quote"],
},
buttonLabels: "fontawesome"
});
self.setInterval (everySecond, 1000);
}
</script>
And You HTML:
<div class="divPageBody">
<div class="divEditor" id="idEditor">
</div>
<div class="divBelowEditor">
<h3>Hello World for medium-editor</h3>
<p>When I was getting started with <a href="https://github.com/yabwe/medium-editor">medium-editor</a>, what I wanted more than anything was a simple Hello World type app, that was a functional editor and nothing more. That's what this app is.</p>
<p>It stores your text in localStorage. Select text to style it. Try adding a link. Drag a small picture into the text. It saves automatically.</p>
<p><a href="https://scripting.com/2015/07/24/mywordEditorGetsMoreBeautiful.html">Dave Winer</a>, July 26, 2015.</p>
</div>
</div>
<script>
$(document).ready (function () {
startup ();
});
</script>