@pie-element/extended-text-entry 9.0.1-next.2 → 9.0.1-next.24

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
@@ -163,7 +163,7 @@ The default bahaviour is to disable the spellcheck for the player.
163
163
 
164
164
  ### Features
165
165
 
166
- * add a different property in the config, forceEnabled, to force a value ([300c664](https://github.com/pie-framework/pie-elements/commit/300c664618f46177137deef3bced2d096cdb8126))
166
+ * add a different property in the config, to force a value ([300c664](https://github.com/pie-framework/pie-elements/commit/300c664618f46177137deef3bced2d096cdb8126))
167
167
 
168
168
 
169
169
 
@@ -160,7 +160,7 @@ The default bahaviour is to disable the spellcheck for the player.
160
160
 
161
161
  ### Features
162
162
 
163
- * add a different property in the config, forceEnabled, to force a value ([300c664](https://github.com/pie-framework/pie-elements/commit/300c664618f46177137deef3bced2d096cdb8126))
163
+ * add a different property in the config, to force a value ([300c664](https://github.com/pie-framework/pie-elements/commit/300c664618f46177137deef3bced2d096cdb8126))
164
164
 
165
165
 
166
166
 
@@ -45,25 +45,49 @@ var ExtendedTextEntry = /*#__PURE__*/function (_HTMLElement) {
45
45
  var _super = _createSuper(ExtendedTextEntry);
46
46
 
47
47
  function ExtendedTextEntry() {
48
+ var _this$_configuration$;
49
+
48
50
  var _this;
49
51
 
50
52
  (0, _classCallCheck2["default"])(this, ExtendedTextEntry);
51
53
  _this = _super.call(this);
52
- _this._model = ExtendedTextEntry.createDefaultModel();
53
- _this._configuration = _defaults["default"].configuration;
54
+ _this._configuration = _defaults["default"].configuration; // if configuration.withRubric.forceEnabled is true, then we
55
+ // update the configuration (we do not want to display the toggle in the Settings Panel)
56
+
57
+ if ((_this$_configuration$ = _this._configuration.withRubric) !== null && _this$_configuration$ !== void 0 && _this$_configuration$.forceEnabled) {
58
+ _this._configuration.withRubric.settings = false;
59
+ }
60
+
61
+ _this._model = ExtendedTextEntry.createDefaultModel({}, _this._configuration);
54
62
  return _this;
55
63
  }
56
64
 
57
65
  (0, _createClass2["default"])(ExtendedTextEntry, [{
58
66
  key: "model",
59
67
  set: function set(m) {
60
- this._model = ExtendedTextEntry.createDefaultModel(m);
68
+ this._model = ExtendedTextEntry.createDefaultModel(m, this._configuration);
61
69
  this.render();
62
70
  }
63
71
  }, {
64
72
  key: "configuration",
65
73
  set: function set(c) {
66
74
  this._configuration = _objectSpread(_objectSpread({}, _defaults["default"].configuration), c);
75
+
76
+ var _ref = c || {},
77
+ _ref$withRubric = _ref.withRubric,
78
+ withRubric = _ref$withRubric === void 0 ? {} : _ref$withRubric; // if configuration.withRubric.forceEnabled is true, then we update the model (rubricEnabled)
79
+ // without triggering the Model Updated event (for more details, check documentation)
80
+ // and also update the configuration (we do not want to display the toggle in the Settings Panel)
81
+
82
+
83
+ if (withRubric !== null && withRubric !== void 0 && withRubric.forceEnabled) {
84
+ this._configuration.withRubric.settings = false;
85
+
86
+ if (!this._model.rubricEnabled) {
87
+ this._model.rubricEnabled = true;
88
+ }
89
+ }
90
+
67
91
  this.render();
68
92
  }
69
93
  }, {
@@ -137,7 +161,19 @@ var ExtendedTextEntry = /*#__PURE__*/function (_HTMLElement) {
137
161
 
138
162
  exports["default"] = ExtendedTextEntry;
139
163
  (0, _defineProperty2["default"])(ExtendedTextEntry, "createDefaultModel", function () {
164
+ var _config$withRubric;
165
+
140
166
  var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
141
- return _objectSpread(_objectSpread({}, _defaults["default"].model), model);
167
+ var config = arguments.length > 1 ? arguments[1] : undefined;
168
+
169
+ var defaultModel = _objectSpread(_objectSpread({}, _defaults["default"].model), model); // if configuration.withRubric.forceEnabled is true, then we update the model (rubricEnabled)
170
+ // without triggering the Model Updated event (for more details, check documentation)
171
+
172
+
173
+ if (config !== null && config !== void 0 && (_config$withRubric = config.withRubric) !== null && _config$withRubric !== void 0 && _config$withRubric.forceEnabled && !defaultModel.rubricEnabled) {
174
+ defaultModel.rubricEnabled = true;
175
+ }
176
+
177
+ return defaultModel;
142
178
  });
143
179
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["ExtendedTextEntry","_model","createDefaultModel","_configuration","defaults","configuration","m","render","c","dispatchEvent","ModelUpdatedEvent","onModelChanged","handler","InsertImageEvent","src","done","DeleteImageEvent","InsertSoundEvent","DeleteSoundEvent","element","React","createElement","Main","model","bind","onConfigurationChanged","imageSupport","add","insertImage","onDeleteImage","uploadSoundSupport","insertSound","onDeleteSound","ReactDOM","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAOA;;AACA;;AACA;;AAEA;;;;;;;;;;IAEqBA,iB;;;;;AAMnB,+BAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,MAAL,GAAcD,iBAAiB,CAACE,kBAAlB,EAAd;AACA,UAAKC,cAAL,GAAsBC,qBAASC,aAA/B;AAHY;AAIb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKL,MAAL,GAAcD,iBAAiB,CAACE,kBAAlB,CAAqCI,CAArC,CAAd;AACA,WAAKC,MAAL;AACD;;;SAED,aAAkBC,CAAlB,EAAqB;AACnB,WAAKL,cAAL,mCACKC,qBAASC,aADd,GAEKG,CAFL;AAKA,WAAKD,MAAL;AACD;;;WAED,wBAAeD,CAAf,EAAkB;AAChB,WAAKL,MAAL,GAAcK,CAAd;AACA,WAAKC,MAAL;AACA,WAAKE,aAAL,CAAmB,IAAIC,qCAAJ,CAAsB,KAAKT,MAA3B,EAAmC,KAAnC,CAAnB;AACD;;;WAED,gCAAuBO,CAAvB,EAA0B;AACxB,WAAKL,cAAL,mCACKC,qBAASC,aADd,GAEKG,CAFL;;AAKA,UAAI,KAAKP,MAAT,EAAiB;AACf,aAAKU,cAAL,CAAoB,KAAKV,MAAzB;AACD;;AAED,WAAKM,MAAL;AACD;AAED;AACF;AACA;AACA;;;;WACE,qBAAYK,OAAZ,EAAqB;AACnB,WAAKH,aAAL,CAA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ACuB,KAAD,uEAAS,EAAT;AAAA,yCACvBnB,qBAASmB,KADc,GAEvBA,KAFuB;AAAA,C","sourcesContent":["import {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport Main from './main';\n\nimport defaults from './defaults';\n\nexport default class ExtendedTextEntry extends HTMLElement {\n static createDefaultModel = (model = {}) => ({\n ...defaults.model,\n ...model\n });\n\n constructor() {\n super();\n this._model = ExtendedTextEntry.createDefaultModel();\n this._configuration = defaults.configuration;\n }\n\n set model(m) {\n this._model = ExtendedTextEntry.createDefaultModel(m);\n this.render();\n }\n\n set configuration(c) {\n this._configuration = {\n ...defaults.configuration,\n ...c,\n };\n\n this.render();\n }\n\n onModelChanged(m) {\n this._model = m;\n this.render();\n this.dispatchEvent(new ModelUpdatedEvent(this._model, false));\n }\n\n onConfigurationChanged(c) {\n this._configuration = {\n ...defaults.configuration,\n ...c,\n };\n\n if (this._model) {\n this.onModelChanged(this._model);\n }\n\n this.render();\n }\n\n /**\n *\n * @param {done, progress, file} handler\n */\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n render() {\n if (this._model) {\n const element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged.bind(this),\n onConfigurationChanged: this.onConfigurationChanged.bind(this),\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n ReactDOM.render(element, this);\n }\n }\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["ExtendedTextEntry","_configuration","defaults","configuration","withRubric","forceEnabled","settings","_model","createDefaultModel","m","render","c","rubricEnabled","dispatchEvent","ModelUpdatedEvent","onModelChanged","handler","InsertImageEvent","src","done","DeleteImageEvent","InsertSoundEvent","DeleteSoundEvent","element","React","createElement","Main","model","bind","onConfigurationChanged","imageSupport","add","insertImage","onDeleteImage","uploadSoundSupport","insertSound","onDeleteSound","ReactDOM","HTMLElement","config","defaultModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAOA;;AACA;;AACA;;AAEA;;;;;;;;;;IAEqBA,iB;;;;;AAiBnB,+BAAc;AAAA;;AAAA;;AAAA;AACZ;AACA,UAAKC,cAAL,GAAsBC,qBAASC,aAA/B,CAFY,CAIZ;AACA;;AACA,iCAAI,MAAKF,cAAL,CAAoBG,UAAxB,kDAAI,sBAAgCC,YAApC,EAAkD;AAChD,YAAKJ,cAAL,CAAoBG,UAApB,CAA+BE,QAA/B,GAA0C,KAA1C;AACD;;AAED,UAAKC,MAAL,GAAcP,iBAAiB,CAACQ,kBAAlB,CAAqC,EAArC,EAAyC,MAAKP,cAA9C,CAAd;AAVY;AAWb;;;;SAED,aAAUQ,CAAV,EAAa;AACX,WAAKF,MAAL,GAAcP,iBAAiB,CAACQ,kBAAlB,CAAqCC,CAArC,EAAwC,KAAKR,cAA7C,CAAd;AACA,WAAKS,MAAL;AACD;;;SAED,aAAkBC,CAAlB,EAAqB;AACnB,WAAKV,cAAL,mCACKC,qBAASC,aADd,GAEKQ,CAFL;;AAKA,iBAA4BA,CAAC,IAAI,EAAjC;AAAA,iCAAQP,UAAR;AAAA,UAAQA,UAAR,gCAAqB,EAArB,mBANmB,CAQnB;AACA;AACA;;;AACA,UAAIA,UAAJ,aAAIA,UAAJ,eAAIA,UAAU,CAAEC,YAAhB,EAA8B;AAC5B,aAAKJ,cAAL,CAAoBG,UAApB,CAA+BE,QAA/B,GAA0C,KAA1C;;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zB,CAHwB;AAIxCC,UAAAA,sBAAsB,EAAE,KAAKA,sBAAL,CAA4BD,IAA5B,CAAiC,IAAjC,CAJgB;AAKxCE,UAAAA,YAAY,EAAE;AACZC,YAAAA,GAAG,EAAE,KAAKC,WAAL,CAAiBJ,IAAjB,CAAsB,IAAtB,CADO;AAEZ,sBAAQ,KAAKK,aAAL,CAAmBL,IAAnB,CAAwB,IAAxB;AAFI,WAL0B;AASxCM,UAAAA,kBAAkB,EAAE;AAClBH,YAAAA,GAAG,EAAE,KAAKI,WAAL,CAAiBP,IAAjB,CAAsB,IAAtB,CADa;AAElB,sBAAQ,KAAKQ,aAAL,CAAmBR,IAAnB,CAAwB,IAAxB;AAFU;AAToB,SAA1B,CAAhB;;AAcAS,6BAAS3B,MAAT,CAAgBa,OAAhB,EAAyB,IAAzB;AACD;AACF;;;kDAlH4Ce,W;;;iCAA1BtC,iB,wBACS,YAAwB;AAAA;;AAAA,MAAvB2B,KAAuB,uEAAf,EAAe;AAAA,MAAXY,MAAW;;AAClD,MAAMC,YAAY,mCACbtC,qBAASyB,KADI,GAEbA,KAFa,CAAlB,CADkD,CAMlD;AACA;;;AACA,MAAIY,MAAM,SAAN,IAAAA,MAAM,WAAN,0BAAAA,MAAM,CAAEnC,UAAR,kEAAoBC,YAApB,IAAoC,CAACmC,YAAY,CAAC5B,aAAtD,EAAqE;AACnE4B,IAAAA,YAAY,CAAC5B,aAAb,GAA6B,IAA7B;AACD;;AAED,SAAO4B,YAAP;AACD,C","sourcesContent":["import {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport Main from './main';\n\nimport defaults from './defaults';\n\nexport default class ExtendedTextEntry extends HTMLElement {\n static createDefaultModel = (model = {}, config) => {\n const defaultModel = {\n ...defaults.model,\n ...model,\n };\n\n // if configuration.withRubric.forceEnabled is true, then we update the model (rubricEnabled)\n // without triggering the Model Updated event (for more details, check documentation)\n if (config?.withRubric?.forceEnabled && !defaultModel.rubricEnabled) {\n defaultModel.rubricEnabled = true;\n }\n\n return defaultModel;\n };\n\n\n constructor() {\n super();\n this._configuration = defaults.configuration;\n\n // if configuration.withRubric.forceEnabled is true, then we\n // update the configuration (we do not want to display the toggle in the Settings Panel)\n if (this._configuration.withRubric?.forceEnabled) {\n this._configuration.withRubric.settings = false;\n }\n\n this._model = ExtendedTextEntry.createDefaultModel({}, this._configuration);\n }\n\n set model(m) {\n this._model = ExtendedTextEntry.createDefaultModel(m, this._configuration);\n this.render();\n }\n\n set configuration(c) {\n this._configuration = {\n ...defaults.configuration,\n ...c,\n };\n\n const { withRubric = {} } = c || {};\n\n // if configuration.withRubric.forceEnabled is true, then we update the model (rubricEnabled)\n // without triggering the Model Updated event (for more details, check documentation)\n // and also update the configuration (we do not want to display the toggle in the Settings Panel)\n if (withRubric?.forceEnabled) {\n this._configuration.withRubric.settings = false;\n\n if (!this._model.rubricEnabled) {\n this._model.rubricEnabled = true;\n }\n }\n\n this.render();\n }\n\n onModelChanged(m) {\n this._model = m;\n this.render();\n this.dispatchEvent(new ModelUpdatedEvent(this._model, false));\n }\n\n onConfigurationChanged(c) {\n this._configuration = {\n ...defaults.configuration,\n ...c,\n };\n\n if (this._model) {\n this.onModelChanged(this._model);\n }\n\n this.render();\n }\n\n /**\n *\n * @param {done, progress, file} handler\n */\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n render() {\n if (this._model) {\n const element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged.bind(this),\n onConfigurationChanged: this.onConfigurationChanged.bind(this),\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n ReactDOM.render(element, this);\n }\n }\n}\n"],"file":"index.js"}
@@ -230,7 +230,7 @@
230
230
  "title": "label"
231
231
  },
232
232
  "forceEnabled": {
233
- "description": "Indicates the value for the toggle; if true, this property will not be visible in Settings Panel",
233
+ "description": "Indicates the value for the toggle;\nif true:\n- this property will not be visible in Settings Panel (settings will become automatically false)\n- the model property afferent to it will become automatically false",
234
234
  "type": "boolean",
235
235
  "title": "forceEnabled"
236
236
  }
@@ -329,7 +329,7 @@
329
329
  "title": "label"
330
330
  },
331
331
  "forceEnabled": {
332
- "description": "Indicates the value for the toggle; if true, this property will not be visible in Settings Panel",
332
+ "description": "Indicates the value for the toggle;\nif true:\n- this property will not be visible in Settings Panel (settings will become automatically false)\n- the model property afferent to it will become automatically false",
333
333
  "type": "boolean",
334
334
  "title": "forceEnabled"
335
335
  }
@@ -177,7 +177,10 @@ Indicates the label for the item that has to be displayed in the Settings Panel
177
177
 
178
178
  ## `forceEnabled` (boolean)
179
179
 
180
- Indicates the value for the toggle; if true, this property will not be visible in Settings Panel
180
+ Indicates the value for the toggle;
181
+ if true:
182
+ - this property will not be visible in Settings Panel (settings will become automatically false)
183
+ - the model property afferent to it will become automatically false
181
184
 
182
185
  # `showPrompt` (boolean)
183
186
 
@@ -262,4 +265,7 @@ Indicates the label for the item that has to be displayed in the Settings Panel
262
265
 
263
266
  ### `forceEnabled` (boolean)
264
267
 
265
- Indicates the value for the toggle; if true, this property will not be visible in Settings Panel
268
+ Indicates the value for the toggle;
269
+ if true:
270
+ - this property will not be visible in Settings Panel (settings will become automatically false)
271
+ - the model property afferent to it will become automatically false
@@ -250,7 +250,7 @@
250
250
  "title": "label"
251
251
  },
252
252
  "forceEnabled": {
253
- "description": "Indicates the value for the toggle; if true, this property will not be visible in Settings Panel",
253
+ "description": "Indicates the value for the toggle;\nif true:\n- this property will not be visible in Settings Panel (settings will become automatically false)\n- the model property afferent to it will become automatically false",
254
254
  "type": "boolean",
255
255
  "title": "forceEnabled"
256
256
  }
@@ -203,7 +203,10 @@ Indicates the label for the item that has to be displayed in the Settings Panel
203
203
 
204
204
  ### `forceEnabled` (boolean)
205
205
 
206
- Indicates the value for the toggle; if true, this property will not be visible in Settings Panel
206
+ Indicates the value for the toggle;
207
+ if true:
208
+ - this property will not be visible in Settings Panel (settings will become automatically false)
209
+ - the model property afferent to it will become automatically false
207
210
 
208
211
  ## `Dimensions` (object)
209
212
 
package/lib/index.js CHANGED
@@ -107,6 +107,8 @@ var RootExtendedTextEntry = /*#__PURE__*/function (_HTMLElement) {
107
107
  }, {
108
108
  key: "connectedCallback",
109
109
  value: function connectedCallback() {
110
+ this.setAttribute('aria-label', 'Written Response Question');
111
+ this.setAttribute('role', 'region');
110
112
  this.render();
111
113
  }
112
114
  }, {
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["log","domParser","window","undefined","DOMParser","parseFromString","v","textContent","value","document","body","err","isComplete","tc","out","length","RootExtendedTextEntry","_model","_session","m","dispatchEvent","ModelSetEvent","tagName","toLowerCase","render","s","SessionChangedEvent","elem","React","createElement","Main","model","session","onChange","handleChange","bind","ReactDOM","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,6BAAN,CAAZ;AAEA,IAAMC,SAAS,GAAG,QAAOC,MAAP,0DAAOA,MAAP,OAAkBC,SAAlB,GAA8B,IAAIC,SAAJ,EAA9B,GAAgD;AAAEC,EAAAA,eAAe,EAAE,yBAACC,CAAD;AAAA,WAAOA,CAAP;AAAA;AAAnB,CAAlE;;AAEO,SAASC,WAAT,CAAqBC,KAArB,EAA4B;AACjC,MAAI,OAAOA,KAAP,KAAiB,QAArB,EAA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B,MAAL;AACD;;;WAED,kBAAS;AAAA;;AACP,UAAI,KAAKP,MAAL,IAAe,KAAKC,QAAxB,EAAkC;AAChC,YAAIS,IAAI,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACnCC,UAAAA,KAAK,EAAE,KAAKd,MADuB;AAEnCe,UAAAA,OAAO,EAAE,KAAKd,QAFqB;AAGnCe,UAAAA,QAAQ,EAAE,KAAKC,YAAL,CAAkBC,IAAlB,CAAuB,IAAvB;AAHyB,SAA1B,CAAX;;AAMAC,6BAASZ,MAAT,CAAgBG,IAAhB,EAAsB,IAAtB,EAA4B,YAAM;AAChC,yCAAW,MAAX;AACD,SAFD;AAGD;AACF;;;kDA7CgDU,W","sourcesContent":["import Main from './main';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nimport { ModelSetEvent, SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport debug from 'debug';\n\nconst log = debug('@pie-ui:extended-text-entry');\n\nconst domParser = typeof window !== undefined ? new DOMParser() : { parseFromString: (v) => v };\n\nexport function textContent(value) {\n if (typeof value !== 'string') {\n return undefined;\n }\n try {\n const document = domParser.parseFromString(value, 'text/html');\n const textContent = document.body.textContent;\n return textContent;\n } catch (err) {\n log('tried to parse as dom and failed', value);\n return value;\n }\n}\n\nexport function isComplete(value) {\n const tc = textContent(value);\n const out = tc !== undefined && tc.length > 0;\n return out;\n}\n\nexport default class RootExtendedTextEntry extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._session = null;\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), false, !!this._model));\n\n this.render();\n }\n\n set session(s) {\n this._session = s;\n this.render();\n }\n\n get session() {\n return this._session;\n }\n\n handleChange(value) {\n this._session.value = value;\n\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), isComplete(value)));\n }\n\n connectedCallback() {\n this.render();\n }\n\n render() {\n if (this._model && this._session) {\n let elem = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onChange: this.handleChange.bind(this),\n });\n\n ReactDOM.render(elem, this, () => {\n renderMath(this);\n });\n }\n }\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["log","domParser","window","undefined","DOMParser","parseFromString","v","textContent","value","document","body","err","isComplete","tc","out","length","RootExtendedTextEntry","_model","_session","m","dispatchEvent","ModelSetEvent","tagName","toLowerCase","render","s","SessionChangedEvent","setAttribute","elem","React","createElement","Main","model","session","onChange","handleChange","bind","ReactDOM","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,6BAAN,CAAZ;AAEA,IAAMC,SAAS,GAAG,QAAOC,MAAP,0DAAOA,MAAP,OAAkBC,SAAlB,GAA8B,IAAIC,SAAJ,EAA9B,GAAgD;AAAEC,EAAAA,eAAe,EAAE,yBAACC,CAAD;AAAA,WAAOA,CAAP;AAAA;AAAnB,CAAlE;;AAEO,SAASC,WAAT,CAAqBC,KAArB,EAA4B;AACjC,MAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;AAC7B,WAAOL,SAAP;AACD;;AACD,MAAI;AACF,QAAMM,QAAQ,GAAGR,SAAS,CAACI,eAAV,CAA0BG,KAA1B,EAAiC,WAAjC,CAAjB;AACA,QAAMD,YAAW,GAAGE,QAAQ,CAACC,IAAT,CAAcH,WAAlC;AACA,WAAOA,YAAP;AACD,GAJD,CAIE,OAAOI,GAAP,EAAY;AACZX,IAAAA,GAAG,CAAC,kCAAD,EAAqCQ,KAArC,CAAH;AACA,WAAOA,KAAP;AACD;AACF;;AAEM,SAASI,UAAT,CAAoBJ,KAApB,EAA2B;AAChC,MAAMK,EAAE,GAAGN,WAAW,CAACC,KAAD,CAAtB;AACA,MAAMM,GAAG,GAAGD,EAAE,KAAKV,SAAP,IAAoBU,EAAE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IAAtB,EAA4B,YAAM;AAChC,yCAAW,MAAX;AACD,SAFD;AAGD;AACF;;;kDAhDgDU,W","sourcesContent":["import Main from './main';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nimport { ModelSetEvent, SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport debug from 'debug';\n\nconst log = debug('@pie-ui:extended-text-entry');\n\nconst domParser = typeof window !== undefined ? new DOMParser() : { parseFromString: (v) => v };\n\nexport function textContent(value) {\n if (typeof value !== 'string') {\n return undefined;\n }\n try {\n const document = domParser.parseFromString(value, 'text/html');\n const textContent = document.body.textContent;\n return textContent;\n } catch (err) {\n log('tried to parse as dom and failed', value);\n return value;\n }\n}\n\nexport function isComplete(value) {\n const tc = textContent(value);\n const out = tc !== undefined && tc.length > 0;\n return out;\n}\n\nexport default class RootExtendedTextEntry extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._session = null;\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), false, !!this._model));\n\n this.render();\n }\n\n set session(s) {\n this._session = s;\n this.render();\n }\n\n get session() {\n return this._session;\n }\n\n handleChange(value) {\n this._session.value = value;\n\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), isComplete(value)));\n }\n\n connectedCallback() {\n this.setAttribute('aria-label', 'Written Response Question'); \n this.setAttribute('role', 'region');\n\n this.render();\n }\n\n render() {\n if (this._model && this._session) {\n let elem = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onChange: this.handleChange.bind(this),\n });\n\n ReactDOM.render(elem, this, () => {\n renderMath(this);\n });\n }\n }\n}\n"],"file":"index.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/extended-text-entry",
3
- "version": "9.0.1-next.2+755b939e9",
3
+ "version": "9.0.1-next.24+9353f7376",
4
4
  "description": "",
5
5
  "repository": "pie-framework/pie-elements",
6
6
  "publishConfig": {
@@ -22,7 +22,7 @@
22
22
  "react": "^16.8.1",
23
23
  "react-dom": "^16.8.1"
24
24
  },
25
- "gitHead": "755b939e9891a6523a5d20360e52dce285fbc83a",
25
+ "gitHead": "9353f73768c78233621ab11119b1961af018a7e4",
26
26
  "scripts": {
27
27
  "postpublish": "../../scripts/postpublish"
28
28
  },