@pie-element/graphing 5.12.1-next.5 → 5.12.2-next.4

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,17 @@
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
+ ## [5.12.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/graphing@5.12.0...@pie-element/graphing@5.12.1) (2024-04-01)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * check for pie-author when configuration is set PD-3614 ([a40d3d9](https://github.com/pie-framework/pie-elements/commit/a40d3d954486cc782d5e80a7c6120c2912c58b39))
12
+
13
+
14
+
15
+
16
+
6
17
  # [5.12.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/graphing@5.11.1...@pie-element/graphing@5.12.0) (2024-04-01)
7
18
 
8
19
 
@@ -3,6 +3,17 @@
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
+ ## [5.11.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/graphing-configure@5.11.0...@pie-element/graphing-configure@5.11.1) (2024-04-01)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * check for pie-author when configuration is set PD-3614 ([a40d3d9](https://github.com/pie-framework/pie-elements/commit/a40d3d954486cc782d5e80a7c6120c2912c58b39))
12
+
13
+
14
+
15
+
16
+
6
17
  # [5.11.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/graphing-configure@5.10.1...@pie-element/graphing-configure@5.11.0) (2024-04-01)
7
18
 
8
19
 
@@ -70,6 +70,16 @@ var GraphLinesConfigure = /*#__PURE__*/function (_HTMLElement) {
70
70
  (0, _classCallCheck2["default"])(this, GraphLinesConfigure);
71
71
  _this = _super.call(this);
72
72
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "resetModelAfterConfigurationIsSet", function () {
73
+ // In environments that use pie-player-components, model is set before configuration.
74
+ // This is the reason why sometimes the model gets altered non-reversible
75
+ // (altered using default configuration instead of client configuration, because at that point client configuration was not set yet)
76
+ // Therefore, in such environments, we will make sure to keep a modelCopy (initialised in set model) and use it to reset
77
+ // the model in set configuration (resetModelAfterConfigurationIsSet) if set configuration is ever called
78
+ var pieAuthors = document.querySelectorAll('pie-author');
79
+ _this.hasPlayerAsParent = Array.from(pieAuthors).some(function (author) {
80
+ return author.contains((0, _assertThisInitialized2["default"])(_this));
81
+ });
82
+
73
83
  if (_this.hasPlayerAsParent) {
74
84
  if (_this._modelCopy) {
75
85
  _this._model = _this._modelCopy;
@@ -99,16 +109,7 @@ var GraphLinesConfigure = /*#__PURE__*/function (_HTMLElement) {
99
109
  _this.dispatchEvent(new _pieConfigureEvents.DeleteImageEvent(src, done));
100
110
  });
101
111
  _this._model = GraphLinesConfigure.createDefaultModel();
102
- _this._configuration = _defaults["default"].configuration; // In environments that use pie-player-components, model is set before configuration.
103
- // This is the reason why sometimes the model gets altered non-reversible
104
- // (altered using default configuration instead of client configuration, because at that point client configuration was not set yet)
105
- // Therefore, in such environments, we will make sure to keep a modelCopy (initialised in set model) and use it to reset
106
- // the model in set configuration (resetModelAfterConfigurationIsSet) if set configuration is ever called
107
-
108
- var pieAuthors = document.querySelectorAll('pie-author');
109
- _this.hasPlayerAsParent = Array.from(pieAuthors).some(function (author) {
110
- return author.contains((0, _assertThisInitialized2["default"])(_this));
111
- });
112
+ _this._configuration = _defaults["default"].configuration;
112
113
  return _this;
113
114
  }
114
115
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["log","sortedAnswers","answers","Object","keys","sort","reduce","result","key","GraphLinesConfigure","hasPlayerAsParent","_modelCopy","_model","model","_render","dispatchEvent","ModelUpdatedEvent","config","_configuration","handler","InsertImageEvent","src","done","DeleteImageEvent","createDefaultModel","defaultValues","configuration","pieAuthors","document","querySelectorAll","Array","from","some","author","contains","m","c","resetModelAfterConfigurationIsSet","language","enabled","languageChoices","options","length","value","settings","InsertSoundEvent","DeleteSoundEvent","el","React","createElement","Configure","onModelChanged","onConfigurationChanged","imageSupport","add","insertImage","onDeleteImage","uploadSoundSupport","insertSound","bind","onDeleteSound","ReactDOM","render","HTMLElement","normalizedModel","domain","defaultTool","graph","range","standardGrid","toolbarTools","toolbarToolsNoLabel","filter","tool","normalizedDefaultTool","correctAnswer","min","max","step","labelStep","height","width"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,iCAAN,CAAZ,C,CAEA;;AACA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,OAAD;AAAA,SACpBC,MAAM,CAACC,IAAP,CAAYF,OAAO,IAAI,EAAvB,EACGG,IADH,GAEGC,MAFH,CAEU,UAACC,MAAD,EAASC,GAAT,EAAiB;AACvB,QAAIA,GAAG,KAAK,eAAZ,EAA6B;AAC3BD,MAAAA,MAAM,CAACC,GAAD,CAAN,GAAcN,OAAO,CAACM,GAAD,CAArB;AACD;;AAED,WAAOD,MAAP;AACD,GARH,EAQK,EARL,CADoB;AAAA,CAAtB;;IAWqBE,mB;;;;;AAwCnB,iCAAc;AAAA;;AAAA;AACZ;AADY,0HAqBsB,YAAM;AACxC,UAAI,MAAKC,iBAAT,EAA4B;AAC1B,YAAI,MAAKC,UAAT,EAAqB;AACnB,gBAAKC,MAAL,GAAc,MAAKD,UAAnB;AACD,SAFD,MAEO;AACL,iBAAO,MAAKA,UAAZ;AACD;AACF;AACF,KA7Ba;AAAA,uGA0DG,UAACE,KAAD,EAAW;AAC1B,YAAKD,MAAL,GAAcC,KAAd;;AACA,YAAKC,OAAL;;AAEAd,MAAAA,GAAG,CAAC,oBAAD,EAAuB,MAAKY,MAA5B,CAAH;;AAEA,YAAKG,aAAL,CAAmB,IAAIC,qCAAJ,CAAsB,M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C,MAAAA,IAAI,EAAEb,MAAM,CAACa,IAJF;AAKXC,MAAAA,SAAS,EAAEd,MAAM,CAACc;AALP,MAAb,IAOAX,KAlBJ;AAmBED,IAAAA,KAAK,EAAGE,YAAY,oCAASF,KAAT;AAAgBa,MAAAA,MAAM,EAAEb,KAAK,CAACc;AAA9B,MAAb,IAAuDd;AAnBhE;AAqBD,C","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport Configure from './configure';\nimport {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\nimport debug from 'debug';\nimport defaultValues from './defaults';\nimport { renderMath } from '@pie-lib/pie-toolbox/math-rendering-accessible';\nimport cloneDeep from 'lodash/cloneDeep';\n\nconst log = debug('pie-elements:graphing:configure');\n\n// this function is implemented in controller as well\nconst sortedAnswers = (answers) =>\n Object.keys(answers || {})\n .sort()\n .reduce((result, key) => {\n if (key !== 'correctAnswer') {\n result[key] = answers[key];\n }\n\n return result;\n }, {});\n\nexport default class GraphLinesConfigure extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const normalizedModel = { ...defaultValues.model, ...model };\n const {\n answers = {},\n domain = {},\n defaultTool,\n graph = {},\n range = {},\n standardGrid,\n toolbarTools,\n } = normalizedModel;\n\n // added support for models without defaultTool defined; also used in packages/graphing/controller/src/index.js\n const toolbarToolsNoLabel = (toolbarTools || []).filter((tool) => tool !== 'label');\n const normalizedDefaultTool = defaultTool || (toolbarToolsNoLabel.length && toolbarToolsNoLabel[0]) || '';\n\n return {\n ...normalizedModel,\n answers:\n (answers &&\n answers.correctAnswer && {\n correctAnswer: answers.correctAnswer,\n ...sortedAnswers(answers),\n }) ||\n answers,\n defaultTool: normalizedDefaultTool,\n range:\n (standardGrid && {\n ...range,\n min: domain.min,\n max: domain.max,\n step: domain.step,\n labelStep: domain.labelStep,\n }) ||\n range,\n graph: (standardGrid && { ...graph, height: graph.width }) || graph,\n };\n };\n\n constructor() {\n super();\n this._model = GraphLinesConfigure.createDefaultModel();\n this._configuration = defaultValues.configuration;\n\n // In environments that use pie-player-components, model is set before configuration.\n // This is the reason why sometimes the model gets altered non-reversible\n // (altered using default configuration instead of client configuration, because at that point client configuration was not set yet)\n // Therefore, in such environments, we will make sure to keep a modelCopy (initialised in set model) and use it to reset\n // the model in set configuration (resetModelAfterConfigurationIsSet) if set configuration is ever called\n const pieAuthors = document.querySelectorAll('pie-author');\n this.hasPlayerAsParent = Array.from(pieAuthors).some(author => author.contains(this));\n }\n\n set model(m) {\n this._model = GraphLinesConfigure.createDefaultModel(m);\n this._modelCopy = cloneDeep(this._model);\n\n this._render();\n }\n\n resetModelAfterConfigurationIsSet = () => {\n if (this.hasPlayerAsParent) {\n if (this._modelCopy) {\n this._model = this._modelCopy;\n } else {\n delete this._modelCopy;\n }\n }\n }\n\n set configuration(c) {\n this._configuration = c;\n\n this.resetModelAfterConfigurationIsSet();\n\n // if language:enabled is true, then the corresponding default item model should include a language value;\n // if it is false, then the language field should be omitted from the item model.\n // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,\n // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).\n //TODO: add logic in controller and add tests\n if (c.language?.enabled) {\n if (c.languageChoices?.options?.length) {\n this._model.language = c.languageChoices.options[0].value;\n }\n } else {\n if (c.language.settings) {\n if (this._model.language) {\n this._configuration.language.enabled = true;\n }\n } else {\n delete this._model.language;\n }\n }\n\n this._render();\n }\n\n onModelChanged = (model) => {\n this._model = model;\n this._render();\n\n log('[onModelChanged]: ', this._model);\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model));\n };\n\n onConfigurationChanged = (config) => {\n this._configuration = config;\n this._render();\n };\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 el = React.createElement(Configure, {\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n model: this._model,\n configuration: this._configuration,\n imageSupport: {\n add: this.insertImage,\n delete: this.onDeleteImage,\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n ReactDOM.render(el, this, () => {\n renderMath(this);\n });\n }\n }\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["log","sortedAnswers","answers","Object","keys","sort","reduce","result","key","GraphLinesConfigure","pieAuthors","document","querySelectorAll","hasPlayerAsParent","Array","from","some","author","contains","_modelCopy","_model","model","_render","dispatchEvent","ModelUpdatedEvent","config","_configuration","handler","InsertImageEvent","src","done","DeleteImageEvent","createDefaultModel","defaultValues","configuration","m","c","resetModelAfterConfigurationIsSet","language","enabled","languageChoices","options","length","value","settings","InsertSoundEvent","DeleteSoundEvent","el","React","createElement","Configure","onModelChanged","onConfigurationChanged","imageSupport","add","insertImage","onDeleteImage","uploadSoundSupport","insertSound","bind","onDeleteSound","ReactDOM","render","HTMLElement","normalizedModel","domain","defaultTool","graph","range","standardGrid","toolbarTools","toolbarToolsNoLabel","filter","tool","normalizedDefaultTool","correctAnswer","min","max","step","labelStep","height","width"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,iCAAN,CAAZ,C,CAEA;;AACA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,OAAD;AAAA,SACpBC,MAAM,CAACC,IAAP,CAAYF,OAAO,IAAI,EAAvB,EACGG,IADH,GAEGC,MAFH,CAEU,UAACC,MAAD,EAASC,GAAT,EAAiB;AACvB,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AAMC,mBAAmB,GAAG,CAACD,YAAY,IAAI,EAAjB,EAAqBE,MAArB,CAA4B,UAACC,IAAD;AAAA,WAAUA,IAAI,KAAK,OAAnB;AAAA,GAA5B,CAA5B;AACA,MAAMC,qBAAqB,GAAGR,WAAW,IAAKK,mBAAmB,CAAC7B,MAApB,IAA8B6B,mBAAmB,CAAC,CAAD,CAAjE,IAAyE,EAAvG;AAEA,yCACKP,eADL;AAEE9D,IAAAA,OAAO,EACJA,OAAO,IACNA,OAAO,CAACyE,aADT;AAEGA,MAAAA,aAAa,EAAEzE,OAAO,CAACyE;AAF1B,OAGM1E,aAAa,CAACC,OAAD,CAHnB,CAAD,IAKAA,OARJ;AASEgE,IAAAA,WAAW,EAAEQ,qBATf;AAUEN,IAAAA,KAAK,EACFC,YAAY,oCACRD,KADQ;AAEXQ,MAAAA,GAAG,EAAEX,MAAM,CAACW,GAFD;AAGXC,MAAAA,GAAG,EAAEZ,MAAM,CAACY,GAHD;AAIXC,MAAAA,IAAI,EAAEb,MAAM,CAACa,IAJF;AAKXC,MAAAA,SAAS,EAAEd,MAAM,CAACc;AALP,MAAb,IAOAX,KAlBJ;AAmBED,IAAAA,KAAK,EAAGE,YAAY,oCAASF,KAAT;AAAgBa,MAAAA,MAAM,EAAEb,KAAK,CAACc;AAA9B,MAAb,IAAuDd;AAnBhE;AAqBD,C","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport Configure from './configure';\nimport {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\nimport debug from 'debug';\nimport defaultValues from './defaults';\nimport { renderMath } from '@pie-lib/pie-toolbox/math-rendering-accessible';\nimport cloneDeep from 'lodash/cloneDeep';\n\nconst log = debug('pie-elements:graphing:configure');\n\n// this function is implemented in controller as well\nconst sortedAnswers = (answers) =>\n Object.keys(answers || {})\n .sort()\n .reduce((result, key) => {\n if (key !== 'correctAnswer') {\n result[key] = answers[key];\n }\n\n return result;\n }, {});\n\nexport default class GraphLinesConfigure extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const normalizedModel = { ...defaultValues.model, ...model };\n const {\n answers = {},\n domain = {},\n defaultTool,\n graph = {},\n range = {},\n standardGrid,\n toolbarTools,\n } = normalizedModel;\n\n // added support for models without defaultTool defined; also used in packages/graphing/controller/src/index.js\n const toolbarToolsNoLabel = (toolbarTools || []).filter((tool) => tool !== 'label');\n const normalizedDefaultTool = defaultTool || (toolbarToolsNoLabel.length && toolbarToolsNoLabel[0]) || '';\n\n return {\n ...normalizedModel,\n answers:\n (answers &&\n answers.correctAnswer && {\n correctAnswer: answers.correctAnswer,\n ...sortedAnswers(answers),\n }) ||\n answers,\n defaultTool: normalizedDefaultTool,\n range:\n (standardGrid && {\n ...range,\n min: domain.min,\n max: domain.max,\n step: domain.step,\n labelStep: domain.labelStep,\n }) ||\n range,\n graph: (standardGrid && { ...graph, height: graph.width }) || graph,\n };\n };\n\n constructor() {\n super();\n this._model = GraphLinesConfigure.createDefaultModel();\n this._configuration = defaultValues.configuration;\n }\n\n set model(m) {\n this._model = GraphLinesConfigure.createDefaultModel(m);\n this._modelCopy = cloneDeep(this._model);\n\n this._render();\n }\n\n resetModelAfterConfigurationIsSet = () => {\n // In environments that use pie-player-components, model is set before configuration.\n // This is the reason why sometimes the model gets altered non-reversible\n // (altered using default configuration instead of client configuration, because at that point client configuration was not set yet)\n // Therefore, in such environments, we will make sure to keep a modelCopy (initialised in set model) and use it to reset\n // the model in set configuration (resetModelAfterConfigurationIsSet) if set configuration is ever called\n const pieAuthors = document.querySelectorAll('pie-author');\n this.hasPlayerAsParent = Array.from(pieAuthors).some(author => author.contains(this));\n\n if (this.hasPlayerAsParent) {\n if (this._modelCopy) {\n this._model = this._modelCopy;\n } else {\n delete this._modelCopy;\n }\n }\n }\n\n set configuration(c) {\n this._configuration = c;\n\n this.resetModelAfterConfigurationIsSet();\n\n // if language:enabled is true, then the corresponding default item model should include a language value;\n // if it is false, then the language field should be omitted from the item model.\n // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,\n // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).\n //TODO: add logic in controller and add tests\n if (c.language?.enabled) {\n if (c.languageChoices?.options?.length) {\n this._model.language = c.languageChoices.options[0].value;\n }\n } else {\n if (c.language.settings) {\n if (this._model.language) {\n this._configuration.language.enabled = true;\n }\n } else {\n delete this._model.language;\n }\n }\n\n this._render();\n }\n\n onModelChanged = (model) => {\n this._model = model;\n this._render();\n\n log('[onModelChanged]: ', this._model);\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model));\n };\n\n onConfigurationChanged = (config) => {\n this._configuration = config;\n this._render();\n };\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 el = React.createElement(Configure, {\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n model: this._model,\n configuration: this._configuration,\n imageSupport: {\n add: this.insertImage,\n delete: this.onDeleteImage,\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n ReactDOM.render(el, this, () => {\n renderMath(this);\n });\n }\n }\n}\n"],"file":"index.js"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/graphing-configure",
3
3
  "private": true,
4
- "version": "5.11.0",
4
+ "version": "5.11.1",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
@@ -50,6 +50,43 @@
50
50
  "title": "disabled"
51
51
  }
52
52
  }
53
+ },
54
+ "customPlugins": {
55
+ "description": "An array of objects that determine custom plugins.\nA custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).\nExample can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.",
56
+ "type": "array",
57
+ "items": {
58
+ "title": "CustomPlugin",
59
+ "type": "object",
60
+ "properties": {
61
+ "event": {
62
+ "description": "The name of the custom event. It needs to be valid (only letters, numbers and \"_\" can be used).\nPIE will emit the event prefixed with \"PIE-\".\nEg: event = 'client_custom_event_A' => the emitted event will be \"PIE-client_custom_event_A\"",
63
+ "type": "string",
64
+ "title": "event"
65
+ },
66
+ "iconAlt": {
67
+ "description": "The alt for the custom button icon",
68
+ "type": "string",
69
+ "title": "iconAlt"
70
+ },
71
+ "iconType": {
72
+ "description": "The icon type.\nCurrently, only \"SVG\" is supported.",
73
+ "type": "string",
74
+ "title": "iconType"
75
+ },
76
+ "icon": {
77
+ "description": "The icon string. Currently, only \"SVG\" is supported, so it needs to be a valid svg.",
78
+ "type": "string",
79
+ "title": "icon"
80
+ }
81
+ },
82
+ "required": [
83
+ "event",
84
+ "icon",
85
+ "iconAlt",
86
+ "iconType"
87
+ ]
88
+ },
89
+ "title": "customPlugins"
53
90
  }
54
91
  }
