Skip to content

Instantly share code, notes, and snippets.

@N1kto
N1kto / __htmlparser2.FeedHandler.js
Created July 22, 2016 12:15
[ROLLUP] Modules ordering issue
var index = require("./index.js"),
DomHandler = index.DomHandler,
DomUtils = index.DomUtils;
//TODO: make this a streamable handler
function FeedHandler(callback, options){
this.init(callback, options);
}
require("util").inherits(FeedHandler, DomHandler);
@N1kto
N1kto / customHTML2Content.js
Created October 25, 2016 20:27
DraftJS: Example of converting <img /> elements from HTML string to custom ContentBlocks
import { ContentState, genKey, Entity, CharacterMetadata, ContentBlock, convertFromHTML } from 'draft-js'
import { List, OrderedSet, Repeat, fromJS } from 'Immutable'
import { compose, toArray, extend } from 'underscore'
/*
* Helpers
*/
// Prepares img meta data object based on img attributes
const getBlockSpecForElement = (imgElement) => ({
@N1kto
N1kto / App.tsx
Last active December 15, 2023 01:53
A workaround for react-router v6 history block
import routerWindow from './routerWindow';
export const App: React.FC = () => {
return (
<Router window={routerWindow}>
{/* Your routes here */}
</Router>
);
};