Fix clipboard "fixes"
This commit is contained in:
parent
1831e2e63e
commit
dbe6df1ab6
@ -4,6 +4,7 @@
|
|||||||
role="log"
|
role="log"
|
||||||
aria-live="polite"
|
aria-live="polite"
|
||||||
aria-relevant="additions"
|
aria-relevant="additions"
|
||||||
|
@copy="onCopy"
|
||||||
>
|
>
|
||||||
<template v-for="(message, id) in getCondensedMessages">
|
<template v-for="(message, id) in getCondensedMessages">
|
||||||
<div
|
<div
|
||||||
@ -41,6 +42,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
const constants = require("../js/constants");
|
const constants = require("../js/constants");
|
||||||
|
const clipboard = require("../js/clipboard");
|
||||||
import Message from "./Message.vue";
|
import Message from "./Message.vue";
|
||||||
import MessageCondensed from "./MessageCondensed.vue";
|
import MessageCondensed from "./MessageCondensed.vue";
|
||||||
|
|
||||||
@ -110,6 +112,9 @@ export default {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
onCopy() {
|
||||||
|
clipboard(this.$el);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const $ = require("jquery");
|
const $ = require("jquery");
|
||||||
const chat = document.getElementById("chat");
|
|
||||||
|
|
||||||
function copyMessages() {
|
module.exports = function(chat) {
|
||||||
const selection = window.getSelection();
|
const selection = window.getSelection();
|
||||||
|
|
||||||
// If selection does not span multiple elements, do nothing
|
// If selection does not span multiple elements, do nothing
|
||||||
@ -37,6 +36,4 @@ function copyMessages() {
|
|||||||
selection.removeAllRanges();
|
selection.removeAllRanges();
|
||||||
selection.addRange(range);
|
selection.addRange(range);
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
};
|
||||||
|
|
||||||
$(chat).on("copy", ".messages", copyMessages);
|
|
||||||
|
@ -18,7 +18,6 @@ window.vueMounted = () => {
|
|||||||
const utils = require("./utils");
|
const utils = require("./utils");
|
||||||
require("./webpush");
|
require("./webpush");
|
||||||
require("./keybinds");
|
require("./keybinds");
|
||||||
require("./clipboard");
|
|
||||||
|
|
||||||
const sidebar = $("#sidebar, #footer");
|
const sidebar = $("#sidebar, #footer");
|
||||||
const viewport = $("#viewport");
|
const viewport = $("#viewport");
|
||||||
|
Loading…
Reference in New Issue
Block a user