+
-
@@ -67,6 +70,9 @@
margin: 0 .8em;
}
+.account-tools-popover {
+}
+
.account-actions button.dropdown-item {
margin-left: 0;
}
diff --git a/src/components/emoji_reactions/emoji_reactions.js b/src/components/emoji_reactions/emoji_reactions.js
index b799ac9a..bd2ec826 100644
--- a/src/components/emoji_reactions/emoji_reactions.js
+++ b/src/components/emoji_reactions/emoji_reactions.js
@@ -1,11 +1,13 @@
import UserAvatar from '../user_avatar/user_avatar.vue'
+import Popover from '../popover/popover.vue'
const EMOJI_REACTION_COUNT_CUTOFF = 12
const EmojiReactions = {
name: 'EmojiReactions',
components: {
- UserAvatar
+ UserAvatar,
+ Popover
},
props: ['status'],
data: () => ({
diff --git a/src/components/emoji_reactions/emoji_reactions.vue b/src/components/emoji_reactions/emoji_reactions.vue
index e5b6d9f5..1a00054c 100644
--- a/src/components/emoji_reactions/emoji_reactions.vue
+++ b/src/components/emoji_reactions/emoji_reactions.vue
@@ -1,15 +1,14 @@
-
-
-
+
-
+
@@ -59,10 +62,6 @@
@import '../../_variables.scss';
@import '../popper/popper.scss';
-.dropdown-menu {
- flex-shrink: 0;
-}
-
.icon-ellipsis {
cursor: pointer;
diff --git a/src/components/popover/popover.js b/src/components/popover/popover.js
index 4ee08323..5918008f 100644
--- a/src/components/popover/popover.js
+++ b/src/components/popover/popover.js
@@ -4,7 +4,10 @@ const Popover = {
props: [
'trigger',
'placement',
- 'show'
+ 'boundTo',
+ 'padding',
+ 'offset',
+ 'popoverClass'
],
data () {
return {
@@ -31,55 +34,77 @@ const Popover = {
}
},
*/
+ updateStyles () {
+ if (this.hidden) return { opacity: 0 }
+
+ // Popover will be anchored around this element
+ const anchorEl = this.$refs.trigger || this.$el
+ const screenBox = anchorEl.getBoundingClientRect()
+ // Screen position of the origin point for popover
+ const origin = { x: screenBox.left + screenBox.width * 0.5, y: screenBox.top }
+ const content = this.$refs.content
+ const parentBounds = this.boundTo === 'container' && this.$el.offsetParent.getBoundingClientRect()
+ const padding = this.padding || {}
+ const bounds = this.boundTo === 'container'
+ ? {
+ xMin: parentBounds.left + (padding.left || 0),
+ xMax: parentBounds.right - (padding.right || 0),
+ yMin: 0 + (padding.top || 50),
+ yMax: window.innerHeight - (padding.bottom || 5)
+ } : {
+ xMin: 0 + (padding.left || 10),
+ xMax: window.innerWidth - (padding.right || 10),
+ yMin: 0 + (padding.top || 50),
+ yMax: window.innerHeight - (padding.bottom || 5)
+ }
+ let horizOffset = 0
+
+ console.log(bounds, content.offsetWidth)
+
+ // If overflowing from left, move it
+ if ((origin.x - content.offsetWidth * 0.5) < bounds.xMin) {
+ horizOffset = -(origin.x - content.offsetWidth * 0.5) + bounds.xMin
+ }
+
+ // If overflowing from right, move it
+ if ((origin.x + horizOffset + content.offsetWidth * 0.5) > bounds.xMax) {
+ horizOffset -= (origin.x + horizOffset + content.offsetWidth * 0.5) - bounds.xMax
+ }
+
+ // Default to whatever user wished with placement prop
+ let usingTop = this.placement !== 'bottom'
+
+ // Handle special cases, first force to displaying on top if there's not space on bottom,
+ // regardless of what placement value was. Then check if there's not space on top, and
+ // force to bottom, again regardless of what placement value was.
+ if (origin.y + content.offsetHeight > bounds.yMax) usingTop = true
+ if (origin.y - content.offsetHeight < bounds.yMin) usingTop = false
+
+ const yOffset = (this.offset && this.offset.y) || 0
+ const vertAlign = usingTop
+ ? {
+ bottom: `${anchorEl.offsetHeight + yOffset}px`
+ }
+ : {
+ top: `${anchorEl.offsetHeight + yOffset}px`
+ }
+ this.styles = {
+ opacity: '100%',
+ left: `${(anchorEl.offsetLeft + anchorEl.offsetWidth * 0.5) - content.offsetWidth * 0.5 + horizOffset}px`,
+ ...vertAlign
+ }
+ },
showPopover () {
+ if (this.hidden) this.$emit('show')
this.hidden = false
- this.$nextTick(function () {
- if (this.hidden) return { opacity: 0 }
-
- const anchorEl = this.$refs.trigger || this.$el
- console.log(anchorEl)
- const screenBox = anchorEl.getBoundingClientRect()
- const origin = { x: screenBox.left + screenBox.width * 0.5, y: screenBox.top}
- const content = this.$refs.content
- let horizOffset = 0
-
- if ((origin.x - content.offsetWidth * 0.5) < 25) {
- horizOffset += -(origin.x - content.offsetWidth * 0.5) + 25
- }
-
- console.log((origin.x + content.offsetWidth * 0.5), (window.innerWidth - 25))
- if ((origin.x + content.offsetWidth * 0.5) > window.innerWidth - 25) {
- horizOffset -= (origin.x + content.offsetWidth * 0.5) - (window.innerWidth - 25)
- }
- // Default to whatever user wished with placement prop
- let usingTop = this.placement !== 'bottom'
-
- // Handle special cases, first force to displaying on top if there's not space on bottom,
- // regardless of what placement value was. Then check if there's not space on top, and
- // force to bottom, again regardless of what placement value was.
- if (origin.y + content.offsetHeight > (window.innerHeight - 25)) usingTop = true
- if (origin.y - content.offsetHeight < 50) usingTop = false
-
- const vertAlign = usingTop ?
- {
- bottom: `${anchorEl.offsetHeight}px`
- } :
- {
- top: `${anchorEl.offsetHeight}px`
- }
- this.styles = {
- opacity: '100%',
- left: `${(anchorEl.offsetLeft + anchorEl.offsetWidth * 0.5) - content.offsetWidth * 0.5 + horizOffset}px`,
- ...vertAlign
- }
- })
+ this.$nextTick(this.updateStyles)
},
hidePopover () {
+ if (!this.hidden) this.$emit('close')
this.hidden = true
this.styles = { opacity: 0 }
},
onMouseenter (e) {
- console.log(this.trigger)
if (this.trigger === 'hover') this.showPopover()
},
onMouseleave (e) {
@@ -97,15 +122,18 @@ const Popover = {
onClickOutside (e) {
if (this.hidden) return
if (this.$el.contains(e.target)) return
- console.log(e.target)
this.hidePopover()
}
},
+ beforeUpdate () {
+ console.log('beforeupdate')
+ // if (!this.hidden) this.$nextTick(this.updateStyles)
+ },
created () {
- document.addEventListener("click", this.onClickOutside)
+ document.addEventListener('click', this.onClickOutside)
},
destroyed () {
- document.removeEventListener("click", this.onClickOutside)
+ document.removeEventListener('click', this.onClickOutside)
this.hidePopover()
}
}
diff --git a/src/components/popover/popover.vue b/src/components/popover/popover.vue
index 273a0a69..d376f609 100644
--- a/src/components/popover/popover.vue
+++ b/src/components/popover/popover.vue
@@ -1,40 +1,26 @@
-
-
-
+
+
-
-
-
-
+ :close="hidePopover"
+ />
@@ -48,15 +34,14 @@
z-index: 8;
position: absolute;
min-width: 0;
+ transition: opacity 0.3s;
- .popover-inner {
- box-shadow: 1px 1px 4px rgba(0,0,0,.6);
- box-shadow: var(--panelShadow);
- border-radius: $fallback--btnRadius;
- border-radius: var(--btnRadius, $fallback--btnRadius);
- background-color: $fallback--bg;
- background-color: var(--bg, $fallback--bg);
- }
+ box-shadow: 1px 1px 4px rgba(0,0,0,.6);
+ box-shadow: var(--panelShadow);
+ border-radius: $fallback--btnRadius;
+ border-radius: var(--btnRadius, $fallback--btnRadius);
+ background-color: $fallback--bg;
+ background-color: var(--bg, $fallback--bg);
.popover-arrow {
width: 0;
diff --git a/src/components/react_button/react_button.js b/src/components/react_button/react_button.js
index a6cf5b94..19949563 100644
--- a/src/components/react_button/react_button.js
+++ b/src/components/react_button/react_button.js
@@ -1,34 +1,25 @@
+import Popover from '../popover/popover.vue'
import { mapGetters } from 'vuex'
const ReactButton = {
props: ['status', 'loggedIn'],
data () {
return {
- showTooltip: false,
- filterWord: '',
- popperOptions: {
- modifiers: {
- preventOverflow: { padding: { top: 50 }, boundariesElement: 'viewport' }
- }
- }
+ filterWord: ''
}
},
+ components: {
+ Popover
+ },
methods: {
- openReactionSelect () {
- this.showTooltip = true
- this.filterWord = ''
- },
- closeReactionSelect () {
- this.showTooltip = false
- },
- addReaction (event, emoji) {
+ addReaction (event, emoji, close) {
const existingReaction = this.status.emoji_reactions.find(r => r.name === emoji)
if (existingReaction && existingReaction.me) {
this.$store.dispatch('unreactWithEmoji', { id: this.status.id, emoji })
} else {
this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji })
}
- this.closeReactionSelect()
+ close()
}
},
computed: {
diff --git a/src/components/react_button/react_button.vue b/src/components/react_button/react_button.vue
index fb43ebaf..8613143f 100644
--- a/src/components/react_button/react_button.vue
+++ b/src/components/react_button/react_button.vue
@@ -1,13 +1,13 @@
-
-
+
{{ emoji }}
@@ -28,7 +28,7 @@
v-for="(emoji, key) in emojis"
:key="key"
class="emoji-button"
- @click="addReaction($event, emoji.replacement)"
+ @click="addReaction($event, emoji.replacement, close)"
>
{{ emoji.replacement }}
@@ -37,14 +37,14 @@
-
+
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
index 83f07dac..66959251 100644
--- a/src/components/status/status.vue
+++ b/src/components/status/status.vue
@@ -177,6 +177,8 @@
.reply-to-and-accountname > a {
+ overflow: hidden;
max-width: 100%;
text-overflow: ellipsis;
- overflow: hidden;
white-space: nowrap;
- display: inline-block;
word-break: break-all;
}
}
@@ -577,7 +578,6 @@ $status-margin: 0.75em;
display: flex;
height: 18px;
margin-right: 0.5em;
- overflow: hidden;
max-width: 100%;
.icon-reply {
transform: scaleX(-1);
@@ -588,6 +588,10 @@ $status-margin: 0.75em;
display: flex;
}
+ .reply-to-popover {
+ min-width: 0;
+ }
+
.reply-to {
display: flex;
}
@@ -595,6 +599,7 @@ $status-margin: 0.75em;
.reply-to-text {
overflow: hidden;
text-overflow: ellipsis;
+ white-space: nowrap;
margin: 0 0.4em 0 0.2em;
color: $fallback--faint;
color: var(--faint, $fallback--faint);
diff --git a/src/components/status_popover/status_popover.js b/src/components/status_popover/status_popover.js
index 4055e5cb..35baac3e 100644
--- a/src/components/status_popover/status_popover.js
+++ b/src/components/status_popover/status_popover.js
@@ -5,15 +5,6 @@ const StatusPopover = {
props: [
'statusId'
],
- data () {
- return {
- popperOptions: {
- modifiers: {
- preventOverflow: { padding: { top: 50 }, boundariesElement: 'viewport' }
- }
- }
- }
- },
computed: {
status () {
return find(this.$store.state.statuses.allStatuses, { id: this.statusId })
@@ -28,6 +19,7 @@ const StatusPopover = {
if (!this.status) {
this.$store.dispatch('fetchStatus', this.statusId)
}
+ console.log(this.$el.offsetParent)
}
}
}
diff --git a/src/components/status_popover/status_popover.vue b/src/components/status_popover/status_popover.vue
index 9f37e4e7..04de1e34 100644
--- a/src/components/status_popover/status_popover.vue
+++ b/src/components/status_popover/status_popover.vue
@@ -1,9 +1,16 @@
-
+
-