@pie-lib/editable-html 7.17.4-next.450 → 7.17.4-next.462

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/CHANGELOG.md CHANGED
@@ -3,6 +3,141 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [9.0.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@9.0.3...@pie-lib/editable-html@9.0.4) (2022-07-22)
7
+
8
+ **Note:** Version bump only for package @pie-lib/editable-html
9
+
10
+
11
+
12
+
13
+
14
+ ## [9.0.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@9.0.2...@pie-lib/editable-html@9.0.3) (2022-07-19)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **editable-html:** fix paste text PD-1899 ([a1e8477](https://github.com/pie-framework/pie-lib/commit/a1e847763ceb14912592fcdf20317fb9a309a912))
20
+
21
+
22
+
23
+
24
+
25
+ ## [9.0.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@9.0.1...@pie-lib/editable-html@9.0.2) (2022-07-19)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * bump mathquill to 1.1.3 ([48b84c5](https://github.com/pie-framework/pie-lib/commit/48b84c534cbf519e172a80d18a48b26eda3cf7e6))
31
+
32
+
33
+
34
+
35
+
36
+ ## [9.0.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@9.0.0...@pie-lib/editable-html@9.0.1) (2022-07-18)
37
+
38
+
39
+ ### Reverts
40
+
41
+ * Revert "feat(editable-html): Make editable-html style inline with mathjax: font, radical, exponential, italicize variables PD-1521" ([c07213c](https://github.com/pie-framework/pie-lib/commit/c07213c627609a47089f9cfec1e16366fc5dcfd3))
42
+
43
+
44
+
45
+
46
+
47
+ # [9.0.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@8.1.2...@pie-lib/editable-html@9.0.0) (2022-07-18)
48
+
49
+
50
+ ### Bug Fixes
51
+
52
+ * **editable-html:** add another sanity checks ([d872981](https://github.com/pie-framework/pie-lib/commit/d87298124408b55d75d42598c0272294a0881043))
53
+ * **editable-html:** add sanity check for drop / paste file - sentry ([d27d252](https://github.com/pie-framework/pie-lib/commit/d27d2522d0567333e0af1ce49a3793ebc44ef032))
54
+ * **editable-html:** add sanity check in respArea - toolbar ([1e4c9f2](https://github.com/pie-framework/pie-lib/commit/1e4c9f21be612409deee08cca6790f019f5d01d3))
55
+ * **editable-html:** potential fix - sanity check for node key in table - sentry ([f417c72](https://github.com/pie-framework/pie-lib/commit/f417c724c49e50e8c3c514b46b42f5d410da2942))
56
+ * code tweaks ([a390dcb](https://github.com/pie-framework/pie-lib/commit/a390dcbe22e9d37776b91071ec1502bbad59ff2a))
57
+ * duplicate image issue ([924a4df](https://github.com/pie-framework/pie-lib/commit/924a4df45cf9f1601704dd48c2a757dd02e2e7a3))
58
+ * tests ([41caca9](https://github.com/pie-framework/pie-lib/commit/41caca9855aa8099f5cb7286cc6660dd20d5c622))
59
+
60
+
61
+ ### Features
62
+
63
+ * **characters:** special character accents span 2 rows, added border for visibility [PD-1462] ([c60b0bc](https://github.com/pie-framework/pie-lib/commit/c60b0bc8ff45cc01f53bc752fd5dd64da623f6be))
64
+ * **editable-html:** add image alignment buttons ([a076a41](https://github.com/pie-framework/pie-lib/commit/a076a4193c82dc552bd21de7a8f928d8481e73e6))
65
+ * **editable-html:** BREAKING CHANGE add image alignment buttons in image toolbar PD-1802 ([bcb59e5](https://github.com/pie-framework/pie-lib/commit/bcb59e5737fe61560fac8de01276baf187888048))
66
+ * **editable-html:** image resize functionality PD-1801. BREAKING CHANGE removed percent buttons from image toolbar ([1d5c33d](https://github.com/pie-framework/pie-lib/commit/1d5c33d4bcd224fa1b38310d7f0f21fba0888f12))
67
+ * **editable-html:** Make editable-html style inline with mathjax: font, radical, exponential, italicize variables PD-1521 ([20752ad](https://github.com/pie-framework/pie-lib/commit/20752ad453880da881bc0a2880c6ef9a10b9589d))
68
+ * **editable-html, render-ui:** wrap up PD-1802 ([e10babf](https://github.com/pie-framework/pie-lib/commit/e10babf2e80aed67c856e9e021e37072e3df33fb))
69
+ * **editor:** added insert spanish and special characters as default [PD-1883] ([26655ec](https://github.com/pie-framework/pie-lib/commit/26655ec87cb4b8a82357e88b62faad3fdc7c296a))
70
+
71
+
72
+ ### BREAKING CHANGES
73
+
74
+ * **editable-html:** Added new buttons in image toolbar.
75
+ The buttons control image horizontal alignment.
76
+
77
+
78
+
79
+
80
+
81
+ ## [8.1.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@8.1.1...@pie-lib/editable-html@8.1.2) (2022-06-28)
82
+
83
+
84
+ ### Bug Fixes
85
+
86
+ * running locally does not work ([ce2d09a](https://github.com/pie-framework/pie-lib/commit/ce2d09a3556937aea4a1c8075a2dbc7c1131fd5f))
87
+
88
+
89
+
90
+
91
+
92
+ ## [8.1.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@8.1.0...@pie-lib/editable-html@8.1.1) (2022-06-28)
93
+
94
+
95
+ ### Bug Fixes
96
+
97
+ * running locally does not work ([e2fbb74](https://github.com/pie-framework/pie-lib/commit/e2fbb74c79bbb2ad6e9af447af51687391d89ad3))
98
+ * **editable-html:** fix image remove ([0f446b3](https://github.com/pie-framework/pie-lib/commit/0f446b38d93fec1548b9ff5c73cc48f2f10d9397))
99
+
100
+
101
+
102
+
103
+
104
+ # [8.1.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@8.0.0...@pie-lib/editable-html@8.1.0) (2022-06-27)
105
+
106
+
107
+ ### Features
108
+
109
+ * **editable-html:** allow drop & paste images PD-581 ([f7ec0d4](https://github.com/pie-framework/pie-lib/commit/f7ec0d4578ededc095422356471fb5e9f2b29af9))
110
+
111
+
112
+
113
+
114
+
115
+ # [8.0.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.22.6...@pie-lib/editable-html@8.0.0) (2022-06-27)
116
+
117
+
118
+ ### Features
119
+
120
+ * **editable-html:** Added characters limit support PD-1681 ([9e7f6ad](https://github.com/pie-framework/pie-lib/commit/9e7f6add3f846d32265990aca98dfb5b4847bb95))
121
+ * **editable-html:** image resize functionality PD-1801 ([6f46903](https://github.com/pie-framework/pie-lib/commit/6f46903acdf791716263be33abe49235572421ad))
122
+ * **plugins:** added special characters adding capabilities [PD-1462] ([b9f41e1](https://github.com/pie-framework/pie-lib/commit/b9f41e11f44df140a66145d0b04558ca2b0ea48e))
123
+
124
+
125
+ ### BREAKING CHANGES
126
+
127
+ * **editable-html:** Removed the percent buttons from editable-html image button. Added resize functionality.
128
+
129
+
130
+
131
+
132
+
133
+ ## [7.22.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.22.5...@pie-lib/editable-html@7.22.6) (2022-06-13)
134
+
135
+ **Note:** Version bump only for package @pie-lib/editable-html
136
+
137
+
138
+
139
+
140
+
6
141
  ## [7.22.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.22.4...@pie-lib/editable-html@7.22.5) (2022-05-30)
7
142
 
8
143
  **Note:** Version bump only for package @pie-lib/editable-html
package/lib/index.js CHANGED
@@ -136,7 +136,9 @@ var EditableHtml = /*#__PURE__*/function (_React$Component) {
136
136
  c.focus();
137
137
 
138
138
  if (position === 'end' && lastText) {
139
- c.moveFocusTo(lastText.key, lastText.text.length).moveAnchorTo(lastText.key, lastText.text.length);
139
+ var _lastText$text, _lastText$text2;
140
+
141
+ c.moveFocusTo(lastText.key, (_lastText$text = lastText.text) === null || _lastText$text === void 0 ? void 0 : _lastText$text.length).moveAnchorTo(lastText.key, (_lastText$text2 = lastText.text) === null || _lastText$text2 === void 0 ? void 0 : _lastText$text2.length);
140
142
  }
141
143
 
142
144
  if (position === 'beginning' && lastText) {
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["log","debug","reduceMultipleBrs","markup","replace","e","console","EditableHtml","props","value","done","html","valueToHtml","htmlParsed","parseDegrees","onChange","onDone","position","node","editorRef","change","c","lastText","document","getNextText","key","getLastText","editorDOM","querySelector","activeElement","blur","focus","moveFocusTo","text","length","moveAnchorTo","onEditingDone","v","htmlToValue","state","allowValidation","current","equals","setState","toolbarOpts","error","ref","rootRef","React","Component","PropTypes","func","isRequired","string","bool"],"sources":["../src/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Editor, { DEFAULT_PLUGINS, ALL_PLUGINS } from './editor';\nimport { htmlToValue, valueToHtml } from './serialization';\nimport { parseDegrees } from './parse-html';\nimport debug from 'debug';\n\nconst log = debug('@pie-lib:editable-html');\n/**\n * Export lower level Editor and serialization functions.\n */\nexport { htmlToValue, valueToHtml, Editor, DEFAULT_PLUGINS, ALL_PLUGINS };\n\n/**\n * Wrapper around the editor that exposes a `markup` and `onChange(markup:string)` api.\n * Because of the mismatch between the markup and the `Value` we need to convert the incoming markup to a value and\n * compare it. TODO: This is an interim fix, we'll need to strip back `Editor` and look how best to maintain the\n * `markup` api whilst avoiding the serialization mismatch. We should be making better use of schemas w/ normalize.\n */\n\nconst reduceMultipleBrs = markup => {\n try {\n return markup.replace(/(<br\\s*\\/?>){3,}/gi, '<br>');\n } catch (e) {\n console.log(\"Couldn't remove <br/> tags: \", e);\n }\n\n return markup;\n};\n\nexport default class EditableHtml extends React.Component {\n static propTypes = {\n onChange: PropTypes.func.isRequired,\n onDone: PropTypes.func,\n markup: PropTypes.string.isRequired,\n allowValidation: PropTypes.bool\n };\n\n static defaultProps = {\n onDone: () => {},\n allowValidation: false\n };\n\n constructor(props) {\n super(props);\n const v = htmlToValue(props.markup);\n this.state = {\n value: v\n };\n }\n\n // eslint-disable-next-line react/no-deprecated\n componentWillReceiveProps(props) {\n if (!props.allowValidation && props.markup === this.props.markup) {\n return;\n }\n\n const v = htmlToValue(reduceMultipleBrs(props.markup));\n const current = htmlToValue(reduceMultipleBrs(this.props.markup));\n\n if (v.equals && !v.equals(current)) {\n this.setState({ value: v });\n }\n }\n\n onChange = (value, done) => {\n const html = valueToHtml(value);\n const htmlParsed = parseDegrees(html);\n\n log('value as html: ', html);\n\n if (html !== this.props.markup) {\n this.props.onChange(htmlParsed);\n }\n\n if (done) {\n this.props.onDone(htmlParsed);\n }\n };\n\n focus = (position, node) => {\n if (this.editorRef) {\n this.editorRef.change(c => {\n const lastText = node\n ? c.value.document.getNextText(node.key)\n : c.value.document.getLastText();\n const editorDOM = document.querySelector(\n `[data-key=\"${this.editorRef.value.document.key}\"]`\n );\n\n if (editorDOM !== document.activeElement) {\n document.activeElement.blur();\n }\n\n c.focus();\n\n if (position === 'end' && lastText) {\n c.moveFocusTo(lastText.key, lastText.text.length).moveAnchorTo(\n lastText.key,\n lastText.text.length\n );\n }\n\n if (position === 'beginning' && lastText) {\n c.moveFocusTo(lastText.key, 0).moveAnchorTo(lastText.key, 0);\n }\n });\n }\n };\n\n finishEditing = () => {\n if (this.editorRef) {\n this.editorRef.props.onEditingDone();\n }\n };\n\n render() {\n const { value } = this.state;\n const { toolbarOpts, error } = this.props;\n\n if (toolbarOpts) {\n toolbarOpts.error = error;\n }\n\n const props = {\n ...this.props,\n markup: null,\n value,\n onChange: this.onChange,\n focus: this.focus\n };\n\n return (\n <Editor\n onRef={ref => {\n if (ref) {\n this.rootRef = ref;\n }\n }}\n editorRef={ref => ref && (this.editorRef = ref)}\n {...props}\n />\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,IAAAC,iBAAA,EAAM,wBAAN,CAAZ;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AAEA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAAAC,MAAM,EAAI;EAClC,IAAI;IACF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,KAAK,EAAE4B;QAAT,CAAd;MACD;IACF;;;WAqDD,kBAAS;MAAA;;MACP,IAAQ5B,KAAR,GAAkB,KAAK8B,KAAvB,CAAQ9B,KAAR;MACA,kBAA+B,KAAKD,KAApC;MAAA,IAAQoC,WAAR,eAAQA,WAAR;MAAA,IAAqBC,KAArB,eAAqBA,KAArB;;MAEA,IAAID,WAAJ,EAAiB;QACfA,WAAW,CAACC,KAAZ,GAAoBA,KAApB;MACD;;MAED,IAAMrC,KAAK,mCACN,KAAKA,KADC;QAETL,MAAM,EAAE,IAFC;QAGTM,KAAK,EAALA,KAHS;QAITM,QAAQ,EAAE,KAAKA,QAJN;QAKTgB,KAAK,EAAE,KAAKA;MALH,EAAX;;MAQA,oBACE,gCAAC,kBAAD;QACE,KAAK,EAAE,eAAAe,GAAG,EAAI;UACZ,IAAIA,GAAJ,EAAS;YACP,MAAI,CAACC,OAAL,GAAeD,GAAf;UACD;QACF,CALH;QAME,SAAS,EAAE,mBAAAA,GAAG;UAAA,OAAIA,GAAG,KAAK,MAAI,CAAC3B,SAAL,GAAiB2B,GAAtB,CAAP;QAAA;MANhB,GAOMtC,KAPN,EADF;IAWD;;;EAjHuCwC,iBAAA,CAAMC,S;;;iCAA3B1C,Y,eACA;EACjBQ,QAAQ,EAAEmC,qBAAA,CAAUC,IAAV,CAAeC,UADR;EAEjBpC,MAAM,EAAEkC,qBAAA,CAAUC,IAFD;EAGjBhD,MAAM,EAAE+C,qBAAA,CAAUG,MAAV,CAAiBD,UAHR;EAIjBZ,eAAe,EAAEU,qBAAA,CAAUI;AAJV,C;iCADA/C,Y,kBAQG;EACpBS,MAAM,EAAE,kBAAM,CAAE,CADI;EAEpBwB,eAAe,EAAE;AAFG,C"}
1
+ {"version":3,"file":"index.js","names":["log","debug","reduceMultipleBrs","markup","replace","e","console","EditableHtml","props","value","done","html","valueToHtml","htmlParsed","parseDegrees","onChange","onDone","position","node","editorRef","change","c","lastText","document","getNextText","key","getLastText","editorDOM","querySelector","activeElement","blur","focus","moveFocusTo","text","length","moveAnchorTo","onEditingDone","v","htmlToValue","state","allowValidation","current","equals","setState","toolbarOpts","error","ref","rootRef","React","Component","PropTypes","func","isRequired","string","bool"],"sources":["../src/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Editor, { DEFAULT_PLUGINS, ALL_PLUGINS } from './editor';\nimport { htmlToValue, valueToHtml } from './serialization';\nimport { parseDegrees } from './parse-html';\nimport debug from 'debug';\n\nconst log = debug('@pie-lib:editable-html');\n/**\n * Export lower level Editor and serialization functions.\n */\nexport { htmlToValue, valueToHtml, Editor, DEFAULT_PLUGINS, ALL_PLUGINS };\n\n/**\n * Wrapper around the editor that exposes a `markup` and `onChange(markup:string)` api.\n * Because of the mismatch between the markup and the `Value` we need to convert the incoming markup to a value and\n * compare it. TODO: This is an interim fix, we'll need to strip back `Editor` and look how best to maintain the\n * `markup` api whilst avoiding the serialization mismatch. We should be making better use of schemas w/ normalize.\n */\n\nconst reduceMultipleBrs = markup => {\n try {\n return markup.replace(/(<br\\s*\\/?>){3,}/gi, '<br>');\n } catch (e) {\n console.log(\"Couldn't remove <br/> tags: \", e);\n }\n\n return markup;\n};\n\nexport default class EditableHtml extends React.Component {\n static propTypes = {\n onChange: PropTypes.func.isRequired,\n onDone: PropTypes.func,\n markup: PropTypes.string.isRequired,\n allowValidation: PropTypes.bool\n };\n\n static defaultProps = {\n onDone: () => {},\n allowValidation: false\n };\n\n constructor(props) {\n super(props);\n const v = htmlToValue(props.markup);\n this.state = {\n value: v\n };\n }\n\n // eslint-disable-next-line react/no-deprecated\n componentWillReceiveProps(props) {\n if (!props.allowValidation && props.markup === this.props.markup) {\n return;\n }\n\n const v = htmlToValue(reduceMultipleBrs(props.markup));\n const current = htmlToValue(reduceMultipleBrs(this.props.markup));\n\n if (v.equals && !v.equals(current)) {\n this.setState({ value: v });\n }\n }\n\n onChange = (value, done) => {\n const html = valueToHtml(value);\n const htmlParsed = parseDegrees(html);\n\n log('value as html: ', html);\n\n if (html !== this.props.markup) {\n this.props.onChange(htmlParsed);\n }\n\n if (done) {\n this.props.onDone(htmlParsed);\n }\n };\n\n focus = (position, node) => {\n if (this.editorRef) {\n this.editorRef.change(c => {\n const lastText = node\n ? c.value.document.getNextText(node.key)\n : c.value.document.getLastText();\n const editorDOM = document.querySelector(\n `[data-key=\"${this.editorRef.value.document.key}\"]`\n );\n\n if (editorDOM !== document.activeElement) {\n document.activeElement.blur();\n }\n\n c.focus();\n\n if (position === 'end' && lastText) {\n c.moveFocusTo(lastText.key, lastText.text?.length).moveAnchorTo(\n lastText.key,\n lastText.text?.length\n );\n }\n\n if (position === 'beginning' && lastText) {\n c.moveFocusTo(lastText.key, 0).moveAnchorTo(lastText.key, 0);\n }\n });\n }\n };\n\n finishEditing = () => {\n if (this.editorRef) {\n this.editorRef.props.onEditingDone();\n }\n };\n\n render() {\n const { value } = this.state;\n const { toolbarOpts, error } = this.props;\n\n if (toolbarOpts) {\n toolbarOpts.error = error;\n }\n\n const props = {\n ...this.props,\n markup: null,\n value,\n onChange: this.onChange,\n focus: this.focus\n };\n\n return (\n <Editor\n onRef={ref => {\n if (ref) {\n this.rootRef = ref;\n }\n }}\n editorRef={ref => ref && (this.editorRef = ref)}\n {...props}\n />\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,IAAAC,iBAAA,EAAM,wBAAN,CAAZ;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AAEA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAAAC,MAAM,EAAI;EAClC,IAAI;IACF,OAAOA,MAAM,CAACC,OAAP,CAAe,oBAAf,EAAqC,MAArC,CAAP;EACD,CAFD,CAEE,OAAOC,CAAP,EAAU;IACVC,OAAO,CAACN,GAAR,C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8B,KAAvB,CAAQ9B,KAAR;MACA,kBAA+B,KAAKD,KAApC;MAAA,IAAQoC,WAAR,eAAQA,WAAR;MAAA,IAAqBC,KAArB,eAAqBA,KAArB;;MAEA,IAAID,WAAJ,EAAiB;QACfA,WAAW,CAACC,KAAZ,GAAoBA,KAApB;MACD;;MAED,IAAMrC,KAAK,mCACN,KAAKA,KADC;QAETL,MAAM,EAAE,IAFC;QAGTM,KAAK,EAALA,KAHS;QAITM,QAAQ,EAAE,KAAKA,QAJN;QAKTgB,KAAK,EAAE,KAAKA;MALH,EAAX;;MAQA,oBACE,gCAAC,kBAAD;QACE,KAAK,EAAE,eAAAe,GAAG,EAAI;UACZ,IAAIA,GAAJ,EAAS;YACP,MAAI,CAACC,OAAL,GAAeD,GAAf;UACD;QACF,CALH;QAME,SAAS,EAAE,mBAAAA,GAAG;UAAA,OAAIA,GAAG,KAAK,MAAI,CAAC3B,SAAL,GAAiB2B,GAAtB,CAAP;QAAA;MANhB,GAOMtC,KAPN,EADF;IAWD;;;EAjHuCwC,iBAAA,CAAMC,S;;;iCAA3B1C,Y,eACA;EACjBQ,QAAQ,EAAEmC,qBAAA,CAAUC,IAAV,CAAeC,UADR;EAEjBpC,MAAM,EAAEkC,qBAAA,CAAUC,IAFD;EAGjBhD,MAAM,EAAE+C,qBAAA,CAAUG,MAAV,CAAiBD,UAHR;EAIjBZ,eAAe,EAAEU,qBAAA,CAAUI;AAJV,C;iCADA/C,Y,kBAQG;EACpBS,MAAM,EAAE,kBAAM,CAAE,CADI;EAEpBwB,eAAe,EAAE;AAFG,C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/editable-html",
3
- "version": "7.17.4-next.450+33e1b46c",
3
+ "version": "7.17.4-next.462+88f0fb88",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "main": "lib/index.js",
@@ -11,9 +11,9 @@
11
11
  "@material-ui/icons": "^3.0.2",
12
12
  "@material-ui/styles": "^3.0.0-alpha.10",
13
13
  "@pie-lib/drag": "^1.1.52",
14
- "@pie-lib/math-rendering": "^2.4.2",
15
- "@pie-lib/math-toolbar": "^1.9.3",
16
- "@pie-lib/render-ui": "^4.12.8",
14
+ "@pie-lib/math-rendering": "^2.3.10-next.462+88f0fb88",
15
+ "@pie-lib/math-toolbar": "^1.8.1-next.462+88f0fb88",
16
+ "@pie-lib/render-ui": "^4.12.1-next.462+88f0fb88",
17
17
  "change-case": "^3.0.2",
18
18
  "classnames": "^2.2.6",
19
19
  "debug": "^4.1.1",
@@ -47,6 +47,6 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "33e1b46c984490a8d5afe61822d31dd1c55fde67",
50
+ "gitHead": "88f0fb88c7a98ceaa2336add0301b176c59355b7",
51
51
  "scripts": {}
52
52
  }
package/src/index.jsx CHANGED
@@ -95,9 +95,9 @@ export default class EditableHtml extends React.Component {
95
95
  c.focus();
96
96
 
97
97
  if (position === 'end' && lastText) {
98
- c.moveFocusTo(lastText.key, lastText.text.length).moveAnchorTo(
98
+ c.moveFocusTo(lastText.key, lastText.text?.length).moveAnchorTo(
99
99
  lastText.key,
100
- lastText.text.length
100
+ lastText.text?.length
101
101
  );
102
102
  }
103
103