Fix clipboard "fixes"

This commit is contained in:
Pavel Djundik 2018-07-09 21:37:52 +03:00 committed by Pavel Djundik
parent 1831e2e63e
commit dbe6df1ab6
3 changed files with 7 additions and 6 deletions

View File

@ -4,6 +4,7 @@
role="log"
aria-live="polite"
aria-relevant="additions"
@copy="onCopy"
>
<template v-for="(message, id) in getCondensedMessages">
<div
@ -41,6 +42,7 @@
<script>
const constants = require("../js/constants");
const clipboard = require("../js/clipboard");
import Message from "./Message.vue";
import MessageCondensed from "./MessageCondensed.vue";
@ -110,6 +112,9 @@ export default {
return true;
},
onCopy() {
clipboard(this.$el);
},
},
};
</script>

View File

@ -1,9 +1,8 @@
"use strict";
const $ = require("jquery");
const chat = document.getElementById("chat");
function copyMessages() {
module.exports = function(chat) {
const selection = window.getSelection();
// If selection does not span multiple elements, do nothing
@ -37,6 +36,4 @@ function copyMessages() {
selection.removeAllRanges();
selection.addRange(range);
}, 0);
}
$(chat).on("copy", ".messages", copyMessages);
};

View File

@ -18,7 +18,6 @@ window.vueMounted = () => {
const utils = require("./utils");
require("./webpush");
require("./keybinds");
require("./clipboard");
const sidebar = $("#sidebar, #footer");
const viewport = $("#viewport");