![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
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.
可离线使用、灵活可配的富文本编辑器,基于 tinymce.
npm add minimce @tinymce/tinymce-vue@3 vue@2 element-ui filepool? imgpond?
// 全局引入
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之外均可配置 |
eventBus | 事件总线 | Vue instance | ||
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
})
v-model
, *.sync
)仅支持局部配置权重:
内置样式
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
原因
iframe
存在执行未知脚本等安全隐患iframe
web-view
中使用 iframe
需要配置业务域名tinymce提供了premium插件 PowerPaste
,可用于粘贴Word文档,但兼容性一般,尤其是不支持 WPS
minimce提供插入Word文档功能,兼容微软、WPS,可在一定程度上替代PowerPaste
注意:粘贴可以片段粘贴,插入只能整个文档插入
// PowerPaste配置示例
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))
})
},
}
})
兼容性
受浏览器限制,PowerPaste
插件无法支持微软Word和Excel文档所支持的所有图片类型
。举个例子,浏览器禁止以编程方式访问文件系统,所以无法解析文档中使用 file://
协议的图片(WPS使用的就是此协议)。
粘贴微软Word文档(Windows系统、≥2013版本)中受保护视图的内容,将仅得到无格式的普通文本,这是受保护视图与剪贴板的交互机制决定的。
受微软Excel网页版限制,粘贴微软Excel网页版的内容将仅得到无格式的普通文本。
粘贴的网页内容默认会保留一定的源格式, 启用 PowerPaste
插件后,对格式的处理将会更加完善。详见https://www.tiny.cloud/docs/enterprise/system-requirements/#improvedhtmlcleaning
::: tip
如需获取纯文本,选中 编辑
- 粘贴为文本
再进行粘贴
清除格式
按钮得到的不是纯文本,可以自定义清除效果:
https://www.tiny.cloud/docs/configure/content-formatting/#removingaformat
:::
如果用户复制第三方网站的内容到编辑框内,静态资源(如图片)可能无法正常显示,这是因为:
第三方网站没有开启静态资源的跨域访问
第三方网站对静态资源做了referrer校验
tinymce的 urlconverter_callback
, paste_postprocess
API不支持异步操作,所以批量转存图片可行性低
技术上是可以解决的,可以通过nginx动态代理配合前面提到的两个API来处理
请自行评估相关风险
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.