Commit b36682cb authored by tyyin lan's avatar tyyin lan

feat(common component): 富文本&图片裁切

parent 496d85af
...@@ -20,12 +20,14 @@ ...@@ -20,12 +20,14 @@
"@tailwindcss/vite": "^4.1.8", "@tailwindcss/vite": "^4.1.8",
"@vueuse/core": "^13.3.0", "@vueuse/core": "^13.3.0",
"axios": "^1.9.0", "axios": "^1.9.0",
"cropperjs": "1",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"element-plus": "^2.9.11", "element-plus": "^2.9.11",
"nanoid": "^5.1.5", "nanoid": "^5.1.5",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"pinia": "^3.0.2", "pinia": "^3.0.2",
"tailwindcss": "^4.1.8", "tailwindcss": "^4.1.8",
"tinymce": "^7.9.1",
"tippy.js": "^6.3.7", "tippy.js": "^6.3.7",
"vue": "^3.5.16", "vue": "^3.5.16",
"vue-i18n": "^11.1.5", "vue-i18n": "^11.1.5",
...@@ -40,7 +42,6 @@ ...@@ -40,7 +42,6 @@
"@types/crypto-js": "^4.2.2", "@types/crypto-js": "^4.2.2",
"@types/node": "^22.15.29", "@types/node": "^22.15.29",
"@types/nprogress": "^0.2.3", "@types/nprogress": "^0.2.3",
"@typescript-eslint/parser": "^8.33.1",
"@vitejs/plugin-vue": "^5.2.4", "@vitejs/plugin-vue": "^5.2.4",
"autoprefixer": "^10.4.21", "autoprefixer": "^10.4.21",
"eslint": "^9.28.0", "eslint": "^9.28.0",
......
...@@ -20,6 +20,9 @@ importers: ...@@ -20,6 +20,9 @@ importers:
axios: axios:
specifier: ^1.9.0 specifier: ^1.9.0
version: 1.9.0 version: 1.9.0
cropperjs:
specifier: '1'
version: 1.6.2
crypto-js: crypto-js:
specifier: ^4.2.0 specifier: ^4.2.0
version: 4.2.0 version: 4.2.0
...@@ -38,6 +41,9 @@ importers: ...@@ -38,6 +41,9 @@ importers:
tailwindcss: tailwindcss:
specifier: ^4.1.8 specifier: ^4.1.8
version: 4.1.8 version: 4.1.8
tinymce:
specifier: ^7.9.1
version: 7.9.1
tippy.js: tippy.js:
specifier: ^6.3.7 specifier: ^6.3.7
version: 6.3.7 version: 6.3.7
...@@ -75,9 +81,6 @@ importers: ...@@ -75,9 +81,6 @@ importers:
'@types/nprogress': '@types/nprogress':
specifier: ^0.2.3 specifier: ^0.2.3
version: 0.2.3 version: 0.2.3
'@typescript-eslint/parser':
specifier: ^8.33.1
version: 8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)
'@vitejs/plugin-vue': '@vitejs/plugin-vue':
specifier: ^5.2.4 specifier: ^5.2.4
version: 5.2.4(vite@6.3.5(@types/node@22.15.29)(jiti@2.4.2)(lightningcss@1.30.1)(sass@1.77.6)(yaml@2.8.0))(vue@3.5.16(typescript@5.8.3)) version: 5.2.4(vite@6.3.5(@types/node@22.15.29)(jiti@2.4.2)(lightningcss@1.30.1)(sass@1.77.6)(yaml@2.8.0))(vue@3.5.16(typescript@5.8.3))
...@@ -653,56 +656,67 @@ packages: ...@@ -653,56 +656,67 @@ packages:
resolution: {integrity: sha512-wC53ZNDgt0pqx5xCAgNunkTzFE8GTgdZ9EwYGVcg+jEjJdZGtq9xPjDnFgfFozQI/Xm1mh+D9YlYtl+ueswNEg==} resolution: {integrity: sha512-wC53ZNDgt0pqx5xCAgNunkTzFE8GTgdZ9EwYGVcg+jEjJdZGtq9xPjDnFgfFozQI/Xm1mh+D9YlYtl+ueswNEg==}
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-arm-musleabihf@4.41.1': '@rollup/rollup-linux-arm-musleabihf@4.41.1':
resolution: {integrity: sha512-jwKCca1gbZkZLhLRtsrka5N8sFAaxrGz/7wRJ8Wwvq3jug7toO21vWlViihG85ei7uJTpzbXZRcORotE+xyrLA==} resolution: {integrity: sha512-jwKCca1gbZkZLhLRtsrka5N8sFAaxrGz/7wRJ8Wwvq3jug7toO21vWlViihG85ei7uJTpzbXZRcORotE+xyrLA==}
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
libc: [musl]
'@rollup/rollup-linux-arm64-gnu@4.41.1': '@rollup/rollup-linux-arm64-gnu@4.41.1':
resolution: {integrity: sha512-g0UBcNknsmmNQ8V2d/zD2P7WWfJKU0F1nu0k5pW4rvdb+BIqMm8ToluW/eeRmxCared5dD76lS04uL4UaNgpNA==} resolution: {integrity: sha512-g0UBcNknsmmNQ8V2d/zD2P7WWfJKU0F1nu0k5pW4rvdb+BIqMm8ToluW/eeRmxCared5dD76lS04uL4UaNgpNA==}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-arm64-musl@4.41.1': '@rollup/rollup-linux-arm64-musl@4.41.1':
resolution: {integrity: sha512-XZpeGB5TKEZWzIrj7sXr+BEaSgo/ma/kCgrZgL0oo5qdB1JlTzIYQKel/RmhT6vMAvOdM2teYlAaOGJpJ9lahg==} resolution: {integrity: sha512-XZpeGB5TKEZWzIrj7sXr+BEaSgo/ma/kCgrZgL0oo5qdB1JlTzIYQKel/RmhT6vMAvOdM2teYlAaOGJpJ9lahg==}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [musl]
'@rollup/rollup-linux-loongarch64-gnu@4.41.1': '@rollup/rollup-linux-loongarch64-gnu@4.41.1':
resolution: {integrity: sha512-bkCfDJ4qzWfFRCNt5RVV4DOw6KEgFTUZi2r2RuYhGWC8WhCA8lCAJhDeAmrM/fdiAH54m0mA0Vk2FGRPyzI+tw==} resolution: {integrity: sha512-bkCfDJ4qzWfFRCNt5RVV4DOw6KEgFTUZi2r2RuYhGWC8WhCA8lCAJhDeAmrM/fdiAH54m0mA0Vk2FGRPyzI+tw==}
cpu: [loong64] cpu: [loong64]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-powerpc64le-gnu@4.41.1': '@rollup/rollup-linux-powerpc64le-gnu@4.41.1':
resolution: {integrity: sha512-3mr3Xm+gvMX+/8EKogIZSIEF0WUu0HL9di+YWlJpO8CQBnoLAEL/roTCxuLncEdgcfJcvA4UMOf+2dnjl4Ut1A==} resolution: {integrity: sha512-3mr3Xm+gvMX+/8EKogIZSIEF0WUu0HL9di+YWlJpO8CQBnoLAEL/roTCxuLncEdgcfJcvA4UMOf+2dnjl4Ut1A==}
cpu: [ppc64] cpu: [ppc64]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-riscv64-gnu@4.41.1': '@rollup/rollup-linux-riscv64-gnu@4.41.1':
resolution: {integrity: sha512-3rwCIh6MQ1LGrvKJitQjZFuQnT2wxfU+ivhNBzmxXTXPllewOF7JR1s2vMX/tWtUYFgphygxjqMl76q4aMotGw==} resolution: {integrity: sha512-3rwCIh6MQ1LGrvKJitQjZFuQnT2wxfU+ivhNBzmxXTXPllewOF7JR1s2vMX/tWtUYFgphygxjqMl76q4aMotGw==}
cpu: [riscv64] cpu: [riscv64]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-riscv64-musl@4.41.1': '@rollup/rollup-linux-riscv64-musl@4.41.1':
resolution: {integrity: sha512-LdIUOb3gvfmpkgFZuccNa2uYiqtgZAz3PTzjuM5bH3nvuy9ty6RGc/Q0+HDFrHrizJGVpjnTZ1yS5TNNjFlklw==} resolution: {integrity: sha512-LdIUOb3gvfmpkgFZuccNa2uYiqtgZAz3PTzjuM5bH3nvuy9ty6RGc/Q0+HDFrHrizJGVpjnTZ1yS5TNNjFlklw==}
cpu: [riscv64] cpu: [riscv64]
os: [linux] os: [linux]
libc: [musl]
'@rollup/rollup-linux-s390x-gnu@4.41.1': '@rollup/rollup-linux-s390x-gnu@4.41.1':
resolution: {integrity: sha512-oIE6M8WC9ma6xYqjvPhzZYk6NbobIURvP/lEbh7FWplcMO6gn7MM2yHKA1eC/GvYwzNKK/1LYgqzdkZ8YFxR8g==} resolution: {integrity: sha512-oIE6M8WC9ma6xYqjvPhzZYk6NbobIURvP/lEbh7FWplcMO6gn7MM2yHKA1eC/GvYwzNKK/1LYgqzdkZ8YFxR8g==}
cpu: [s390x] cpu: [s390x]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-x64-gnu@4.41.1': '@rollup/rollup-linux-x64-gnu@4.41.1':
resolution: {integrity: sha512-cWBOvayNvA+SyeQMp79BHPK8ws6sHSsYnK5zDcsC3Hsxr1dgTABKjMnMslPq1DvZIp6uO7kIWhiGwaTdR4Og9A==} resolution: {integrity: sha512-cWBOvayNvA+SyeQMp79BHPK8ws6sHSsYnK5zDcsC3Hsxr1dgTABKjMnMslPq1DvZIp6uO7kIWhiGwaTdR4Og9A==}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-x64-musl@4.41.1': '@rollup/rollup-linux-x64-musl@4.41.1':
resolution: {integrity: sha512-y5CbN44M+pUCdGDlZFzGGBSKCA4A/J2ZH4edTYSSxFg7ce1Xt3GtydbVKWLlzL+INfFIZAEg1ZV6hh9+QQf9YQ==} resolution: {integrity: sha512-y5CbN44M+pUCdGDlZFzGGBSKCA4A/J2ZH4edTYSSxFg7ce1Xt3GtydbVKWLlzL+INfFIZAEg1ZV6hh9+QQf9YQ==}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [musl]
'@rollup/rollup-win32-arm64-msvc@4.41.1': '@rollup/rollup-win32-arm64-msvc@4.41.1':
resolution: {integrity: sha512-lZkCxIrjlJlMt1dLO/FbpZbzt6J/A8p4DnqzSa4PWqPEUUUnzXLeki/iyPLfV0BmHItlYgHUqJe+3KiyydmiNQ==} resolution: {integrity: sha512-lZkCxIrjlJlMt1dLO/FbpZbzt6J/A8p4DnqzSa4PWqPEUUUnzXLeki/iyPLfV0BmHItlYgHUqJe+3KiyydmiNQ==}
...@@ -760,24 +774,28 @@ packages: ...@@ -760,24 +774,28 @@ packages:
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [glibc]
'@tailwindcss/oxide-linux-arm64-musl@4.1.8': '@tailwindcss/oxide-linux-arm64-musl@4.1.8':
resolution: {integrity: sha512-O6b8QesPbJCRshsNApsOIpzKt3ztG35gfX9tEf4arD7mwNinsoCKxkj8TgEE0YRjmjtO3r9FlJnT/ENd9EVefQ==} resolution: {integrity: sha512-O6b8QesPbJCRshsNApsOIpzKt3ztG35gfX9tEf4arD7mwNinsoCKxkj8TgEE0YRjmjtO3r9FlJnT/ENd9EVefQ==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [musl]
'@tailwindcss/oxide-linux-x64-gnu@4.1.8': '@tailwindcss/oxide-linux-x64-gnu@4.1.8':
resolution: {integrity: sha512-32iEXX/pXwikshNOGnERAFwFSfiltmijMIAbUhnNyjFr3tmWmMJWQKU2vNcFX0DACSXJ3ZWcSkzNbaKTdngH6g==} resolution: {integrity: sha512-32iEXX/pXwikshNOGnERAFwFSfiltmijMIAbUhnNyjFr3tmWmMJWQKU2vNcFX0DACSXJ3ZWcSkzNbaKTdngH6g==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [glibc]
'@tailwindcss/oxide-linux-x64-musl@4.1.8': '@tailwindcss/oxide-linux-x64-musl@4.1.8':
resolution: {integrity: sha512-s+VSSD+TfZeMEsCaFaHTaY5YNj3Dri8rST09gMvYQKwPphacRG7wbuQ5ZJMIJXN/puxPcg/nU+ucvWguPpvBDg==} resolution: {integrity: sha512-s+VSSD+TfZeMEsCaFaHTaY5YNj3Dri8rST09gMvYQKwPphacRG7wbuQ5ZJMIJXN/puxPcg/nU+ucvWguPpvBDg==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [musl]
'@tailwindcss/oxide-wasm32-wasi@4.1.8': '@tailwindcss/oxide-wasm32-wasi@4.1.8':
resolution: {integrity: sha512-CXBPVFkpDjM67sS1psWohZ6g/2/cd+cq56vPxK4JeawelxwK4YECgl9Y9TjkE2qfF+9/s1tHHJqrC4SS6cVvSg==} resolution: {integrity: sha512-CXBPVFkpDjM67sS1psWohZ6g/2/cd+cq56vPxK4JeawelxwK4YECgl9Y9TjkE2qfF+9/s1tHHJqrC4SS6cVvSg==}
...@@ -1218,6 +1236,9 @@ packages: ...@@ -1218,6 +1236,9 @@ packages:
typescript: typescript:
optional: true optional: true
cropperjs@1.6.2:
resolution: {integrity: sha512-nhymn9GdnV3CqiEHJVai54TULFAE3VshJTXSqSJKa8yXAKyBKDWdhHarnlIPrshJ0WMFTGuFvG02YjLXfPiuOA==}
cross-spawn@7.0.6: cross-spawn@7.0.6:
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
engines: {node: '>= 8'} engines: {node: '>= 8'}
...@@ -1834,24 +1855,28 @@ packages: ...@@ -1834,24 +1855,28 @@ packages:
engines: {node: '>= 12.0.0'} engines: {node: '>= 12.0.0'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [glibc]
lightningcss-linux-arm64-musl@1.30.1: lightningcss-linux-arm64-musl@1.30.1:
resolution: {integrity: sha512-jmUQVx4331m6LIX+0wUhBbmMX7TCfjF5FoOH6SD1CttzuYlGNVpA7QnrmLxrsub43ClTINfGSYyHe2HWeLl5CQ==} resolution: {integrity: sha512-jmUQVx4331m6LIX+0wUhBbmMX7TCfjF5FoOH6SD1CttzuYlGNVpA7QnrmLxrsub43ClTINfGSYyHe2HWeLl5CQ==}
engines: {node: '>= 12.0.0'} engines: {node: '>= 12.0.0'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [musl]
lightningcss-linux-x64-gnu@1.30.1: lightningcss-linux-x64-gnu@1.30.1:
resolution: {integrity: sha512-piWx3z4wN8J8z3+O5kO74+yr6ze/dKmPnI7vLqfSqI8bccaTGY5xiSGVIJBDd5K5BHlvVLpUB3S2YCfelyJ1bw==} resolution: {integrity: sha512-piWx3z4wN8J8z3+O5kO74+yr6ze/dKmPnI7vLqfSqI8bccaTGY5xiSGVIJBDd5K5BHlvVLpUB3S2YCfelyJ1bw==}
engines: {node: '>= 12.0.0'} engines: {node: '>= 12.0.0'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [glibc]
lightningcss-linux-x64-musl@1.30.1: lightningcss-linux-x64-musl@1.30.1:
resolution: {integrity: sha512-rRomAK7eIkL+tHY0YPxbc5Dra2gXlI63HL+v1Pdi1a3sC+tJTcFrHX+E86sulgAXeI7rSzDYhPSeHHjqFhqfeQ==} resolution: {integrity: sha512-rRomAK7eIkL+tHY0YPxbc5Dra2gXlI63HL+v1Pdi1a3sC+tJTcFrHX+E86sulgAXeI7rSzDYhPSeHHjqFhqfeQ==}
engines: {node: '>= 12.0.0'} engines: {node: '>= 12.0.0'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [musl]
lightningcss-win32-arm64-msvc@1.30.1: lightningcss-win32-arm64-msvc@1.30.1:
resolution: {integrity: sha512-mSL4rqPi4iXq5YVqzSsJgMVFENoa4nGTT/GjO2c0Yl9OuQfPsIfncvLrEW6RbbB24WtZ3xP/2CCmI3tNkNV4oA==} resolution: {integrity: sha512-mSL4rqPi4iXq5YVqzSsJgMVFENoa4nGTT/GjO2c0Yl9OuQfPsIfncvLrEW6RbbB24WtZ3xP/2CCmI3tNkNV4oA==}
...@@ -2530,6 +2555,9 @@ packages: ...@@ -2530,6 +2555,9 @@ packages:
resolution: {integrity: sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==} resolution: {integrity: sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==}
engines: {node: '>=12.0.0'} engines: {node: '>=12.0.0'}
tinymce@7.9.1:
resolution: {integrity: sha512-zaOHwmiP1EqTeLRXAvVriDb00JYnfEjWGPdKEuac7MiZJ5aiDMZ4Unc98Gmajn+PBljOmO1GKV6G0KwWn3+k8A==}
tippy.js@6.3.7: tippy.js@6.3.7:
resolution: {integrity: sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==} resolution: {integrity: sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==}
...@@ -3853,6 +3881,8 @@ snapshots: ...@@ -3853,6 +3881,8 @@ snapshots:
optionalDependencies: optionalDependencies:
typescript: 5.8.3 typescript: 5.8.3
cropperjs@1.6.2: {}
cross-spawn@7.0.6: cross-spawn@7.0.6:
dependencies: dependencies:
path-key: 3.1.1 path-key: 3.1.1
...@@ -5066,6 +5096,8 @@ snapshots: ...@@ -5066,6 +5096,8 @@ snapshots:
fdir: 6.4.5(picomatch@4.0.2) fdir: 6.4.5(picomatch@4.0.2)
picomatch: 4.0.2 picomatch: 4.0.2
tinymce@7.9.1: {}
tippy.js@6.3.7: tippy.js@6.3.7:
dependencies: dependencies:
'@popperjs/core': 2.11.8 '@popperjs/core': 2.11.8
......
<script setup lang="ts">
import Cropper from 'cropperjs'
import 'cropperjs/dist/cropper.css'
import { nextTick, ref, shallowRef, useTemplateRef } from 'vue'
const imageElRef = useTemplateRef('imageElRef')
// const rectanglePreview = useTemplateRef('rectanglePreview')
// const roundPreview = useTemplateRef('roundPreview')
const dialogVisible = ref(false)
const cropperIns = shallowRef<Cropper | null>(null)
const isInitCropper = ref(false)
const confirmBtnLoading = ref(false)
const currentEditImageUrl = ref('')
let cropImageResolve: (value: any) => void = () => {}
let cropImageReject: (value: any) => void = () => {}
function initCropper(options: Cropper.Options<HTMLImageElement>) {
return new Promise((resolve) => {
nextTick(() => {
if (imageElRef.value) {
cropperIns.value = new Cropper(imageElRef.value, {
viewMode: 2,
dragMode: 'move',
aspectRatio: 1.25,
// cropBoxMovable: false, // 可通过拖动移动裁剪框
// cropBoxResizable: false, // 可通过拖动调整裁剪框的大小
minCropBoxWidth: 50, // 裁剪框的最小宽度
minCropBoxHeight: 50, // 裁剪框的最小高度
// autoCropArea: 1,
// preview: previewRef.value! || [],
// preview: [roundPreview.value!],
// rotatable: false, // 旋转
// scalable: false, // 可伸缩
// zoomable: false, // 可缩放
// zoomOnTouch: false, // 缩放触摸
ready: () => {
if (!isInitCropper.value) {
isInitCropper.value = true
resolve('加载成功')
}
},
...options,
})
}
})
})
}
function handleCropConfirm() {
if (cropperIns.value) {
confirmBtnLoading.value = true
cropperIns.value.getCroppedCanvas().toBlob((blob) => {
if (blob) {
const fd = new FormData()
const file = new File([blob], `image.${blob.type.split('/')[1]}`, { type: blob.type })
fd.append('file', file)
cropImageResolve(file)
confirmBtnLoading.value = false
dialogVisible.value = false
}
})
}
}
function handleCropCancel() {
dialogVisible.value = false
cropImageReject(new Error('Cancel'))
}
function cropImage(url: string, options: Cropper.Options<HTMLImageElement> = {}): Promise<File> {
currentEditImageUrl.value = url
dialogVisible.value = true
return initCropper(options).then(() => {
return new Promise((resolve, reject) => {
cropImageResolve = resolve
cropImageReject = reject
})
})
}
function onModalAfterLeave() {
if (cropperIns.value) {
cropperIns.value.destroy()
cropperIns.value = null
isInitCropper.value = false
}
}
defineExpose({
cropImage,
})
</script>
<template>
<el-dialog v-model="dialogVisible" title="图片裁切" width="800" @closed="onModalAfterLeave">
<div class="relative h-[400px]">
<Transition>
<div v-show="!isInitCropper" class="absolute inset-0 z-1">
<el-skeleton animated loading class="h-full">
<template #template>
<el-skeleton-item variant="image" class="!h-full" />
</template>
</el-skeleton>
</div>
</Transition>
<img
v-show="isInitCropper"
ref="imageElRef"
class="block h-full w-full"
alt="Picture"
:src="currentEditImageUrl"
/>
</div>
<template #footer>
<el-button plain @click="handleCropCancel">取消</el-button>
<el-button type="primary" plain :laoding="confirmBtnLoading" @click="handleCropConfirm">裁切</el-button>
</template>
</el-dialog>
</template>
<style lang="css" scoped>
.v-enter-active,
.v-leave-active {
transition: opacity 0.5s ease;
}
.v-enter-from,
.v-leave-to {
opacity: 0;
}
</style>
/* Import TinyMCE */
import tinymce from 'tinymce'
import type { RawEditorOptions } from 'tinymce'
/* icons */
import 'tinymce/icons/default/icons.min.js'
/* 主题 */
import 'tinymce/themes/silver/theme.min.js'
import 'tinymce/models/dom/model.min.js'
/* 皮肤 */
import 'tinymce/skins/ui/oxide/skin.js'
import 'tinymce/skins/ui/oxide/content.js'
import 'tinymce/skins/ui/oxide/skin.shadowdom.js'
import 'tinymce/skins/content/default/content.js'
/* 插件 */
import 'tinymce/plugins/advlist'
import 'tinymce/plugins/code'
import 'tinymce/plugins/emoticons'
import 'tinymce/plugins/emoticons/js/emojis'
import 'tinymce/plugins/link'
import 'tinymce/plugins/lists'
import 'tinymce/plugins/table'
/* 多语言 */
import './lib/langs/zh_CN.js'
export function editorRender(options: RawEditorOptions) {
tinymce.init({
selector: '#tinymce-app textarea#tinymce-textarea',
license_key: 'gpl',
language: 'zh_CN',
placeholder: '请输入你的内容...',
menubar: false,
height: '100%',
statusbar: false,
// branding: false,
// resize: false,
automatic_uploads: false,
browser_spellcheck: true,
// highlight_on_focus: false,
plugins: 'advlist code emoticons link lists table',
toolbar:
'undo redo | accordion accordionremove | blocks fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent | forecolor backcolor removeformat',
toolbar_mode: 'sliding',
skin_url: 'default',
content_css: 'default',
/* 覆盖默认配置 */
...options,
})
}
tinymce.addI18n('zh_CN', {
'#': '#',
Accessibility: '\u8f85\u52a9\u529f\u80fd',
Accordion: '\u6298\u53e0\u9762\u677f',
'Accordion body...': '\u6298\u53e0\u9762\u677f\u6b63\u6587...',
'Accordion summary...': '\u6298\u53e0\u9762\u677f\u6458\u8981...',
Action: '\u52a8\u4f5c',
Activity: '\u6d3b\u52a8',
Address: '\u5730\u5740',
Advanced: '\u9ad8\u7ea7',
Align: '\u5bf9\u9f50',
'Align center': '\u5c45\u4e2d\u5bf9\u9f50',
'Align left': '\u5de6\u5bf9\u9f50',
'Align right': '\u53f3\u5bf9\u9f50',
Alignment: '\u5bf9\u9f50',
'Alignment {0}': '\u5bf9\u9f50{0}',
All: '\u5168\u90e8',
'Alternative description': '\u66ff\u4ee3\u63cf\u8ff0',
'Alternative source': '\u955c\u50cf',
'Alternative source URL': '\u66ff\u4ee3\u6765\u6e90\u7f51\u5740',
Anchor: '\u951a\u70b9',
'Anchor...': '\u951a\u70b9...',
Anchors: '\u951a\u70b9',
'Animals and Nature': '\u52a8\u7269\u548c\u81ea\u7136',
Arrows: '\u7bad\u5934',
B: 'B',
'Background color': '\u80cc\u666f\u989c\u8272',
'Background color {0}': '\u80cc\u666f\u989c\u8272 {0}',
Black: '\u9ed1\u8272',
Block: '\u5757',
'Block {0}': '\u6587\u672c\u5757{0}',
Blockquote: 'Blockquote',
Blocks: '\u6837\u5f0f',
Blue: '\u84dd\u8272',
'Blue component': '\u767d\u8272\u90e8\u5206',
Body: '\u8868\u4f53',
Bold: '\u7c97\u4f53',
Border: '\u6846\u7ebf',
'Border color': '\u6846\u7ebf\u989c\u8272',
'Border style': '\u8fb9\u6846\u6837\u5f0f',
'Border width': '\u8fb9\u6846\u5bbd\u5ea6',
Bottom: '\u4e0b\u65b9\u5bf9\u9f50',
'Browse files': '\u6d4f\u89c8\u6587\u4ef6',
'Browse for an image': '\u6d4f\u89c8\u56fe\u7247',
'Browse links': '\u6d4f\u89c8\u94fe\u63a5',
'Bullet list': '\u65e0\u5e8f\u5217\u8868',
Cancel: '\u53d6\u6d88',
Caption: '\u6807\u9898',
Cell: '\u5355\u5143\u683c',
'Cell padding': '\u5355\u5143\u683c\u5185\u8fb9\u8ddd',
'Cell properties': '\u5355\u5143\u683c\u5c5e\u6027',
'Cell spacing': '\u5355\u5143\u683c\u5916\u95f4\u8ddd',
'Cell styles': '\u5355\u5143\u683c\u6837\u5f0f',
'Cell type': '\u50a8\u5b58\u683c\u522b',
Center: '\u5c45\u4e2d',
Characters: '\u5b57\u7b26',
'Characters (no spaces)': '\u5b57\u7b26(\u65e0\u7a7a\u683c)',
Circle: '\u7a7a\u5fc3\u5706',
Class: '\u7c7b\u578b',
'Clear formatting': '\u6e05\u9664\u683c\u5f0f',
Close: '\u5173\u95ed',
Code: '\u4ee3\u7801',
'Code sample...': '\u793a\u4f8b\u4ee3\u7801...',
'Code view': '\u4ee3\u7801\u89c6\u56fe',
'Color Picker': '\u9009\u8272\u5668',
'Color swatch': '\u989c\u8272\u6837\u672c',
Cols: '\u5217',
Column: '\u5217',
'Column clipboard actions': '\u5217\u526a\u8d34\u677f\u64cd\u4f5c',
'Column group': '\u5217\u7ec4',
'Column header': '\u5217\u6807\u9898',
'Constrain proportions': '\u4fdd\u6301\u6bd4\u4f8b',
Copy: '\u590d\u5236',
'Copy column': '\u590d\u5236\u5217',
'Copy row': '\u590d\u5236\u884c',
'Could not find the specified string.': '\u672a\u627e\u5230\u641c\u7d22\u5185\u5bb9\u3002',
'Could not load emojis': '\u65e0\u6cd5\u52a0\u8f7dEmojis',
Count: '\u8ba1\u6570',
Currency: '\u8d27\u5e01',
'Current window': '\u5f53\u524d\u7a97\u53e3',
'Custom color': '\u81ea\u5b9a\u4e49\u989c\u8272',
'Custom...': '\u81ea\u5b9a\u4e49......',
Cut: '\u526a\u5207',
'Cut column': '\u526a\u5207\u5217',
'Cut row': '\u526a\u5207\u884c',
'Dark Blue': '\u6df1\u84dd\u8272',
'Dark Gray': '\u6df1\u7070\u8272',
'Dark Green': '\u6df1\u7eff\u8272',
'Dark Orange': '\u6df1\u6a59\u8272',
'Dark Purple': '\u6df1\u7d2b\u8272',
'Dark Red': '\u6df1\u7ea2\u8272',
'Dark Turquoise': '\u6df1\u84dd\u7eff\u8272',
'Dark Yellow': '\u6697\u9ec4\u8272',
Dashed: '\u865a\u7ebf',
'Date/time': '\u65e5\u671f/\u65f6\u95f4',
'Decrease indent': '\u51cf\u5c11\u7f29\u8fdb',
Default: '\u9884\u8bbe',
'Delete accordion': '\u5220\u9664\u6298\u53e0\u9762\u677f',
'Delete column': '\u5220\u9664\u5217',
'Delete row': '\u5220\u9664\u884c',
'Delete table': '\u5220\u9664\u8868\u683c',
Dimensions: '\u5c3a\u5bf8',
Disc: '\u5b9e\u5fc3\u5706',
Div: 'Div',
Document: '\u6587\u6863',
Dotted: '\u865a\u7ebf',
Double: '\u53cc\u7cbe\u5ea6',
'Drop an image here': '\u62d6\u653e\u4e00\u5f20\u56fe\u50cf\u81f3\u6b64',
'Dropped file type is not supported': '\u6b64\u6587\u4ef6\u7c7b\u578b\u4e0d\u652f\u6301\u62d6\u653e',
Edit: '\u7f16\u8f91',
Embed: '\u5185\u5d4c',
Emojis: 'Emojis',
'Emojis...': 'Emojis...',
Error: '\u9519\u8bef',
'Error: Form submit field collision.': '\u9519\u8bef: \u8868\u5355\u63d0\u4ea4\u5b57\u6bb5\u51b2\u7a81\u3002',
'Error: No form element found.': '\u9519\u8bef: \u6ca1\u6709\u8868\u5355\u63a7\u4ef6\u3002',
'Extended Latin': '\u62c9\u4e01\u8bed\u6269\u5145',
'Failed to initialize plugin: {0}': '\u63d2\u4ef6\u521d\u59cb\u5316\u5931\u8d25: {0}',
'Failed to load plugin url: {0}': '\u63d2\u4ef6\u52a0\u8f7d\u5931\u8d25 \u94fe\u63a5: {0}',
'Failed to load plugin: {0} from url {1}': '\u63d2\u4ef6\u52a0\u8f7d\u5931\u8d25: {0} \u6765\u81ea\u94fe\u63a5 {1}',
'Failed to upload image: {0}': '\u56fe\u7247\u4e0a\u4f20\u5931\u8d25: {0}',
File: '\u6587\u4ef6',
Find: '\u5bfb\u627e',
'Find (if searchreplace plugin activated)':
'\u67e5\u627e(\u5982\u679c\u67e5\u627e\u66ff\u6362\u63d2\u4ef6\u5df2\u6fc0\u6d3b)',
'Find and Replace': '\u67e5\u627e\u548c\u66ff\u6362',
'Find and replace...': '\u67e5\u627e\u5e76\u66ff\u6362...',
'Find in selection': '\u5728\u9009\u533a\u4e2d\u67e5\u627e',
'Find whole words only': '\u5168\u5b57\u5339\u914d',
Flags: '\u65d7\u5e1c',
'Focus to contextual toolbar': '\u79fb\u52a8\u7126\u70b9\u5230\u4e0a\u4e0b\u6587\u83dc\u5355',
'Focus to element path': '\u79fb\u52a8\u7126\u70b9\u5230\u5143\u7d20\u8def\u5f84',
'Focus to menubar': '\u79fb\u52a8\u7126\u70b9\u5230\u83dc\u5355\u680f',
'Focus to toolbar': '\u79fb\u52a8\u7126\u70b9\u5230\u5de5\u5177\u680f',
Font: '\u5b57\u4f53',
'Font size {0}': '\u5b57\u4f53\u5927\u5c0f{0}',
'Font sizes': '\u5b57\u4f53\u5927\u5c0f',
'Font {0}': '\u5b57\u4f53{0}',
Fonts: '\u5b57\u4f53',
'Food and Drink': '\u98df\u7269\u548c\u996e\u54c1',
Footer: '\u8868\u5c3e',
Format: '\u683c\u5f0f',
'Format {0}': '\u683c\u5f0f{0}',
Formats: '\u683c\u5f0f',
Fullscreen: '\u5168\u5c4f',
G: 'G',
General: '\u4e00\u822c',
Gray: '\u7070\u8272',
Green: '\u7eff\u8272',
'Green component': '\u7eff\u8272\u90e8\u5206',
Groove: '\u51f9\u69fd',
'Handy Shortcuts': '\u5feb\u6377\u952e',
Header: '\u8868\u5934',
'Header cell': '\u8868\u5934\u5355\u5143\u683c',
'Heading 1': '\u4e00\u7ea7\u6807\u9898',
'Heading 2': '\u4e8c\u7ea7\u6807\u9898',
'Heading 3': '\u4e09\u7ea7\u6807\u9898',
'Heading 4': '\u56db\u7ea7\u6807\u9898',
'Heading 5': '\u4e94\u7ea7\u6807\u9898',
'Heading 6': '\u516d\u7ea7\u6807\u9898',
Headings: '\u6807\u9898',
Height: '\u9ad8\u5ea6',
Help: '\u5e2e\u52a9',
'Hex color code': '\u5341\u516d\u8fdb\u5236\u989c\u8272\u4ee3\u7801',
Hidden: '\u9690\u85cf',
'Horizontal align': '\u6c34\u5e73\u5bf9\u9f50',
'Horizontal line': '\u6c34\u5e73\u5206\u5272\u7ebf',
'Horizontal space': '\u6c34\u5e73\u95f4\u8ddd',
ID: 'ID',
'ID should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.':
'ID\u5e94\u8be5\u4ee5\u82f1\u6587\u5b57\u6bcd\u5f00\u5934\uff0c\u540e\u9762\u53ea\u80fd\u6709\u82f1\u6587\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u7834\u6298\u53f7\u3001\u70b9\u3001\u5192\u53f7\u6216\u4e0b\u5212\u7ebf\u3002',
'Image is decorative': '\u56fe\u50cf\u662f\u88c5\u9970\u6027\u7684',
'Image list': '\u56fe\u7247\u6e05\u5355',
'Image title': '\u56fe\u7247\u6807\u9898',
'Image...': '\u56fe\u7247...',
'ImageProxy HTTP error: Could not find Image Proxy':
'\u56fe\u7247\u4ee3\u7406\u8bf7\u6c42\u9519\u8bef\uff1a\u65e0\u6cd5\u627e\u5230\u56fe\u7247\u4ee3\u7406',
'ImageProxy HTTP error: Incorrect Image Proxy URL':
'\u56fe\u7247\u4ee3\u7406\u8bf7\u6c42\u9519\u8bef\uff1a\u56fe\u7247\u4ee3\u7406\u5730\u5740\u9519\u8bef',
'ImageProxy HTTP error: Rejected request':
'\u56fe\u7247\u4ee3\u7406\u8bf7\u6c42\u9519\u8bef\uff1a\u8bf7\u6c42\u88ab\u62d2\u7edd',
'ImageProxy HTTP error: Unknown ImageProxy error':
'\u56fe\u7247\u4ee3\u7406\u8bf7\u6c42\u9519\u8bef\uff1a\u672a\u77e5\u7684\u56fe\u7247\u4ee3\u7406\u9519\u8bef',
'Increase indent': '\u589e\u52a0\u7f29\u8fdb',
Inline: '\u6587\u672c',
Insert: '\u63d2\u5165',
'Insert Template': '\u63d2\u5165\u6a21\u677f',
'Insert accordion': '\u63d2\u5165\u6298\u53e0\u9762\u677f',
'Insert column after': '\u5728\u53f3\u4fa7\u63d2\u5165\u5217',
'Insert column before': '\u5728\u5de6\u4fa7\u63d2\u5165\u5217',
'Insert date/time': '\u63d2\u5165\u65e5\u671f/\u65f6\u95f4',
'Insert image': '\u63d2\u5165\u56fe\u7247',
'Insert link (if link plugin activated)':
'\u63d2\u5165\u94fe\u63a5 (\u5982\u679c\u94fe\u63a5\u63d2\u4ef6\u5df2\u6fc0\u6d3b)',
'Insert row after': '\u5728\u4e0b\u65b9\u63d2\u5165\u884c',
'Insert row before': '\u5728\u4e0a\u65b9\u63d2\u5165\u884c',
'Insert table': '\u63d2\u5165\u8868\u683c',
'Insert template...': '\u63d2\u5165\u6a21\u677f...',
'Insert video': '\u63d2\u5165\u89c6\u9891',
'Insert/Edit code sample': '\u63d2\u5165/\u7f16\u8f91\u4ee3\u7801\u793a\u4f8b',
'Insert/edit image': '\u63d2\u5165/\u7f16\u8f91\u56fe\u7247',
'Insert/edit link': '\u63d2\u5165/\u7f16\u8f91\u94fe\u63a5',
'Insert/edit media': '\u63d2\u5165/\u7f16\u8f91\u5a92\u4f53',
'Insert/edit video': '\u63d2\u5165/\u7f16\u8f91\u89c6\u9891',
Inset: '\u5d4c\u5165',
'Invalid hex color code: {0}': '\u5341\u516d\u8fdb\u5236\u989c\u8272\u4ee3\u7801\u65e0\u6548\uff1a {0}',
'Invalid input': '\u65e0\u6548\u8f93\u5165',
Italic: '\u659c\u4f53',
Justify: '\u4e24\u7aef\u5bf9\u9f50',
'Keyboard Navigation': '\u952e\u76d8\u6307\u5f15',
Language: '\u8bed\u8a00',
'Learn more...': '\u4e86\u89e3\u66f4\u591a...',
Left: '\u5de6',
'Left to right': '\u7531\u5de6\u5230\u53f3',
'Light Blue': '\u6d45\u84dd\u8272',
'Light Gray': '\u6d45\u7070\u8272',
'Light Green': '\u6d45\u7eff\u8272',
'Light Purple': '\u6d45\u7d2b\u8272',
'Light Red': '\u6d45\u7ea2\u8272',
'Light Yellow': '\u6d45\u9ec4\u8272',
'Line height': 'Line height',
'Link list': '\u94fe\u63a5\u6e05\u5355',
'Link...': '\u94fe\u63a5...',
'List Properties': '\u5217\u8868\u5c5e\u6027',
'List properties...': '\u6807\u9898\u5b57\u4f53\u5c5e\u6027',
'Loading emojis...': '\u6b63\u5728\u52a0\u8f7dEmojis...',
'Loading...': '\u52a0\u8f7d\u4e2d...',
'Lower Alpha': '\u5c0f\u5199\u82f1\u6587\u5b57\u6bcd',
'Lower Greek': '\u5c0f\u5199\u5e0c\u814a\u5b57\u6bcd',
'Lower Roman': '\u5c0f\u5199\u7f57\u9a6c\u6570\u5b57',
'Match case': '\u5927\u5c0f\u5199\u5339\u914d',
Mathematical: '\u6570\u5b66',
'Media poster (Image URL)': '\u5c01\u9762(\u56fe\u7247\u5730\u5740)',
'Media...': '\u591a\u5a92\u4f53...',
'Medium Blue': '\u4e2d\u84dd\u8272',
'Medium Gray': '\u4e2d\u7070\u8272',
'Medium Purple': '\u4e2d\u7d2b\u8272',
'Merge cells': '\u5408\u5e76\u5355\u5143\u683c',
Middle: '\u5c45\u4e2d\u5bf9\u9f50',
'Midnight Blue': '\u6df1\u84dd\u8272',
'More...': '\u66f4\u591a...',
Name: '\u540d\u79f0',
'Navy Blue': '\u6d77\u519b\u84dd',
'New document': '\u65b0\u5efa\u6587\u6863',
'New window': '\u65b0\u7a97\u53e3',
Next: '\u4e0b\u4e00\u4e2a',
No: '\u5426',
'No alignment': '\u672a\u5bf9\u9f50',
'No color': '\u65e0',
'Nonbreaking space': '\u4e0d\u95f4\u65ad\u7a7a\u683c',
None: '\u65e0',
'Numbered list': '\u6709\u5e8f\u5217\u8868',
OR: '\u6216',
Objects: '\u7269\u4ef6',
Ok: '\u786e\u5b9a',
'Open help dialog': '\u6253\u5f00\u5e2e\u52a9\u5bf9\u8bdd\u6846',
'Open link': '\u6253\u5f00\u94fe\u63a5',
'Open link in...': '\u94fe\u63a5\u6253\u5f00\u4f4d\u7f6e...',
'Open popup menu for split buttons':
'\u6253\u5f00\u5f39\u51fa\u5f0f\u83dc\u5355\uff0c\u7528\u4e8e\u62c6\u5206\u6309\u94ae',
Orange: '\u6a59\u8272',
Outset: '\u5916\u7f6e',
'Page break': '\u5206\u9875\u7b26',
Paragraph: '\u6bb5\u843d',
Paste: '\u7c98\u8d34',
'Paste as text': '\u7c98\u8d34\u4e3a\u6587\u672c',
'Paste column after': '\u7c98\u8d34\u540e\u9762\u7684\u5217',
'Paste column before': '\u7c98\u8d34\u6b64\u5217\u524d',
'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.':
'\u5f53\u524d\u4e3a\u7eaf\u6587\u672c\u7c98\u8d34\u6a21\u5f0f\uff0c\u518d\u6b21\u70b9\u51fb\u53ef\u4ee5\u56de\u5230\u666e\u901a\u7c98\u8d34\u6a21\u5f0f\u3002',
'Paste or type a link': '\u7c98\u8d34\u6216\u8f93\u5165\u94fe\u63a5',
'Paste row after': '\u7c98\u8d34\u884c\u5230\u4e0b\u65b9',
'Paste row before': '\u7c98\u8d34\u884c\u5230\u4e0a\u65b9',
'Paste your embed code below:': '\u5c06\u5185\u5d4c\u4ee3\u7801\u7c98\u8d34\u5728\u4e0b\u9762:',
People: '\u4eba\u7c7b',
Plugins: '\u63d2\u4ef6',
'Plugins installed ({0}):': '\u5df2\u5b89\u88c5\u63d2\u4ef6 ({0}):',
'Powered by {0}': '\u7531{0}\u9a71\u52a8',
Pre: '\u524d\u8a00',
Preferences: '\u9996\u9009\u9879',
Preformatted: '\u9884\u5148\u683c\u5f0f\u5316\u7684',
'Premium plugins:': '\u4f18\u79c0\u63d2\u4ef6\uff1a',
'Press the Up and Down arrow keys to resize the editor.':
'\u6309\u4e0a\u4e0b\u7bad\u5934\u952e\u4ee5\u8c03\u6574\u7f16\u8f91\u5668\u5927\u5c0f\u3002',
'Press the arrow keys to resize the editor.':
'\u6309\u7bad\u5934\u952e\u4ee5\u8c03\u6574\u7f16\u8f91\u5668\u5927\u5c0f\u3002',
'Press {0} for help': '\u6309 {0} \u83b7\u5f97\u5e2e\u52a9',
Preview: '\u9884\u89c8',
Previous: '\u4e0a\u4e00\u4e2a',
Print: '\u6253\u5370',
'Print...': '\u6253\u5370...',
Purple: '\u7d2b\u8272',
Quotations: '\u5f15\u7528',
R: 'R',
'Range 0 to 255': '\u8303\u56f40\u81f3255',
Red: '\u7ea2\u8272',
'Red component': '\u7ea2\u8272\u90e8\u5206',
Redo: '\u91cd\u505a',
Remove: '\u79fb\u9664',
'Remove color': '\u79fb\u9664\u989c\u8272',
'Remove link': '\u79fb\u9664\u94fe\u63a5',
Replace: '\u66ff\u6362',
'Replace all': '\u66ff\u6362\u5168\u90e8',
'Replace with': '\u66ff\u6362\u4e3a',
Resize: '\u8c03\u6574\u5927\u5c0f',
'Restore last draft': '\u6062\u590d\u4e0a\u6b21\u7684\u8349\u7a3f',
'Reveal or hide additional toolbar items': '\u663e\u793a\u6216\u9690\u85cf\u5176\u4ed6\u5de5\u5177\u680f\u9879',
'Rich Text Area': '\u5bcc\u6587\u672c\u533a\u57df',
'Rich Text Area. Press ALT-0 for help.': '\u7f16\u8f91\u533a\u3002\u6309Alt+0\u952e\u6253\u5f00\u5e2e\u52a9\u3002',
'Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help':
'\u7f16\u8f91\u533a\u3002\u6309ALT-F9\u6253\u5f00\u83dc\u5355\uff0c\u6309ALT-F10\u6253\u5f00\u5de5\u5177\u680f\uff0c\u6309ALT-0\u67e5\u770b\u5e2e\u52a9',
Ridge: '\u6d77\u810a\u5ea7',
Right: '\u53f3',
'Right to left': '\u7531\u53f3\u5230\u5de6',
Row: '\u884c',
'Row clipboard actions': '\u884c\u526a\u8d34\u677f\u64cd\u4f5c',
'Row group': '\u884c\u7ec4',
'Row header': '\u884c\u5934',
'Row properties': '\u884c\u5c5e\u6027',
'Row type': '\u884c\u7c7b\u578b',
Rows: '\u884c\u6570',
Save: '\u4fdd\u5b58',
'Save (if save plugin activated)': '\u4fdd\u5b58(\u5982\u679c\u4fdd\u5b58\u63d2\u4ef6\u5df2\u6fc0\u6d3b)',
Scope: '\u8303\u56f4',
Search: '\u641c\u7d22',
'Select all': '\u5168\u9009',
'Select...': '\u9009\u62e9...',
Selection: '\u9009\u62e9',
Shortcut: '\u5feb\u6377\u65b9\u5f0f',
'Show blocks': '\u663e\u793a\u533a\u5757\u8fb9\u6846',
'Show caption': '\u663e\u793a\u6807\u9898',
'Show invisible characters': '\u663e\u793a\u4e0d\u53ef\u89c1\u5b57\u7b26',
Size: '\u5b57\u53f7',
Solid: '\u5b9e\u7ebf',
Source: '\u5730\u5740',
'Source code': '\u6e90\u4ee3\u7801',
'Special Character': '\u7279\u6b8a\u5b57\u7b26',
'Special character...': '\u7279\u6b8a\u5b57\u7b26...',
'Split cell': '\u62c6\u5206\u5355\u5143\u683c',
Square: '\u5b9e\u5fc3\u65b9\u5757',
'Start list at number': '\u4ee5\u6570\u5b57\u5f00\u59cb\u5217\u8868',
Strikethrough: '\u5220\u9664\u7ebf',
Style: '\u6837\u5f0f',
Subscript: '\u4e0b\u6807',
Superscript: '\u4e0a\u6807',
'Switch to or from fullscreen mode': '\u5207\u6362\u5168\u5c4f\u6a21\u5f0f',
Symbols: '\u7b26\u53f7',
'System Font': '\u7cfb\u7edf\u5b57\u4f53',
Table: '\u8868\u683c',
'Table caption': '\u8868\u683c\u6807\u9898',
'Table properties': '\u8868\u683c\u5c5e\u6027',
'Table styles': '\u8868\u683c\u6837\u5f0f',
Template: '\u6a21\u677f',
Templates: '\u6a21\u677f',
Text: '\u6587\u5b57',
'Text color': '\u5b57\u4f53\u989c\u8272',
'Text color {0}': '\u5b57\u4f53\u989c\u8272 {0}',
'Text to display': '\u8981\u663e\u793a\u7684\u6587\u672c',
'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?':
'\u4f60\u6240\u586b\u5199\u7684URL\u5730\u5740\u4e3a\u90ae\u4ef6\u5730\u5740\uff0c\u9700\u8981\u52a0\u4e0amailto: \u524d\u7f00\u5417\uff1f',
'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?':
'\u4f60\u6240\u586b\u5199\u7684URL\u5730\u5740\u5c5e\u4e8e\u5916\u90e8\u94fe\u63a5\uff0c\u9700\u8981\u52a0\u4e0ahttp:// \u524d\u7f00\u5417\uff1f',
'The URL you entered seems to be an external link. Do you want to add the required https:// prefix?':
'\u60a8\u8f93\u5165\u7684 URL \u4f3c\u4e4e\u662f\u4e00\u4e2a\u5916\u90e8\u94fe\u63a5\u3002\u60a8\u60f3\u6dfb\u52a0\u6240\u9700\u7684 https:// \u524d\u7f00\u5417\uff1f',
Title: '\u6807\u9898',
'To open the popup, press Shift+Enter': '\u6309Shitf+Enter\u952e\u6253\u5f00\u5bf9\u8bdd\u6846',
'Toggle accordion': '\u5207\u6362\u6298\u53e0\u9762\u677f',
Tools: '\u5de5\u5177',
Top: '\u4e0a\u65b9\u5bf9\u9f50',
'Travel and Places': '\u65c5\u6e38\u548c\u5730\u70b9',
Turquoise: '\u9752\u7eff\u8272',
Underline: '\u4e0b\u5212\u7ebf',
Undo: '\u64a4\u9500',
Upload: '\u4e0a\u4f20',
'Uploading image': '\u4e0a\u4f20\u56fe\u7247',
'Upper Alpha': '\u5927\u5199\u82f1\u6587\u5b57\u6bcd',
'Upper Roman': '\u5927\u5199\u7f57\u9a6c\u6570\u5b57',
Url: '\u5730\u5740',
'User Defined': '\u81ea\u5b9a\u4e49',
Valid: '\u6709\u6548',
Version: '\u7248\u672c',
'Vertical align': '\u5782\u76f4\u5bf9\u9f50',
'Vertical space': '\u5782\u76f4\u95f4\u8ddd',
View: '\u67e5\u770b',
'Visual aids': '\u7f51\u683c\u7ebf',
Warn: '\u8b66\u544a',
White: '\u767d\u8272',
Width: '\u5bbd\u5ea6',
'Word count': '\u5b57\u6570',
Words: '\u5355\u8bcd',
'Words: {0}': '\u5b57\u6570\uff1a{0}',
Yellow: '\u9ec4\u8272',
Yes: '\u662f',
'You are using {0}': '\u4f60\u6b63\u5728\u4f7f\u7528 {0}',
'You have unsaved changes are you sure you want to navigate away?':
'\u4f60\u8fd8\u6709\u6587\u6863\u5c1a\u672a\u4fdd\u5b58\uff0c\u786e\u5b9a\u8981\u79bb\u5f00\uff1f',
"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.":
'\u4f60\u7684\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u6253\u5f00\u526a\u8d34\u677f\uff0c\u8bf7\u4f7f\u7528Ctrl+X/C/V\u7b49\u5feb\u6377\u952e\u3002',
alignment: '\u5bf9\u9f50',
'austral sign': '\u6fb3\u5143\u7b26\u53f7',
'cedi sign': '\u585e\u5730\u7b26\u53f7',
'colon sign': '\u5192\u53f7',
'cruzeiro sign': '\u514b\u9c81\u8d5b\u7f57\u5e01\u7b26\u53f7',
'currency sign': '\u8d27\u5e01\u7b26\u53f7',
'dollar sign': '\u7f8e\u5143\u7b26\u53f7',
'dong sign': '\u8d8a\u5357\u76fe\u7b26\u53f7',
'drachma sign': '\u5fb7\u62c9\u514b\u9a6c\u7b26\u53f7',
'euro-currency sign': '\u6b27\u5143\u7b26\u53f7',
example: '\u793a\u4f8b',
formatting: '\u683c\u5f0f\u5316',
'french franc sign': '\u6cd5\u90ce\u7b26\u53f7',
'german penny symbol': '\u5fb7\u56fd\u4fbf\u58eb\u7b26\u53f7',
'guarani sign': '\u74dc\u62c9\u5c3c\u7b26\u53f7',
history: '\u5386\u53f2',
'hryvnia sign': '\u683c\u91cc\u592b\u5c3c\u4e9a\u7b26\u53f7',
indentation: '\u7f29\u8fdb',
'indian rupee sign': '\u5370\u5ea6\u5362\u6bd4',
'kip sign': '\u8001\u631d\u57fa\u666e\u7b26\u53f7',
'lira sign': '\u91cc\u62c9\u7b26\u53f7',
'livre tournois sign': '\u91cc\u5f17\u5f17\u5c14\u7b26\u53f7',
'manat sign': '\u9a6c\u7eb3\u7279\u7b26\u53f7',
'mill sign': '\u5bc6\u5c14\u7b26\u53f7',
'naira sign': '\u5948\u62c9\u7b26\u53f7',
'new sheqel sign': '\u65b0\u8c22\u514b\u5c14\u7b26\u53f7',
'nordic mark sign': '\u5317\u6b27\u9a6c\u514b',
'peseta sign': '\u6bd4\u585e\u5854\u7b26\u53f7',
'peso sign': '\u6bd4\u7d22\u7b26\u53f7',
'ruble sign': '\u5362\u5e03\u7b26\u53f7',
'rupee sign': '\u5362\u6bd4\u7b26\u53f7',
'spesmilo sign': 'spesmilo\u7b26\u53f7',
styles: '\u6837\u5f0f',
'tenge sign': '\u575a\u6208\u7b26\u53f7',
'tugrik sign': '\u56fe\u683c\u91cc\u514b\u7b26\u53f7',
'turkish lira sign': '\u571f\u8033\u5176\u91cc\u62c9',
'won sign': '\u97e9\u5143\u7b26\u53f7',
'yen character': '\u65e5\u5143\u5b57\u6837',
'yen/yuan character variant one': '\u5143\u5b57\u6837\uff08\u5927\u5199\uff09',
'yuan character': '\u4eba\u6c11\u5e01\u5143\u5b57\u6837',
'yuan character, in hong kong and taiwan': '\u5143\u5b57\u6837\uff08\u6e2f\u53f0\u5730\u533a\uff09',
'{0} characters': '{0} \u4e2a\u5b57\u7b26',
'{0} columns, {1} rows': '{0} \u5217\uff0c{1} \u884c',
'{0} words': '{0} \u5b57',
})
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { editorRender } from './editor-loader'
import type { Editor, RawEditorOptions } from 'tinymce'
interface Props {
initOptions?: RawEditorOptions
}
const { initOptions = {} } = defineProps<Props>()
const isEditorRender = ref(false)
const editorInstance = ref<Editor | null>(null)
function editorLoader() {
editorRender({
...initOptions,
setup: (editor) => {
if (initOptions.setup) initOptions.setup(editor)
editorInstance.value = editor
editor.on('init', () => {
isEditorRender.value = true
})
},
})
}
onMounted(() => {
editorLoader()
})
function getContent() {
return editorInstance.value?.getContent() || ''
}
defineExpose({
getContent,
})
</script>
<template>
<div id="tinymce-app" v-loading="!isEditorRender" class="relative h-[400px] w-full">
<textarea id="tinymce-textarea" :class="isEditorRender ? 'opacity-0' : 'opacity-100'"></textarea>
</div>
</template>
...@@ -27,6 +27,23 @@ export default defineConfig(({ command, mode }) => { ...@@ -27,6 +27,23 @@ export default defineConfig(({ command, mode }) => {
server: { server: {
host: true, host: true,
port: envConf.VITE_PORT, port: envConf.VITE_PORT,
/* proxy: {
'/local': {
target: 'http://127.0.0.1:3000',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/local/, '/api/rest'),
},
}, */
},
build: {
rollupOptions: {
output: {
manualChunks: {
tinymce: ['tinymce'],
},
},
},
}, },
} }
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment