buddyexpress / bdesk_photo Goto Github PK
View Code? Open in Web Editor NEWAllow tinymce to embed image as a base64
Allow tinymce to embed image as a base64
I'm still trying to figure out how to fix this myself, but the instructions should be updated once this is resolved.
I try to add a browse picker to upload picture, but problem with base64 data undefiend when use browse picker and I have no problem with drag and drop picture.
tinymce code viewer (Drag and drop and Browse picker result)
<img src="blob:http://localhost:64878/dbd2013e-50bd-44a4-a9ff-1773d3cc5e22" />
Drag and drop result
<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgEAYABgAAD/7gAOQWRvYmUAZAAAAAAB/... />
Browse picker result
<img title="Lighthouse.jpg" src="data:image/jpeg;base64,undefined" alt="" width="1024" height="768" />
init code
tinymce.init(
{
height : 300,
selector : '#txtImg',
plugins : 'code advlist autolink autosave link image lists charmap print preview hr anchor pagebreak spellchecker searchreplace wordcount visualblocks visualchars fullscreen insertdatetime media nonbreaking table contextmenu directionality emoticons template textcolor paste fullpage textcolor colorpicker textpattern',
toolbar : 'undo redo | link image | code',
paste_data_images : true,
image_title : true,
automatic_uploads : false,
image_advtab: true,
file_picker_types : 'file image media',
file_picker_callback: function(cb, value, meta)
{
var input = document.createElement('input');
input.setAttribute('type', 'file');
input.setAttribute('accept', 'image/*');
input.onchange = function()
{
var file = this.files[0];
var id = 'blobid' + (new Date()).getTime();
var blobCache = tinymce.activeEditor.editorUpload.blobCache;
var blobInfo = blobCache.create(id, file);
blobCache.add(blobInfo);
cb(blobInfo.blobUri(), { title: file.name });
};
input.click();
}
});
Thank for this plugin, I test it on tinymce 4.1.5, but if you are using "past" plugin, it not work.
You can see the button, open the dialog for select image, but no img tag inserted. Without "past" plugin, it work like a charm. Any idea ?
Thanks
Hello there, I downloaded this plugin for tinymce.
I found a little issue with this plugin on tinymce 4.2.3
This line doesn't work or do anything:
editor.execCommand("trueInsertRawHTML", false, "");
I found a fix replacing that line with this line:
tinymce.activeEditor.setContent("", {format: 'raw'});
And one recommendation, remove the restrictions of image and file size I don't see the point of this restrictions....
Hope this helps.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.