annotate src/minified/plugins/plaintext.js @ 0:4c4fc447baea

start with sceditor-3.1.1
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 04 Aug 2022 15:21:29 -0600
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4c4fc447baea start with sceditor-3.1.1
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 /* SCEditor v3.1.1 | (C) 2017, Sam Clarke | sceditor.com/license */
4c4fc447baea start with sceditor-3.1.1
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2
4c4fc447baea start with sceditor-3.1.1
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 !function(t){"use strict";var i=t.utils,l=t.dom;t.plugins.plaintext=function(){var n=!0;this.init=function(){var t=this.commands,e=this.opts;e&&e.plaintext&&e.plaintext.addButton&&(n=e.plaintext.enabled,t.pastetext=i.extend(t.pastetext||{},{state:function(){return n?1:0},exec:function(){n=!n}}))},this.signalPasteRaw=function(t){var e;n&&(t.html&&!t.text&&((e=document.createElement("div")).innerHTML=t.html,i.each(e.querySelectorAll("p"),function(t,e){l.convertElement(e,"div")}),i.each(e.querySelectorAll("br"),function(t,e){e.nextSibling&&l.isInline(e.nextSibling,!0)||e.parentNode.removeChild(e)}),document.body.appendChild(e),t.text=e.innerText,document.body.removeChild(e)),t.html=null)}}}(sceditor);