监控ckeditor内容变化,删除编辑器内图片,ueditor同样适用

let body = document.querySelector("iframe").contentDocument.body;
let observer = new MutationObserver((mutationsList, observer) => {
  for (let mutation of mutationsList) {
    if (mutation.removedNodes.length > 0) {
      console.log(mutation);
      console.log(mutation.removedNodes)
    }
  }
});
observer.observe(body, { subtree: true, childList: true });

以上是监控代码;
删除图片的代码没有包含在内,自己控制

posted @ 2019-09-06 07:31  liulun  阅读(1070)  评论(0编辑  收藏  举报