Mercurial Hosting > sceditor
comparison src/plugins/plaintext.js @ 29:ea32a44b5a6e
remove more oo
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 11 Aug 2022 19:54:03 -0600 |
parents | b7725dab7482 |
children |
comparison
equal
deleted
inserted
replaced
28:f227fdfebded | 29:ea32a44b5a6e |
---|---|
23 * | 23 * |
24 * pastetext.enabled - If the plain text button should be enabled at start | 24 * pastetext.enabled - If the plain text button should be enabled at start |
25 * up. Only applies if addButton is enabled. | 25 * up. Only applies if addButton is enabled. |
26 */ | 26 */ |
27 sceditor.plugins.plaintext = function () { | 27 sceditor.plugins.plaintext = function () { |
28 var base = {}; | |
28 var plainTextEnabled = true; | 29 var plainTextEnabled = true; |
29 | 30 |
30 this.init = function () { | 31 base.init = function (editor) { |
31 var commands = this.commands; | 32 var commands = editor.commands; |
32 var opts = this.opts; | 33 var opts = editor.opts; |
33 | 34 |
34 if (opts && opts.plaintext && opts.plaintext.addButton) { | 35 if (opts && opts.plaintext && opts.plaintext.addButton) { |
35 plainTextEnabled = opts.plaintext.enabled; | 36 plainTextEnabled = opts.plaintext.enabled; |
36 | 37 |
37 commands.pastetext = utils.extend(commands.pastetext || {}, { | 38 commands.pastetext = utils.extend(commands.pastetext || {}, { |
43 } | 44 } |
44 }); | 45 }); |
45 } | 46 } |
46 }; | 47 }; |
47 | 48 |
48 this.signalPasteRaw = function (data) { | 49 base.signalPasteRaw = function (data) { |
49 if (plainTextEnabled) { | 50 if (plainTextEnabled) { |
50 if (data.html && !data.text) { | 51 if (data.html && !data.text) { |
51 var div = document.createElement('div'); | 52 var div = document.createElement('div'); |
52 div.innerHTML = data.html; | 53 div.innerHTML = data.html; |
53 | 54 |
72 } | 73 } |
73 | 74 |
74 data.html = null; | 75 data.html = null; |
75 } | 76 } |
76 }; | 77 }; |
78 | |
79 return base; | |
77 }; | 80 }; |
78 }(sceditor)); | 81 }(sceditor)); |