Please add this rule to the editable DIV tag. I want to filter out the img tag directly when the user pastes it in. There is bug without effect, how to change it?

it"s okay to test for yourself, but there seems to be something wrong with the paste event

< div id= "edithtml" class= "contenteditable=" true "onpaste=" this.innerHTML = this.innerHTML.replace (/ < (?! img). *? > / g,"") "> < / div >

May.13,2022

you can execute


after pasting.

this code found on the Internet will only select the text

when copying.
function pasteFilter() {
      var e = window.event;
      e.preventDefault();
      var text = null;
      //
      if (window.clipboardData && clipboardData.setData) {
        // IE
        text = window.clipboardData.getData('text');
      } else {
        try {
          text = (e.originalEvent || e).clipboardData.getData('text/plain');
        } catch (e) {
          return;
        }
      };
      if (document.body.createTextRange) {
        if (document.selection) {
          textRange = document.selection.createRange();
        } else if (window.getSelection) {
          sel = window.getSelection();
          var range = sel.getRangeAt(0);
          // TextRange
          var tempEl = document.createElement("span");
          tempEl.innerHTML = "&-sharpFEFF;";
          range.deleteContents();
          range.insertNode(tempEl);
          textRange = document.body.createTextRange();
          textRange.moveToElementText(tempEl);
          tempEl.parentNode.removeChild(tempEl);
        };
        textRange.text = text;
        textRange.collapse(false);
        textRange.select();
      } else {
        // Chrome
        document.execCommand("insertText", false, text);
      };
    };
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb05d2-22cd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb05d2-22cd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?