EasyUI Forum
March 28, 2024, 03:35:31 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: TextEditor - Remove html code on paste.  (Read 2675 times)
joe
Newbie
*
Posts: 33


View Profile Email
« on: April 20, 2018, 09:31:30 PM »

I am using the texteditor extension.  Is it possible to remove all html/rich text on a paste?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #1 on: April 23, 2018, 01:45:16 AM »

Disable the 'paste' event and retrieve the text from the clipboard, call the 'insertContent' method to insert the plain text into the texteditor component.
Code:
$('#te').bind('paste', function(e){
var text = e.originalEvent.clipboardData.getData('text');
$(this).texteditor('insertContent', '<span>'+text+'</span>');
return false;
});
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!