This list is no longer updated, thus the information is no longer reliable.
You can see the latest version (from october 2022) here
This list is no longer updated, thus the information is no longer reliable.
You can see the latest version (from october 2022) here
(function (context, trackingId, options) { | |
const history = context.history; | |
const doc = document; | |
const nav = navigator || {}; | |
const storage = localStorage; | |
const encode = encodeURIComponent; | |
const pushState = history.pushState; | |
const typeException = 'exception'; | |
const generateId = () => Math.random().toString(36); | |
const getId = () => { |
@@ -0,0 +1,62 @@ | |
import React from 'react' | |
import RULES from './somewhere' // What you normally feed slate-html-serializer | |
const rules = [ | |
...RULES, | |
// from slate-html-serializer | |
{ | |
serialize(obj, children) { | |
if (obj.object === 'string') { |
import Html from 'slate-html-serializer'; | |
// import React from 'react'; | |
// import { FunctionTypes } from 'constants/editor/ViewModel'; | |
// import { Nodes } from 'components/editor'; | |
import { getEventTransfer } from 'slate-react'; | |
import { BlockTypes } from 'constants/editor'; | |
import { Block } from 'slate'; |
// Ignore those pesky styles | |
require('ignore-styles'); | |
// Set up babel to do its thing... env for the latest toys, react-app for CRA | |
require('babel-register')({ | |
ignore: /\/(build|node_modules)\//, | |
presets: ['env', 'react-app'] | |
}); | |
// Now that the nonsense is over... load up the server entry point |
const wrapperStyle = { | |
position: 'relative' | |
} | |
const PlaceHolder = React.createClass({ | |
renderPlaceholder(){ | |
const { node, state } = this.props; | |
const placeholderText = node.data.get('placeholderText'); | |
return ( |
<!DOCTYPE html> | |
<html> | |
<head> | |
<%= inline_js 'application.js' %> | |
<%= inline_css 'application.css' %> | |
</head> | |
<body> | |
</body> | |
</html> |
import React from 'react'; | |
import { renderToStaticMarkup } from 'react-dom/server'; | |
class SvgBackground extends React.Component { | |
render() { | |
return ( | |
<svg xmlns='http://www.w3.org/2000/svg' width={100} height={100}> | |
<rect width={100} height={100} fill='#269' /> | |
<g fill='#6494b7'> | |
<rect width={100} height={1} y={20} /> |
Want to use the excellent rich text editor Slate in a Rails app? Beware – since you'll be integrating React with your Rails app, it'll turn out pretty complicated and you'll have to do things (e.g. start server, managing dependencies, etc.) a bit differently than before. Let's start.
react_on_rails
is pretty much the best option for integrating React into Rails. Install it like so:
/** | |
* Michael Scott Hertzberg <[email protected]> (http://hertzber.gs) | |
* | |
* recursively check for set localStorage value every 100ms. | |
* this will also safely clear the timeout once found. | |
* can be used callback style or directly. | |
* functionally pure. | |
*/ | |
function waitForLocalStorage(key, cb, timer) { | |
if (!localStorage.getItem(key)) return (timer = setTimeout(waitForLocalStorage.bind(null, key, cb), 100)) |