@the-grid/ed
Advanced tools
Comparing version 0.18.0 to 0.18.1
## dev | ||
## 0.18.1 - 2016-07-15 | ||
* Perf boost for when setContent is hit with old news | ||
## 0.18.0 - 2016-07-15 | ||
@@ -4,0 +8,0 @@ |
@@ -245,2 +245,3 @@ /* eslint no-console: 0 */ | ||
let content = ed.getContent() | ||
// content[4].metadata.caption = Date.now() + '' | ||
ed.setContent(content) | ||
@@ -247,0 +248,0 @@ } |
@@ -13,2 +13,6 @@ 'use strict'; | ||
var _lodash = require('../util/lodash'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _placeholder = require('./placeholder'); | ||
@@ -97,3 +101,7 @@ | ||
} | ||
this.setState({}); | ||
var store = this.props.store; | ||
var initialBlock = store.getBlock(id); | ||
if (!initialBlock) return; | ||
this.setState({ initialBlock: initialBlock }); | ||
} | ||
@@ -103,3 +111,13 @@ }, { | ||
value: function updateBlockAll() { | ||
this.setState({}); | ||
var store = this.props.store; | ||
var _state2 = this.state; | ||
var id = _state2.id; | ||
var initialBlock = _state2.initialBlock; | ||
var block = store.getBlock(id); | ||
if (!block) return; | ||
// Needed to speed up ed.setContent | ||
// and not render every block every time | ||
if (_lodash2.default.isEqual(initialBlock, block)) return; | ||
this.setState({ initialBlock: block }); | ||
} | ||
@@ -106,0 +124,0 @@ }]); |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.18.0", | ||
"version": "0.18.1", | ||
"description": "the grid api with prosemirror", | ||
@@ -8,0 +8,0 @@ "main": "dist/ed.js", |
import React, {createElement as el} from 'react' | ||
import _ from '../util/lodash' | ||
@@ -12,2 +13,3 @@ import Placeholder from './placeholder' | ||
class Media extends React.Component { | ||
@@ -55,6 +57,16 @@ constructor (props) { | ||
} | ||
this.setState({}) | ||
const {store} = this.props | ||
const initialBlock = store.getBlock(id) | ||
if (!initialBlock) return | ||
this.setState({initialBlock}) | ||
} | ||
updateBlockAll () { | ||
this.setState({}) | ||
const {store} = this.props | ||
const {id, initialBlock} = this.state | ||
const block = store.getBlock(id) | ||
if (!block) return | ||
// Needed to speed up ed.setContent | ||
// and not render every block every time | ||
if (_.isEqual(initialBlock, block)) return | ||
this.setState({initialBlock: block}) | ||
} | ||
@@ -61,0 +73,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
7190018
13852