55
92
  },
@@ -665,6 +702,43 @@
665
702
  "title": "disabled"
666
703
  }
667
704
  }
705
+ },
706
+ "customPlugins": {
707
+ "description": "An array of objects that determine custom plugins.\nA custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).\nExample can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.",
708
+ "type": "array",
709
+ "items": {
710
+ "title": "CustomPlugin",
711
+ "type": "object",
712
+ "properties": {
713
+ "event": {
714
+ "description": "The name of the custom event. It needs to be valid (only letters, numbers and \"_\" can be used).\nPIE will emit the event prefixed with \"PIE-\".\nEg: event = 'client_custom_event_A' => the emitted event will be \"PIE-client_custom_event_A\"",
715
+ "type": "string",
716
+ "title": "event"
717
+ },
718
+ "iconAlt": {
719
+ "description": "The alt for the custom button icon",
720
+ "type": "string",
721
+ "title": "iconAlt"
722
+ },
723
+ "iconType": {
724
+ "description": "The icon type.\nCurrently, only \"SVG\" is supported.",
725
+ "type": "string",
726
+ "title": "iconType"
727
+ },
728
+ "icon": {
729
+ "description": "The icon string. Currently, only \"SVG\" is supported, so it needs to be a valid svg.",
730
+ "type": "string",
731
+ "title": "icon"
732
+ }
733
+ },
734
+ "required": [
735
+ "event",
736
+ "icon",
737
+ "iconAlt",
738
+ "iconType"
739
+ ]
740
+ },
741
+ "title": "customPlugins"
668
742
  }
