@pie-lib/editable-html 7.22.4 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,3 @@
1
- import { MarkButton } from '../toolbar/toolbar-buttons';
2
-
3
1
  import PropTypes from 'prop-types';
4
2
  import React from 'react';
5
3
  import debug from 'debug';
@@ -7,45 +5,17 @@ import { withStyles } from '@material-ui/core/styles';
7
5
 
8
6
  const log = debug('@pie-lib:editable-html:plugins:image:image-toolbar');
9
7
 
10
- const PercentButton = ({ percent, active, onClick }) => {
11
- const label = `${percent}%`;
12
- return (
13
- <MarkButton active={active} onToggle={() => onClick(percent)} label={label}>
14
- {label}
15
- </MarkButton>
16
- );
17
- };
18
-
19
- PercentButton.propTypes = {
20
- percent: PropTypes.number.isRequired,
21
- active: PropTypes.bool.isRequired,
22
- onClick: PropTypes.func.isRequired
23
- };
24
-
25
8
  export class ImageToolbar extends React.Component {
26
9
  static propTypes = {
27
- percent: PropTypes.number.isRequired,
28
10
  onChange: PropTypes.func.isRequired,
29
11
  classes: PropTypes.object.isRequired
30
12
  };
31
13
 
32
- onPercentClick = percent => {
33
- log('[onPercentClick]: percent:', percent);
34
- this.props.onChange(percent);
35
- };
36
-
37
14
  render() {
38
- const { classes, percent } = this.props;
15
+ // Don't remove toolbar since we will have other new buttons
16
+ const { classes } = this.props;
39
17
  return (
40
18
  <div className={classes.holder}>
41
- <PercentButton percent={25} active={percent === 25} onClick={this.onPercentClick} />
42
- <PercentButton percent={50} active={percent === 50} onClick={this.onPercentClick} />
43
- <PercentButton active={percent === 75} percent={75} onClick={this.onPercentClick} />
44
- <PercentButton
45
- percent={100}
46
- active={percent === 100 || !percent}
47
- onClick={this.onPercentClick}
48
- />
49
19
  </div>
50
20
  );
51
21
  }
@@ -90,7 +90,9 @@ export default function ImagePlugin(opts) {
90
90
  {
91
91
  onDelete: opts.onDelete,
92
92
  onFocus: opts.onFocus,
93
- onBlur: opts.onBlur
93
+ onBlur: opts.onBlur,
94
+ maxImageWidth: opts.maxImageWidth,
95
+ maxImageHeight: opts.maxImageHeight,
94
96
  },
95
97
  props
96
98
  );
@@ -4,6 +4,7 @@ import BulletedListIcon from '@material-ui/icons/FormatListBulleted';
4
4
  import NumberedListIcon from '@material-ui/icons/FormatListNumbered';
5
5
  import ImagePlugin from './image';
6
6
  import MediaPlugin from './media';
7
+ import CharactersPlugin from './characters';
7
8
  import Italic from '@material-ui/icons/FormatItalic';
8
9
  import MathPlugin from './math';
9
10
  import React from 'react';
@@ -63,6 +64,7 @@ export const ALL_PLUGINS = [
63
64
  'numbered-list',
64
65
  'image',
65
66
  'math',
67
+ 'languageCharacters',
66
68
  'table',
67
69
  'video',
68
70
  'audio',
@@ -103,6 +105,7 @@ export const buildPlugins = (activePlugins, opts) => {
103
105
  addIf('video', MediaPlugin('video', opts.media)),
104
106
  addIf('audio', MediaPlugin('audio', opts.media)),
105
107
  addIf('math', mathPlugin),
108
+ ...opts.languageCharacters.map(config => addIf('languageCharacters', CharactersPlugin(config))),
106
109
  addIf('bulleted-list', List({ key: 'l', type: 'ul_list', icon: <BulletedListIcon /> })),
107
110
  addIf('numbered-list', List({ key: 'n', type: 'ol_list', icon: <NumberedListIcon /> })),
108
111
  ToolbarPlugin(opts.toolbar),