experimenting with editors...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-10-05 20:44:25 +03:00
parent 473fe85d0f
commit 17a159f310
2 changed files with 39 additions and 0 deletions

View File

@ -84,6 +84,7 @@ function(elem){
.forEach(function(text){ .forEach(function(text){
// skip stuff... // skip stuff...
if(text.parentNode.nodeName.toLowerCase() == 'a' if(text.parentNode.nodeName.toLowerCase() == 'a'
|| text.parentNode.nodeName.toLowerCase() == 'script'
|| (text.parentNode.getAttribute('wikiwords') ?? '').toLowerCase() == 'no'){ || (text.parentNode.getAttribute('wikiwords') ?? '').toLowerCase() == 'no'){
return } return }
var t = text.nodeValue var t = text.nodeValue

View File

@ -22,6 +22,40 @@
<link rel="stylesheet" href="css/fonts.css"> <link rel="stylesheet" href="css/fonts.css">
<!-- MediumEditor -->
<!--link rel="stylesheet" href="experiments/medium-editor/css/medium-editor.css">
<link rel="stylesheet" href="experiments/medium-editor/css/themes/default.css">
<script src="ext-lib/showdown.min.js"></script>
<script src="experiments/medium-editor/js/medium-editor.js"></script>
<script src="experiments/medium-editor/js/me-markdown.standalone.js"></script>
<script>
var setupMediumEditor = async function () {
var editorelem = document.querySelector('.medium-editor')
if(editorelem){
console.log('MediumEditor: setup...')
var page = pwiki.get('..')
// load the initial state...
var converter = new showdown.Converter()
editorelem.innerHTML = converter.makeHtml(await page.raw)
var elem = document.querySelector('.medium-markdown')
editor = new MediumEditor(editorelem, {
extensions: {
markdown: new MeMarkdown(function(code) {
saveContent(page.path, code)
// XXX DEBUG...
elem
&& (elem.textContent = code) }) } }) } }
</script-->
<!-- MediumEditor -->
<!-- ToastUIEditor -->
<!-- ToastUIEditor -->
</head> </head>
<style> <style>
@ -320,6 +354,10 @@ require(['./browser'], function(browser){
&& this.dom && this.dom
.querySelector('#'+ this.hash) .querySelector('#'+ this.hash)
.scrollIntoView() .scrollIntoView()
// XXX MediumEditor...
//setupMediumEditor()
// handle refresh... // handle refresh...
// NOTE: we need to do this as hashchange is only triggered // NOTE: we need to do this as hashchange is only triggered
// when the hash is actually changed... // when the hash is actually changed...