reosimgs
v1.0.31
Published
Tinymce Plugin - Format img tag src, background-image url
Downloads
5
Readme
reosimgs
👀 中文文档
Feature
- Tinymce Plugin - Format img tag src, background-image url
Description
- Tinymce version support: 5.0.4+
- Supported language: Simplified Chinese
- Repo Author: Kori
Usage
Put this repo folder(reosimgs) in the plugins folder under the TinyMCE home directory
Example path: public/js/tinymce/plugins/reosimgs
In your component page:
fetch_new_src is get new src logic function
- This function takes a url string
- Need return this Promise response for example:
{ "code": 200, "msg": "OK", "data": { "url": "https://newimgrul-asdads21321321asxasx.png" } }
Init
initTinymce() {
window.tinymce.init({
selector: `#tinymceId`,
plugins: 'reosimgs',
toolbar: [
'reosimgs'
],
width: '100%',
fontsize_formats: '12px 14px 16px 18px 20px 22px 24px 26px 36px 48px 56px',
statusbar: false,
async fetch_new_src(src) {
return fetch('http://xxxx.com/api/save/image', {
body: JSON.stringify({ url: src }),
method: 'POST',
'Content-Type': 'application/json'
})
.then((response) => {
return response.json()
})
.catch((error) => {
console.error('Failed to fetch image:', error)
throw error
})
},
})
},