669
743
  }
670
744
  },
@@ -757,6 +831,43 @@
757
831
  "title": "disabled"
758
832
  }
759
833
  }
834
+ },
835
+ "customPlugins": {
836
+ "description": "An array of objects that determine custom plugins.\nA custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).\nExample can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.",
837
+ "type": "array",
838
+ "items": {
839
+ "title": "CustomPlugin",
840
+ "type": "object",
841
+ "properties": {
842
+ "event": {
843
+ "description": "The name of the custom event. It needs to be valid (only letters, numbers and \"_\" can be used).\nPIE will emit the event prefixed with \"PIE-\".\nEg: event = 'client_custom_event_A' => the emitted event will be \"PIE-client_custom_event_A\"",
844
+ "type": "string",
845
+ "title": "event"
846
+ },
847
+ "iconAlt": {
848
+ "description": "The alt for the custom button icon",
849
+ "type": "string",
850
+ "title": "iconAlt"
851
+ },
852
+ "iconType": {
853
+ "description": "The icon type.\nCurrently, only \"SVG\" is supported.",
854
+ "type": "string",
855
+ "title": "iconType"
856
+ },
857
+ "icon": {
858
+ "description": "The icon string. Currently, only \"SVG\" is supported, so it needs to be a valid svg.",
859
+ "type": "string",
860
+ "title": "icon"
861
+ }
862
+ },
863
+ "required": [
864
+ "event",
865
+ "icon",
866
+ "iconAlt",
867
+ "iconType"
868
+ ]
869
+ },
870
+ "title": "customPlugins"
760
871
  }
