Skip to content

Commit bf57a8a

Browse files
committed
change structure to allow passing in meta data - fixes draft-js-plugins#33
1 parent 6fbd8f2 commit bf57a8a

File tree

3 files changed

+27
-25
lines changed

3 files changed

+27
-25
lines changed

site/components/UnicornEditor/stickers.js

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
import { fromJS } from 'immutable';
22

33
const stickers = fromJS({
4-
'b3aa388f-b9f4-45b0-bba5-d92cf2caa48b': {
5-
id: 'b3aa388f-b9f4-45b0-bba5-d92cf2caa48b',
6-
url: 'images/unicorn-4.png',
7-
},
8-
'adec3f13-823c-47c3-b4d1-be4f68dd9d6d': {
9-
id: 'adec3f13-823c-47c3-b4d1-be4f68dd9d6d',
10-
url: 'images/unicorn-1.png',
11-
},
12-
'e14b5a20-1025-4952-b731-41cd4b118ba0': {
13-
id: 'e14b5a20-1025-4952-b731-41cd4b118ba0',
14-
url: 'images/unicorn-6.png',
15-
},
16-
'659a0dbf-5f85-4f32-999d-eb9ba6b0f417': {
17-
id: '659a0dbf-5f85-4f32-999d-eb9ba6b0f417',
18-
url: 'images/unicorn-2.png',
19-
},
20-
'fab0ae95-ae95-4775-b484-72c290437602': {
21-
id: 'fab0ae95-ae95-4775-b484-72c290437602',
22-
url: 'images/unicorn-5.png',
23-
},
24-
'71853190-8acd-4d3b-b4fd-63f7b0648daa': {
25-
id: '71853190-8acd-4d3b-b4fd-63f7b0648daa',
26-
url: 'images/unicorn-3.png',
4+
data: {
5+
'b3aa388f-b9f4-45b0-bba5-d92cf2caa48b': {
6+
id: 'b3aa388f-b9f4-45b0-bba5-d92cf2caa48b',
7+
url: 'images/unicorn-4.png',
8+
},
9+
'adec3f13-823c-47c3-b4d1-be4f68dd9d6d': {
10+
id: 'adec3f13-823c-47c3-b4d1-be4f68dd9d6d',
11+
url: 'images/unicorn-1.png',
12+
},
13+
'e14b5a20-1025-4952-b731-41cd4b118ba0': {
14+
id: 'e14b5a20-1025-4952-b731-41cd4b118ba0',
15+
url: 'images/unicorn-6.png',
16+
},
17+
'659a0dbf-5f85-4f32-999d-eb9ba6b0f417': {
18+
id: '659a0dbf-5f85-4f32-999d-eb9ba6b0f417',
19+
url: 'images/unicorn-2.png',
20+
},
21+
'fab0ae95-ae95-4775-b484-72c290437602': {
22+
id: 'fab0ae95-ae95-4775-b484-72c290437602',
23+
url: 'images/unicorn-5.png',
24+
},
25+
'71853190-8acd-4d3b-b4fd-63f7b0648daa': {
26+
id: '71853190-8acd-4d3b-b4fd-63f7b0648daa',
27+
url: 'images/unicorn-3.png',
28+
},
2729
},
2830
});
2931

src/stickerPlugin/Sticker/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default (stickers) => {
2222
const data = Entity.get(block.getEntityAt(0)).getData();
2323
return (
2424
<figure style={ styles.root } contentEditable={ false } data-offset-key={ `${block.get('key')}-0-0` }>
25-
<img style={ styles.image } src={ stickers.getIn([data.id, 'url']) } />
25+
<img style={ styles.image } src={ stickers.getIn(['data', data.id, 'url']) } />
2626
<span
2727
style={ styles.removeButton }
2828
onClick={ this.remove }

src/stickerPlugin/StickerSelect/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default (stickers) => {
7171

7272
render() {
7373
// Create the sticker selection elements
74-
const stickerElements = stickers.map((sticker) => {
74+
const stickerElements = stickers.get('data').map((sticker) => {
7575
const id = sticker.get('id');
7676
const url = sticker.get('url');
7777
return (

0 commit comments

Comments
 (0)