This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": [ | |
[ | |
"@babel/preset-env", | |
{ | |
"useBuiltIns": "entry", | |
"corejs": 3 | |
} | |
] | |
], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import loadPolyfills from './load-polyfills'; | |
import mountApp from './app'; // the entry point for the rest of my app | |
loadPolyfills().then(mountApp); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const trimByCharToSentence = (text = "", chars = 0) => { | |
// string is broken down into sentences; | |
// this is done by splitting it into array between | |
// the most common sentence-ending punctuation marks: | |
// period, exclaimation, ellipsis and question mark; | |
// if string consists of a single statement, make an array | |
// anyways | |
const sentences = text.match(/[^\.!…\?]+[\.!…\?]+/g) || [text] | |
// store | |
let result = "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tools | |
import React from "react" | |
import styled from "styled-components" | |
// styles | |
const Dots = styled.span` | |
&::after { | |
display: inline-block; | |
animation: ellipsis 1.25s infinite; | |
content: "."; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Ajax(url, fn) { | |
var request = new XMLHttpRequest(); | |
request.open('GET', url, true); | |
request.onload = function() { | |
if (request.status >= 200 && request.status < 400) { | |
var data = JSON.parse(request.responseText); | |
fn(data); | |
} else { | |
console.log("Error. Server connection OK.", request.responseText); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const wrapperStyle = { | |
position: 'relative' | |
} | |
const PlaceHolder = React.createClass({ | |
renderPlaceholder(){ | |
const { node, state, parent } = this.props; | |
const placeholderText = node.data.get('placeholderText'); | |
return ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const plugins = [ | |
AutoReplace({ | |
trigger: "*", | |
before: /(\*)(.*)/, | |
ignoreIn: "heading", | |
transform: (transform, e, data, matches) => { | |
return transform | |
.addMark({ type: "bold" }) | |
.insertText(matches.before[2]) | |
.removeMark({ type: "bold" }) |