simplifying theme layout
This commit is contained in:
parent
27cf36c390
commit
995e75d3e2
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{% block title %}TTFROG{% endblock %}</title>
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='site.css' ) }}">
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='froghat.css' ) }}">
|
||||
{% block styles %}
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
|
@ -22,9 +22,9 @@
|
|||
<div class='content'>
|
||||
<main>
|
||||
{% for message in g.messages %}
|
||||
<div class="alert">
|
||||
<article class="alert">
|
||||
{{ message }}
|
||||
</div>
|
||||
</article>
|
||||
{% endfor %}
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
|
|
@ -36,7 +36,6 @@
|
|||
{% endblock %}
|
||||
</footer>
|
||||
|
||||
<script src="{{ url_for('static', filename='site.js') }}"></script>
|
||||
{% block scripts %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@
|
|||
|
||||
{% block scripts %}
|
||||
<!-- for converting markdown to html -->
|
||||
<script src="{{ url_for('static', filename='editor/purify.min.js' ) }}"></script>
|
||||
<script src="{{ url_for('static', filename='editor/marked.umd.min.js' ) }}"></script>
|
||||
<script src="{{ url_for('static', filename='editor/froghat.js' ) }}"></script>
|
||||
<script src="{{ url_for('static', filename='purify.min.js' ) }}"></script>
|
||||
<script src="{{ url_for('static', filename='marked.umd.min.js' ) }}"></script>
|
||||
<script src="{{ url_for('static', filename='froghat.js' ) }}"></script>
|
||||
{% if user.can_write(page) %}
|
||||
<script src="{{ url_for('static', filename='editor/turndown.js' ) }}"></script>
|
||||
<script src="{{ url_for('static', filename='editor/joplin-turndown-plugin-gfm.js' ) }}"></script>
|
||||
<script src="{{ url_for('static', filename='editor/froghat-editor.js' ) }}"></script>
|
||||
<script src="{{ url_for('static', filename='turndown.js' ) }}"></script>
|
||||
<script src="{{ url_for('static', filename='joplin-turndown-plugin-gfm.js' ) }}"></script>
|
||||
<script src="{{ url_for('static', filename='froghat-editor.js' ) }}"></script>
|
||||
{% endif %}
|
||||
<script>
|
||||
const wiki = new Froghat{% if user.can_write(page) %}Editor{% endif %}({plugins: [MacroPlugin, WidgetPlugin]});
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
#editor {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#editor.loaded {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#editor.view {
|
||||
}
|
||||
|
||||
#editor.edit {
|
||||
font-family: monospace;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
#editor.wysiwyg {
|
||||
}
|
||||
|
||||
#editor.wysiwyg .md {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
|
@ -1,8 +1,69 @@
|
|||
FroghatAPIv1 = {
|
||||
get: function(doc_id, callback) {
|
||||
(async () => {
|
||||
const raw = await fetch('/_/v1/get/' + doc_id, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
const res = await raw.json();
|
||||
if (res['code'] != 200) {
|
||||
console.error("APIv1 error: ", res)
|
||||
}
|
||||
callback(res);
|
||||
})();
|
||||
},
|
||||
|
||||
put: function(data, callback) {
|
||||
(async () => {
|
||||
const raw = await fetch('/_/v1/put/' + window.location.pathname, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
'body': data
|
||||
}),
|
||||
});
|
||||
const res = await raw.json();
|
||||
if (res['code'] != 200) {
|
||||
console.error("APIv1 error: ", res)
|
||||
}
|
||||
callback(res);
|
||||
})();
|
||||
},
|
||||
|
||||
search: function(space, query, callback) {
|
||||
(async () => {
|
||||
const raw = await fetch('/_/v1/search/' + space, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
'body': query
|
||||
}),
|
||||
});
|
||||
const res = await raw.json();
|
||||
if (res['code'] != 200) {
|
||||
console.error("APIv1 error: ", res)
|
||||
}
|
||||
callback(res);
|
||||
})();
|
||||
},
|
||||
};
|
||||
|
||||
class Froghat {
|
||||
constructor(settings) {
|
||||
/*
|
||||
* Create a new Editor instance.
|
||||
* Create a new Froghat instance.
|
||||
*/
|
||||
this.api = settings.api || FroghatAPIv1;
|
||||
|
||||
this.element = document.getElementById(settings.editorId || 'froghat');
|
||||
this.source = this.element.textContent;
|
||||
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
APIv1 = {
|
||||
get: function(doc_id, callback) {
|
||||
(async () => {
|
||||
const raw = await fetch('/_/v1/get/' + doc_id, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
const res = await raw.json();
|
||||
if (res['code'] != 200) {
|
||||
console.error("APIv1 error: ", res)
|
||||
}
|
||||
callback(res);
|
||||
})();
|
||||
},
|
||||
|
||||
put: function(data, callback) {
|
||||
(async () => {
|
||||
const raw = await fetch('/_/v1/put/' + window.location.pathname, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
'body': data
|
||||
}),
|
||||
});
|
||||
const res = await raw.json();
|
||||
if (res['code'] != 200) {
|
||||
console.error("APIv1 error: ", res)
|
||||
}
|
||||
callback(res);
|
||||
})();
|
||||
},
|
||||
|
||||
search: function(space, query, callback) {
|
||||
(async () => {
|
||||
const raw = await fetch('/_/v1/search/' + space, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
'body': query
|
||||
}),
|
||||
});
|
||||
const res = await raw.json();
|
||||
if (res['code'] != 200) {
|
||||
console.error("APIv1 error: ", res)
|
||||
}
|
||||
callback(res);
|
||||
})();
|
||||
},
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user