|
1 | 1 | /*! |
2 | 2 | * Simditor v2.3.21 |
3 | 3 | * http://simditor.tower.im/ |
4 | | -* 2018-10-17 |
| 4 | +* 2018-11-09 |
5 | 5 | */ |
6 | 6 | (function (root, factory) { |
7 | 7 | if (typeof define === 'function' && define.amd) { |
8 | 8 | // AMD. Register as an anonymous module unless amdModuleId is set |
9 | | - define('simditor', ["jquery","simple-module","simple-hotkeys","simple-uploader"], function ($, SimpleModule, simpleHotkeys, simpleUploader) { |
10 | | - return (root['Simditor'] = factory($, SimpleModule, simpleHotkeys, simpleUploader)); |
| 9 | + define('simditor', ["jquery","simple-module","simple-hotkeys","simple-uploader","dompurify"], function ($, SimpleModule, simpleHotkeys, simpleUploader, DOMPurify) { |
| 10 | + return (root['Simditor'] = factory($, SimpleModule, simpleHotkeys, simpleUploader, DOMPurify)); |
11 | 11 | }); |
12 | 12 | } else if (typeof exports === 'object') { |
13 | 13 | // Node. Does not work with strict CommonJS, but |
14 | 14 | // only CommonJS-like environments that support module.exports, |
15 | 15 | // like Node. |
16 | | - module.exports = factory(require("jquery"),require("simple-module"),require("simple-hotkeys"),require("simple-uploader")); |
| 16 | + module.exports = factory(require("jquery"),require("simple-module"),require("simple-hotkeys"),require("simple-uploader"),require("dompurify")); |
17 | 17 | } else { |
18 | | - root['Simditor'] = factory(jQuery,SimpleModule,simple.hotkeys,simple.uploader); |
| 18 | + root['Simditor'] = factory(jQuery,SimpleModule,simple.hotkeys,simple.uploader,window.DOMPurify); |
19 | 19 | } |
20 | | -}(this, function ($, SimpleModule, simpleHotkeys, simpleUploader) { |
| 20 | +}(this, function ($, SimpleModule, simpleHotkeys, simpleUploader, DOMPurify) { |
21 | 21 |
|
22 | 22 | var AlignmentButton, BlockquoteButton, BoldButton, Button, Clipboard, CodeButton, CodePopover, ColorButton, FontScaleButton, Formatter, HrButton, ImageButton, ImagePopover, IndentButton, Indentation, InputManager, ItalicButton, Keystroke, LinkButton, LinkPopover, ListButton, OrderListButton, OutdentButton, Popover, Selection, Simditor, StrikethroughButton, TableButton, TitleButton, Toolbar, UnderlineButton, UndoManager, UnorderListButton, Util, |
23 | 23 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, |
@@ -2342,7 +2342,7 @@ Clipboard = (function(superClass) { |
2342 | 2342 | return function() { |
2343 | 2343 | var pasteContent; |
2344 | 2344 | _this.editor.hidePopover(); |
2345 | | - _this.editor.body.get(0).innerHTML = state.html; |
| 2345 | + _this.editor.body.get(0).innerHTML = DOMPurify ? DOMPurify.sanitize(state.html) : state.html; |
2346 | 2346 | _this.editor.undoManager.caretPosition(state.caret); |
2347 | 2347 | _this.editor.body.focus(); |
2348 | 2348 | _this.editor.selection.reset(); |
@@ -2649,7 +2649,7 @@ Simditor = (function(superClass) { |
2649 | 2649 | Simditor.prototype.setValue = function(val) { |
2650 | 2650 | this.hidePopover(); |
2651 | 2651 | this.textarea.val(val); |
2652 | | - this.body.get(0).innerHTML = val; |
| 2652 | + this.body.get(0).innerHTML = DOMPurify ? DOMPurify.sanitize(val) : val; |
2653 | 2653 | this.formatter.format(); |
2654 | 2654 | this.formatter.decorate(); |
2655 | 2655 | this.util.reflow(this.body); |
|
0 commit comments