Browse Source

fix editor markdown conversion so it doesn't fuck up the content anymore

:)
pull/1/head
wes 7 years ago
parent
commit
070c517dac
  1. 4
      src/scripts/app.tag
  2. 2
      src/scripts/editor.js
  3. 5
      src/scripts/editor.tag
  4. 5
      src/scripts/riotblog.js
  5. 5
      src/website.py

4
src/scripts/app.tag

@ -23,7 +23,9 @@
</sidebar> </sidebar>
</section> </section>
<div id="menu" class={"show-md show-sm show-xs navigate-small dropdown dropdown-right " + (menuActive ? "active" : "")}> <div id="menu"
class={"show-md show-sm show-xs navigate-small dropdown dropdown-right " + (menuActive ? "active" : "")}
>
<button onclick={menuOn} class="mobile-navigate btn btn-link navigate-item dropdown-toggle" tabindex="0"> <button onclick={menuOn} class="mobile-navigate btn btn-link navigate-item dropdown-toggle" tabindex="0">
<i class="bar-menu fa fa-bars" aria-hidden="true"></i> <i class="bar-menu fa fa-bars" aria-hidden="true"></i>
</button> </button>

2
src/scripts/editor.js

@ -6,7 +6,6 @@ import { default as smooth } from 'smoothscroll-polyfill';
import { default as showdown } from 'showdown'; import { default as showdown } from 'showdown';
import 'element-closest'; import 'element-closest';
console.log("yeeeeaaaaah");
promise.Promise.polyfill(); promise.Promise.polyfill();
smooth.polyfill(); smooth.polyfill();
@ -15,5 +14,4 @@ window.RiotControl = RiotControl;
RiotControl.addStore(new riot.observable()); RiotControl.addStore(new riot.observable());
console.log(`adfdsddf`);
riot.mount("editor"); riot.mount("editor");

5
src/scripts/editor.tag

@ -56,7 +56,7 @@
</div> </div>
<div class="column col-6"> <div class="column col-6">
<raw content="{this.converted}"></raw> <raw content="{this.converter.makeHtml(this.converted)}"></raw>
</div> </div>
</div> </div>
</div> </div>
@ -71,6 +71,7 @@ this.loading = false;
this.querystring = querystring; this.querystring = querystring;
this.converted = "<h3>Nothing here </h3>"; this.converted = "<h3>Nothing here </h3>";
this.converter = new showdown.Converter();
this.placeholderText = "Write a post!"; this.placeholderText = "Write a post!";
this.placeholder = this.placeholderText; this.placeholder = this.placeholderText;
@ -212,7 +213,7 @@ self.loadPost = (_id) => {
return false; return false;
} }
self.update({"loading" : true}); self.update({"loading" : true});
axios.get(`/blog/getpost/${_id.slice(-8)}`) axios.get(`/blog/getrawpost/${_id.slice(-8)}`)
.then(function(resp) { .then(function(resp) {
self.update({"loading" : false}); self.update({"loading" : false});
self.refs.textarea.value = resp.data.content; self.refs.textarea.value = resp.data.content;

5
src/scripts/riotblog.js

@ -1,13 +1,14 @@
import riot from 'riot'; import riot from 'riot';
import { default as RiotControl } from 'riotcontrol'; import { default as RiotControl } from 'riotcontrol';
import { default as promise } from 'es6-promise';
import { default as smooth } from 'smoothscroll-polyfill';
import './post.tag'; import './post.tag';
import './posts.tag'; import './posts.tag';
import './projects.tag'; import './projects.tag';
import './app.tag'; import './app.tag';
import './grid.js'; import './grid.js';
import { default as promise } from 'es6-promise';
import { default as smooth } from 'smoothscroll-polyfill';
import 'element-closest'; import 'element-closest';
import fetchCached from 'fetch-cached'; import fetchCached from 'fetch-cached';
import 'whatwg-fetch'; import 'whatwg-fetch';

5
src/website.py

@ -159,6 +159,11 @@ def NeverWhere(configfile=None):
def getpost(_id): def getpost(_id):
return posts.getpost(_id) return posts.getpost(_id)
@cache.cached(timeout=50)
@app.route("/blog/getrawpost/<_id>")
def getrawpost(_id):
return posts.getpost(_id, convert=False)
# get the first post of a given category # get the first post of a given category
@cache.cached(timeout=50) @cache.cached(timeout=50)
@app.route("/blog/getpost/<category>") @app.route("/blog/getpost/<category>")

Loading…
Cancel
Save