diff --git a/app/assets/javascripts/enhancedTextbox.js b/app/assets/javascripts/enhancedTextbox.js new file mode 100644 index 000000000..8adb210f8 --- /dev/null +++ b/app/assets/javascripts/enhancedTextbox.js @@ -0,0 +1,85 @@ +(function(Modules) { + "use strict"; + + if ( + !('oninput' in document.createElement('input')) + ) return; + + const tagPattern = /\(\(([^\)\((\?)]+)(\?\?)?([^\)\(]*)\)\)/g; + + Modules.EnhancedTextbox = function() { + + this.start = function(textarea) { + + let visibleTextbox; + + this.highlightPlaceholders = ( + typeof textarea.data('highlightPlaceholders') === 'undefined' || + !!textarea.data('highlightPlaceholders') + ); + + this.$textbox = $(textarea) + .wrap(` +
+ `) + .after(this.$background = $(` +