|
@@ -50,6 +50,16 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
success(json.data.imgUrl);
|
|
|
+ // Listen for the NodeChange event to set the alt attribute
|
|
|
+ const editor = tinymce.activeEditor;
|
|
|
+ editor.on('NodeChange', function(e) {
|
|
|
+ const imgElm = e.element;
|
|
|
+ if (imgElm.nodeName === 'IMG' && imgElm.src === json.data.imgUrl) {
|
|
|
+ console.log("Setting alt attribute to:", json.data.oldName || '全国政务信息一体化应用平台'); // Debugging: Check the alt value
|
|
|
+ editor.dom.setAttrib(imgElm, 'alt',json.data.oldName || '全国政务信息一体化应用平台'); // Use oldName or a default value
|
|
|
+ editor.off('NodeChange'); // Remove the event listener after setting the alt
|
|
|
+ }
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
formData = new FormData();
|