761
872
  }
762
873
  },
@@ -860,6 +971,43 @@
860
971
  "title": "disabled"
861
972
  }
862
973
  }
974
+ },
975
+ "customPlugins": {
976
+ "description": "An array of objects that determine custom plugins.\nA custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).\nExample can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.",
977
+ "type": "array",
978
+ "items": {
979
+ "title": "CustomPlugin",
980
+ "type": "object",
981
+ "properties": {
982
+ "event": {
983
+ "description": "The name of the custom event. It needs to be valid (only letters, numbers and \"_\" can be used).\nPIE will emit the event prefixed with \"PIE-\".\nEg: event = 'client_custom_event_A' => the emitted event will be \"PIE-client_custom_event_A\"",
984
+ "type": "string",
985
+ "title": "event"
986
+ },
987
+ "iconAlt": {
988
+ "description": "The alt for the custom button icon",
989
+ "type": "string",
990
+ "title": "iconAlt"
991
+ },
992
+ "iconType": {
993
+ "description": "The icon type.\nCurrently, only \"SVG\" is supported.",
994
+ "type": "string",
995
+ "title": "iconType"
996
+ },
997
+ "icon": {
998
+ "description": "The icon string. Currently, only \"SVG\" is supported, so it needs to be a valid svg.",
999
+ "type": "string",
1000
+ "title": "icon"
1001
+ }
1002
+ },
1003
+ "required": [
1004
+ "event",
1005
+ "icon",
1006
+ "iconAlt",
1007
+ "iconType"
1008
+ ]
1009
+ },
1010
+ "title": "customPlugins"
863
1011
  }
