@@ -11,15 +11,15 @@ import Info from '@material-ui/icons/Info';
1111import debug from 'debug' ;
1212import { EditableHtml } from '@pie-lib/pie-toolbox/editable-html' ;
1313import Tooltip from '@material-ui/core/Tooltip' ;
14- import { generateValidationMessage } from './utils' ;
15- import {
16- clearSelection ,
17- getDOMNodes ,
18- getLabelElement ,
19- getRangeDetails ,
20- isSideLabel ,
21- wrapRange ,
22- } from '@pie-element/extended-text-entry/src/annotation/annotation-utils' ;
14+ import { clearSelection , generateValidationMessage } from './utils' ;
15+ // import {
16+ // clearSelection,
17+ // getDOMNodes,
18+ // getLabelElement,
19+ // getRangeDetails,
20+ // isSideLabel,
21+ // wrapRange,
22+ // } from '@pie-element/extended-text-entry/src/annotation/annotation-utils';
2323import classNames from 'classnames' ;
2424
2525import Switch from '@material-ui/core/Switch' ;
@@ -184,23 +184,23 @@ export class Design extends React.Component {
184184 return annotation ;
185185 } ;
186186
187- addAnnotation = ( type ) => {
188- const { annotations, onChange } = this . props ;
189- const annotation = this . createNewAnnotation ( '' , type ) ;
190- const labelElem = getLabelElement ( annotation . id ) ;
191-
192- annotations . push ( annotation ) ;
193-
194- this . setState ( {
195- openedMenu : false ,
196- openedEditor : true ,
197- annotationIndex : annotations . length - 1 ,
198- annotation,
199- labelElem,
200- } ) ;
201-
202- onChange ( annotations ) ;
203- } ;
187+ // addAnnotation = (type) => {
188+ // const { annotations, onChange } = this.props;
189+ // const annotation = this.createNewAnnotation('', type);
190+ // const labelElem = getLabelElement(annotation.id);
191+ //
192+ // annotations.push(annotation);
193+ //
194+ // this.setState({
195+ // openedMenu: false,
196+ // openedEditor: true,
197+ // annotationIndex: annotations.length - 1,
198+ // annotation,
199+ // labelElem,
200+ // });
201+ //
202+ // onChange(annotations);
203+ // };
204204
205205 // new functionalities
206206
@@ -357,9 +357,16 @@ export class Design extends React.Component {
357357 } ;
358358
359359 clearTokens = ( ) => {
360- const { text } = this . state ;
360+ const { model } = this . props ;
361+
362+ const container = document . createElement ( 'div' ) ;
363+ container . innerHTML = model . text ;
364+
365+ // Remove all children and add new content
366+ this . textRef . innerHTML = '' ;
367+ this . textRef . appendChild ( container ) ;
361368
362- this . setState ( { tokenizedText : text } ) ;
369+ this . setState ( { tokenizedText : model . text } ) ;
363370 } ;
364371
365372 selectWords = ( ) => {
0 commit comments