Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Offline, optionated rich-text editor powered by tinymce.
imgpond
/ filepool
mediaembed
需要搭配后端服务 请自行配置advcode
essential
以上的 plan
提供换肤、换图标风格工具栏选项element-ui
集成说明:
element-ui
是以外置依赖的方式引入的 所以不必担心代码体积和版本不一致等问题element-ui
的 el-form
组件 支持 el-form
的全局disabledDependencies:vue element-ui imgpond? filepool?
// 全局引入
import Minimce from 'minimce'
Vue.use(Minimce, {
// 全局配置
})
<!-- 局部引入 -->
<template>
<Minimce v-bind="config"/>
</template>
<script>
import Minimce from 'minimce'
export default {
components: { Minimce },
data () {
return {
config: {
// 局部配置
}
}
}
}
</script>
Attribute | Description | Type | Accepted Values | Default |
---|---|---|---|---|
value / v-model | html格式的输入内容 | string | ||
apiKey | tinymce api key | string | https://www.tiny.cloud/auth/signup/ | |
plan | tinymce plan(默认启用plan包含的全套插件,mediaembed除外) | string | 'core'/'essential'/'professional'/'custom' 参考https://www.tiny.cloud/pricing | 'core' |
disabled | 是否禁用(禁用模式不可编辑,保留工具栏) | boolean | false | |
readonly | 是否只读(只读模式仅展示html,相当于预览) | boolean | false | |
tinymceOptions | tinymce配置 | object / function | https://www.tiny.cloud/docs/configure/ | 除setup之外均可配置 |
Imgpond | 上传图片插件(配置后自动开启功能) | Vue Component | ||
Filepool | 上传文件插件(配置后自动开启功能) | Vue Component | ||
MobileLink | 插入移动端页面链接插件(配置后自动开启功能) | Vue Component |
Imgpond
You can use Imgpond to upload local images.
import Imgpond from 'imgpond'
Vue.use(Imgpond)
import Minimce from 'minimce'
Vue.use(Minimce, {
Imgpond
})
Filepool
You can use Filepool to upload local audio and video.
import Filepool from 'filepool'
Vue.use(Filepool)
import Minimce from 'minimce'
Vue.use(Minimce, {
Filepool
})
MobileLink
tinymce的插入链接功能只能插入普通链接 如果需要定制化需求 比如想要插入的链接是移动端某个页面的链接 可以自定义一个组件
组件通过 eventBus.$emit('insertTag', '<div/>')
插入标签
// 事件通信
const eventBus = new Vue()
export { eventBus } // 用于其它组件与Minimce进行通信
import MobileLink from '@/components/MobileLink'
import Minimce from 'minimce'
Vue.use(Minimce, {
MobileLink,
eventBus
})
样式
内置样式
line-height: 1.8;
overflow: auto;
p {
margin-block-end: 0;
margin-block-start: 0;
}
img {
max-width: 100%;
height: auto !important;
vertical-align: middle;
}
audio, video {
width: 100%;
background-color: #000;
}
可按需复制至富文本展示端使用
import Minimce from 'minimce'
Vue.use(Minimce, {
tinymceOptions: {
invalid_elements: 'iframe,frame,audio' // 默认值:'iframe,frame'
}
})
默认屏蔽
iframe
原因:小程序中不能访问没有配置的业务域名
import Minimce from 'minimce'
import axios from 'axios'
import { getAxiosShortcut } from 'admate'
const { POST } = getAxiosShortcut(axios)
Vue.use(Minimce, {
apiKey: process.env.VUE_APP_API_KEY,
plan: 'essential',
tinymceOptions: {
images_upload_handler (blobInfo, success, failure) {
const blob = blobInfo.blob()
const file = new File(
[blob],
blobInfo.filename(),
{ type: blob.type }
)
POST.upload(process.env.VUE_APP_UPLOAD_API, {
file
}).then(res => {
if (typeof res.data?.data === 'string') {
success(res.data.data)
} else {
failure(res.data?.message)
}
}).catch(err => {
failure(String(err))
})
},
}
})
兼容性
[tinymce官方] 受浏览器限制,PowerPaste
插件无法支持微软Word和Excel文档所支持的所有图片类型
。但将 powerpaste_keep_unsupported_src
参数开启时,PowerPaste
仍会把不支持图片的原始链接存储在 data-image-src
属性中,以便开发者通过 post-processing
钩子做进一步处理。
[tinymce官方] 粘贴微软Word文档(Windows系统、≥2013版本)中受保护视图的内容,将仅得到无格式的普通文本,这是受保护视图与剪贴板的交互机制决定的。
[tinymce官方] 受微软Excel网页版限制,粘贴微软Excel网页版的内容将仅得到无格式的普通文本。
element-ui
老版本可能存在 Imgpond
的图片无法清除的问题tinymce
有依赖window对象中的某些属性 在微前端环境中(如 乾坤
)对window对象做了代理 会导致报错 临时的解决方式是关闭subProject的jsSandbox(新版 乾坤
已解决)FAQs
Rich text editor, offline TinyMCE Vue 2.6/2.7/3 isomorphic wrapper.
The npm package minimce receives a total of 49 weekly downloads. As such, minimce popularity was classified as not popular.
We found that minimce demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.