@makeen.io/material-ui-kit
Version:
Makeen UI components kit. Based on material-ui.
21 lines (20 loc) • 2.08 kB
JavaScript
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";import _createClass from "@babel/runtime/helpers/createClass";import _inherits from "@babel/runtime/helpers/inherits";import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";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;}}import { Quill } from "react-quill";
var Clipboard = Quill.import("modules/clipboard");
var Delta = Quill.import("delta");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: "onPaste", value: function onPaste(
e) {
e.preventDefault();
var range = this.quill.getSelection();
var text = e.clipboardData.getData("text/plain");
var delta = new Delta().
retain(range.index).
delete(range.length).
insert(text);
var index = text.length + range.index;
var length = 0;
this.quill.updateContents(delta, "silent");
this.quill.setSelection(index, length, "silent");
this.quill.scrollIntoView();
} }]);return PlainClipboard;}(Clipboard);
export default PlainClipboard;
//# sourceMappingURL=plainClipboard.js.map