UNPKG

@elliemae/ds-wysiwygeditor

Version:

Ellie Mae - Dim Sum - WYSIWYG Editor

48 lines (36 loc) 2.19 kB
import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck'; import _createClass from '@babel/runtime/helpers/esm/createClass'; import _inherits from '@babel/runtime/helpers/esm/inherits'; import _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn'; import _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf'; import { Quill } from 'react-quill'; function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } var Clipboard = Quill.import('modules/clipboard'); var Delta = Quill.import('delta'); /** * Just for the sake of an example. https://quilljs.com/docs/modules/ */ var PlainClipboard = /*#__PURE__*/function (_Clipboard) { _inherits(PlainClipboard, _Clipboard); var _super = _createSuper(PlainClipboard); function PlainClipboard() { _classCallCheck(this, PlainClipboard); return _super.apply(this, arguments); } _createClass(PlainClipboard, [{ key: "convert", value: function convert() { var html = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; if (typeof html === 'string') { this.container.innerHTML = html; } var text = this.container.innerText; this.container.innerHTML = ''; return new Delta().insert(text); } }]); return PlainClipboard; }(Clipboard); // Uncomment if adding custom clipboard, or add in the file you are importing this to export default PlainClipboard; //# sourceMappingURL=PlainClipboard.js.map