@pie-element/extended-text-entry 9.0.0 → 9.0.1-next.14
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 +1 -1
- package/configure/CHANGELOG.md +1 -1
- package/configure/lib/index.js +40 -4
- package/configure/lib/index.js.map +1 -1
- package/docs/config-schema.json +2 -2
- package/docs/config-schema.json.md +8 -2
- package/docs/pie-schema.json +1 -1
- package/docs/pie-schema.json.md +4 -1
- package/package.json +2 -2
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,
|
|
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
|
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -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,
|
|
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
|
|
package/configure/lib/index.js
CHANGED
|
@@ -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.
|
|
53
|
-
|
|
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
|
-
|
|
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","
|
|
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,q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AT,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"}
|
package/docs/config-schema.json
CHANGED
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
"title": "label"
|
|
231
231
|
},
|
|
232
232
|
"forceEnabled": {
|
|
233
|
-
"description": "Indicates the value for the toggle
|
|
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
|
|
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;
|
|
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;
|
|
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
|
package/docs/pie-schema.json
CHANGED
|
@@ -250,7 +250,7 @@
|
|
|
250
250
|
"title": "label"
|
|
251
251
|
},
|
|
252
252
|
"forceEnabled": {
|
|
253
|
-
"description": "Indicates the value for the toggle
|
|
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
|
}
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -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;
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/extended-text-entry",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.1-next.14+dbc1d50cb",
|
|
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": "
|
|
25
|
+
"gitHead": "dbc1d50cbc34321e5e6c5b334da11dcf4281cb0b",
|
|
26
26
|
"scripts": {
|
|
27
27
|
"postpublish": "../../scripts/postpublish"
|
|
28
28
|
},
|