864
1012
  }
865
1013
  },
@@ -1094,6 +1242,43 @@
1094
1242
  "title": "disabled"
1095
1243
  }
1096
1244
  }
1245
+ },
1246
+ "customPlugins": {
1247
+ "description": "An array of objects that determine custom plugins.\nA custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).\nExample can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.",
1248
+ "type": "array",
1249
+ "items": {
1250
+ "title": "CustomPlugin",
1251
+ "type": "object",
1252
+ "properties": {
1253
+ "event": {
1254
+ "description": "The name of the custom event. It needs to be valid (only letters, numbers and \"_\" can be used).\nPIE will emit the event prefixed with \"PIE-\".\nEg: event = 'client_custom_event_A' => the emitted event will be \"PIE-client_custom_event_A\"",
1255
+ "type": "string",
1256
+ "title": "event"
1257
+ },
1258
+ "iconAlt": {
1259
+ "description": "The alt for the custom button icon",
1260
+ "type": "string",
1261
+ "title": "iconAlt"
1262
+ },
1263
+ "iconType": {
1264
+ "description": "The icon type.\nCurrently, only \"SVG\" is supported.",
1265
+ "type": "string",
1266
+ "title": "iconType"
1267
+ },
1268
+ "icon": {
1269
+ "description": "The icon string. Currently, only \"SVG\" is supported, so it needs to be a valid svg.",
1270
+ "type": "string",
1271
+ "title": "icon"
1272
+ }
1273
+ },
1274
+ "required": [
1275
+ "event",
1276
+ "icon",
1277
+ "iconAlt",
1278
+ "iconType"
1279
+ ]
1280
+ },
1281
+ "title": "customPlugins"
1097
1282
  }
1098
1283
  }
1099
1284
  },
@@ -1108,6 +1293,38 @@
1108
1293
  }
1109
1294
  }
1110
1295
  },
1296
+ "CustomPlugin": {
1297
+ "title": "CustomPlugin",
1298
+ "type": "object",
1299
+ "properties": {
1300
+ "event": {
1301
+ "description": "The name of the custom event. It needs to be valid (only letters, numbers and \"_\" can be used).\nPIE will emit the event prefixed with \"PIE-\".\nEg: event = 'client_custom_event_A' => the emitted event will be \"PIE-client_custom_event_A\"",
1302
+ "type": "string",
1303
+ "title": "event"
1304
+ },
1305
+ "iconAlt": {
1306
+ "description": "The alt for the custom button icon",
1307
+ "type": "string",
1308
+ "title": "iconAlt"
1309
+ },
1310
+ "iconType": {
1311
+ "description": "The icon type.\nCurrently, only \"SVG\" is supported.",
1312
+ "type": "string",
1313
+ "title": "iconType"
1314
+ },
1315
+ "icon": {
1316
+ "description": "The icon string. Currently, only \"SVG\" is supported, so it needs to be a valid svg.",
1317
+ "type": "string",
1318
+ "title": "icon"
1319
+ }
1320
+ },
1321
+ "required": [
1322
+ "event",
1323
+ "icon",
1324
+ "iconAlt",
1325
+ "iconType"
1326
+ ]
1327
+ },
1111
1328
  "AuthoringConfigProp": {
1112
1329
  "title": "AuthoringConfigProp",
1113
1330
  "type": "object",
@@ -1827,6 +2044,43 @@
1827
2044
  "title": "disabled"
1828
2045
  }
1829
2046
  }
2047
+ },
2048
+ "customPlugins": {
2049
+ "description": "An array of objects that determine custom plugins.\nA custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).\nExample can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.",
2050
+ "type": "array",
2051
+ "items": {
2052
+ "title": "CustomPlugin",
2053
+ "type": "object",
2054
+ "properties": {
2055
+ "event": {
2056
+ "description": "The name of the custom event. It needs to be valid (only letters, numbers and \"_\" can be used).\nPIE will emit the event prefixed with \"PIE-\".\nEg: event = 'client_custom_event_A' => the emitted event will be \"PIE-client_custom_event_A\"",
2057
+ "type": "string",
2058
+ "title": "event"
2059
+ },
2060
+ "iconAlt": {
2061
+ "description": "The alt for the custom button icon",
2062
+ "type": "string",
2063
+ "title": "iconAlt"
2064
+ },
2065
+ "iconType": {
2066
+ "description": "The icon type.\nCurrently, only \"SVG\" is supported.",
2067
+ "type": "string",
2068
+ "title": "iconType"
2069
+ },
2070
+ "icon": {
2071
+ "description": "The icon string. Currently, only \"SVG\" is supported, so it needs to be a valid svg.",
2072
+ "type": "string",
2073
+ "title": "icon"
2074
+ }
2075
+ },
2076
+ "required": [
2077
+ "event",
2078
+ "icon",
2079
+ "iconAlt",
2080
+ "iconType"
2081
+ ]
2082
+ },
2083
+ "title": "customPlugins"
1830
2084
  }
