Support 5.x by replacing call to .onStory() with .on(STORY_CHANGED, ... )
This commit is contained in:
parent
fcf7e93164
commit
52f8ac8a49
9789
package-lock.json
generated
Normal file
9789
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -6,7 +6,8 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"storybook": "start-storybook -p 9001 -c .storybook",
|
"storybook": "start-storybook -p 9001 -c .storybook",
|
||||||
"deploy-storybook": "storybook-to-ghpages",
|
"deploy-storybook": "storybook-to-ghpages",
|
||||||
"transpile": "babel --plugins \"transform-runtime\" ./src --out-dir ."
|
"transpile": "babel --plugins \"transform-runtime\" ./src --out-dir .",
|
||||||
|
"transpile:watch": "babel --watch --plugins \"transform-runtime\" ./src --out-dir ."
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
|
|
|
@ -28,6 +28,8 @@ var _addons = require('@storybook/addons');
|
||||||
|
|
||||||
var _addons2 = _interopRequireDefault(_addons);
|
var _addons2 = _interopRequireDefault(_addons);
|
||||||
|
|
||||||
|
var _coreEvents = require('@storybook/core-events');
|
||||||
|
|
||||||
var _reactSyntaxHighlighter = require('react-syntax-highlighter');
|
var _reactSyntaxHighlighter = require('react-syntax-highlighter');
|
||||||
|
|
||||||
var _reactSyntaxHighlighter2 = _interopRequireDefault(_reactSyntaxHighlighter);
|
var _reactSyntaxHighlighter2 = _interopRequireDefault(_reactSyntaxHighlighter);
|
||||||
|
@ -89,7 +91,7 @@ var StaticMarkup = function (_React$Component) {
|
||||||
channel.on('evgenykochetkov/static-markup/show-markup', this.onShowStaticMarkup);
|
channel.on('evgenykochetkov/static-markup/show-markup', this.onShowStaticMarkup);
|
||||||
|
|
||||||
// Clear the current state on every story change.
|
// Clear the current state on every story change.
|
||||||
this.stopListeningOnStory = api.onStory(function () {
|
this.stopListeningOnStory = api.on(_coreEvents.STORY_CHANGED, function () {
|
||||||
_this2.onShowStaticMarkup('');
|
_this2.onShowStaticMarkup('');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import addons from '@storybook/addons';
|
import addons from '@storybook/addons';
|
||||||
|
import { STORY_CHANGED } from '@storybook/core-events';
|
||||||
import SyntaxHighlighter from 'react-syntax-highlighter';
|
import SyntaxHighlighter from 'react-syntax-highlighter';
|
||||||
import { docco } from 'react-syntax-highlighter/dist/styles/hljs';
|
import { docco } from 'react-syntax-highlighter/dist/styles/hljs';
|
||||||
const pretty = require('pretty');
|
const pretty = require('pretty');
|
||||||
|
@ -36,7 +37,7 @@ class StaticMarkup extends React.Component {
|
||||||
channel.on('evgenykochetkov/static-markup/show-markup', this.onShowStaticMarkup);
|
channel.on('evgenykochetkov/static-markup/show-markup', this.onShowStaticMarkup);
|
||||||
|
|
||||||
// Clear the current state on every story change.
|
// Clear the current state on every story change.
|
||||||
this.stopListeningOnStory = api.onStory(() => {
|
this.stopListeningOnStory = api.on(STORY_CHANGED, () => {
|
||||||
this.onShowStaticMarkup('');
|
this.onShowStaticMarkup('');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue