@zzish/math-rich-input 0.1.21 → 0.1.23

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.
package/dist/index.js CHANGED
@@ -22781,6 +22781,12 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
22781
22781
  });
22782
22782
 
22783
22783
  _defineProperty(_assertThisInitialized(_this2), "handleBlur", function (event) {
22784
+ var onBlur = _this2.props.onBlur;
22785
+
22786
+ if (onBlur != null) {
22787
+ onBlur();
22788
+ }
22789
+
22784
22790
  try {
22785
22791
  _this2.setState({
22786
22792
  hasFocus: false,
@@ -23018,7 +23024,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
23018
23024
  onBlur: this.handleBlur,
23019
23025
  dangerouslySetInnerHTML: {
23020
23026
  __html: html
23021
- }
23027
+ },
23028
+ "data-placeholder": this.props.placeholder || ""
23022
23029
  }))), this.state.showEquationEditor && /*#__PURE__*/React__default['default'].createElement(EquationEditorModal, {
23023
23030
  ref: function ref(r) {
23024
23031
  return _this3.equationEditorModal = r;
@@ -38,6 +38,15 @@
38
38
  overflow: overlay;
39
39
  }
40
40
 
41
+ .MathRichInput:empty::before {
42
+ content: attr(data-placeholder);
43
+ color: #acb6c0;
44
+ font-size: 15px;
45
+ }
46
+ .MathRichInput:empty:focus::before {
47
+ content: "";
48
+ }
49
+
41
50
  .MathRichInput:focus {
42
51
  outline: 0;
43
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzish/math-rich-input",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "description": "React component for user to enter rich text with embedded math equations.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,6 +38,15 @@
38
38
  overflow: overlay;
39
39
  }
40
40
 
41
+ .MathRichInput:empty::before {
42
+ content: attr(data-placeholder);
43
+ color: #acb6c0;
44
+ font-size: 15px;
45
+ }
46
+ .MathRichInput:empty:focus::before {
47
+ content: "";
48
+ }
49
+
41
50
  .MathRichInput:focus {
42
51
  outline: 0;
43
52
  }
@@ -1825,6 +1825,10 @@ export default class MathRichInput extends React.Component {
1825
1825
  };
1826
1826
 
1827
1827
  handleBlur = (event) => {
1828
+ const { onBlur } = this.props;
1829
+ if (onBlur != null) {
1830
+ onBlur();
1831
+ }
1828
1832
  try {
1829
1833
  this.setState({ hasFocus: false, showAccentBar: false });
1830
1834
  } catch (error) {
@@ -1889,6 +1893,7 @@ export default class MathRichInput extends React.Component {
1889
1893
  onFocus={this.handleFocus}
1890
1894
  onBlur={this.handleBlur}
1891
1895
  dangerouslySetInnerHTML={{ __html: html }}
1896
+ data-placeholder={this.props.placeholder || ""}
1892
1897
  ></span>
1893
1898
  </div>
1894
1899
  </div>