1831
2085
  }
1832
2086
  },
@@ -38,6 +38,35 @@ Properties of the `image` object:
38
38
 
39
39
  Indicates if the plugin is disabled or not
40
40
 
41
+ ## `customPlugins` (array)
42
+
43
+ An array of objects that determine custom plugins.
44
+ A custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).
45
+ Example can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.
46
+
47
+ The object is an array with all elements of the type `object`.
48
+
49
+ The array object has the following properties:
50
+
51
+ ### `event` (string, required)
52
+
53
+ The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used).
54
+ PIE will emit the event prefixed with "PIE-".
55
+ Eg: event = 'client_custom_event_A' => the emitted event will be "PIE-client_custom_event_A"
56
+
57
+ ### `iconAlt` (string, required)
58
+
59
+ The alt for the custom button icon
60
+
61
+ ### `iconType` (string, required)
62
+
63
+ The icon type.
64
+ Currently, only "SVG" is supported.
65
+
66
+ ### `icon` (string, required)
67
+
68
+ The icon string. Currently, only "SVG" is supported, so it needs to be a valid svg.
69
+
41
70
  # `authoring` (object)
42
71
 
43
72
  Properties of the `authoring` object:
@@ -473,6 +502,35 @@ Properties of the `image` object:
473
502
 
474
503
  Indicates if the plugin is disabled or not
475
504
 
505
+ ### `customPlugins` (array)
506
+
507
+ An array of objects that determine custom plugins.
508
+ A custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).
509
+ Example can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.
510
+
511
+ The object is an array with all elements of the type `object`.
512
+
513
+ The array object has the following properties:
514
+
515
+ #### `event` (string, required)
516
+
517
+ The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used).
518
+ PIE will emit the event prefixed with "PIE-".
519
+ Eg: event = 'client_custom_event_A' => the emitted event will be "PIE-client_custom_event_A"
520
+
521
+ #### `iconAlt` (string, required)
522
+
523
+ The alt for the custom button icon
524
+
525
+ #### `iconType` (string, required)
526
+
527
+ The icon type.
528
+ Currently, only "SVG" is supported.
529
+
530
+ #### `icon` (string, required)
531
+
532
+ The icon string. Currently, only "SVG" is supported, so it needs to be a valid svg.
533
+
476
534
  ## `required` (boolean)
477
535
 
478
536
  Indicates if the item is required and the value cannot be empty
@@ -541,6 +599,35 @@ Properties of the `image` object:
541
599
 
542
600
  Indicates if the plugin is disabled or not
543
601
 
602
+ ### `customPlugins` (array)
603
+
604
+ An array of objects that determine custom plugins.
605
+ A custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).
606
+ Example can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.
607
+
608
+ The object is an array with all elements of the type `object`.
609
+
610
+ The array object has the following properties:
611
+
612
+ #### `event` (string, required)
613
+
614
+ The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used).
615
+ PIE will emit the event prefixed with "PIE-".
616
+ Eg: event = 'client_custom_event_A' => the emitted event will be "PIE-client_custom_event_A"
617
+
618
+ #### `iconAlt` (string, required)
619
+
620
+ The alt for the custom button icon
621
+
622
+ #### `iconType` (string, required)
623
+
624
+ The icon type.
625
+ Currently, only "SVG" is supported.
626
+
627
+ #### `icon` (string, required)
628
+
629
+ The icon string. Currently, only "SVG" is supported, so it needs to be a valid svg.
630
+
544
631
  ## `required` (boolean)
545
632
 
546
633
  Indicates if the item is required and the value cannot be empty
@@ -617,6 +704,35 @@ Properties of the `image` object:
617
704
 
618
705
  Indicates if the plugin is disabled or not
619
706
 
707
+ ### `customPlugins` (array)
708
+
709
+ An array of objects that determine custom plugins.
710
+ A custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).
711
+ Example can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.
712
+
713
+ The object is an array with all elements of the type `object`.
714
+
715
+ The array object has the following properties:
716
+
717
+ #### `event` (string, required)
718
+
719
+ The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used).
720
+ PIE will emit the event prefixed with "PIE-".
721
+ Eg: event = 'client_custom_event_A' => the emitted event will be "PIE-client_custom_event_A"
722
+
723
+ #### `iconAlt` (string, required)
724
+
725
+ The alt for the custom button icon
726
+
727
+ #### `iconType` (string, required)
728
+
729
+ The icon type.
730
+ Currently, only "SVG" is supported.
731
+
732
+ #### `icon` (string, required)
733
+
734
+ The icon string. Currently, only "SVG" is supported, so it needs to be a valid svg.
735
+
620
736
  ## `required` (boolean)
621
737
 
622
738
  Indicates if the item is required and the value cannot be empty
@@ -800,6 +916,35 @@ Properties of the `image` object:
800
916
 
801
917
  Indicates if the plugin is disabled or not
802
918
 
919
+ ### `customPlugins` (array)
920
+
921
+ An array of objects that determine custom plugins.
922
+ A custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).
923
+ Example can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.
924
+
925
+ The object is an array with all elements of the type `object`.
926
+
927
+ The array object has the following properties:
928
+
929
+ #### `event` (string, required)
930
+
931
+ The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used).
932
+ PIE will emit the event prefixed with "PIE-".
933
+ Eg: event = 'client_custom_event_A' => the emitted event will be "PIE-client_custom_event_A"
934
+
935
+ #### `iconAlt` (string, required)
936
+
937
+ The alt for the custom button icon
938
+
939
+ #### `iconType` (string, required)
940
+
941
+ The icon type.
942
+ Currently, only "SVG" is supported.
943
+
944
+ #### `icon` (string, required)
945
+
946
+ The icon string. Currently, only "SVG" is supported, so it needs to be a valid svg.
947
+
803
948
  ## `EditableHtmlButtonConfigure` (object)
