From 9975d18ed04e58f278c621adf346c3b28a0052c2 Mon Sep 17 00:00:00 2001 From: Daniel Castillo Date: Sat, 10 Nov 2018 22:00:13 +0100 Subject: [PATCH 1/4] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20upgrade=20to=20medium-?= =?UTF-8?q?zoom@1.0.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/@vuepress/plugin-medium-zoom/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@vuepress/plugin-medium-zoom/package.json b/packages/@vuepress/plugin-medium-zoom/package.json index 9fd642216c..7049758619 100644 --- a/packages/@vuepress/plugin-medium-zoom/package.json +++ b/packages/@vuepress/plugin-medium-zoom/package.json @@ -17,7 +17,7 @@ "generator" ], "dependencies": { - "medium-zoom": "^0.4.0" + "medium-zoom": "^1.0.2" }, "author": "ULIVZ ", "license": "MIT", From d8b310f575982581ccbd414743283aa01cc9a9ee Mon Sep 17 00:00:00 2001 From: Daniel Castillo Date: Sat, 10 Nov 2018 22:00:36 +0100 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=90=9B=20fix=20medium-zoom=20not=20up?= =?UTF-8?q?dating=20on=20component=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/@vuepress/plugin-medium-zoom/mixin.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/@vuepress/plugin-medium-zoom/mixin.js b/packages/@vuepress/plugin-medium-zoom/mixin.js index 8ca95d5f44..cc350313cc 100644 --- a/packages/@vuepress/plugin-medium-zoom/mixin.js +++ b/packages/@vuepress/plugin-medium-zoom/mixin.js @@ -4,9 +4,22 @@ import './style.css' import zoom from 'medium-zoom' export default { + data: () => ({ zoom: null }), + mounted () { + const self = this + setTimeout(() => { + self.zoom = zoom(SELECTOR) + }, 1000) + }, + + updated () { + const self = this setTimeout(() => { - zoom(SELECTOR) + if (self.zoom) { + self.zoom.detach() + self.zoom.attach(SELECTOR) + } }, 1000) } } From e86768bdb3d2db9649866090c8c9d8e0456e2590 Mon Sep 17 00:00:00 2001 From: Daniel Castillo Date: Sat, 10 Nov 2018 23:01:16 +0100 Subject: [PATCH 3/4] =?UTF-8?q?=E2=AC=87=EF=B8=8F=20downgrade=20to=20mediu?= =?UTF-8?q?m-zoom@0.4.0=20to=20fix=20serverside=20rendering=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/@vuepress/plugin-medium-zoom/mixin.js | 2 +- packages/@vuepress/plugin-medium-zoom/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@vuepress/plugin-medium-zoom/mixin.js b/packages/@vuepress/plugin-medium-zoom/mixin.js index cc350313cc..e914d54343 100644 --- a/packages/@vuepress/plugin-medium-zoom/mixin.js +++ b/packages/@vuepress/plugin-medium-zoom/mixin.js @@ -18,8 +18,8 @@ export default { setTimeout(() => { if (self.zoom) { self.zoom.detach() - self.zoom.attach(SELECTOR) } + self.zoom = zoom(SELECTOR) }, 1000) } } diff --git a/packages/@vuepress/plugin-medium-zoom/package.json b/packages/@vuepress/plugin-medium-zoom/package.json index 7049758619..9fd642216c 100644 --- a/packages/@vuepress/plugin-medium-zoom/package.json +++ b/packages/@vuepress/plugin-medium-zoom/package.json @@ -17,7 +17,7 @@ "generator" ], "dependencies": { - "medium-zoom": "^1.0.2" + "medium-zoom": "^0.4.0" }, "author": "ULIVZ ", "license": "MIT", From 1cff44ffc8545ad1191c5777bc2f1a983720efc4 Mon Sep 17 00:00:00 2001 From: Daniel Castillo Date: Mon, 12 Nov 2018 07:21:05 +0100 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=91=8C=20use=20arrow=20function=20'th?= =?UTF-8?q?is'=20and=20outsource=20updateZoom=20to=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../@vuepress/plugin-medium-zoom/mixin.js | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/@vuepress/plugin-medium-zoom/mixin.js b/packages/@vuepress/plugin-medium-zoom/mixin.js index e914d54343..e0a054539c 100644 --- a/packages/@vuepress/plugin-medium-zoom/mixin.js +++ b/packages/@vuepress/plugin-medium-zoom/mixin.js @@ -7,19 +7,21 @@ export default { data: () => ({ zoom: null }), mounted () { - const self = this - setTimeout(() => { - self.zoom = zoom(SELECTOR) - }, 1000) + this.updateZoom() }, updated () { - const self = this - setTimeout(() => { - if (self.zoom) { - self.zoom.detach() - } - self.zoom = zoom(SELECTOR) - }, 1000) + this.updateZoom() + }, + + methods: { + updateZoom () { + setTimeout(() => { + if (this.zoom) { + this.zoom.detach() + } + this.zoom = zoom(SELECTOR) + }, 1000) + } } }