Tinymce图像插件在angular 10中不工作
我的项目是angular 10,我正在使用tinymce angular“^4.0.0” 我无法在Tinymce编辑器中加载图像这是我的代码 Html文件: 打字稿: 此.tinymceInit={Tinymce图像插件在angular 10中不工作,tinymce,angular10,Tinymce,Angular10,我的项目是angular 10,我正在使用tinymce angular“^4.0.0” 我无法在Tinymce编辑器中加载图像这是我的代码 Html文件: 打字稿: 此.tinymceInit={ height : "480", plugins: 'image code', toolbar: 'undo redo | link image | code', // enable title field in the Image dialog image_title: tru
height : "480",
plugins: 'image code',
toolbar: 'undo redo | link image | code',
// enable title field in the Image dialog
image_title: true,
// enable automatic uploads of images represented by blob or data URIs
automatic_uploads: true,
// add custom filepicker only to Image dialog
file_picker_types: 'image',
file_picker_callback : function(cb, value, meta) {
var input = document.createElement('input');
input.setAttribute('type', 'file');
input.setAttribute('accept', 'image/*');
// Note: In modern browsers input[type="file"] is functional without
// even adding it to the DOM, but that might not be the case in some older
// or quirky browsers like IE, so you might want to add it to the DOM
// just in case, and visually hide it. And do not forget do remove it
// once you do not need it anymore.
input.onchange = function() {
var file = input.files[0];
var reader = new FileReader();
reader.onload = function () {
// Note: Now we need to register the blob in TinyMCEs image blob
// registry. In the next release this part hopefully won't be
// necessary, as we are looking to handle it internally.
var id = 'blobid' + (new Date()).getTime();
var blobCache = tinymce.activeEditor.editorUpload.blobCache;
var base64 = reader.result.toString().split(',')[1];
var blobInfo = blobCache.create(id, file, base64);
blobCache.add(blobInfo);
// call the callback and populate the Title field with the file name
cb(blobInfo.blobUri(), { title: file.name });
};
reader.readAsDataURL(file);
};
input.click();
}
}
问题是tinymce变量未初始化。显示未定义
我在那个地方看到了这个例子,但不起作用