Copy the prism.js
file under examples/prism/
in Draft.js repository.
Run npm install prismjs
Then open it in your browser.
This file contains 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
<!DOCTYPE HTML> | |
<html lang="en" ng-app="myApp"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Dynamic Pagination w/ Filtering</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta name="description" content=""> | |
<meta name="author" content="Kim Maida"> | |
<!-- JS Libraries --> |
This file contains 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
In VSC, push F1, then write "extension", select "installer extension" and then, write "eslint" and validate. you will have to relaunch VSC | |
In VSC code, open the user parameters (settings.json) and write: | |
{ | |
//disable default javascript validator replaced by eslint | |
"javascript.validate.enable" : false | |
} |
This file contains 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
(editorState | |
.getCurrentContent() | |
.getBlockForKey(selectionState.getStartKey()) === editorState | |
.getCurrentContent() | |
.getBlockForKey(selectionState.getEndKey())); |
This file contains 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 React, { Component } from 'react'; | |
// Get a component's display name | |
const getDisplayName = WrappedComponent => { | |
const component = WrappedComponent.WrappedComponent || WrappedComponent; | |
return component.displayName || component.name || 'Component'; | |
}; | |
export default ({ theme }) => WrappedComponent => class ConfigDecorator extends Component { | |
// Statics |
This file contains 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
insertMedia(type, src, cb) { | |
let editorState = this.state.editorState | |
let contentState = editorState.getCurrentContent(); | |
let selectionState = editorState.getSelection(); | |
let afterRemoval = Modifier.removeRange(contentState, selectionState, 'backward'); | |
let targetSelection = afterRemoval.getSelectionAfter(); | |
let afterSplit = Modifier.splitBlock(afterRemoval, targetSelection); | |
let insertionTarget = afterSplit.getSelectionAfter(); |
This file contains 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
var ModalFixMixin = { | |
componentDidMount() { | |
if (document && document.body) { | |
var orig = document.body.className; | |
document.body.className = orig + (orig ? ' ' : '') + 'modal-open'; | |
} | |
}, | |
componentWillUnmount() { | |
if (document && document.body) { | |
document.body.className = document.body.className.replace(/ ?modal-open/, ''); |
This file contains 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
TextEditor.js | |
<div styleName="container"> | |
<Toolbar | |
editorState={editorState} | |
onChange={this.onEditorChange} | |
boundingRect={boundingRect} /> | |
<Editor | |
editorState={editorState} | |
onChange={this.onEditorChange} |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
This file contains 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
.public-DraftEditor-content { | |
height: 40px; | |
overflow: scroll; | |
padding-bottom: 10px; /* hide the scrollbar */ | |
} | |
.public-DraftStyleDefault-block > span { | |
white-space: nowrap; | |
} |
OlderNewer