804
949
 
805
950
  Properties of the `EditableHtmlButtonConfigure` object:
@@ -808,6 +953,29 @@ Properties of the `EditableHtmlButtonConfigure` object:
808
953
 
809
954
  Indicates if the plugin is disabled or not
810
955
 
956
+ ## `CustomPlugin` (object)
957
+
958
+ Properties of the `CustomPlugin` object:
959
+
960
+ ### `event` (string, required)
961
+
962
+ The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used).
963
+ PIE will emit the event prefixed with "PIE-".
964
+ Eg: event = 'client_custom_event_A' => the emitted event will be "PIE-client_custom_event_A"
965
+
966
+ ### `iconAlt` (string, required)
967
+
968
+ The alt for the custom button icon
969
+
970
+ ### `iconType` (string, required)
971
+
972
+ The icon type.
973
+ Currently, only "SVG" is supported.
974
+
975
+ ### `icon` (string, required)
976
+
977
+ The icon string. Currently, only "SVG" is supported, so it needs to be a valid svg.
978
+
811
979
  ## `AuthoringConfigProp` (object)
812
980
 
813
981
  Properties of the `AuthoringConfigProp` object:
@@ -1310,6 +1478,35 @@ Properties of the `image` object:
1310
1478
 
1311
1479
  Indicates if the plugin is disabled or not
1312
1480
 
1481
+ #### `customPlugins` (array)
1482
+
1483
+ An array of objects that determine custom plugins.
1484
+ A custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).
1485
+ Example can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.
1486
+
1487
+ The object is an array with all elements of the type `object`.
1488
+
1489
+ The array object has the following properties:
1490
+
1491
+ ##### `event` (string, required)
1492
+
1493
+ The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used).
1494
+ PIE will emit the event prefixed with "PIE-".
1495
+ Eg: event = 'client_custom_event_A' => the emitted event will be "PIE-client_custom_event_A"
1496
+
1497
+ ##### `iconAlt` (string, required)
1498
+
1499
+ The alt for the custom button icon
1500
+
1501
+ ##### `iconType` (string, required)
1502
+
1503
+ The icon type.
1504
+ Currently, only "SVG" is supported.
1505
+
1506
+ ##### `icon` (string, required)
1507
+
1508
+ The icon string. Currently, only "SVG" is supported, so it needs to be a valid svg.
1509
+
1313
1510
  ### `required` (boolean)
1314
1511
 
1315
1512
  Indicates if the item is required and the value cannot be empty
@@ -1622,6 +1622,43 @@
1622
1622
  "title": "disabled"
1623
1623
  }
1624
1624
  }
1625
+ },
1626
+ "customPlugins": {
1627
+ "description": "An array of objects that determine custom plugins.\nA custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).\nExample can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.",
1628
+ "type": "array",
1629
+ "items": {
1630
+ "title": "CustomPlugin",
1631
+ "type": "object",
1632
+ "properties": {
1633
+ "event": {
1634
+ "description": "The name of the custom event. It needs to be valid (only letters, numbers and \"_\" can be used).\nPIE will emit the event prefixed with \"PIE-\".\nEg: event = 'client_custom_event_A' => the emitted event will be \"PIE-client_custom_event_A\"",
1635
+ "type": "string",
1636
+ "title": "event"
1637
+ },
1638
+ "iconAlt": {
1639
+ "description": "The alt for the custom button icon",
1640
+ "type": "string",
1641
+ "title": "iconAlt"
1642
+ },
1643
+ "iconType": {
1644
+ "description": "The icon type.\nCurrently, only \"SVG\" is supported.",
1645
+ "type": "string",
1646
+ "title": "iconType"
1647
+ },
1648
+ "icon": {
1649
+ "description": "The icon string. Currently, only \"SVG\" is supported, so it needs to be a valid svg.",
1650
+ "type": "string",
1651
+ "title": "icon"
1652
+ }
1653
+ },
1654
+ "required": [
1655
+ "event",
1656
+ "icon",
1657
+ "iconAlt",
1658
+ "iconType"
1659
+ ]
1660
+ },
1661
+ "title": "customPlugins"
1625
1662
  }
1626
1663
  }
1627
1664
  },
@@ -1636,6 +1673,38 @@
1636
1673
  }
1637
1674
  }
1638
1675
  },
1676
+ "CustomPlugin": {
1677
+ "title": "CustomPlugin",
1678
+ "type": "object",
1679
+ "properties": {
1680
+ "event": {
1681
+ "description": "The name of the custom event. It needs to be valid (only letters, numbers and \"_\" can be used).\nPIE will emit the event prefixed with \"PIE-\".\nEg: event = 'client_custom_event_A' => the emitted event will be \"PIE-client_custom_event_A\"",
1682
+ "type": "string",
1683
+ "title": "event"
1684
+ },
1685
+ "iconAlt": {
1686
+ "description": "The alt for the custom button icon",
1687
+ "type": "string",
1688
+ "title": "iconAlt"
1689
+ },
1690
+ "iconType": {
1691
+ "description": "The icon type.\nCurrently, only \"SVG\" is supported.",
1692
+ "type": "string",
1693
+ "title": "iconType"
1694
+ },
1695
+ "icon": {
1696
+ "description": "The icon string. Currently, only \"SVG\" is supported, so it needs to be a valid svg.",
1697
+ "type": "string",
1698
+ "title": "icon"
1699
+ }
1700
+ },
1701
+ "required": [
1702
+ "event",
1703
+ "icon",
1704
+ "iconAlt",
1705
+ "iconType"
1706
+ ]
1707
+ },
1639
1708
  "AuthoringConfigProp": {
1640
1709
  "title": "AuthoringConfigProp",
1641
1710
  "type": "object",
@@ -2355,6 +2424,43 @@
2355
2424
  "title": "disabled"
2356
2425
  }
