diff --git a/app/assets/javascripts/highlightTags.js b/app/assets/javascripts/highlightTags.js index 62b9ba736..97ab56bfb 100644 --- a/app/assets/javascripts/highlightTags.js +++ b/app/assets/javascripts/highlightTags.js @@ -15,16 +15,14 @@ .wrap(`
`) - .after(this.$backgroundMaskForeground = $(` + .after(this.$background = $(` - - `)) .on("input", this.update); this.initialHeight = this.$textbox.height(); - this.$backgroundMaskForeground.css({ + this.$background.css({ 'width': this.$textbox.outerWidth(), 'border-width': this.$textbox.css('border-width') }); @@ -37,15 +35,15 @@ this.resize = () => this.$textbox.height( Math.max( this.initialHeight, - this.$backgroundMaskForeground.outerHeight() + this.$background.outerHeight() ) ); this.escapedMessage = () => $('').text(this.$textbox.val()).html(); - this.replacePlaceholders = () => this.$backgroundMaskForeground.html( + this.replacePlaceholders = () => this.$background.html( this.escapedMessage().replace( - tagPattern, match => `${match}` + tagPattern, match => `${match}` ) ); diff --git a/app/assets/stylesheets/components/placeholder.scss b/app/assets/stylesheets/components/placeholder.scss index c0ed059cb..e4b6b9fb9 100644 --- a/app/assets/stylesheets/components/placeholder.scss +++ b/app/assets/stylesheets/components/placeholder.scss @@ -1,8 +1,24 @@ +%placeholder, .placeholder { + display: inline; - background: $light-blue; - color: $white; - white-space: nowrap; - padding: 0 5px; - border-radius: 3px; + background: $yellow; + color: $text-colour; + overflow-wrap: break-word; + word-wrap: break-word; + border-radius: 20px; + box-shadow: inset 9px 0 0 0 $white, inset -9px 0 0 0 $white, inset 0 -3px 0 0 $white, inset 0 3px 0 0 $white; + + .sms-message-wrapper & { + box-shadow: inset 9px 0 0 0 $panel-colour, inset -9px 0 0 0 $panel-colour, inset 0 -3.5px 0 0 $panel-colour, inset 0 3.5px 0 0 $panel-colour; + } + +} + +.placeholder-no-brackets { + @extend %placeholder; + padding-left: 3px; + padding-right: 3px; + border-radius: 1px; + box-shadow: inset 0 -2px 0 0 $white, inset 0 2px 0 0 $white; } diff --git a/app/assets/stylesheets/components/textbox.scss b/app/assets/stylesheets/components/textbox.scss index 2aad83604..27ee0d1f8 100644 --- a/app/assets/stylesheets/components/textbox.scss +++ b/app/assets/stylesheets/components/textbox.scss @@ -26,61 +26,25 @@ line-height: 1.6; } - &-background, - &-foreground, - &-mask { + &-background { position: absolute; top: 0; left: 0; pointer-events: none; color: transparent; white-space: pre-wrap; + overflow-wrap: break-word; + word-wrap: break-word; border: 2px solid transparent; padding-bottom: $gutter-half; - } - - &-background { - z-index: 10; - .tag { - background: $light-blue; - border-radius: 3px; + .placeholder { color: transparent; - display: inline; } } - &-mask { - - z-index: 30; - - .tag { - color: $white; - text-shadow: 0 1px 0 $light-blue, 0 -1px 0 $light-blue; - position: relative; - display: inline; - overflow: hidden; - } - - } - - &-foreground { - - z-index: 40; - - .tag { - color: transparent; - border-radius: 3px; - overflow: hidden; - display: inline; - box-shadow: inset 0.75em 0 0 0 $tag-background, inset -0.75em 0 0 0 $tag-background; - } - - } - - } .textbox-help-link { diff --git a/app/templates/components/email-message.html b/app/templates/components/email-message.html index c7e7db0ae..51a1cffae 100644 --- a/app/templates/components/email-message.html +++ b/app/templates/components/email-message.html @@ -25,7 +25,7 @@