0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-27 18:02:42 +00:00

Initial pass at appending codefenced CSS to Style data at save time, only on /new brews (so only once per brew).

This commit is contained in:
Sean Robertson
2021-06-21 12:34:51 +12:00
parent d61fda9cff
commit 69231ba57a

View File

@@ -135,6 +135,13 @@ const NewPage = createClass({
console.log('saving new brew');
// Split out CSS to Style if CSS codefence exists
if(brew.text.startsWith('```css') && brew.text.indexOf('```\n\n') > 0) {
const index = brew.text.indexOf('```\n\n');
brew.style = `${brew.style}${brew.text.slice(7, index - 1)}`;
brew.text = brew.text.slice(index + 5);
}
if(this.state.saveGoogle) {
const res = await request
.post('/api/newGoogle/')