Support 5.x by replacing call to .onStory() with .on(STORY_CHANGED, ... )

This commit is contained in:
Nils Norman Haukås 2019-06-27 09:42:49 +02:00
parent fcf7e93164
commit 52f8ac8a49
No known key found for this signature in database
GPG Key ID: BB8DD87F83E1359E
4 changed files with 9796 additions and 3 deletions

9789
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,8 @@
"scripts": {
"storybook": "start-storybook -p 9001 -c .storybook",
"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": [
"react",

View File

@ -28,6 +28,8 @@ var _addons = require('@storybook/addons');
var _addons2 = _interopRequireDefault(_addons);
var _coreEvents = require('@storybook/core-events');
var _reactSyntaxHighlighter = require('react-syntax-highlighter');
var _reactSyntaxHighlighter2 = _interopRequireDefault(_reactSyntaxHighlighter);
@ -89,7 +91,7 @@ var StaticMarkup = function (_React$Component) {
channel.on('evgenykochetkov/static-markup/show-markup', this.onShowStaticMarkup);
// Clear the current state on every story change.
this.stopListeningOnStory = api.onStory(function () {
this.stopListeningOnStory = api.on(_coreEvents.STORY_CHANGED, function () {
_this2.onShowStaticMarkup('');
});
}

View File

@ -1,5 +1,6 @@
import React from 'react';
import addons from '@storybook/addons';
import { STORY_CHANGED } from '@storybook/core-events';
import SyntaxHighlighter from 'react-syntax-highlighter';
import { docco } from 'react-syntax-highlighter/dist/styles/hljs';
const pretty = require('pretty');
@ -36,7 +37,7 @@ class StaticMarkup extends React.Component {
channel.on('evgenykochetkov/static-markup/show-markup', this.onShowStaticMarkup);
// Clear the current state on every story change.
this.stopListeningOnStory = api.onStory(() => {
this.stopListeningOnStory = api.on(STORY_CHANGED, () => {
this.onShowStaticMarkup('');
});
}