Skip to content
Open
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
10,273 changes: 10,273 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-wysiwyg",
"version": "1.7.2",
"name": "vue-wysiwyg-master",
"version": "1.7.6",
"description": "A WYSIWYG HTML editor for Vue.js",
"keywords": [
"vue",
Expand All @@ -22,8 +22,8 @@
},
"dependencies": {
"debounce": "^1.1.0",
"vue": "^2.5.13",
"vue2-dropzone": "^3.0.4"
"vue": "2.5.13",
"vue2-dropzone": "3.6.0"
},
"devDependencies": {
"autoprefixer": "^8.0.0",
Expand Down Expand Up @@ -56,7 +56,7 @@
"url-loader": "^0.6.2",
"vue-loader": "^14.1.1",
"vue-style-loader": "^4.0.2",
"vue-template-compiler": "^2.5.13",
"vue-template-compiler": "2.5.13",
"webpack": "^3.11.0",
"webpack-bundle-analyzer": "^2.10.0",
"webpack-dev-middleware": "^2.0.5",
Expand Down
98 changes: 60 additions & 38 deletions src/editor/Button.vue
Original file line number Diff line number Diff line change
@@ -1,71 +1,93 @@
<template lang="pug">
div(@mousedown="onBtnClick")
a(:class="'vw-btn-'+module.title", v-html="module.icon")
a(:class="'vw-btn-'+module.title", v-html="module.icon")

.dashboard(
v-show="showDashboard",
ref="dashboard"
)
component(
.dashboard(
v-show="showDashboard",
ref="dashboard"
)
component(
v-if="module.render",
v-once,
ref="moduleDashboard",
:is="module",
@exec="exec",
:uid="uid"
:options="options"
:translations="translations"
)

</template>
<script>
import bus from 'src/editor/bus.js';

export default {
props: ["module", "options"],
props: ["module", "options", "translations"],

data () {
return {
showDashboard: false,
}
},
data() {
return {
showDashboard: false,
}
},

computed: {
uid () {
uid() {
return this.$parent._uid
}
},

methods: {
closeDashboard () {
this.showDashboard = false;
},
methods: {
closeDashboard() {
this.showDashboard = false;
},

openDashboard () {
this.showDashboard = true;
},
openDashboard() {
this.showDashboard = true;
},

exec () {
exec() {
this.$parent.exec.apply(null, arguments)
},

onBtnClick ($event) {
$event.preventDefault();
if (this.module.action !== undefined)
this.exec.apply(null, this.module.action);
detectBrowser() {
var userAgent = navigator.userAgent;
if (userAgent.indexOf("Edg") > -1) {
return "Microsoft Edge";
} else if (userAgent.indexOf("Chrome") > -1) {
return "Chrome";
} else if (userAgent.indexOf("Firefox") > -1) {
return "Firefox";
} else if (userAgent.indexOf("Safari") > -1) {
return "Safari";
} else if (userAgent.indexOf("Opera") > -1) {
return "Opera";
} else if (userAgent.indexOf("Trident") > -1 || userAgent.indexOf("MSIE") > -1) {
return "Internet Explorer";
}

else if (this.module.customAction !== undefined) {
this.module.customAction(bus.utils).forEach(a => this.exec.apply(null, a));
}
return "Unknown";
},

onBtnClick($event) {
if (this.detectBrowser() === 'Firefox') {
$event.preventDefault();
}
if (this.module.action !== undefined)
this.exec.apply(null, this.module.action);

else if (
this.module.render !== undefined &&
(!this.$refs.dashboard || !this.$refs.dashboard.contains($event.target))
) {
this.showDashboard = !this.showDashboard;
bus.emit(`${this.uid}_${this.showDashboard ? "show" : "hide"}_dashboard_${this.module.title}`);
return;
}
}
}
else if (this.module.customAction !== undefined) {
this.module.customAction(bus.utils).forEach(a => this.exec.apply(null, a));
}

else if (
this.module.render !== undefined &&
(!this.$refs.dashboard || !this.$refs.dashboard.contains($event.target))
) {
this.showDashboard = !this.showDashboard;
bus.emit(`${this.uid}_${this.showDashboard ? "show" : "hide"}_dashboard_${this.module.title}`);
return;
}
}
}
}
</script>
Loading