diff --git a/server/ui-src/assets/styles.scss b/server/ui-src/assets/styles.scss index 26d628e..01d8111 100644 --- a/server/ui-src/assets/styles.scss +++ b/server/ui-src/assets/styles.scss @@ -91,6 +91,89 @@ #preview-html { min-height: 300px; + + &.tablet, + &.phone { + border: solid $gray-300 1px; + } +} + +#responsive-view { + margin: auto; + transition: width 0.5s; + position: relative; + + &.tablet, + &.phone { + border-radius: 35px; + box-sizing: content-box; + padding-bottom: 76px; + padding-top: 54px; + padding-left: 10px; + padding-right: 10px; + background: $gray-800; + + iframe { + height: 100% !important; + background: #fff; + } + } + + &.phone { + &::before { + border-radius: 5px; + background: $gray-600; + top: 22px; + content: ""; + display: block; + height: 10px; + left: 50%; + position: absolute; + transform: translateX(-50%); + width: 80px; + } + + &::after { + border-radius: 20px; + background: $gray-900; + bottom: 20px; + content: ""; + display: block; + width: 65px; + height: 40px; + left: 50%; + position: absolute; + transform: translateX(-50%); + } + } + + &.tablet { + &::before { + border-radius: 50%; + border: solid #b5b0b0 2px; + top: 22px; + content: ""; + display: block; + width: 10px; + height: 10px; + left: 50%; + position: absolute; + transform: translateX(-50%); + } + + &::after { + border-radius: 50%; + border: solid #b5b0b0 2px; + bottom: 23px; + content: ""; + display: block; + width: 30px; + height: 30px; + left: 50%; + position: absolute; + transform: translateX(-50%); + } + } } .list-group-item.message:first-child { @@ -302,8 +385,8 @@ pre[class*="language-"] { opacity: 0.7; } @media screen and (max-width: 767px) { - pre[class*="language-"]:after, - pre[class*="language-"]:before { + pre[class*="language-"]::after, + pre[class*="language-"]::before { bottom: 14px; box-shadow: none; } diff --git a/server/ui-src/templates/Message.vue b/server/ui-src/templates/Message.vue index b8f47e4..90e3b9a 100644 --- a/server/ui-src/templates/Message.vue +++ b/server/ui-src/templates/Message.vue @@ -26,7 +26,15 @@ export default { showTags: false, // to force rerendering of component messageTags: [], allTags: [], - loadHeaders: false + loadHeaders: false, + showMobileBtns: false, + scaleHTMLPreview: 'display', + // keys names match bootstrap icon names + responsiveSizes: { + phone: 'width: 322px; height: 570px', + tablet: 'width: 768px; height: 1024px', + display: 'width: 100%; height: 100%', + }, } }, @@ -38,6 +46,7 @@ export default { self.messageTags = self.message.Tags; self.allTags = self.existingTags; self.loadHeaders = false; + self.scaleHTMLPreview = 'display';// default view // delay to select first tab and add HTML highlighting (prev/next) self.$nextTick(function () { self.renderUI(); @@ -55,6 +64,14 @@ export default { if (this.showTags) { this.saveTags(); } + }, + scaleHTMLPreview() { + if (this.scaleHTMLPreview == 'display') { + let self = this; + window.setTimeout(function () { + self.resizeIframes(); + }, 500); + } } }, @@ -124,15 +141,14 @@ export default { }, resizeIframes: function () { + if (this.scaleHTMLPreview != 'display') { + return; + } let h = document.getElementById('preview-html'); if (h) { h.style.height = h.contentWindow.document.body.scrollHeight + 50 + 'px'; } - let s = document.getElementById('message-src'); - if (s) { - s.style.height = s.contentWindow.document.body.scrollHeight + 50 + 'px'; - } }, saveTags: function () { @@ -245,29 +261,45 @@ export default {