2357
2426
  }
2427
+ },
2428
+ "customPlugins": {
2429
+ "description": "An array of objects that determine custom plugins.\nA custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).\nExample can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.",
2430
+ "type": "array",
2431
+ "items": {
2432
+ "title": "CustomPlugin",
2433
+ "type": "object",
2434
+ "properties": {
2435
+ "event": {
2436
+ "description": "The name of the custom event. It needs to be valid (only letters, numbers and \"_\" can be used).\nPIE will emit the event prefixed with \"PIE-\".\nEg: event = 'client_custom_event_A' => the emitted event will be \"PIE-client_custom_event_A\"",
2437
+ "type": "string",
2438
+ "title": "event"
2439
+ },
2440
+ "iconAlt": {
2441
+ "description": "The alt for the custom button icon",
2442
+ "type": "string",
2443
+ "title": "iconAlt"
2444
+ },
2445
+ "iconType": {
2446
+ "description": "The icon type.\nCurrently, only \"SVG\" is supported.",
2447
+ "type": "string",
2448
+ "title": "iconType"
2449
+ },
2450
+ "icon": {
2451
+ "description": "The icon string. Currently, only \"SVG\" is supported, so it needs to be a valid svg.",
2452
+ "type": "string",
2453
+ "title": "icon"
2454
+ }
2455
+ },
2456
+ "required": [
2457
+ "event",
2458
+ "icon",
2459
+ "iconAlt",
2460
+ "iconType"
2461
+ ]
2462
+ },
2463
+ "title": "customPlugins"
2358
2464
  }
2359
2465
  }
2360
2466
  },
@@ -320,6 +320,35 @@ Properties of the `image` object:
320
320
 
321
321
  Indicates if the plugin is disabled or not
322
322
 
323
+ ### `customPlugins` (array)
324
+
325
+ An array of objects that determine custom plugins.
326
+ A custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).
327
+ Example can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.
328
+
329
+ The object is an array with all elements of the type `object`.
330
+
331
+ The array object has the following properties:
332
+
333
+ #### `event` (string, required)
334
+
335
+ The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used).
336
+ PIE will emit the event prefixed with "PIE-".
337
+ Eg: event = 'client_custom_event_A' => the emitted event will be "PIE-client_custom_event_A"
338
+
339
+ #### `iconAlt` (string, required)
340
+
341
+ The alt for the custom button icon
342
+
343
+ #### `iconType` (string, required)
344
+
345
+ The icon type.
346
+ Currently, only "SVG" is supported.
347
+
348
+ #### `icon` (string, required)
349
+
350
+ The icon string. Currently, only "SVG" is supported, so it needs to be a valid svg.
351
+
323
352
  ## `EditableHtmlButtonConfigure` (object)
324
353
 
325
354
  Properties of the `EditableHtmlButtonConfigure` object:
@@ -328,6 +357,29 @@ Properties of the `EditableHtmlButtonConfigure` object:
328
357
 
329
358
  Indicates if the plugin is disabled or not
330
359
 
360
+ ## `CustomPlugin` (object)
361
+
362
+ Properties of the `CustomPlugin` object:
363
+
364
+ ### `event` (string, required)
365
+
366
+ The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used).
367
+ PIE will emit the event prefixed with "PIE-".
368
+ Eg: event = 'client_custom_event_A' => the emitted event will be "PIE-client_custom_event_A"
369
+
370
+ ### `iconAlt` (string, required)
371
+
372
+ The alt for the custom button icon
373
+
374
+ ### `iconType` (string, required)
375
+
376
+ The icon type.
377
+ Currently, only "SVG" is supported.
378
+
379
+ ### `icon` (string, required)
380
+
381
+ The icon string. Currently, only "SVG" is supported, so it needs to be a valid svg.
382
+
331
383
  ## `AuthoringConfigProp` (object)
332
384
 
333
385
  Properties of the `AuthoringConfigProp` object:
@@ -830,6 +882,35 @@ Properties of the `image` object:
830
882
 
831
883
  Indicates if the plugin is disabled or not
832
884
 
885
+ #### `customPlugins` (array)
886
+
887
+ An array of objects that determine custom plugins.
888
+ A custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).
889
+ Example can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.
890
+
891
+ The object is an array with all elements of the type `object`.
892
+
893
+ The array object has the following properties:
894
+
895
+ ##### `event` (string, required)
896
+
897
+ The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used).
898
+ PIE will emit the event prefixed with "PIE-".
899
+ Eg: event = 'client_custom_event_A' => the emitted event will be "PIE-client_custom_event_A"
900
+
901
+ ##### `iconAlt` (string, required)
902
+
903
+ The alt for the custom button icon
904
+
905
+ ##### `iconType` (string, required)
906
+
907
+ The icon type.
908
+ Currently, only "SVG" is supported.
909
+
910
+ ##### `icon` (string, required)
911
+
912
+ The icon string. Currently, only "SVG" is supported, so it needs to be a valid svg.
913
+
833
914
  ### `required` (boolean)
834
915
 
835
916
  Indicates if the item is required and the value cannot be empty
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "5.12.1-next.5+579694d54",
7
+ "version": "5.12.2-next.4+44cb8eb36",
8
8
  "description": "",
9
9
  "scripts": {
10
10
  "postpublish": "../../scripts/postpublish"
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "author": "",
22
22
  "license": "ISC",
23
- "gitHead": "579694d5468995065657b651f06ec9513d0476b6",
23
+ "gitHead": "44cb8eb36e997cd5218007c604c8d94137022f6e",
24
24
  "main": "lib/index.js",
25
25
  "module": "src/index.js"
26
26
  }