summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/frontend/loader_loading.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web_editor/static/src/js/frontend/loader_loading.js')
-rw-r--r--addons/web_editor/static/src/js/frontend/loader_loading.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/addons/web_editor/static/src/js/frontend/loader_loading.js b/addons/web_editor/static/src/js/frontend/loader_loading.js
new file mode 100644
index 00000000000..b5156944470
--- /dev/null
+++ b/addons/web_editor/static/src/js/frontend/loader_loading.js
@@ -0,0 +1,30 @@
+(function () {
+'use strict';
+
+/**
+ * This file makes sure textarea elements with a specific editor class are
+ * tweaked as soon as the DOM is ready so that they appear to be loading.
+ *
+ * They must then be loaded using standard Odoo modules system. In particular,
+ * @see web_editor.loader
+ */
+
+document.addEventListener('DOMContentLoaded', () => {
+ document.querySelectorAll('textarea.o_wysiwyg_loader').forEach(textarea => {
+ var wrapper = document.createElement('div');
+ wrapper.classList.add('position-relative', 'o_wysiwyg_wrapper');
+
+ var loadingElement = document.createElement('div');
+ loadingElement.classList.add('o_wysiwyg_loading');
+ var loadingIcon = document.createElement('i');
+ loadingIcon.classList.add('text-600', 'text-center',
+ 'fa', 'fa-circle-o-notch', 'fa-spin', 'fa-2x');
+ loadingElement.appendChild(loadingIcon);
+ wrapper.appendChild(loadingElement);
+
+ textarea.parentNode.insertBefore(wrapper, textarea);
+ wrapper.insertBefore(textarea, loadingElement);
+ });
+});
+
+})();