UNPKG

@elliemae/ds-wysiwygeditor

Version:

Ellie Mae - Dim Sum - WYSIWYG Editor

118 lines (107 loc) 5.75 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var _extends = require('@babel/runtime/helpers/extends'); var _slicedToArray = require('@babel/runtime/helpers/slicedToArray'); var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties'); var React = require('react'); var reactDesc = require('react-desc'); var components_DSWYSIWYGEditorImpl = require('./components/DSWYSIWYGEditorImpl.js'); require('@babel/runtime/helpers/classCallCheck'); require('@babel/runtime/helpers/createClass'); require('@babel/runtime/helpers/assertThisInitialized'); require('@babel/runtime/helpers/inherits'); require('@babel/runtime/helpers/possibleConstructorReturn'); require('@babel/runtime/helpers/getPrototypeOf'); require('@babel/runtime/helpers/defineProperty'); require('react-quill'); require('quill-blot-formatter'); require('./components/ImageLibraryModal.js'); require('@elliemae/ds-imagelibrarymodal'); require('prop-types'); require('./components/InsertFieldModal.js'); require('@elliemae/ds-modal'); require('lodash'); require('@elliemae/ds-shared/constants'); require('./components/customFields.js'); require('./components/CustomToolbar.js'); require('@elliemae/ds-basic/Button'); require('@elliemae/ds-icons/ArrowheadDown'); require('@elliemae/ds-dropdownmenu'); require('@elliemae/ds-basic/Tooltip'); require('./constants.js'); require('@babel/runtime/helpers/toConsumableArray'); require('./components/colors.js'); require('./quillOverrides/IndentStyle.js'); require('@babel/runtime/helpers/get'); require('./quillOverrides/LinkFormat.js'); require('./utils.js'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends); var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray); var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties); var React__default = /*#__PURE__*/_interopDefaultLegacy(React); var DSWYSIWYGEditor = function DSWYSIWYGEditor(_ref) { var _ref$value = _ref.value, value = _ref$value === void 0 ? '' : _ref$value, _ref$onChange = _ref.onChange, onChange = _ref$onChange === void 0 ? function () { return null; } : _ref$onChange, _ref$getQuillRef = _ref.getQuillRef, getQuillRef = _ref$getQuillRef === void 0 ? function () { return null; } : _ref$getQuillRef, _ref$quillModules = _ref.quillModules, quillModules = _ref$quillModules === void 0 ? {} : _ref$quillModules, customToolbar = _ref.customToolbar, toolbarHandlers = _ref.toolbarHandlers, _ref$showRawHTML = _ref.showRawHTML, showRawHTML = _ref$showRawHTML === void 0 ? false : _ref$showRawHTML, height = _ref.height, hideItems = _ref.hideItems, rest = _objectWithoutProperties__default['default'](_ref, ["value", "onChange", "getQuillRef", "quillModules", "customToolbar", "toolbarHandlers", "showRawHTML", "height", "hideItems"]); var emptyAction = function emptyAction() {}; var _useState = React.useState(showRawHTML), _useState2 = _slicedToArray__default['default'](_useState, 2), showHTML = _useState2[0], setShowHTML = _useState2[1]; React.useEffect(function () { return setShowHTML(showRawHTML); }, [showRawHTML]); return /*#__PURE__*/React__default['default'].createElement(components_DSWYSIWYGEditorImpl, _extends__default['default']({ forceHttpLink: true, handleCustomFieldClick: emptyAction, handleImageClick: emptyAction, quillOverrides: [], value: value, onChange: onChange, getQuillRef: getQuillRef, quillModules: quillModules, customToolbar: customToolbar, toolbarHandlers: toolbarHandlers, showRawHTML: showHTML, onShowHTML: function onShowHTML() { return setShowHTML(!showHTML); }, height: height, hideItems: hideItems }, rest)); }; var wysiwygEditorProps = { value: reactDesc.PropTypes.string.description('editors value').isRequired, onChange: reactDesc.PropTypes.func.description("(content, delta, source, editor) : Called back with the new contents of the editor after change. \n It will be passed the HTML contents of the editor, a delta object expressing the change, the source of the change, and finally a read-only proxy to editor accessors such as getHTML(). \n \u26A0\uFE0F Do not use this delta object as value, as it will cause a loop. \n Use editor.getContents() instead. See Using Deltas for details. \n Read more: https://github.com/zenoamaro/react-quill#props").isRequired, getQuillRef: reactDesc.PropTypes.func.description('function to use quill.js ref'), quillModules: reactDesc.PropTypes.object.description('object to override quill modules'), customToolbar: reactDesc.PropTypes.element.description('custom toolbar'), toolbarHandlers: reactDesc.PropTypes.object.description('object with toolbar handlers'), showRawHTML: reactDesc.PropTypes.bool.description('whether to display html view or not').defaultValue(false), height: reactDesc.PropTypes.string.description('heigth of the editors text area'), readOnly: reactDesc.PropTypes.string.description("If true, the editor won't allow changing its contents. Wraps the Quill disable API."), hideItems: reactDesc.PropTypes.object.description('object of defaultItems to be removed from toolbar').defaultValue({}) }; DSWYSIWYGEditor.propTypes = wysiwygEditorProps; var WYSIWYWithSchema = reactDesc.describe(DSWYSIWYGEditor); WYSIWYWithSchema.propTypes = wysiwygEditorProps; exports.WYSIWYWithSchema = WYSIWYWithSchema; exports.default = DSWYSIWYGEditor; //# sourceMappingURL=DSWYSIWYGEditor.js.map