summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web_editor/static/src/js')
-rw-r--r--addons/web_editor/static/src/js/editor/snippets.options.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js
index 19f6a129f12..060347f00e1 100644
--- a/addons/web_editor/static/src/js/editor/snippets.options.js
+++ b/addons/web_editor/static/src/js/editor/snippets.options.js
@@ -18,6 +18,8 @@ var _t = core._t;
* @param {string} [title]
* @param {Object} [options]
* @param {string[]} [options.classes]
+ * @param {string} [options.tooltip]
+ * @param {string} [options.placeholder]
* @param {Object} [options.dataAttributes]
* @returns {HTMLElement} - the original 'el' argument
*/
@@ -35,6 +37,9 @@ function _addTitleAndAllowedAttributes(el, title, options) {
if (options && options.tooltip) {
tooltipEl.title = options.tooltip;
}
+ if (options && options.placeholder) {
+ el.setAttribute('placeholder', options.placeholder);
+ }
if (options && options.dataAttributes) {
for (const key in options.dataAttributes) {
el.dataset[key] = options.dataAttributes[key];
@@ -750,7 +755,7 @@ const InputUserValueWidget = UserValueWidget.extend({
this.inputEl = document.createElement('input');
this.inputEl.setAttribute('type', 'text');
- this.inputEl.setAttribute('placeholder', this.el.dataset.placeholder || '');
+ this.inputEl.setAttribute('placeholder', this.el.getAttribute('placeholder') || '');
this.inputEl.classList.toggle('text-left', !unit);
this.inputEl.classList.toggle('text-right', !!unit);
this.containerEl.appendChild(this.inputEl);
@@ -1898,6 +1903,7 @@ const SnippetOptionWidget = Widget.extend({
classes: el.classList,
dataAttributes: el.dataset,
tooltip: el.title,
+ placeholder: el.getAttribute('placeholder'),
childNodes: [...el.childNodes],
},
};