Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed copy to clipboard on child component #1

Open
wants to merge 1 commit into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

fixed copy to clipboard on child component

  • Loading branch information...
Elmer Dadol
Elmer Dadol committed Aug 9, 2019
commit 856028d59ed9041d0fb8209100cba4b874c493c9
34 main.js
@@ -1191,6 +1191,7 @@ exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||

const application = __webpack_require__(/*! application */ "application");
const clipboard = __webpack_require__(/*! clipboard */ "clipboard");
const EventBus = __webpack_require__(/*! ./event-bus.js */ "./src/event-bus.js").default;

module.exports = {
props: {
@@ -1200,7 +1201,7 @@ module.exports = {
},
methods: {
copy() {
application.editDocument(() => clipboard.copyText(this.message));
EventBus.$emit('copy', this.message);
},
close() {
this.dialog.close();
@@ -9866,6 +9867,23 @@ try {
module.exports = g;


/***/ }),

/***/ "./src/event-bus.js":
/*!**************************!*\
!*** ./src/event-bus.js ***!
\**************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
// event-bus.js

const EventBus = new vue__WEBPACK_IMPORTED_MODULE_0__["default"]();
/* harmony default export */ __webpack_exports__["default"] = (EventBus);

/***/ }),

/***/ "./src/hello.vue":
@@ -9950,17 +9968,25 @@ __webpack_require__.r(__webpack_exports__);
const styles = __webpack_require__(/*! ./styles.css */ "./src/styles.css");
const Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js").default;
const hello = __webpack_require__(/*! ./hello.vue */ "./src/hello.vue").default

const EventBus = __webpack_require__(/*! ./event-bus.js */ "./src/event-bus.js").default;
const clipboard = __webpack_require__(/*! clipboard */ "clipboard");
const { Text, Color } = __webpack_require__(/*! scenegraph */ "scenegraph");

let dialog;
function getDialog() {
if (dialog == null) {
document.body.innerHTML = `<dialog><div id="container"></div></dialog>`
dialog = document.querySelector("dialog");

var app4 = new Vue({
el: "#container",
components: { hello },
mounted() {
EventBus.$on('copy', (message) => {
clipboard.copyText(message);
console.log(message);
});
},
render(h) {
return h(hello, { props: { dialog } })
}
@@ -9971,8 +9997,8 @@ function getDialog() {

module.exports = {
commands: {
menuCommand: function () {
getDialog().showModal();
menuCommand: async function () {
await getDialog().showModal();
}
}
};

Some generated files are not rendered by default. Learn more.

@@ -0,0 +1,4 @@
// event-bus.js
import Vue from 'vue';
const EventBus = new Vue();
export default EventBus;
@@ -14,6 +14,7 @@
<script>
const application = require('application');
const clipboard = require('clipboard');
const EventBus = require("./event-bus.js").default;
module.exports = {
props: {
@@ -23,7 +24,7 @@
},
methods: {
copy() {
application.editDocument(() => clipboard.copyText(this.message));
EventBus.$emit('copy', this.message);
},
close() {
this.dialog.close();
@@ -1,17 +1,25 @@
const styles = require("./styles.css");
const Vue = require("vue").default;
const hello = require("./hello.vue").default

const EventBus = require("./event-bus.js").default;
const clipboard = require('clipboard');
const { Text, Color } = require("scenegraph");

let dialog;
function getDialog() {
if (dialog == null) {
document.body.innerHTML = `<dialog><div id="container"></div></dialog>`
dialog = document.querySelector("dialog");

var app4 = new Vue({
el: "#container",
components: { hello },
mounted() {
EventBus.$on('copy', (message) => {
clipboard.copyText(message);
console.log(message);
});
},
render(h) {
return h(hello, { props: { dialog } })
}
@@ -22,8 +30,8 @@ function getDialog() {

module.exports = {
commands: {
menuCommand: function () {
getDialog().showModal();
menuCommand: async function () {
await getDialog().showModal();
}
}
};
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.