From 273dc0f43f7a9139734af076ee30465abba6c523 Mon Sep 17 00:00:00 2001 From: simon3000 Date: Thu, 11 Jul 2019 21:50:28 +0200 Subject: [PATCH 1/7] =?UTF-8?q?=E7=AA=97=E5=8F=A3=E7=BC=A9=E6=94=BE?= =?UTF-8?q?=E6=97=B6=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/ChatRenderer/index.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/components/ChatRenderer/index.vue b/frontend/src/components/ChatRenderer/index.vue index d6cd236..2897926 100644 --- a/frontend/src/components/ChatRenderer/index.vue +++ b/frontend/src/components/ChatRenderer/index.vue @@ -65,7 +65,11 @@ export default { this.styleElement.innerText = this.css this.scrollToBottom() }, + created() { + window.addEventListener('resize', this.scrollToBottom) + }, beforeDestroy() { + window.removeEventListener('resize', this.scrollToBottom) document.head.removeChild(this.styleElement) }, updated() { From 4f4d117ce06bc9c229ce1e6781ec1838b23c8f11 Mon Sep 17 00:00:00 2001 From: simon3000 Date: Thu, 11 Jul 2019 22:51:41 +0200 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BD=BF=E7=94=A8calc=E4=BC=98=E5=8C=96CSS?= =?UTF-8?q?=E7=94=9F=E6=88=90=E5=99=A8=E7=9A=84=E6=B5=8F=E8=A7=88=E9=83=A8?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/StyleGenerator/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/StyleGenerator/index.vue b/frontend/src/views/StyleGenerator/index.vue index f23d144..d33901f 100644 --- a/frontend/src/views/StyleGenerator/index.vue +++ b/frontend/src/views/StyleGenerator/index.vue @@ -357,8 +357,8 @@ export default { #example-container { position: fixed; top: 30px; - right: 30px; - width: 400px; + left: calc(210px + 40px + (100vw - 210px - 40px) / 2); + width: calc((100vw - 210px - 40px) / 2 - 40px - 30px); height: calc(100vh - 110px); background-color: #444; From d3cc8b0c77191a10e2caba4134285bfe40d88199 Mon Sep 17 00:00:00 2001 From: simon3000 Date: Thu, 11 Jul 2019 22:52:06 +0200 Subject: [PATCH 3/7] =?UTF-8?q?=F0=9F=91=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/StyleGenerator/index.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/views/StyleGenerator/index.vue b/frontend/src/views/StyleGenerator/index.vue index d33901f..adc1c2a 100644 --- a/frontend/src/views/StyleGenerator/index.vue +++ b/frontend/src/views/StyleGenerator/index.vue @@ -380,6 +380,14 @@ export default { background-position:0 0, 16px 0, 16px -16px, 0px 16px; padding: 25px; + + resize: both; + overflow: hidden; +} + +#example-container:active { + height: 0; + width: 0; } .app-wrapper.mobile #example-container { From 53be587189ec9dd48a73813910a5fbab15abfa1d Mon Sep 17 00:00:00 2001 From: simon3000 Date: Thu, 11 Jul 2019 23:14:11 +0200 Subject: [PATCH 4/7] =?UTF-8?q?=E8=87=AA=E5=8A=A8resize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/StyleGenerator/index.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/views/StyleGenerator/index.vue b/frontend/src/views/StyleGenerator/index.vue index adc1c2a..d451ffd 100644 --- a/frontend/src/views/StyleGenerator/index.vue +++ b/frontend/src/views/StyleGenerator/index.vue @@ -309,6 +309,12 @@ export default { examplePaidMessages } }, + mounted() { + const observer = new MutationObserver(() => window.dispatchEvent(new Event('resize'))) + + const child = document.querySelector('#example-container') + observer.observe(child, { attributes: true }) + }, computed: { computedResult() { return stylegen.getStyle(this.form) From a69b6b640624f158203b38d32fd78217ea3aa5e5 Mon Sep 17 00:00:00 2001 From: simon3000 Date: Sat, 13 Jul 2019 01:14:55 +0200 Subject: [PATCH 5/7] =?UTF-8?q?=E7=BB=99ChatRenderer=E5=8A=A0=E4=B8=8Ademo?= =?UTF-8?q?=20prop,=20=E4=B8=BAtrue=E6=97=B6=E8=87=AA=E5=8A=A8resize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/ChatRenderer/index.vue | 12 ++++++++++-- frontend/src/views/StyleGenerator/index.vue | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/ChatRenderer/index.vue b/frontend/src/components/ChatRenderer/index.vue index 2897926..3a9521e 100644 --- a/frontend/src/components/ChatRenderer/index.vue +++ b/frontend/src/components/ChatRenderer/index.vue @@ -48,6 +48,10 @@ export default { props: { paidMessages: Array, messages: Array, + demo: { + type: Boolean, + required: false, + }, css: String }, data() { @@ -66,10 +70,14 @@ export default { this.scrollToBottom() }, created() { - window.addEventListener('resize', this.scrollToBottom) + if (this.demo) { + window.addEventListener('resize', this.scrollToBottom) + } }, beforeDestroy() { - window.removeEventListener('resize', this.scrollToBottom) + if (this.demo) { + window.removeEventListener('resize', this.scrollToBottom) + } document.head.removeChild(this.styleElement) }, updated() { diff --git a/frontend/src/views/StyleGenerator/index.vue b/frontend/src/views/StyleGenerator/index.vue index d451ffd..f79de63 100644 --- a/frontend/src/views/StyleGenerator/index.vue +++ b/frontend/src/views/StyleGenerator/index.vue @@ -190,7 +190,7 @@
- +
From ffc3c9d8a0c53414d5e7e35414a2520e207a8ad3 Mon Sep 17 00:00:00 2001 From: simon3000 Date: Sat, 13 Jul 2019 01:16:57 +0200 Subject: [PATCH 6/7] =?UTF-8?q?=E5=B0=86=E7=9B=91=E5=90=AC=E7=9A=84event?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E6=94=B9=E4=B8=BAexampleResize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/ChatRenderer/index.vue | 4 ++-- frontend/src/views/StyleGenerator/index.vue | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/ChatRenderer/index.vue b/frontend/src/components/ChatRenderer/index.vue index 3a9521e..e715bc9 100644 --- a/frontend/src/components/ChatRenderer/index.vue +++ b/frontend/src/components/ChatRenderer/index.vue @@ -71,12 +71,12 @@ export default { }, created() { if (this.demo) { - window.addEventListener('resize', this.scrollToBottom) + window.addEventListener('exampleResize', this.scrollToBottom) } }, beforeDestroy() { if (this.demo) { - window.removeEventListener('resize', this.scrollToBottom) + window.removeEventListener('exampleResize', this.scrollToBottom) } document.head.removeChild(this.styleElement) }, diff --git a/frontend/src/views/StyleGenerator/index.vue b/frontend/src/views/StyleGenerator/index.vue index f79de63..4b69d63 100644 --- a/frontend/src/views/StyleGenerator/index.vue +++ b/frontend/src/views/StyleGenerator/index.vue @@ -310,7 +310,7 @@ export default { } }, mounted() { - const observer = new MutationObserver(() => window.dispatchEvent(new Event('resize'))) + const observer = new MutationObserver(() => window.dispatchEvent(new Event('exampleResize'))) const child = document.querySelector('#example-container') observer.observe(child, { attributes: true }) From ee78cbf90e3ea79c916ded490504ae975eedc981 Mon Sep 17 00:00:00 2001 From: simon3000 Date: Sat, 13 Jul 2019 01:51:58 +0200 Subject: [PATCH 7/7] =?UTF-8?q?=E6=94=B9=E7=94=A8refs=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E6=89=A7=E8=A1=8Cfunction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/ChatRenderer/index.vue | 12 ------------ frontend/src/views/StyleGenerator/index.vue | 4 ++-- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/frontend/src/components/ChatRenderer/index.vue b/frontend/src/components/ChatRenderer/index.vue index e715bc9..d6cd236 100644 --- a/frontend/src/components/ChatRenderer/index.vue +++ b/frontend/src/components/ChatRenderer/index.vue @@ -48,10 +48,6 @@ export default { props: { paidMessages: Array, messages: Array, - demo: { - type: Boolean, - required: false, - }, css: String }, data() { @@ -69,15 +65,7 @@ export default { this.styleElement.innerText = this.css this.scrollToBottom() }, - created() { - if (this.demo) { - window.addEventListener('exampleResize', this.scrollToBottom) - } - }, beforeDestroy() { - if (this.demo) { - window.removeEventListener('exampleResize', this.scrollToBottom) - } document.head.removeChild(this.styleElement) }, updated() { diff --git a/frontend/src/views/StyleGenerator/index.vue b/frontend/src/views/StyleGenerator/index.vue index 4b69d63..76df4d1 100644 --- a/frontend/src/views/StyleGenerator/index.vue +++ b/frontend/src/views/StyleGenerator/index.vue @@ -190,7 +190,7 @@
- +
@@ -310,7 +310,7 @@ export default { } }, mounted() { - const observer = new MutationObserver(() => window.dispatchEvent(new Event('exampleResize'))) + const observer = new MutationObserver(() => this.$refs.example.scrollToBottom()) const child = document.querySelector('#example-container') observer.observe(child, { attributes: true })