Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/assets/markdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@
}

pre {
width: calc(100% - var(--default-clickable-area));
padding: 4px;
margin: 2px 0;
margin: 0;
border-radius: var(--border-radius);
background-color: var(--color-background-dark);
overflow-x: auto;

& code {
margin: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
:open="showSettings"
show-navigation
legacy
no-version
@update:open="handleHideSettings">
<NcAppSettingsSection
id="basic-info"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@
<div
v-else
class="message-main__text markdown-message"
:class="{ 'message-highlighted': isNewPollMessage }"
@mouseover="handleMarkdownMouseOver"
@mouseleave="handleMarkdownMouseLeave">
:class="{ 'message-highlighted': isNewPollMessage }">
<!-- Replied parent message -->
<MessageQuote v-if="showQuote" :message="message.parent" />

Expand All @@ -67,22 +65,6 @@
:reference-limit="1"
reference-interactive-opt-in
@interact-todo="handleInteraction" />

<!-- Additional controls -->
<NcButton
v-if="containsCodeBlocks"
v-show="currentCodeBlock !== null"
class="message-copy-code"
variant="tertiary"
size="small"
:aria-label="t('spreed', 'Copy code block')"
:title="t('spreed', 'Copy code block')"
:style="{ top: copyButtonOffset }"
@click="copyCodeBlock">
<template #icon>
<IconContentCopy :size="16" />
</template>
</NcButton>
</div>

<!-- Additional message info-->
Expand Down Expand Up @@ -170,7 +152,6 @@ import IconBellOffOutline from 'vue-material-design-icons/BellOffOutline.vue'
import IconCancel from 'vue-material-design-icons/Cancel.vue'
import IconCheck from 'vue-material-design-icons/Check.vue'
import IconCheckAll from 'vue-material-design-icons/CheckAll.vue'
import IconContentCopy from 'vue-material-design-icons/ContentCopy.vue'
import IconForumOutline from 'vue-material-design-icons/ForumOutline.vue'
import IconReload from 'vue-material-design-icons/Reload.vue'
import MessageQuote from '../../../../MessageQuote.vue'
Expand Down Expand Up @@ -211,7 +192,6 @@ export default {
IconCancel,
IconCheck,
IconCheckAll,
IconContentCopy,
IconForumOutline,
IconReload,
},
Expand Down Expand Up @@ -267,8 +247,6 @@ export default {
return {
isEditing: false,
showReloadButton: false,
currentCodeBlock: null,
copyButtonOffset: 0,
}
},

Expand Down Expand Up @@ -422,10 +400,6 @@ export default {
}
return t('spreed', 'You cannot send messages to this conversation at the moment')
},

containsCodeBlocks() {
return this.message.message.includes('```')
},
},

watch: {
Expand All @@ -447,42 +421,6 @@ export default {
methods: {
t,

getCodeBlocks() {
if (!this.containsCodeBlocks) {
return null
}

return Array.from(this.$refs.messageMain?.querySelectorAll('pre'))
},

handleMarkdownMouseOver(event) {
const codeBlocks = this.getCodeBlocks()
if (!codeBlocks) {
return
}
const index = codeBlocks.findIndex((item) => item.contains(event.target))
if (index !== -1) {
this.currentCodeBlock = index
const el = codeBlocks[index]
this.copyButtonOffset = `${el.offsetTop}px`
}
},

handleMarkdownMouseLeave() {
this.currentCodeBlock = null
this.copyButtonOffset = 0
},

async copyCodeBlock() {
try {
const code = this.getCodeBlocks()[this.currentCodeBlock].textContent
await navigator.clipboard.writeText(code)
showSuccess(t('spreed', 'Code block copied to clipboard'))
} catch (error) {
showError(t('spreed', 'Code block could not be copied'))
}
},

handleRetry() {
if (this.sendingErrorCanRetry) {
if (this.message.sendingFailure === 'failed-upload') {
Expand Down Expand Up @@ -601,14 +539,6 @@ export default {
&.markdown-message {
position: relative;

.message-copy-code {
position: absolute;
top: 0;
inset-inline-end: calc(4px + var(--default-clickable-area));
margin-top: 4px;
background-color: var(--color-background-dark);
}

:deep(.rich-text--wrapper) {
// NcRichText is used with dir="auto", so internal text direction may vary
// But we want to keep the alignment consistent with the rest of the UI
Expand Down
22 changes: 1 addition & 21 deletions src/components/SettingsDialog/SettingsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,6 @@
</template>
</NcHotkey>
</NcHotkeyList>

<!-- Information about current version used. Talk Desktop has this in 'About' window -->
<p
v-if="!IS_DESKTOP"
class="app-settings-section__version">
{{ t('spreed', 'Talk version: {version}', { version: talkVersion }) }}
</p>
</NcAppSettingsShortcutsSection>
</NcAppSettingsDialog>
</template>
Expand All @@ -177,7 +170,7 @@ import NcKbd from '@nextcloud/vue/components/NcKbd'
import IconFolderOpenOutline from 'vue-material-design-icons/FolderOpenOutline.vue'
import IconMicrophoneOutline from 'vue-material-design-icons/MicrophoneOutline.vue'
import { CHAT_STYLE, CONVERSATION, PRIVACY } from '../../constants.ts'
import { getTalkConfig, getTalkVersion } from '../../services/CapabilitiesManager.ts'
import { getTalkConfig } from '../../services/CapabilitiesManager.ts'
import { useCustomSettings } from '../../services/SettingsAPI.ts'
import { useActorStore } from '../../stores/actor.ts'
import { useSettingsStore } from '../../stores/settings.ts'
Expand All @@ -186,8 +179,6 @@ import { useSoundsStore } from '../../stores/sounds.js'
const disableKeyboardShortcuts = OCP.Accessibility.disableKeyboardShortcuts()
const settingsUrl = generateUrl('/settings/user/notifications')

const talkVersion = getTalkVersion()

const supportTypingStatus = getTalkConfig('local', 'chat', 'typing-privacy') !== undefined
const supportStartWithoutMedia = getTalkConfig('local', 'call', 'start-without-media') !== undefined
const supportConversationsListStyle = getTalkConfig('local', 'conversations', 'list-style') !== undefined
Expand Down Expand Up @@ -218,10 +209,8 @@ export default {
const { customSettingsSections } = useCustomSettings()

return {
IS_DESKTOP,
disableKeyboardShortcuts,
settingsUrl,
talkVersion,
settingsStore,
soundsStore,
supportTypingStatus,
Expand Down Expand Up @@ -424,12 +413,3 @@ export default {
},
}
</script>

<style lang="scss" scoped>
.app-settings-section {
&__version {
margin-inline: var(--form-element-label-offset);
color: var(--color-text-maxcontrast);
}
}
</style>