diff --git a/files/file.go b/files/file.go index c1451878..3892d991 100644 --- a/files/file.go +++ b/files/file.go @@ -170,7 +170,7 @@ func (i *FileInfo) detectType(modify, saveContent, readHeader bool) error { case strings.HasPrefix(mimetype, "image"): i.Type = "image" return nil - case (strings.HasPrefix(mimetype, "text") || (len(buffer) > 0 && !isBinary(buffer))) && i.Size <= 10*1024*1024: // 10 MB + case (strings.HasPrefix(mimetype, "text") || !isBinary(buffer)) && i.Size <= 10*1024*1024: // 10 MB i.Type = "text" if !modify { diff --git a/frontend/src/assets/fonts/roboto/bold-cyrillic-ext.woff2 b/frontend/src/assets/fonts/roboto/bold-cyrillic-ext.woff2 new file mode 100755 index 00000000..0a67a942 Binary files /dev/null and b/frontend/src/assets/fonts/roboto/bold-cyrillic-ext.woff2 differ diff --git a/frontend/src/assets/fonts/roboto/bold-cyrillic.woff2 b/frontend/src/assets/fonts/roboto/bold-cyrillic.woff2 new file mode 100755 index 00000000..714bb431 Binary files /dev/null and b/frontend/src/assets/fonts/roboto/bold-cyrillic.woff2 differ diff --git a/frontend/src/assets/fonts/roboto/bold-greek-ext.woff2 b/frontend/src/assets/fonts/roboto/bold-greek-ext.woff2 new file mode 100755 index 00000000..6dffd067 Binary files /dev/null and b/frontend/src/assets/fonts/roboto/bold-greek-ext.woff2 differ diff --git a/frontend/src/assets/fonts/roboto/bold-greek.woff2 b/frontend/src/assets/fonts/roboto/bold-greek.woff2 new file mode 100755 index 00000000..8edfa0e5 Binary files /dev/null and b/frontend/src/assets/fonts/roboto/bold-greek.woff2 differ diff --git a/frontend/src/assets/fonts/roboto/bold-latin-ext.woff2 b/frontend/src/assets/fonts/roboto/bold-latin-ext.woff2 new file mode 100755 index 00000000..fe8bf694 Binary files /dev/null and b/frontend/src/assets/fonts/roboto/bold-latin-ext.woff2 differ diff --git a/frontend/src/assets/fonts/roboto/bold-latin.woff2 b/frontend/src/assets/fonts/roboto/bold-latin.woff2 new file mode 100755 index 00000000..57269b7e Binary files /dev/null and b/frontend/src/assets/fonts/roboto/bold-latin.woff2 differ diff --git a/frontend/src/assets/fonts/roboto/bold-vietnamese.woff2 b/frontend/src/assets/fonts/roboto/bold-vietnamese.woff2 new file mode 100755 index 00000000..64c1d0e7 Binary files /dev/null and b/frontend/src/assets/fonts/roboto/bold-vietnamese.woff2 differ diff --git a/frontend/src/components/files/ExtendedImage.vue b/frontend/src/components/files/ExtendedImage.vue index 9bc88d80..742523a6 100644 --- a/frontend/src/components/files/ExtendedImage.vue +++ b/frontend/src/components/files/ExtendedImage.vue @@ -29,14 +29,6 @@ export default { type: Number, default: () => 200, }, - maxScale: { - type: Number, - default: () => 4, - }, - minScale: { - type: Number, - default: () => 0.25, - }, classList: { type: Array, default: () => [], @@ -45,10 +37,6 @@ export default { type: Number, default: () => 0.25, }, - autofill: { - type: Boolean, - default: () => false, - }, }, data() { return { @@ -64,6 +52,8 @@ export default { center: { x: 0, y: 0 }, relative: { x: 0, y: 0 }, }, + maxScale: 4, + minScale: 0.25, }; }, mounted() { @@ -88,6 +78,10 @@ export default { }, watch: { src: function () { + if (!this.decodeUTIF()) { + this.$refs.imgex.src = this.src; + } + this.scale = 1; this.setZoom(); this.setCenter(); @@ -122,6 +116,21 @@ export default { img.classList.add("image-ex-img-ready"); document.addEventListener("mouseup", this.onMouseUp); + + let realSize = img.naturalWidth; + let displaySize = img.offsetWidth; + + // Image is in portrait orientation + if (img.naturalHeight > img.naturalWidth) { + realSize = img.naturalHeight; + displaySize = img.offsetHeight; + } + + // Scale needed to display the image on full size + const fullScale = realSize / displaySize; + + // Full size plus additional zoom + this.maxScale = fullScale + 4; }, onMouseUp() { this.inDrag = false; @@ -251,7 +260,7 @@ export default { } }, wheelMove(event) { - this.scale += (event.wheelDeltaY / 100) * this.zoomStep; + this.scale += -Math.sign(event.deltaY) * this.zoomStep; this.setZoom(); }, setZoom() { diff --git a/frontend/src/components/prompts/Prompts.vue b/frontend/src/components/prompts/Prompts.vue index 3d3b2eda..36cb0349 100644 --- a/frontend/src/components/prompts/Prompts.vue +++ b/frontend/src/components/prompts/Prompts.vue @@ -56,6 +56,12 @@ export default { let prompt = this.$refs.currentComponent; + // Esc! + if (event.keyCode === 27) { + event.stopImmediatePropagation(); + this.$store.commit("closeHovers"); + } + // Enter if (event.keyCode == 13) { switch (this.show) { diff --git a/frontend/src/css/_share.css b/frontend/src/css/_share.css index a5f2d35f..6d1c2296 100644 --- a/frontend/src/css/_share.css +++ b/frontend/src/css/_share.css @@ -34,7 +34,7 @@ } .share__box__info { - flex: 1 1 auto; + flex: 1 1 18em; } .share__box__element { diff --git a/frontend/src/css/fonts.css b/frontend/src/css/fonts.css index d700edcb..b986f291 100644 --- a/frontend/src/css/fonts.css +++ b/frontend/src/css/fonts.css @@ -110,4 +110,60 @@ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; } +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 700; + src: local('Roboto Bold'), local('Roboto-Bold'), url(../assets/fonts/roboto/bold-cyrillic-ext.woff2) format('woff2'); + unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; +} + +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 700; + src: local('Roboto Bold'), local('Roboto-Bold'), url(../assets/fonts/roboto/bold-cyrillic.woff2) format('woff2'); + unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; +} + +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 700; + src: local('Roboto Bold'), local('Roboto-Bold'), url(../assets/fonts/roboto/bold-greek-ext.woff2) format('woff2'); + unicode-range: U+1F00-1FFF; +} + +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 700; + src: local('Roboto Bold'), local('Roboto-Bold'), url(../assets/fonts/roboto/bold-greek.woff2) format('woff2'); + unicode-range: U+0370-03FF; +} + +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 700; + src: local('Roboto Bold'), local('Roboto-Bold'), url(../assets/fonts/roboto/bold-vietnamese.woff2) format('woff2'); + unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; +} + +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 700; + src: local('Roboto Bold'), local('Roboto-Bold'), url(../assets/fonts/roboto/bold-latin-ext.woff2) format('woff2'); + unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; +} + +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 700; + src: local('Roboto Bold'), local('Roboto-Bold'), url(../assets/fonts/roboto/bold-latin.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; +} + @import "~material-design-icons/iconfont/material-icons.css"; diff --git a/frontend/src/css/listing.css b/frontend/src/css/listing.css index 7abf14bb..8506df7a 100644 --- a/frontend/src/css/listing.css +++ b/frontend/src/css/listing.css @@ -25,6 +25,7 @@ transition: .1s ease background, .1s ease opacity; align-items: center; cursor: pointer; + user-select: none; } #listing .item div:last-of-type { diff --git a/frontend/src/css/styles.css b/frontend/src/css/styles.css index 80138364..e32856e3 100644 --- a/frontend/src/css/styles.css +++ b/frontend/src/css/styles.css @@ -109,6 +109,7 @@ #previewer { background-color: rgba(0, 0, 0, 0.9); + padding-top: 4em; position: fixed; top: 0; left: 0; @@ -142,7 +143,6 @@ } #previewer .preview { - margin-top: 4em; text-align: center; height: calc(100vh - 4em); } @@ -209,7 +209,7 @@ #editor-container { background-color: #fafafa; position: fixed; - margin-top: 4em; + padding-top: 4em; top: 0; left: 0; width: 100%; diff --git a/frontend/src/views/Files.vue b/frontend/src/views/Files.vue index c49a1c5c..781b0edb 100644 --- a/frontend/src/views/Files.vue +++ b/frontend/src/views/Files.vue @@ -1,6 +1,6 @@