|
@@ -1,5 +1,5 @@
|
|
<template>
|
|
<template>
|
|
- <div :class="{fullscreen:fullscreen}" :style="{width:containerWidth}" class="tinymce-container">
|
|
|
|
|
|
+ <div :class="{ fullscreen: fullscreen }" :style="{ width: containerWidth }" class="tinymce-container">
|
|
<textarea :id="tinymceId" class="tinymce-textarea" />
|
|
<textarea :id="tinymceId" class="tinymce-textarea" />
|
|
<div class="editor-custom-btn-container">
|
|
<div class="editor-custom-btn-container">
|
|
<editorImage color="#1890ff" class="editor-upload-btn" @successCBK="imageSuccessCBK" />
|
|
<editorImage color="#1890ff" class="editor-upload-btn" @successCBK="imageSuccessCBK" />
|
|
@@ -157,7 +157,21 @@ export default {
|
|
imageSuccessCBK(arr) {
|
|
imageSuccessCBK(arr) {
|
|
const that = this
|
|
const that = this
|
|
arr.forEach(v => {
|
|
arr.forEach(v => {
|
|
- window.tinymce.get(that.tinymceId).insertContent(`<img class="wscnph" src="${v.url}" >`)
|
|
|
|
|
|
+ const isPdf = v.url.indexOf('pdf') !== -1
|
|
|
|
+ const isDocx = v.url.indexOf('docx') !== -1
|
|
|
|
+ let isDownload = false
|
|
|
|
+ const fileName = v.url.substring(v.url.lastIndexOf('/') + 1)
|
|
|
|
+ let href = ''
|
|
|
|
+ if (isPdf) {
|
|
|
|
+ href = `/pdf/web/viewer.html?file=${encodeURIComponent(v.url)}`
|
|
|
|
+ } else if (isDocx) {
|
|
|
|
+ href = `/#/docxPreview?file=${encodeURIComponent(v.url)}`
|
|
|
|
+ } else {
|
|
|
|
+ href = v.url
|
|
|
|
+ isDownload = true
|
|
|
|
+ }
|
|
|
|
+ // window.tinymce.get(that.tinymceId).insertContent(`<img class="wscnph" src="${v.url}" >`)
|
|
|
|
+ window.tinymce.get(that.tinymceId).insertContent(`<a class="wscnph" target="_blank" ${isDownload ? 'download' : ''} href="${href}" >${fileName}</a>`)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -165,7 +179,6 @@ export default {
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|
|
-
|
|
|
|
.tinymce-container {
|
|
.tinymce-container {
|
|
position: relative;
|
|
position: relative;
|
|
line-height: normal;
|
|
line-height: normal;
|
|
@@ -177,10 +190,12 @@ export default {
|
|
top: 5px;
|
|
top: 5px;
|
|
z-index: 2005;
|
|
z-index: 2005;
|
|
}
|
|
}
|
|
|
|
+
|
|
.fullscreen .editor-custom-btn-container {
|
|
.fullscreen .editor-custom-btn-container {
|
|
z-index: 10000;
|
|
z-index: 10000;
|
|
position: fixed;
|
|
position: fixed;
|
|
}
|
|
}
|
|
|
|
+
|
|
.editor-upload-btn {
|
|
.editor-upload-btn {
|
|
display: inline-block;
|
|
display: inline-block;
|
|
}
|
|
}
|