From a0fd024b61b2cdebff7cb1b8513decedc60b9d3b Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Sat, 8 Aug 2020 21:58:50 +0300 Subject: [PATCH] disable certain tools in notes --- wax-prosemirror-components/dist/index.js | 1312 ++++ wax-prosemirror-components/dist/index.js.map | 1 + .../src/components/ImageUpload.js | 37 +- wax-prosemirror-core/dist/index.js | 795 +++ wax-prosemirror-core/dist/index.js.map | 1 + wax-prosemirror-layouts/dist/index.js | 239 + wax-prosemirror-layouts/dist/index.js.map | 1 + wax-prosemirror-plugins/dist/index.js | 419 ++ wax-prosemirror-plugins/dist/index.js.map | 1 + wax-prosemirror-schema/dist/index.js | 1506 ++++ wax-prosemirror-schema/dist/index.js.map | 1 + wax-prosemirror-services/dist/index.js | 6142 +++++++++++++++++ wax-prosemirror-services/dist/index.js.map | 1 + .../src/CodeBlockService/CodeBlockTool.js | 5 + .../DisplayBlockLevel/AuthorService/Author.js | 5 + .../EpigraphPoetryService/EpigraphPoetry.js | 5 + .../EpigraphProseService/EpigraphProse.js | 5 + .../HeadingService/Heading1.js | 5 + .../HeadingService/Heading2.js | 5 + .../HeadingService/Heading3.js | 5 + .../SubTitleService/SubTitle.js | 17 +- .../DisplayBlockLevel/TitleService/Title.js | 17 +- .../src/ImageService/Image.js | 12 +- .../BulletListService/BulletList.js | 17 +- .../OrderedListService/OrderedList.js | 17 +- .../src/NoteService/Note.js | 22 +- .../TablesService/InsertTableService/Table.js | 5 + .../BlockQuoteService/BlockQuote.js | 15 +- .../ExtractPoetryService/ExtractPoetry.js | 19 +- .../ExtractProseService/ExtractProse.js | 19 +- .../ParagraphContinued.js | 19 +- .../ParagraphService/Paragraph.js | 17 +- .../SourceNoteService/SourceNote.js | 17 +- wax-prosemirror-themes/dist/index.js | 99 + wax-prosemirror-themes/dist/index.js.map | 1 + wax-prosemirror-utilities/dist/index.js | 404 ++ wax-prosemirror-utilities/dist/index.js.map | 1 + 37 files changed, 11121 insertions(+), 88 deletions(-) create mode 100644 wax-prosemirror-components/dist/index.js create mode 100644 wax-prosemirror-components/dist/index.js.map create mode 100644 wax-prosemirror-core/dist/index.js create mode 100644 wax-prosemirror-core/dist/index.js.map create mode 100644 wax-prosemirror-layouts/dist/index.js create mode 100644 wax-prosemirror-layouts/dist/index.js.map create mode 100644 wax-prosemirror-plugins/dist/index.js create mode 100644 wax-prosemirror-plugins/dist/index.js.map create mode 100644 wax-prosemirror-schema/dist/index.js create mode 100644 wax-prosemirror-schema/dist/index.js.map create mode 100644 wax-prosemirror-services/dist/index.js create mode 100644 wax-prosemirror-services/dist/index.js.map create mode 100644 wax-prosemirror-themes/dist/index.js create mode 100644 wax-prosemirror-themes/dist/index.js.map create mode 100644 wax-prosemirror-utilities/dist/index.js create mode 100644 wax-prosemirror-utilities/dist/index.js.map diff --git a/wax-prosemirror-components/dist/index.js b/wax-prosemirror-components/dist/index.js new file mode 100644 index 000000000..5f48fec81 --- /dev/null +++ b/wax-prosemirror-components/dist/index.js @@ -0,0 +1,1312 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var React = require('react'); +var React__default = _interopDefault(React); +var styled = _interopDefault(require('styled-components')); +var waxProsemirrorThemes = require('wax-prosemirror-themes'); +var waxProsemirrorCore = require('wax-prosemirror-core'); +var FontAwesomeIcon = _interopDefault(require('@fortawesome/react-fontawesome')); +var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons'); +var tablesFn = require('prosemirror-tables'); +var Dropdown = _interopDefault(require('react-dropdown')); +require('react-dropdown/style.css'); +var lodash = require('lodash'); +var waxProsemirrorUtilities = require('wax-prosemirror-utilities'); +var prosemirrorModel = require('prosemirror-model'); +var useDeepCompareEffect = _interopDefault(require('use-deep-compare-effect')); +var prosemirrorState = require('prosemirror-state'); +var reactTransitionGroup = require('react-transition-group'); +var uuid = require('uuid'); + +function _taggedTemplateLiteral(strings, raw) { + if (!raw) { + raw = strings.slice(0); + } + + return Object.freeze(Object.defineProperties(strings, { + raw: { + value: Object.freeze(raw) + } + })); +} + +function _templateObject() { + var data = _taggedTemplateLiteral(["\n ", ";\n"]); + + _templateObject = function _templateObject() { + return data; + }; + + return data; +} +var InfoAreaContainer = styled.div(_templateObject(), "" +/* height: ${props => (props.height ? props.height : "30px")}; +position: fixed; +bottom: 0; +z-index: 9999; +background: #efefef; +width: 100%;*/ +); + +var InfoArea = function InfoArea() { + return /*#__PURE__*/React__default.createElement(InfoAreaContainer, null); +}; + +function _templateObject$1() { + var data = _taggedTemplateLiteral(["\n position: ", ";\n left: ", ";\n top: ", ";\n z-index: 999;\n"]); + + _templateObject$1 = function _templateObject() { + return data; + }; + + return data; +} +var OverlayContainer = styled.div(_templateObject$1(), function (props) { + return props.position.position; +}, function (props) { + return "".concat(props.position.left, "px"); +}, function (props) { + return "".concat(props.position.top, "px"); +}); + +var Overlay = function Overlay(props) { + return /*#__PURE__*/React__default.createElement(OverlayContainer, props, props.children); +}; + +function _templateObject$2() { + var data = _taggedTemplateLiteral(["\n ", ";\n opacity: ", ";\n pointer-events: ", ";\n color: ", ";\n background-color: ", ";\n &:hover {\n background-color: ", ";\n }\n"]); + + _templateObject$2 = function _templateObject() { + return data; + }; + + return data; +} +var ButtonStyled = styled.button(_templateObject$2(), waxProsemirrorThemes.ButtonStyles, function (props) { + return props.select ? 1 : 0.4; +}, function (props) { + return props.select ? 'default' : 'none'; +}, function (props) { + return props.isActive ? 'white' : props.theme.colorButton; +}, function (props) { + return props.isActive ? props.theme.colorPrimary : 'transparent'; +}, function (props) { + return props.isActive ? props.theme.colorPrimary : 'transparent'; +}); + +var Button = function Button(_ref) { + var _ref$view = _ref.view, + view = _ref$view === void 0 ? {} : _ref$view, + item = _ref.item; + + var _useContext = React.useContext(waxProsemirrorCore.WaxContext), + main = _useContext.view.main, + activeViewId = _useContext.activeViewId; + + if (item.onlyOnMain) { + view = main; + } + + return /*#__PURE__*/React__default.createElement(ButtonStyled, { + type: "button", + isActive: item.active && item.active(view.state), + title: item.title, + disabled: item.enable && !item.enable(view.state), + onMouseDown: function onMouseDown(e) { + e.preventDefault(); + item.run(view.state, view.dispatch); + }, + select: item.select && item.select(view.state, activeViewId) + }, item.content); +}; + +var icons = { + em: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faItalic + }), + italic: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faItalic + }), + strong: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faBold + }), + bold: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faBold + }), + code: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faCode + }), + subscript: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faSubscript + }), + superscript: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faSuperscript + }), + underline: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faUnderline + }), + strikethrough: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faStrikethrough + }), + link: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faLink + }), + paragraph: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faParagraph + }), + heading: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faHeading + }), + blockquote: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faQuoteLeft + }), + code_block: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faFileCode + }), + ordered_list: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faListOl + }), + bullet_list: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faListUl + }), + image: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faImage + }), + table: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faTable + }), + footnote: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faStickyNote + }), + undo: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faUndo + }), + redo: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faRedo + }), + lift: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faOutdent + }), + join_up: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faAngleUp + }), + source: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faVial + }), + ellipses: /*#__PURE__*/React__default.createElement(FontAwesomeIcon, { + icon: freeSolidSvgIcons.faEllipsisH + }), + small_caps: /*#__PURE__*/React__default.createElement("span", { + className: "small-caps" + }, /*#__PURE__*/React__default.createElement("svg", { + width: "35", + height: "20", + viewBox: "0 0 35 20", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, /*#__PURE__*/React__default.createElement("path", { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M9.21799 1.12207L9.34998 0H0V1.12207H4.004V15.0701H5.258V1.12207H9.21799ZM14.14 6.34912L14.242 5.51611H7.935V6.34912H10.587V15.0701H11.539V6.34912H14.14Z", + transform: "translate(10.286 8.92993)", + fill: "#4F4F4F" + }))) +}; + +function _templateObject$3() { + var data = _taggedTemplateLiteral(["\n display: inline-flex;\n cursor: not-allowed;\n opacity: ", ";\n pointer-events: ", ";\n .Dropdown-control {\n border: none;\n }\n .Dropdown-arrow {\n right: 25px;\n top: 21px;\n }\n .Dropdown-menu {\n width: 120%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n .Dropdown-option {\n width: 100%;\n }\n }\n"]); + + _templateObject$3 = function _templateObject() { + return data; + }; + + return data; +} +var DropdownStyled = styled(Dropdown)(_templateObject$3(), function (props) { + return props.select ? 1 : 0.4; +}, function (props) { + return props.select ? 'default' : 'none'; +}); +var dropDownOptions = [{ + label: 'add column before', + value: 'addColumnBefore' +}, { + label: 'add column after', + value: 'addColumnAfter' +}, { + label: 'Delete column', + value: 'deleteColumn' +}, { + label: 'Insert row before', + value: 'addRowBefore' +}, { + label: 'Insert row after', + value: 'addRowAfter' +}, { + label: 'Delete row', + value: 'deleteRow' +}, { + label: 'Delete table', + value: 'deleteTable' +}, { + label: 'Merge cells', + value: 'mergeCells' +}, { + label: 'Split cell', + value: 'splitCell' +}, { + label: 'Toggle header column', + value: 'toggleHeaderColumn' +}, { + label: 'Toggle header row', + value: 'toggleHeaderRow' +}, { + label: 'Toggle header cells', + value: 'toggleHeaderCell' +}]; + +var TableDropDown = function TableDropDown(_ref) { + var _ref$view = _ref.view, + dispatch = _ref$view.dispatch, + state = _ref$view.state, + item = _ref.item; + return /*#__PURE__*/React__default.createElement(DropdownStyled, { + options: dropDownOptions, + onChange: function onChange(option) { + tablesFn[option.value](state, dispatch); + }, + placeholder: "Table Options", + select: item.select && item.select(state) + }); +}; + +function _templateObject$4() { + var data = _taggedTemplateLiteral(["\n opacity: ", ";\n pointer-events: ", ";\n color: #777;\n display: inline-flex;\n padding: 0px 10px;\n .custom-file-upload {\n cursor: pointer;\n }\n &:hover {\n }\n input {\n display: none;\n }\n"]); + + _templateObject$4 = function _templateObject() { + return data; + }; + + return data; +} +var UploadImage = styled.div(_templateObject$4(), function (props) { + return props.select ? 1 : 0.4; +}, function (props) { + return props.select ? 'default' : 'none'; +}); + +var ImageUpload = function ImageUpload(_ref) { + var item = _ref.item, + fileUpload = _ref.fileUpload, + view = _ref.view; + + var _useContext = React.useContext(waxProsemirrorCore.WaxContext), + activeViewId = _useContext.activeViewId; + + return /*#__PURE__*/React__default.createElement(UploadImage, { + select: item.select && item.select(view.state, activeViewId) + }, /*#__PURE__*/React__default.createElement("label", { + className: "custom-file-upload", + title: "upload image", + htmlFor: "file-upload" + }, item.content, /*#__PURE__*/React__default.createElement("input", { + id: "file-upload", + onChange: function onChange(e) { + return fileUpload(e.target.files[0]); + }, + type: "file" + }))); +}; + +function _templateObject$5() { + var data = _taggedTemplateLiteral(["\n border-bottom: 1px solid #d9d9d9;\n color: #979797;\n font-family: 'Fira Sans';\n font-size: 15px;\n font-weight: bold;\n letter-spacing: 0.6px;\n list-style: none;\n line-height: 0;\n margin: 5px 0;\n display: block;\n padding: 20px 0 10px;\n margin-left: 10px;\n text-align: left;\n text-transform: uppercase;\n width: 51%;\n"]); + + _templateObject$5 = function _templateObject() { + return data; + }; + + return data; +} +var LeftMenuStyled = styled.div(_templateObject$5()); + +var LeftMenuTitle = function LeftMenuTitle(_ref) { + var title = _ref.title; + return /*#__PURE__*/React__default.createElement(LeftMenuStyled, null, title); +}; + +function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; +} + +function _iterableToArrayLimit(arr, i) { + if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; +} + +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + + return arr2; +} + +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(n); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} + +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} + +function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); +} + +function _templateObject3() { + var data = _taggedTemplateLiteral(["\n display: flex;\n width: 0;\n top: 40px;\n position: relative;\n right: 100%;\n"]); + + _templateObject3 = function _templateObject3() { + return data; + }; + + return data; +} + +function _templateObject2() { + var data = _taggedTemplateLiteral(["\n background: none;\n border: none;\n cursor: pointer;\n &:active {\n outline: none;\n }\n"]); + + _templateObject2 = function _templateObject2() { + return data; + }; + + return data; +} + +function _templateObject$6() { + var data = _taggedTemplateLiteral(["\n border-right: 1px solid #ecedf1;\n &:last-child {\n border-right: none;\n }\n"]); + + _templateObject$6 = function _templateObject() { + return data; + }; + + return data; +} +var ToolGroupStyled = styled.div(_templateObject$6()); +var MoreButton = styled.button(_templateObject2()); +var InnerStyled = styled.div(_templateObject3()); + +var ToolGroupComponent = function ToolGroupComponent(_ref) { + var view = _ref.view, + tools = _ref.tools, + name = _ref.name, + title = _ref.title; + + var _useState = React.useState(false), + _useState2 = _slicedToArray(_useState, 2), + more = _useState2[0], + showHide = _useState2[1], + toolsShown = [], + rest = [], + DisplayTitle = lodash.isFunction(title) ? title : function () { + return title; + }; + + tools.forEach(function (tool) { + tool.isIntoMoreSection() && tool.isDisplayed() ? rest.push(tool.renderTool(view)) : toolsShown.push(tool.renderTool(view)); + }); + return /*#__PURE__*/React__default.createElement(ToolGroupStyled, { + "data-name": name + }, /*#__PURE__*/React__default.createElement(DisplayTitle, null), toolsShown, rest.length && !more ? /*#__PURE__*/React__default.createElement(MoreButton, { + title: "show more tools", + onClick: function onClick() { + return showHide(!more); + } + }, icons.ellipses) : null, more && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(MoreButton, { + title: "hide", + onClick: function onClick() { + return showHide(!more); + } + }, icons.ellipses), /*#__PURE__*/React__default.createElement(InnerStyled, null, rest))); +}; + +function _templateObject$7() { + var data = _taggedTemplateLiteral(["\n display: flex;\n margin-top: 10px;\n width: 2%;\n &:after {\n content: counter(footnote-view);\n vertical-align: super;\n font-size: 75%;\n counter-increment: footnote-view;\n cursor: pointer;\n }\n"]); + + _templateObject$7 = function _templateObject() { + return data; + }; + + return data; +} +var NoteNumberStyled = styled.div(_templateObject$7()); + +var onClick = function onClick() {}; + +var NoteNumber = function NoteNumber(_ref) { + var number = _ref.number; + return /*#__PURE__*/React__default.createElement(NoteNumberStyled, { + onClick: onClick + }); +}; + +function _templateObject2$1() { + var data = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n width: 100%;\n min-height: 20px;\n margin-top: 10px;\n height: 100%;\n border-bottom: 1px solid black;\n &:focus {\n outline: none;\n }\n\n p {\n margin: 0;\n }\n\n span.comment {\n border-bottom: 2px solid #ffab20;\n border-radius: 3px 3px 0 0;\n\n .active-comment {\n background-color: #ffab20;\n }\n }\n\n span.deletion {\n text-decoration: line-through;\n color: red;\n }\n\n span.insertion {\n color: blue;\n }\n\n .selected-insertion,\n .selected-deletion,\n .selected-format-change,\n .selected-block-change {\n background-color: #fffacf;\n }\n\n .format-change {\n border-bottom: 2px solid blue;\n }\n"]); + + _templateObject2$1 = function _templateObject2() { + return data; + }; + + return data; +} + +function _templateObject$8() { + var data = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n min-height: 28px;\n width: 100%;\n position: relative;\n margin-bottom: 5px;\n"]); + + _templateObject$8 = function _templateObject() { + return data; + }; + + return data; +} +var NoteEditorContainerStyled = styled.div(_templateObject$8()); +var NoteStyled = styled.div(_templateObject2$1()); +var NoteEditorContainer = React__default.forwardRef(function (props, ref) { + return /*#__PURE__*/React__default.createElement(NoteEditorContainerStyled, null, /*#__PURE__*/React__default.createElement(NoteNumber, null), " ", /*#__PURE__*/React__default.createElement(NoteStyled, Object.assign({ + ref: ref + }, props))); +}); + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); + } + + return keys; +} + +function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + + if (i % 2) { + ownKeys(Object(source), true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + } + + return target; +} + +function _templateObject2$2() { + var data = _taggedTemplateLiteral(["\n cursor: pointer;\n"]); + + _templateObject2$2 = function _templateObject2() { + return data; + }; + + return data; +} + +function _templateObject$9() { + var data = _taggedTemplateLiteral(["\n padding: 20px;\n border-radius: 3px;\n border: 1px solid #000;\n background: #ecedf1;\n z-index: 9999;\n -webkit-box-shadow: 0px 0px 0px 2px rgba(0, 0, 0, 0.75);\n -moz-box-shadow: 0px 0px 0px 2px rgba(0, 0, 0, 0.75);\n box-shadow: 0px 0px 0px 2px rgba(0, 0, 0, 0.75);\n"]); + + _templateObject$9 = function _templateObject() { + return data; + }; + + return data; +} +var LinkWrapper = styled.div(_templateObject$9()); +var Button$1 = styled.button(_templateObject2$2()); + +var LinkComponent = function LinkComponent(_ref) { + var mark = _ref.mark, + setPosition = _ref.setPosition, + position = _ref.position; + var href = mark ? mark.attrs.href : null; + var linkMark = mark ? mark : null; + + var _useContext = React.useContext(waxProsemirrorCore.WaxContext), + activeView = _useContext.activeView; + + var state = activeView.state, + dispatch = activeView.dispatch; + var ref = React.useRef(null); + var linkInput = React.useRef(null); + + var _useState = React.useState('Create'), + _useState2 = _slicedToArray(_useState, 2), + addButtonText = _useState2[0], + setButtonText = _useState2[1]; + + var _useState3 = React.useState(linkMark), + _useState4 = _slicedToArray(_useState3, 2), + lastLinkMark = _useState4[0], + setLLastLinkMark = _useState4[1]; + + var _useState5 = React.useState(href), + _useState6 = _slicedToArray(_useState5, 2), + linkHref = _useState6[0], + setLinkHref = _useState6[1]; + + React.useEffect(function () { + setLinkText(); + removeMarkIfEmptyHref(); + }, [ref.current, href]); + + var addLinkHref = function addLinkHref() { + var href = linkHref; + var linkMark = state.schema.marks.link; + var tr = state.tr; + dispatch(tr.addMark(mark.from, mark.to, linkMark.create(_objectSpread2({}, mark && mark.attrs || {}, { + href: href + })))); + activeView.focus(); + }; + + var removeLink = function removeLink() { + dispatch(state.tr.removeMark(mark.from, mark.to, state.schema.marks.link)); + activeView.focus(); + }; + + var handleKeyDown = function handleKeyDown(event) { + if (event.key === 'Enter' || event.which === 13) { + addLinkHref(); + } + }; + + var updateLinkHref = function updateLinkHref() { + var value = linkInput.current.value; + setLinkHref(value); + }; + + var setLinkText = function setLinkText() { + if (mark && mark.attrs.href !== '') { + setButtonText('Update'); + setLinkHref(mark.attrs.href); + } else { + setButtonText('Create'); + setLinkHref(''); + if (linkInput.current) linkInput.current.focus(); + } + }; + + var removeMarkIfEmptyHref = function removeMarkIfEmptyHref() { + var _state$selection = state.selection, + $from = _state$selection.$from, + $to = _state$selection.$to; + var PMLinkMark = state.schema.marks.link; + var actualMark = waxProsemirrorUtilities.DocumentHelpers.getSelectionMark(state, PMLinkMark); + setLLastLinkMark(actualMark); + + if (lastLinkMark.attrs.href === '' && ($from.pos < lastLinkMark.from || $to.pos > lastLinkMark.to)) { + dispatch(state.tr.setMeta('addToHistory', false).removeMark(lastLinkMark.from, lastLinkMark.to, state.schema.marks.link)); + } + }; + + return mark ? /*#__PURE__*/React__default.createElement(LinkWrapper, { + ref: ref + }, /*#__PURE__*/React__default.createElement("input", { + type: "text", + ref: linkInput, + onChange: updateLinkHref, + onKeyPress: handleKeyDown, + value: linkHref + }), /*#__PURE__*/React__default.createElement(Button$1, { + primary: true, + onClick: addLinkHref + }, addButtonText), /*#__PURE__*/React__default.createElement(Button$1, { + onClick: removeLink + }, "Remove")) : null; +}; + +var CommentBubbleComponent = function CommentBubbleComponent(_ref) { + var setPosition = _ref.setPosition, + position = _ref.position, + showComment = _ref.showComment, + group = _ref.group; + + var _useContext = React.useContext(waxProsemirrorCore.WaxContext), + activeView = _useContext.activeView, + activeViewId = _useContext.activeViewId; + + var state = activeView.state, + dispatch = activeView.dispatch; + React.useLayoutEffect(function () { + var WaxSurface = activeView.dom.getBoundingClientRect(); + var selection = activeView.state.selection; + var from = selection.from, + to = selection.to; + var start = activeView.coordsAtPos(from); + var end = activeView.coordsAtPos(to); + var difference = end.top - start.top; + var left = WaxSurface.width + WaxSurface.x; + var top = end.top - difference / 2 - 5; + setPosition(_objectSpread2({}, position, { + left: left, + top: top + })); + }, [position.left]); + + var createComment = function createComment(event) { + event.preventDefault(); + waxProsemirrorUtilities.Commands.createComment(state, dispatch, group, activeViewId); + activeView.focus(); + }; + + var isSelectionComment = function isSelectionComment() { + var commentMark = activeView.state.schema.marks.comment; + var mark = waxProsemirrorUtilities.DocumentHelpers.findMark(state, commentMark, true); // TODO Overlapping comments . for now don't allow + + if (mark.length >= 1) return true; + return false; + }; + + return !isSelectionComment() && showComment(activeViewId) && /*#__PURE__*/React__default.createElement("button", { + type: "button", + onMouseDown: function onMouseDown(event) { + createComment(event); + } + }, "create"); +}; + +function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); +} + +function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); +} + +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} + +function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); +} + +function _templateObject$a() { + var data = _taggedTemplateLiteral(["\n padding: 4px;\n border-bottom: 1px solid #ffab20;\n cursor: pointer;\n"]); + + _templateObject$a = function _templateObject() { + return data; + }; + + return data; +} +var SinlgeCommentRow = styled.div(_templateObject$a()); +var Comment = (function (_ref) { + var comment = _ref.comment, + activeView = _ref.activeView, + user = _ref.user, + active = _ref.active; + var commentInput = React.useRef(null); + + var _useState = React.useState(comment), + _useState2 = _slicedToArray(_useState, 2), + commentAnnotation = _useState2[0], + setCommentAnnotation = _useState2[1]; + + var _useState3 = React.useState(''), + _useState4 = _slicedToArray(_useState3, 2), + commentInputValue = _useState4[0], + setcommentInputValue = _useState4[1]; + + var state = activeView.state, + dispatch = activeView.dispatch; + var allCommentsWithSameId = waxProsemirrorUtilities.DocumentHelpers.findAllMarksWithSameId(state, comment); + var conversation = comment.attrs.conversation; + var commentMark = state.schema.marks.comment; + React.useEffect(function () { + setTimeout(function () { + if (commentInput.current !== null && conversation.length === 0) commentInput.current.focus(); + }, 500); + }, [active]); + + var handleKeyDown = function handleKeyDown(event) { + if (event.key === 'Enter' || event.which === 13) { + saveComment(event); + } + }; + + var saveComment = function saveComment(event) { + event.stopPropagation(); + var value = commentInput.current.value; + var tr = state.tr, + doc = state.doc; + var obj = { + content: value, + displayName: user.username, + timestamp: Math.floor(Date.now() / 300000) + }; + commentAnnotation.attrs.conversation.push(obj); + allCommentsWithSameId.forEach(function (singleComment) { + dispatch(tr.addMark(singleComment.pos, singleComment.pos + singleComment.nodeSize, commentMark.create(_objectSpread2({}, commentAnnotation && commentAnnotation.attrs || {}, { + conversation: commentAnnotation.attrs.conversation + })))); + }); + setcommentInputValue(''); + }; + + var updateCommentInputValue = function updateCommentInputValue() { + var value = commentInput.current.value; + setcommentInputValue(value); + }; + + var onBlur = function onBlur() { + var value = commentInput.current.value; + + if (conversation.length === 0 && value === '') { + resolveComment(); + } + }; + + var resolveComment = function resolveComment(event) { + if (event) event.stopPropagation(); + var maxPos = comment.pos; + var minPos = comment.pos; + allCommentsWithSameId.forEach(function (singleComment) { + var markPosition = waxProsemirrorUtilities.DocumentHelpers.findMarkPosition(activeView, singleComment.pos, 'comment'); + if (markPosition.from < minPos) minPos = markPosition.from; + if (markPosition.to > maxPos) maxPos = markPosition.to; + }); + if (allCommentsWithSameId.length > 1) maxPos += lodash.last(allCommentsWithSameId).node.nodeSize; + dispatch(state.tr.removeMark(minPos, maxPos, commentMark)); + activeView.focus(); + }; + + var commentInputReply = function commentInputReply() { + return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("input", { + type: "text", + ref: commentInput, + placeholder: "add a new comment", + onChange: updateCommentInputValue, + onKeyPress: handleKeyDown, + onBlur: onBlur, + onClick: function onClick(event) { + event.stopPropagation(); + }, + value: commentInputValue, + disabled: !active + }), /*#__PURE__*/React__default.createElement("button", { + disabled: !active, + type: "button", + onClick: function onClick(event) { + return saveComment(event); + } + }, "Post"), /*#__PURE__*/React__default.createElement("button", { + disabled: !active, + type: "button", + onClick: function onClick(event) { + return resolveComment(event); + } + }, "Resolve")); + }; + + return conversation.length === 0 ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, commentInputReply()) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, conversation.map(function (singleComment, index) { + return /*#__PURE__*/React__default.createElement(SinlgeCommentRow, { + key: uuid.v4() + }, "".concat(singleComment.displayName, " : ").concat(singleComment.content)); + }), commentInputReply()); +}); + +function _templateObject$b() { + var data = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n border: 1px solid #ffab20;\n position: absolute;\n transition: ", ";\n top: ", ";\n left: ", ";\n opacity: ", ";\n"]); + + _templateObject$b = function _templateObject() { + return data; + }; + + return data; +} +var CommentBoxStyled = styled.div(_templateObject$b(), function (_ref) { + var state = _ref.state; + return 'top 1s, opacity 1.5s, left 1s'; +}, function (props) { + return props.top ? "".concat(props.top, "px") : 0; +}, function (props) { + return props.active ? "".concat(63, "%") : "".concat(65, "%"); +}, function (_ref2) { + var state = _ref2.state; + + switch (state) { + case 'exited': + return 0.2; + + case 'exiting': + return 0.4; + + case 'entering': + return 0.6; + + case 'entered': + return 1; + } +}); +var CommentBox = (function (_ref3) { + var comment = _ref3.comment, + top = _ref3.top, + dataBox = _ref3.dataBox; + console.log('rerender'); + + var _useState = React.useState(false), + _useState2 = _slicedToArray(_useState, 2), + animate = _useState2[0], + setAnimate = _useState2[1]; + + var id = comment.attrs.id; + React.useEffect(function () { + setAnimate(true); + }, []); + var MemorizedComponent = React.memo(function () { + var _useContext = React.useContext(waxProsemirrorCore.WaxContext), + view = _useContext.view, + user = _useContext.view.main.props.user, + app = _useContext.app, + activeView = _useContext.activeView; + + var active = false; + var commentPlugin = app.PmPlugins.get('commentPlugin'); + var activeComment = commentPlugin.getState(activeView.state).comment; + if (activeComment && id === activeComment.attrs.id) active = true; + + var setCommentActive = function setCommentActive() { + var viewId = comment.attrs.viewid; + + if (active) { + view[viewId].focus(); + return false; + } + + var allCommentsWithSameId = waxProsemirrorUtilities.DocumentHelpers.findAllMarksWithSameId(view[viewId].state, comment); + var maxPos = lodash.maxBy(allCommentsWithSameId, 'pos'); + maxPos.pos += lodash.last(allCommentsWithSameId).node.nodeSize; + view[viewId].dispatch(view[viewId].state.tr.setSelection(new prosemirrorState.TextSelection(view[viewId].state.tr.doc.resolve(maxPos.pos, maxPos.pos)))); + view[viewId].focus(); + }; + + return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(reactTransitionGroup.Transition, { + "in": animate, + timeout: 1000 + }, function (state) { + return /*#__PURE__*/React__default.createElement(CommentBoxStyled, { + top: top, + state: state, + "data-box": dataBox, + active: active, + onClick: setCommentActive + }, /*#__PURE__*/React__default.createElement(Comment, { + comment: comment, + active: active, + activeView: activeView, + user: user + })); + })); + }); + return /*#__PURE__*/React__default.createElement(MemorizedComponent, null); +}); + +function _templateObject$c() { + var data = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n border: 1px solid blue;\n position: absolute;\n transition: ", ";\n top: ", ";\n left: ", ";\n opacity: ", ";\n"]); + + _templateObject$c = function _templateObject() { + return data; + }; + + return data; +} +var TrackChangeBoxStyled = styled.div(_templateObject$c(), function (_ref) { + var state = _ref.state; + return "top 1s, opacity 1.5s, left 1s"; +}, function (props) { + return props.top ? "".concat(props.top, "px") : 0; +}, function (props) { + return props.active ? "".concat(63, "%") : "".concat(65, "%"); +}, function (_ref2) { + var state = _ref2.state; + + switch (state) { + case "exited": + return 0.2; + + case "exiting": + return 0.4; + + case "entering": + return 0.6; + + case "entered": + return 1; + } +}); +var TrackChangeBox = (function (_ref3) { + var trackChange = _ref3.trackChange, + view = _ref3.view, + top = _ref3.top, + dataBox = _ref3.dataBox; + + var _useState = React.useState(false), + _useState2 = _slicedToArray(_useState, 2), + animate = _useState2[0], + setAnimate = _useState2[1]; + + var _useContext = React.useContext(waxProsemirrorCore.WaxContext), + main = _useContext.view.main, + app = _useContext.app, + activeView = _useContext.activeView; + + var action; + + if (trackChange instanceof prosemirrorModel.Mark) { + if (trackChange.type.name = "format_change") { + var _trackChange$attrs = trackChange.attrs, + username = _trackChange$attrs.username, + before = _trackChange$attrs.before, + after = _trackChange$attrs.after; + action = "User ".concat(username, " added ").concat(after[0]); + } + } else { + action = "User demo changed paragraph to heading 1"; + } + + var active = false; + React.useEffect(function () { + setAnimate(true); + }, []); + return /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(reactTransitionGroup.Transition, { + "in": animate, + timeout: 1000 + }, function (state) { + return /*#__PURE__*/React__default.createElement(TrackChangeBoxStyled, { + top: top, + state: state, + "data-box": dataBox, + active: active + }, /*#__PURE__*/React__default.createElement("div", null, action, /*#__PURE__*/React__default.createElement("button", null, "Accept"), /*#__PURE__*/React__default.createElement("button", null, "Reject"))); + })); +}); + +/* eslint react/prop-types: 0 */ +var BoxList = (function (_ref) { + var commentsTracks = _ref.commentsTracks, + view = _ref.view, + position = _ref.position; + if (!position) return null; + return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, commentsTracks.map(function (commentTrack, index) { + var id = commentTrack instanceof prosemirrorModel.Mark ? commentTrack.attrs.id : commentTrack.node.attrs.id; + var top = position[index] ? position[index][id] : 0; + + if (commentTrack.type && commentTrack.type.name === 'comment') { + return /*#__PURE__*/React__default.createElement(CommentBox, { + key: id, + comment: commentTrack, + top: top, + dataBox: id + }); + } + + return /*#__PURE__*/React__default.createElement(TrackChangeBox, { + key: id, + trackChange: commentTrack, + view: view, + top: top, + dataBox: id + }); + })); +}); + +var RightArea = (function (_ref) { + var area = _ref.area; + + var _useContext = React.useContext(waxProsemirrorCore.WaxContext), + view = _useContext.view, + main = _useContext.view.main, + app = _useContext.app, + activeView = _useContext.activeView; + + var commentPlugin = app.PmPlugins.get('commentPlugin'); + + var _useState = React.useState([]), + _useState2 = _slicedToArray(_useState, 2), + marksNodes = _useState2[0], + setMarksNodes = _useState2[1]; + + var _useState3 = React.useState(), + _useState4 = _slicedToArray(_useState3, 2), + position = _useState4[0], + setPosition = _useState4[1]; + + var _useState5 = React.useState(true), + _useState6 = _slicedToArray(_useState5, 2), + isFirstRun = _useState6[0], + setFirstRun = _useState6[1]; + + var setTops = React.useCallback(function () { + var result = []; + var markNodeEl = null; + var annotationTop = 0; + var boxHeight = 0; + var top = 0; + var allCommentsTop = []; + var nodesMarksToIterrate = marksNodes[area] === 'main' ? lodash.sortBy(marksNodes[area], ['pos']) : marksNodes[area]; + lodash.each(nodesMarksToIterrate, function (markNode, pos) { + var WaxSurface = main.dom.getBoundingClientRect(); + var id = markNode instanceof prosemirrorModel.Mark ? markNode.attrs.id : markNode.node.attrs.id; + var activeComment = commentPlugin.getState(activeView.state).comment; + var isActive = false; + if (activeComment && id === activeComment.attrs.id) isActive = true; // annotation top + + if (area === 'main') { + markNodeEl = document.querySelector("[data-id=\"".concat(id, "\"]")); + if (markNodeEl) annotationTop = markNodeEl.getBoundingClientRect().top - WaxSurface.top; + } else { + var panelWrapper = document.getElementsByClassName('panelWrapper'); + var panelWrapperHeight = panelWrapper[0].getBoundingClientRect().height; + markNodeEl = document.querySelector('#notes-container').querySelector("[data-id=\"".concat(id, "\"]")); + if (markNodeEl) annotationTop = markNodeEl.getBoundingClientRect().top - panelWrapperHeight - 50; + } // get height of this markNode box + + + var boxEl = document.querySelector("div[data-box=\"".concat(id, "\"]")); + if (boxEl) boxHeight = parseInt(boxEl.offsetHeight, 10); // where the box should move to + + top = annotationTop; // if the above comment box has already taken up the height, move down + + if (pos > 0) { + var previousBox = marksNodes[area][pos - 1]; + var previousEndHeight = previousBox.endHeight; + + if (annotationTop < previousEndHeight) { + top = previousEndHeight + 2; + } + } // store where the box ends to be aware of overlaps in the next box + + + markNode.endHeight = top + boxHeight + 2; + result[pos] = top; + allCommentsTop.push(_defineProperty({}, id, result[pos])); // if active, move as many boxes above as needed to bring it to the annotation's height + + if (isActive) { + markNode.endHeight = annotationTop + boxHeight + 2; + result[pos] = annotationTop; + allCommentsTop[pos][id] = result[pos]; + var b = true; + var i = pos; // first one active, none above + + if (i === 0) b = false; + + while (b) { + var boxAbove = marksNodes[area][i - 1]; + var boxAboveEnds = boxAbove.endHeight; + var currentTop = result[i]; + var doesOverlap = boxAboveEnds > currentTop; + + if (doesOverlap) { + var overlap = boxAboveEnds - currentTop; + result[i - 1] -= overlap; + var previousMarkNode = marksNodes[area][i - 1] instanceof prosemirrorModel.Mark ? marksNodes[area][i - 1].attrs.id : marksNodes[area][i - 1].node.attrs.id; + allCommentsTop[i - 1][previousMarkNode] = result[i - 1]; + } + + if (!doesOverlap) b = false; + if (i <= 1) b = false; + i -= 1; + } + } + }); + return allCommentsTop; + }); + useDeepCompareEffect(function () { + setMarksNodes(updateMarks(view)); + + if (isFirstRun) { + setTimeout(function () { + setPosition(setTops()); + setFirstRun(false); + }, 400); + } else { + setPosition(setTops()); + } + }, [updateMarks(view), setTops()]); + var CommentTrackComponent = React.useMemo(function () { + return /*#__PURE__*/React__default.createElement(BoxList, { + commentsTracks: marksNodes[area] || [], + area: area, + view: main, + position: position + }); + }, [marksNodes[area] || [], position]); + return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, CommentTrackComponent); +}); // TODO if allInlineNodes and allBlockNodes count don't change, do not compute again + +var updateMarks = function updateMarks(view) { + if (view.main) { + var allInlineNodes = []; + Object.keys(view).forEach(function (eachView) { + allInlineNodes.push.apply(allInlineNodes, _toConsumableArray(waxProsemirrorUtilities.DocumentHelpers.findInlineNodes(view[eachView].state.doc))); + }); + var allBlockNodes = waxProsemirrorUtilities.DocumentHelpers.findBlockNodes(view.main.state.doc); + var finalMarks = []; + var finalNodes = []; + allInlineNodes.map(function (node) { + if (node.node.marks.length > 0) { + node.node.marks.filter(function (mark) { + if (mark.type.name === 'comment' || mark.type.name === 'insertion' || mark.type.name === 'deletion' || mark.type.name === 'format_change') { + mark.pos = node.pos; + finalMarks.push(mark); + } + }); + } + }); + allBlockNodes.map(function (node) { + if (node.node.attrs.track && node.node.attrs.track.length > 0) { + finalNodes.push(node); + } + }); + var nodesAndMarks = [].concat(_toConsumableArray(lodash.uniqBy(finalMarks, 'attrs.id')), finalNodes); + var groupedMarkNodes = {}; + nodesAndMarks.forEach(function (markNode) { + var markNodeAttrs = markNode.attrs ? markNode.attrs : markNode.node.attrs; + + if (!groupedMarkNodes[markNodeAttrs.group]) { + groupedMarkNodes[markNodeAttrs.group] = [markNode]; + } else { + groupedMarkNodes[markNodeAttrs.group].push(markNode); + } + }); + return groupedMarkNodes; + } + + return []; +}; + +function _templateObject$d() { + var data = _taggedTemplateLiteral(["\n ", ";\n opacity: ", ";\n pointer-events: ", ";\n color: ", ";\n background-color: ", ";\n &:hover {\n background-color: ", ";\n }\n"]); + + _templateObject$d = function _templateObject() { + return data; + }; + + return data; +} +var ButtonStyled$1 = styled.button(_templateObject$d(), waxProsemirrorThemes.ButtonStyles, function (props) { + return props.select ? 1 : 0.4; +}, function (props) { + return props.select ? 'default' : 'none'; +}, function (props) { + return props.isActive ? 'white' : props.theme.colorButton; +}, function (props) { + return props.isActive ? props.theme.colorPrimary : 'transparent'; +}, function (props) { + return props.isActive ? props.theme.colorPrimary : 'transparent'; +}); + +var TrackChangeEnable = function TrackChangeEnable(_ref) { + var _ref$view = _ref.view, + view = _ref$view === void 0 ? {} : _ref$view, + item = _ref.item, + enabled = _ref.enabled; + + if (item.onlyOnMain) { + var _useContext = React.useContext(waxProsemirrorCore.WaxContext), + main = _useContext.view.main; + + view = main; + } + + var _useState = React.useState(enabled), + _useState2 = _slicedToArray(_useState, 2), + isEnabled = _useState2[0], + setEnabled = _useState2[1]; + + return /*#__PURE__*/React__default.createElement(ButtonStyled$1, { + type: "button", + isActive: isEnabled, + title: item.title, + disabled: item.enable && !item.enable(view.state), + onMouseDown: function onMouseDown(e) { + e.preventDefault(); + setEnabled(!isEnabled); + item.run(view.state, view.dispatch); + }, + select: item.select && item.select(view.state) + }, item.content); +}; + +exports.Button = Button; +exports.CommentBubbleComponent = CommentBubbleComponent; +exports.ImageUpload = ImageUpload; +exports.InfoArea = InfoArea; +exports.LeftMenuTitle = LeftMenuTitle; +exports.LinkComponent = LinkComponent; +exports.NoteEditorContainer = NoteEditorContainer; +exports.Overlay = Overlay; +exports.RightArea = RightArea; +exports.TableDropDown = TableDropDown; +exports.ToolGroupComponent = ToolGroupComponent; +exports.TrackChangeEnable = TrackChangeEnable; +exports.icons = icons; +//# sourceMappingURL=index.js.map diff --git a/wax-prosemirror-components/dist/index.js.map b/wax-prosemirror-components/dist/index.js.map new file mode 100644 index 000000000..a38484ba2 --- /dev/null +++ b/wax-prosemirror-components/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js","../src/components/infoArea/InfoArea.js","../src/components/Overlay.js","../src/components/Button.js","../src/icons/icons.js","../src/components/TableDropDown.js","../src/components/ImageUpload.js","../src/components/LeftMenuTitle.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray.js","../src/components/ToolGroupComponent.js","../src/components/notes/NoteNumber.js","../src/components/notes/NoteEditorContainer.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectSpread2.js","../src/components/link/LinkComponent.js","../src/components/comments/CommentBubbleComponent.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/iterableToArray.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js","../src/components/comments/Comment.js","../src/components/comments/CommentBox.js","../src/components/trackChanges/TrackChangeBox.js","../src/components/rightArea/BoxList.js","../src/components/rightArea/RightArea.js","../src/components/trackChanges/TrackChangeEnable.js"],"sourcesContent":["export default function _taggedTemplateLiteral(strings, raw) {\n if (!raw) {\n raw = strings.slice(0);\n }\n\n return Object.freeze(Object.defineProperties(strings, {\n raw: {\n value: Object.freeze(raw)\n }\n }));\n}","import React from \"react\";\nimport styled from \"styled-components\";\n\nconst InfoAreaContainer = styled.div`\n ${\"\" /* height: ${props => (props.height ? props.height : \"30px\")};\n position: fixed;\n bottom: 0;\n z-index: 9999;\n background: #efefef;\n width: 100%;*/};\n`;\n\nconst InfoArea = () => <InfoAreaContainer />;\n\nexport default InfoArea;\n","import React from 'react';\nimport styled from 'styled-components';\n\nconst OverlayContainer = styled.div`\n position: ${props => props.position.position};\n left: ${props => `${props.position.left}px`};\n top: ${props => `${props.position.top}px`};\n z-index: 999;\n`;\n\nconst Overlay = props => (\n <OverlayContainer {...props}>{props.children}</OverlayContainer>\n);\n\nexport default Overlay;\n","/* eslint react/prop-types: 0 */\nimport React, { useContext } from 'react';\nimport styled from 'styled-components';\nimport { ButtonStyles } from 'wax-prosemirror-themes';\nimport { WaxContext } from 'wax-prosemirror-core';\n\nconst ButtonStyled = styled.button`\n ${ButtonStyles};\n opacity: ${props => (props.select ? 1 : 0.4)};\n pointer-events: ${props => (props.select ? 'default' : 'none')};\n color: ${props => (props.isActive ? 'white' : props.theme.colorButton)};\n background-color: ${props =>\n props.isActive ? props.theme.colorPrimary : 'transparent'};\n &:hover {\n background-color: ${props =>\n props.isActive ? props.theme.colorPrimary : 'transparent'};\n }\n`;\n\nconst Button = ({ view = {}, item }) => {\n const {\n view: { main },\n activeViewId,\n } = useContext(WaxContext);\n if (item.onlyOnMain) {\n view = main;\n }\n\n return (\n <ButtonStyled\n type=\"button\"\n isActive={item.active && item.active(view.state)}\n title={item.title}\n disabled={item.enable && !item.enable(view.state)}\n onMouseDown={e => {\n e.preventDefault();\n item.run(view.state, view.dispatch);\n }}\n select={item.select && item.select(view.state, activeViewId)}\n >\n {item.content}\n </ButtonStyled>\n );\n};\n\nexport default Button;\n","import React from 'react';\nimport FontAwesomeIcon from '@fortawesome/react-fontawesome';\nimport {\n faBold,\n faItalic,\n faCode,\n faSuperscript,\n faSubscript,\n faUnderline,\n faStrikethrough,\n faLink,\n faParagraph,\n faHeading,\n faQuoteLeft,\n faListOl,\n faListUl,\n faImage,\n faTable,\n faUndo,\n faRedo,\n faOutdent,\n faAngleUp,\n faStickyNote,\n faVial,\n faFileCode,\n faEllipsisH,\n} from '@fortawesome/free-solid-svg-icons';\n\nexport default {\n em: <FontAwesomeIcon icon={faItalic} />,\n italic: <FontAwesomeIcon icon={faItalic} />,\n strong: <FontAwesomeIcon icon={faBold} />,\n bold: <FontAwesomeIcon icon={faBold} />,\n code: <FontAwesomeIcon icon={faCode} />,\n subscript: <FontAwesomeIcon icon={faSubscript} />,\n superscript: <FontAwesomeIcon icon={faSuperscript} />,\n underline: <FontAwesomeIcon icon={faUnderline} />,\n strikethrough: <FontAwesomeIcon icon={faStrikethrough} />,\n link: <FontAwesomeIcon icon={faLink} />,\n paragraph: <FontAwesomeIcon icon={faParagraph} />,\n heading: <FontAwesomeIcon icon={faHeading} />,\n blockquote: <FontAwesomeIcon icon={faQuoteLeft} />,\n code_block: <FontAwesomeIcon icon={faFileCode} />,\n ordered_list: <FontAwesomeIcon icon={faListOl} />,\n bullet_list: <FontAwesomeIcon icon={faListUl} />,\n image: <FontAwesomeIcon icon={faImage} />,\n table: <FontAwesomeIcon icon={faTable} />,\n footnote: <FontAwesomeIcon icon={faStickyNote} />,\n undo: <FontAwesomeIcon icon={faUndo} />,\n redo: <FontAwesomeIcon icon={faRedo} />,\n lift: <FontAwesomeIcon icon={faOutdent} />,\n join_up: <FontAwesomeIcon icon={faAngleUp} />,\n source: <FontAwesomeIcon icon={faVial} />,\n ellipses: <FontAwesomeIcon icon={faEllipsisH} />,\n small_caps: (\n <span className=\"small-caps\">\n <svg\n width=\"35\"\n height=\"20\"\n viewBox=\"0 0 35 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M9.21799 1.12207L9.34998 0H0V1.12207H4.004V15.0701H5.258V1.12207H9.21799ZM14.14 6.34912L14.242 5.51611H7.935V6.34912H10.587V15.0701H11.539V6.34912H14.14Z\"\n transform=\"translate(10.286 8.92993)\"\n fill=\"#4F4F4F\"\n />\n </svg>\n </span>\n ),\n};\n","/* eslint react/prop-types: 0 */\nimport React from 'react';\nimport styled from 'styled-components';\nimport * as tablesFn from 'prosemirror-tables';\nimport Dropdown from 'react-dropdown';\nimport 'react-dropdown/style.css';\n\nconst DropdownStyled = styled(Dropdown)`\n display: inline-flex;\n cursor: not-allowed;\n opacity: ${props => (props.select ? 1 : 0.4)};\n pointer-events: ${props => (props.select ? 'default' : 'none')};\n .Dropdown-control {\n border: none;\n }\n .Dropdown-arrow {\n right: 25px;\n top: 21px;\n }\n .Dropdown-menu {\n width: 120%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n .Dropdown-option {\n width: 100%;\n }\n }\n`;\n\nconst dropDownOptions = [\n { label: 'add column before', value: 'addColumnBefore' },\n { label: 'add column after', value: 'addColumnAfter' },\n { label: 'Delete column', value: 'deleteColumn' },\n { label: 'Insert row before', value: 'addRowBefore' },\n { label: 'Insert row after', value: 'addRowAfter' },\n { label: 'Delete row', value: 'deleteRow' },\n { label: 'Delete table', value: 'deleteTable' },\n { label: 'Merge cells', value: 'mergeCells' },\n { label: 'Split cell', value: 'splitCell' },\n { label: 'Toggle header column', value: 'toggleHeaderColumn' },\n { label: 'Toggle header row', value: 'toggleHeaderRow' },\n { label: 'Toggle header cells', value: 'toggleHeaderCell' },\n];\n\nconst TableDropDown = ({ view: { dispatch, state }, item }) => (\n <DropdownStyled\n options={dropDownOptions}\n onChange={option => {\n tablesFn[option.value](state, dispatch);\n }}\n placeholder=\"Table Options\"\n select={item.select && item.select(state)}\n />\n);\nexport default TableDropDown;\n","/* eslint react/prop-types: 0 */\nimport React, { useContext } from 'react';\nimport styled from 'styled-components';\nimport { WaxContext } from 'wax-prosemirror-core';\n\nconst UploadImage = styled.div`\n opacity: ${props => (props.select ? 1 : 0.4)};\n pointer-events: ${props => (props.select ? 'default' : 'none')};\n color: #777;\n display: inline-flex;\n padding: 0px 10px;\n .custom-file-upload {\n cursor: pointer;\n }\n &:hover {\n }\n input {\n display: none;\n }\n`;\nconst ImageUpload = ({ item, fileUpload, view }) => {\n const { activeViewId } = useContext(WaxContext);\n\n return (\n <UploadImage select={item.select && item.select(view.state, activeViewId)}>\n <label\n className=\"custom-file-upload\"\n title=\"upload image\"\n htmlFor=\"file-upload\"\n >\n {item.content}\n <input\n id=\"file-upload\"\n onChange={e => fileUpload(e.target.files[0])}\n type=\"file\"\n />\n </label>\n </UploadImage>\n );\n};\nexport default ImageUpload;\n","/* eslint react/prop-types: 0 */\nimport React from 'react';\nimport styled from 'styled-components';\n\nconst LeftMenuStyled = styled.div`\n border-bottom: 1px solid #d9d9d9;\n color: #979797;\n font-family: 'Fira Sans';\n font-size: 15px;\n font-weight: bold;\n letter-spacing: 0.6px;\n list-style: none;\n line-height: 0;\n margin: 5px 0;\n display: block;\n padding: 20px 0 10px;\n margin-left: 10px;\n text-align: left;\n text-transform: uppercase;\n width: 51%;\n`;\n\nconst LeftMenuTitle = ({ title }) => {\n return <LeftMenuStyled>{title}</LeftMenuStyled>;\n};\n\nexport default LeftMenuTitle;\n","export default function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}","export default function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}","import arrayLikeToArray from \"./arrayLikeToArray\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import arrayWithHoles from \"./arrayWithHoles\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray\";\nimport nonIterableRest from \"./nonIterableRest\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","import React, { useState } from 'react';\nimport { isFunction } from 'lodash';\nimport styled from 'styled-components';\nimport icons from '../icons/icons';\n\nconst ToolGroupStyled = styled.div`\n border-right: 1px solid #ecedf1;\n &:last-child {\n border-right: none;\n }\n`;\n\nconst MoreButton = styled.button`\n background: none;\n border: none;\n cursor: pointer;\n &:active {\n outline: none;\n }\n`;\n\nconst InnerStyled = styled.div`\n display: flex;\n width: 0;\n top: 40px;\n position: relative;\n right: 100%;\n`;\n\nconst ToolGroupComponent = ({ view, tools, name, title }) => {\n const [more, showHide] = useState(false),\n toolsShown = [],\n rest = [],\n DisplayTitle = isFunction(title) ? title : () => title;\n\n tools.forEach(tool => {\n tool.isIntoMoreSection() && tool.isDisplayed()\n ? rest.push(tool.renderTool(view))\n : toolsShown.push(tool.renderTool(view));\n });\n\n return (\n <ToolGroupStyled data-name={name}>\n <DisplayTitle />\n {toolsShown}\n {rest.length && !more ? (\n <MoreButton title=\"show more tools\" onClick={() => showHide(!more)}>\n {icons.ellipses}\n </MoreButton>\n ) : null}\n {more && (\n <div>\n <MoreButton title=\"hide\" onClick={() => showHide(!more)}>\n {icons.ellipses}\n </MoreButton>\n <InnerStyled>{rest}</InnerStyled>\n </div>\n )}\n </ToolGroupStyled>\n );\n};\n\nexport default ToolGroupComponent;\n","/* eslint react/prop-types: 0 */\nimport React from 'react';\nimport styled from 'styled-components';\n\nconst NoteNumberStyled = styled.div`\n display: flex;\n margin-top: 10px;\n width: 2%;\n &:after {\n content: counter(footnote-view);\n vertical-align: super;\n font-size: 75%;\n counter-increment: footnote-view;\n cursor: pointer;\n }\n`;\n\nconst onClick = () => {};\n\nconst NoteNumber = ({ number }) => {\n return <NoteNumberStyled onClick={onClick} />;\n};\n\nexport default NoteNumber;\n","import React from 'react';\nimport styled from 'styled-components';\n\nimport NoteNumber from './NoteNumber';\n\nconst NoteEditorContainerStyled = styled.div`\n display: flex;\n flex-direction: row;\n min-height: 28px;\n width: 100%;\n position: relative;\n margin-bottom: 5px;\n`;\n\nconst NoteStyled = styled.div`\n display: flex;\n flex-direction: row;\n width: 100%;\n min-height: 20px;\n margin-top: 10px;\n height: 100%;\n border-bottom: 1px solid black;\n &:focus {\n outline: none;\n }\n\n p {\n margin: 0;\n }\n\n span.comment {\n border-bottom: 2px solid #ffab20;\n border-radius: 3px 3px 0 0;\n\n .active-comment {\n background-color: #ffab20;\n }\n }\n\n span.deletion {\n text-decoration: line-through;\n color: red;\n }\n\n span.insertion {\n color: blue;\n }\n\n .selected-insertion,\n .selected-deletion,\n .selected-format-change,\n .selected-block-change {\n background-color: #fffacf;\n }\n\n .format-change {\n border-bottom: 2px solid blue;\n }\n`;\n\nconst NoteEditorContainer = React.forwardRef((props, ref) => (\n <NoteEditorContainerStyled>\n <NoteNumber /> <NoteStyled ref={ref} {...props} />\n </NoteEditorContainerStyled>\n));\n\nexport default NoteEditorContainer;\n","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import defineProperty from \"./defineProperty\";\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nexport default function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}","/* eslint react/prop-types: 0 */\nimport React, { useRef, useEffect, useState, useContext } from 'react';\nimport styled from 'styled-components';\nimport { WaxContext } from 'wax-prosemirror-core';\nimport { DocumentHelpers } from 'wax-prosemirror-utilities';\n\nconst LinkWrapper = styled.div`\n padding: 20px;\n border-radius: 3px;\n border: 1px solid #000;\n background: #ecedf1;\n z-index: 9999;\n -webkit-box-shadow: 0px 0px 0px 2px rgba(0, 0, 0, 0.75);\n -moz-box-shadow: 0px 0px 0px 2px rgba(0, 0, 0, 0.75);\n box-shadow: 0px 0px 0px 2px rgba(0, 0, 0, 0.75);\n`;\n\nconst Button = styled.button`\n cursor: pointer;\n`;\n\nconst LinkComponent = ({ mark, setPosition, position }) => {\n const href = mark ? mark.attrs.href : null;\n const linkMark = mark ? mark : null;\n const { activeView } = useContext(WaxContext);\n const { state, dispatch } = activeView;\n const ref = useRef(null);\n const linkInput = useRef(null);\n const [addButtonText, setButtonText] = useState('Create');\n const [lastLinkMark, setLLastLinkMark] = useState(linkMark);\n const [linkHref, setLinkHref] = useState(href);\n\n useEffect(() => {\n setLinkText();\n removeMarkIfEmptyHref();\n }, [ref.current, href]);\n\n const addLinkHref = () => {\n const href = linkHref;\n const linkMark = state.schema.marks.link;\n const { tr } = state;\n\n dispatch(\n tr.addMark(\n mark.from,\n mark.to,\n linkMark.create({\n ...((mark && mark.attrs) || {}),\n href,\n }),\n ),\n );\n activeView.focus();\n };\n\n const removeLink = () => {\n dispatch(state.tr.removeMark(mark.from, mark.to, state.schema.marks.link));\n activeView.focus();\n };\n\n const handleKeyDown = event => {\n if (event.key === 'Enter' || event.which === 13) {\n addLinkHref();\n }\n };\n\n const updateLinkHref = () => {\n const {\n current: { value },\n } = linkInput;\n setLinkHref(value);\n };\n\n const setLinkText = () => {\n if (mark && mark.attrs.href !== '') {\n setButtonText('Update');\n setLinkHref(mark.attrs.href);\n } else {\n setButtonText('Create');\n setLinkHref('');\n if (linkInput.current) linkInput.current.focus();\n }\n };\n\n const removeMarkIfEmptyHref = () => {\n const {\n selection: { $from, $to },\n } = state;\n const PMLinkMark = state.schema.marks.link;\n const actualMark = DocumentHelpers.getSelectionMark(state, PMLinkMark);\n setLLastLinkMark(actualMark);\n\n if (\n lastLinkMark.attrs.href === '' &&\n ($from.pos < lastLinkMark.from || $to.pos > lastLinkMark.to)\n ) {\n dispatch(\n state.tr\n .setMeta('addToHistory', false)\n .removeMark(\n lastLinkMark.from,\n lastLinkMark.to,\n state.schema.marks.link,\n ),\n );\n }\n };\n\n return mark ? (\n <LinkWrapper ref={ref}>\n <input\n type=\"text\"\n ref={linkInput}\n onChange={updateLinkHref}\n onKeyPress={handleKeyDown}\n value={linkHref}\n />\n <Button primary onClick={addLinkHref}>\n {addButtonText}\n </Button>\n <Button onClick={removeLink}>Remove</Button>\n </LinkWrapper>\n ) : null;\n};\n\nexport default LinkComponent;\n","/* eslint react/prop-types: 0 */\nimport React, { useLayoutEffect, useContext } from 'react';\nimport { Commands, DocumentHelpers } from 'wax-prosemirror-utilities';\nimport { WaxContext } from 'wax-prosemirror-core';\n\nconst CommentBubbleComponent = ({\n setPosition,\n position,\n showComment,\n group,\n}) => {\n const { activeView, activeViewId } = useContext(WaxContext);\n const { state, dispatch } = activeView;\n useLayoutEffect(() => {\n const WaxSurface = activeView.dom.getBoundingClientRect();\n const { selection } = activeView.state;\n const { from, to } = selection;\n const start = activeView.coordsAtPos(from);\n const end = activeView.coordsAtPos(to);\n const difference = end.top - start.top;\n const left = WaxSurface.width + WaxSurface.x;\n const top = end.top - difference / 2 - 5;\n setPosition({ ...position, left, top });\n }, [position.left]);\n\n const createComment = event => {\n event.preventDefault();\n Commands.createComment(state, dispatch, group, activeViewId);\n activeView.focus();\n };\n\n const isSelectionComment = () => {\n const commentMark = activeView.state.schema.marks.comment;\n const mark = DocumentHelpers.findMark(state, commentMark, true);\n\n // TODO Overlapping comments . for now don't allow\n if (mark.length >= 1) return true;\n return false;\n };\n\n return (\n !isSelectionComment() &&\n showComment(activeViewId) && (\n <button\n type=\"button\"\n onMouseDown={event => {\n createComment(event);\n }}\n >\n create\n </button>\n )\n );\n};\n\nexport default CommentBubbleComponent;\n","import arrayLikeToArray from \"./arrayLikeToArray\";\nexport default function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}","export default function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import arrayWithoutHoles from \"./arrayWithoutHoles\";\nimport iterableToArray from \"./iterableToArray\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray\";\nimport nonIterableSpread from \"./nonIterableSpread\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}","/* eslint react/prop-types: 0 */\nimport React, { useState, useRef, useEffect } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport { last } from 'lodash';\nimport styled from 'styled-components';\nimport { DocumentHelpers } from 'wax-prosemirror-utilities';\n\nconst SinlgeCommentRow = styled.div`\n padding: 4px;\n border-bottom: 1px solid #ffab20;\n cursor: pointer;\n`;\n\nexport default ({ comment, activeView, user, active }) => {\n const commentInput = useRef(null);\n const [commentAnnotation, setCommentAnnotation] = useState(comment);\n const [commentInputValue, setcommentInputValue] = useState('');\n const { state, dispatch } = activeView;\n const allCommentsWithSameId = DocumentHelpers.findAllMarksWithSameId(\n state,\n comment,\n );\n const {\n attrs: { conversation },\n } = comment;\n const commentMark = state.schema.marks.comment;\n\n useEffect(() => {\n setTimeout(() => {\n if (commentInput.current !== null && conversation.length === 0)\n commentInput.current.focus();\n }, 500);\n }, [active]);\n\n const handleKeyDown = event => {\n if (event.key === 'Enter' || event.which === 13) {\n saveComment(event);\n }\n };\n\n const saveComment = event => {\n event.stopPropagation();\n\n const {\n current: { value },\n } = commentInput;\n const { tr, doc } = state;\n\n const obj = {\n content: value,\n displayName: user.username,\n timestamp: Math.floor(Date.now() / 300000),\n };\n\n commentAnnotation.attrs.conversation.push(obj);\n\n allCommentsWithSameId.forEach(singleComment => {\n dispatch(\n tr.addMark(\n singleComment.pos,\n singleComment.pos + singleComment.nodeSize,\n commentMark.create({\n ...((commentAnnotation && commentAnnotation.attrs) || {}),\n conversation: commentAnnotation.attrs.conversation,\n }),\n ),\n );\n });\n\n setcommentInputValue('');\n };\n\n const updateCommentInputValue = () => {\n const {\n current: { value },\n } = commentInput;\n setcommentInputValue(value);\n };\n\n const onBlur = () => {\n const {\n current: { value },\n } = commentInput;\n if (value !== '') {\n // saveComment();\n }\n\n if (conversation.length === 0 && value === '') {\n resolveComment();\n }\n };\n\n const resolveComment = event => {\n if (event) event.stopPropagation();\n let maxPos = comment.pos;\n let minPos = comment.pos;\n\n allCommentsWithSameId.forEach(singleComment => {\n const markPosition = DocumentHelpers.findMarkPosition(\n activeView,\n singleComment.pos,\n 'comment',\n );\n if (markPosition.from < minPos) minPos = markPosition.from;\n if (markPosition.to > maxPos) maxPos = markPosition.to;\n });\n\n if (allCommentsWithSameId.length > 1)\n maxPos += last(allCommentsWithSameId).node.nodeSize;\n dispatch(state.tr.removeMark(minPos, maxPos, commentMark));\n activeView.focus();\n };\n\n const commentInputReply = () => {\n return (\n <>\n <input\n type=\"text\"\n ref={commentInput}\n placeholder=\"add a new comment\"\n onChange={updateCommentInputValue}\n onKeyPress={handleKeyDown}\n onBlur={onBlur}\n onClick={event => {\n event.stopPropagation();\n }}\n value={commentInputValue}\n disabled={!active}\n />\n <button\n disabled={!active}\n type=\"button\"\n onClick={event => saveComment(event)}\n >\n Post\n </button>\n <button\n disabled={!active}\n type=\"button\"\n onClick={event => resolveComment(event)}\n >\n Resolve\n </button>\n </>\n );\n };\n\n return conversation.length === 0 ? (\n <>{commentInputReply()}</>\n ) : (\n <>\n {conversation.map((singleComment, index) => {\n return (\n <SinlgeCommentRow key={uuidv4()}>\n {`${singleComment.displayName} : ${singleComment.content}`}\n </SinlgeCommentRow>\n );\n })}\n {commentInputReply()}\n </>\n );\n};\n","/* eslint react/prop-types: 0 */\nimport React, { useState, useEffect, useContext, memo } from 'react';\nimport { TextSelection } from 'prosemirror-state';\nimport { last, maxBy } from 'lodash';\n\nimport { Transition } from 'react-transition-group';\nimport styled from 'styled-components';\nimport { DocumentHelpers } from 'wax-prosemirror-utilities';\nimport { WaxContext } from 'wax-prosemirror-core';\nimport Comment from './Comment';\n\nconst CommentBoxStyled = styled.div`\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n border: 1px solid #ffab20;\n position: absolute;\n transition: ${({ state }) => 'top 1s, opacity 1.5s, left 1s'};\n top: ${props => (props.top ? `${props.top}px` : 0)};\n left: ${props => (props.active ? `${63}%` : `${65}%`)};\n opacity: ${({ state }) => {\n switch (state) {\n case 'exited':\n return 0.2;\n case 'exiting':\n return 0.4;\n case 'entering':\n return 0.6;\n case 'entered':\n return 1;\n default:\n }\n }};\n`;\n\nexport default ({ comment, top, dataBox }) => {\n console.log('rerender');\n const [animate, setAnimate] = useState(false);\n const {\n attrs: { id },\n } = comment;\n\n useEffect(() => {\n setAnimate(true);\n }, []);\n\n const MemorizedComponent = memo(() => {\n const {\n view,\n view: {\n main: {\n props: { user },\n },\n },\n app,\n activeView,\n } = useContext(WaxContext);\n let active = false;\n\n const commentPlugin = app.PmPlugins.get('commentPlugin');\n const activeComment = commentPlugin.getState(activeView.state).comment;\n\n if (activeComment && id === activeComment.attrs.id) active = true;\n\n const setCommentActive = () => {\n const viewId = comment.attrs.viewid;\n\n if (active) {\n view[viewId].focus();\n return false;\n }\n\n const allCommentsWithSameId = DocumentHelpers.findAllMarksWithSameId(\n view[viewId].state,\n comment,\n );\n\n const maxPos = maxBy(allCommentsWithSameId, 'pos');\n maxPos.pos += last(allCommentsWithSameId).node.nodeSize;\n\n view[viewId].dispatch(\n view[viewId].state.tr.setSelection(\n new TextSelection(\n view[viewId].state.tr.doc.resolve(maxPos.pos, maxPos.pos),\n ),\n ),\n );\n\n view[viewId].focus();\n };\n\n return (\n <>\n <Transition in={animate} timeout={1000}>\n {state => (\n <CommentBoxStyled\n top={top}\n state={state}\n data-box={dataBox}\n active={active}\n onClick={setCommentActive}\n >\n <Comment\n comment={comment}\n active={active}\n activeView={activeView}\n user={user}\n />\n </CommentBoxStyled>\n )}\n </Transition>\n </>\n );\n });\n\n return <MemorizedComponent />;\n};\n","import { Mark } from \"prosemirror-model\";\nimport React, { Fragment, useState, useEffect, useContext } from \"react\";\nimport { Transition } from \"react-transition-group\";\nimport styled from \"styled-components\";\nimport { WaxContext } from \"wax-prosemirror-core\";\n\nconst TrackChangeBoxStyled = styled.div`\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n border: 1px solid blue;\n position: absolute;\n transition: ${({ state }) => \"top 1s, opacity 1.5s, left 1s\"};\n top: ${props => (props.top ? `${props.top}px` : 0)};\n left: ${props => (props.active ? `${63}%` : `${65}%`)};\n opacity: ${({ state }) => {\n switch (state) {\n case \"exited\":\n return 0.2;\n case \"exiting\":\n return 0.4;\n case \"entering\":\n return 0.6;\n case \"entered\":\n return 1;\n }\n }};\n`;\n\nexport default ({ trackChange, view, top, dataBox }) => {\n const [animate, setAnimate] = useState(false);\n const { view: { main }, app, activeView } = useContext(WaxContext);\n let action;\n if (trackChange instanceof Mark) {\n if ((trackChange.type.name = \"format_change\")) {\n const { attrs: { username, before, after } } = trackChange;\n action = `User ${username} added ${after[0]}`;\n }\n } else {\n action = `User demo changed paragraph to heading 1`;\n }\n\n let active = false;\n useEffect(() => {\n setAnimate(true);\n }, []);\n\n return (\n <Fragment>\n <Transition in={animate} timeout={1000}>\n {state => (\n <TrackChangeBoxStyled\n top={top}\n state={state}\n data-box={dataBox}\n active={active}\n >\n <div>\n {action}\n <button>Accept</button>\n <button>Reject</button>\n </div>\n </TrackChangeBoxStyled>\n )}\n </Transition>\n </Fragment>\n );\n};\n","/* eslint react/prop-types: 0 */\nimport { Mark } from 'prosemirror-model';\nimport React from 'react';\nimport CommentBox from '../comments/CommentBox';\nimport TrackChangeBox from '../trackChanges/TrackChangeBox';\n\nexport default ({ commentsTracks, view, position }) => {\n if (!position) return null;\n return (\n <>\n {commentsTracks.map((commentTrack, index) => {\n const id =\n commentTrack instanceof Mark\n ? commentTrack.attrs.id\n : commentTrack.node.attrs.id;\n\n const top = position[index] ? position[index][id] : 0;\n\n if (commentTrack.type && commentTrack.type.name === 'comment') {\n return (\n <CommentBox\n key={id}\n comment={commentTrack}\n top={top}\n dataBox={id}\n />\n );\n }\n return (\n <TrackChangeBox\n key={id}\n trackChange={commentTrack}\n view={view}\n top={top}\n dataBox={id}\n />\n );\n })}\n </>\n );\n};\n","/* eslint react/prop-types: 0 */\nimport { Mark } from 'prosemirror-model';\nimport React, { useContext, useState, useMemo, useCallback } from 'react';\nimport useDeepCompareEffect from 'use-deep-compare-effect';\nimport { each, uniqBy, sortBy } from 'lodash';\nimport { WaxContext } from 'wax-prosemirror-core';\nimport { DocumentHelpers } from 'wax-prosemirror-utilities';\nimport BoxList from './BoxList';\n\nexport default ({ area }) => {\n const {\n view,\n view: { main },\n app,\n activeView,\n } = useContext(WaxContext);\n const commentPlugin = app.PmPlugins.get('commentPlugin');\n const [marksNodes, setMarksNodes] = useState([]);\n const [position, setPosition] = useState();\n const [isFirstRun, setFirstRun] = useState(true);\n\n const setTops = useCallback(() => {\n const result = [];\n let markNodeEl = null;\n let annotationTop = 0;\n let boxHeight = 0;\n let top = 0;\n const allCommentsTop = [];\n\n const nodesMarksToIterrate =\n marksNodes[area] === 'main'\n ? sortBy(marksNodes[area], ['pos'])\n : marksNodes[area];\n\n each(nodesMarksToIterrate, (markNode, pos) => {\n const WaxSurface = main.dom.getBoundingClientRect();\n const id =\n markNode instanceof Mark ? markNode.attrs.id : markNode.node.attrs.id;\n\n const activeComment = commentPlugin.getState(activeView.state).comment;\n\n let isActive = false;\n if (activeComment && id === activeComment.attrs.id) isActive = true;\n\n // annotation top\n if (area === 'main') {\n markNodeEl = document.querySelector(`[data-id=\"${id}\"]`);\n if (markNodeEl)\n annotationTop =\n markNodeEl.getBoundingClientRect().top - WaxSurface.top;\n } else {\n const panelWrapper = document.getElementsByClassName('panelWrapper');\n const panelWrapperHeight = panelWrapper[0].getBoundingClientRect()\n .height;\n markNodeEl = document\n .querySelector('#notes-container')\n .querySelector(`[data-id=\"${id}\"]`);\n if (markNodeEl)\n annotationTop =\n markNodeEl.getBoundingClientRect().top - panelWrapperHeight - 50;\n }\n\n // get height of this markNode box\n const boxEl = document.querySelector(`div[data-box=\"${id}\"]`);\n if (boxEl) boxHeight = parseInt(boxEl.offsetHeight, 10);\n\n // where the box should move to\n top = annotationTop;\n\n // if the above comment box has already taken up the height, move down\n if (pos > 0) {\n const previousBox = marksNodes[area][pos - 1];\n const previousEndHeight = previousBox.endHeight;\n if (annotationTop < previousEndHeight) {\n top = previousEndHeight + 2;\n }\n }\n // store where the box ends to be aware of overlaps in the next box\n markNode.endHeight = top + boxHeight + 2;\n result[pos] = top;\n allCommentsTop.push({ [id]: result[pos] });\n\n // if active, move as many boxes above as needed to bring it to the annotation's height\n if (isActive) {\n markNode.endHeight = annotationTop + boxHeight + 2;\n result[pos] = annotationTop;\n allCommentsTop[pos][id] = result[pos];\n let b = true;\n let i = pos;\n\n // first one active, none above\n if (i === 0) b = false;\n\n while (b) {\n const boxAbove = marksNodes[area][i - 1];\n const boxAboveEnds = boxAbove.endHeight;\n const currentTop = result[i];\n\n const doesOverlap = boxAboveEnds > currentTop;\n\n if (doesOverlap) {\n const overlap = boxAboveEnds - currentTop;\n result[i - 1] -= overlap;\n\n const previousMarkNode =\n marksNodes[area][i - 1] instanceof Mark\n ? marksNodes[area][i - 1].attrs.id\n : marksNodes[area][i - 1].node.attrs.id;\n\n allCommentsTop[i - 1][previousMarkNode] = result[i - 1];\n }\n\n if (!doesOverlap) b = false;\n if (i <= 1) b = false;\n i -= 1;\n }\n }\n });\n\n return allCommentsTop;\n });\n\n useDeepCompareEffect(() => {\n setMarksNodes(updateMarks(view));\n if (isFirstRun) {\n setTimeout(() => {\n setPosition(setTops());\n setFirstRun(false);\n }, 400);\n } else {\n setPosition(setTops());\n }\n }, [updateMarks(view), setTops()]);\n\n const CommentTrackComponent = useMemo(\n () => (\n <BoxList\n commentsTracks={marksNodes[area] || []}\n area={area}\n view={main}\n position={position}\n />\n ),\n [marksNodes[area] || [], position],\n );\n return <>{CommentTrackComponent}</>;\n};\n\n// TODO if allInlineNodes and allBlockNodes count don't change, do not compute again\nconst updateMarks = view => {\n if (view.main) {\n const allInlineNodes = [];\n\n Object.keys(view).forEach(eachView => {\n allInlineNodes.push(\n ...DocumentHelpers.findInlineNodes(view[eachView].state.doc),\n );\n });\n\n const allBlockNodes = DocumentHelpers.findBlockNodes(view.main.state.doc);\n const finalMarks = [];\n const finalNodes = [];\n\n allInlineNodes.map(node => {\n if (node.node.marks.length > 0) {\n node.node.marks.filter(mark => {\n if (\n mark.type.name === 'comment' ||\n mark.type.name === 'insertion' ||\n mark.type.name === 'deletion' ||\n mark.type.name === 'format_change'\n ) {\n mark.pos = node.pos;\n finalMarks.push(mark);\n }\n });\n }\n });\n\n allBlockNodes.map(node => {\n if (node.node.attrs.track && node.node.attrs.track.length > 0) {\n finalNodes.push(node);\n }\n });\n\n const nodesAndMarks = [...uniqBy(finalMarks, 'attrs.id'), ...finalNodes];\n\n const groupedMarkNodes = {};\n\n nodesAndMarks.forEach(markNode => {\n const markNodeAttrs = markNode.attrs\n ? markNode.attrs\n : markNode.node.attrs;\n\n if (!groupedMarkNodes[markNodeAttrs.group]) {\n groupedMarkNodes[markNodeAttrs.group] = [markNode];\n } else {\n groupedMarkNodes[markNodeAttrs.group].push(markNode);\n }\n });\n return groupedMarkNodes;\n }\n return [];\n};\n","import React, { useContext, useState } from 'react';\nimport styled from 'styled-components';\nimport { ButtonStyles } from 'wax-prosemirror-themes';\nimport { WaxContext } from 'wax-prosemirror-core';\n\nconst ButtonStyled = styled.button`\n ${ButtonStyles};\n opacity: ${props => (props.select ? 1 : 0.4)};\n pointer-events: ${props => (props.select ? 'default' : 'none')};\n color: ${props => (props.isActive ? 'white' : props.theme.colorButton)};\n background-color: ${props =>\n props.isActive ? props.theme.colorPrimary : 'transparent'};\n &:hover {\n background-color: ${props =>\n props.isActive ? props.theme.colorPrimary : 'transparent'};\n }\n`;\n\nconst TrackChangeEnable = ({ view = {}, item, enabled }) => {\n if (item.onlyOnMain) {\n const {\n view: { main },\n } = useContext(WaxContext);\n view = main;\n }\n\n const [isEnabled, setEnabled] = useState(enabled);\n\n return (\n <ButtonStyled\n type=\"button\"\n isActive={isEnabled}\n title={item.title}\n disabled={item.enable && !item.enable(view.state)}\n onMouseDown={e => {\n e.preventDefault();\n setEnabled(!isEnabled);\n item.run(view.state, view.dispatch);\n }}\n select={item.select && item.select(view.state)}\n >\n {item.content}\n </ButtonStyled>\n );\n};\n\nexport default TrackChangeEnable;\n"],"names":["_taggedTemplateLiteral","strings","raw","slice","Object","freeze","defineProperties","value","InfoAreaContainer","styled","div","InfoArea","React","OverlayContainer","props","position","left","top","Overlay","children","ButtonStyled","button","ButtonStyles","select","isActive","theme","colorButton","colorPrimary","Button","view","item","useContext","WaxContext","main","activeViewId","onlyOnMain","active","state","title","enable","e","preventDefault","run","dispatch","content","em","faItalic","italic","strong","faBold","bold","code","faCode","subscript","faSubscript","superscript","faSuperscript","underline","faUnderline","strikethrough","faStrikethrough","link","faLink","paragraph","faParagraph","heading","faHeading","blockquote","faQuoteLeft","code_block","faFileCode","ordered_list","faListOl","bullet_list","faListUl","image","faImage","table","faTable","footnote","faStickyNote","undo","faUndo","redo","faRedo","lift","faOutdent","join_up","faAngleUp","source","faVial","ellipses","faEllipsisH","small_caps","DropdownStyled","Dropdown","dropDownOptions","label","TableDropDown","option","tablesFn","UploadImage","ImageUpload","fileUpload","target","files","LeftMenuStyled","LeftMenuTitle","_arrayWithHoles","arr","Array","isArray","_iterableToArrayLimit","i","Symbol","iterator","_arr","_n","_d","_e","undefined","_i","_s","next","done","push","length","err","_arrayLikeToArray","len","arr2","_unsupportedIterableToArray","o","minLen","arrayLikeToArray","n","prototype","toString","call","constructor","name","from","test","_nonIterableRest","TypeError","_slicedToArray","arrayWithHoles","iterableToArrayLimit","unsupportedIterableToArray","nonIterableRest","ToolGroupStyled","MoreButton","InnerStyled","ToolGroupComponent","tools","useState","more","showHide","toolsShown","rest","DisplayTitle","isFunction","forEach","tool","isIntoMoreSection","isDisplayed","renderTool","icons","NoteNumberStyled","onClick","NoteNumber","number","NoteEditorContainerStyled","NoteStyled","NoteEditorContainer","forwardRef","ref","_defineProperty","obj","key","defineProperty","enumerable","configurable","writable","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","apply","_objectSpread2","arguments","getOwnPropertyDescriptors","LinkWrapper","LinkComponent","mark","setPosition","href","attrs","linkMark","activeView","useRef","linkInput","addButtonText","setButtonText","lastLinkMark","setLLastLinkMark","linkHref","setLinkHref","useEffect","setLinkText","removeMarkIfEmptyHref","current","addLinkHref","schema","marks","tr","addMark","to","create","focus","removeLink","removeMark","handleKeyDown","event","which","updateLinkHref","selection","$from","$to","PMLinkMark","actualMark","DocumentHelpers","getSelectionMark","pos","setMeta","CommentBubbleComponent","showComment","group","useLayoutEffect","WaxSurface","dom","getBoundingClientRect","start","coordsAtPos","end","difference","width","x","createComment","Commands","isSelectionComment","commentMark","comment","findMark","_arrayWithoutHoles","_iterableToArray","iter","_nonIterableSpread","_toConsumableArray","arrayWithoutHoles","iterableToArray","nonIterableSpread","SinlgeCommentRow","user","commentInput","commentAnnotation","setCommentAnnotation","commentInputValue","setcommentInputValue","allCommentsWithSameId","findAllMarksWithSameId","conversation","setTimeout","saveComment","stopPropagation","doc","displayName","username","timestamp","Math","floor","Date","now","singleComment","nodeSize","updateCommentInputValue","onBlur","resolveComment","maxPos","minPos","markPosition","findMarkPosition","last","node","commentInputReply","map","index","uuidv4","CommentBoxStyled","dataBox","console","log","animate","setAnimate","id","MemorizedComponent","memo","app","commentPlugin","PmPlugins","get","activeComment","getState","setCommentActive","viewId","viewid","maxBy","setSelection","TextSelection","resolve","Transition","TrackChangeBoxStyled","trackChange","action","Mark","type","before","after","Fragment","commentsTracks","commentTrack","area","marksNodes","setMarksNodes","isFirstRun","setFirstRun","setTops","useCallback","result","markNodeEl","annotationTop","boxHeight","allCommentsTop","nodesMarksToIterrate","sortBy","each","markNode","document","querySelector","panelWrapper","getElementsByClassName","panelWrapperHeight","height","boxEl","parseInt","offsetHeight","previousBox","previousEndHeight","endHeight","b","boxAbove","boxAboveEnds","currentTop","doesOverlap","overlap","previousMarkNode","useDeepCompareEffect","updateMarks","CommentTrackComponent","useMemo","allInlineNodes","eachView","findInlineNodes","allBlockNodes","findBlockNodes","finalMarks","finalNodes","track","nodesAndMarks","uniqBy","groupedMarkNodes","markNodeAttrs","TrackChangeEnable","enabled","isEnabled","setEnabled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAe,SAASA,sBAAT,CAAgCC,OAAhC,EAAyCC,GAAzC,EAA8C;AAC3D,MAAI,CAACA,GAAL,EAAU;AACRA,IAAAA,GAAG,GAAGD,OAAO,CAACE,KAAR,CAAc,CAAd,CAAN;AACD;;AAED,SAAOC,MAAM,CAACC,MAAP,CAAcD,MAAM,CAACE,gBAAP,CAAwBL,OAAxB,EAAiC;AACpDC,IAAAA,GAAG,EAAE;AACHK,MAAAA,KAAK,EAAEH,MAAM,CAACC,MAAP,CAAcH,GAAd;AADJ;AAD+C,GAAjC,CAAd,CAAP;AAKD;;;;;;;;;;;ACPD,IAAMM,iBAAiB,GAAGC,MAAM,CAACC,GAAV,oBACnB;AAAG;;;;;;AADgB,CAAvB;;AASA,IAAMC,QAAQ,GAAG,SAAXA,QAAW;AAAA,sBAAMC,6BAAC,iBAAD,OAAN;AAAA,CAAjB;;;;;;;;;;;ACTA,IAAMC,gBAAgB,GAAGJ,MAAM,CAACC,GAAV,sBACR,UAAAI,KAAK;AAAA,SAAIA,KAAK,CAACC,QAAN,CAAeA,QAAnB;AAAA,CADG,EAEZ,UAAAD,KAAK;AAAA,mBAAOA,KAAK,CAACC,QAAN,CAAeC,IAAtB;AAAA,CAFO,EAGb,UAAAF,KAAK;AAAA,mBAAOA,KAAK,CAACC,QAAN,CAAeE,GAAtB;AAAA,CAHQ,CAAtB;;AAOA,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAAAJ,KAAK;AAAA,sBACnBF,6BAAC,gBAAD,EAAsBE,KAAtB,EAA8BA,KAAK,CAACK,QAApC,CADmB;AAAA,CAArB;;;;;;;;;;;ACJA,IAAMC,YAAY,GAAGX,MAAM,CAACY,MAAV,sBACdC,iCADc,EAEL,UAAAR,KAAK;AAAA,SAAKA,KAAK,CAACS,MAAN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GAAGI,IAAP;AACD;;AANyD,kBAQ1B0H,cAAQ,CAACyO,OAAD,CARkB;AAAA;AAAA,MAQnDC,SARmD;AAAA,MAQxCC,UARwC;;AAU1D,sBACE1X,6BAACQ,cAAD;AACE,IAAA,IAAI,EAAC,QADP;AAEE,IAAA,QAAQ,EAAEiX,SAFZ;AAGE,IAAA,KAAK,EAAEvW,IAAI,CAACQ,KAHd;AAIE,IAAA,QAAQ,EAAER,IAAI,CAACS,MAAL,IAAe,CAACT,IAAI,CAACS,MAAL,CAAYV,IAAI,CAACQ,KAAjB,CAJ5B;AAKE,IAAA,WAAW,EAAE,qBAAAG,CAAC,EAAI;AAChBA,MAAAA,CAAC,CAACC,cAAF;AACA6V,MAAAA,UAAU,CAAC,CAACD,SAAF,CAAV;AACAvW,MAAAA,IAAI,CAACY,GAAL,CAASb,IAAI,CAACQ,KAAd,EAAqBR,IAAI,CAACc,QAA1B;AACD,KATH;AAUE,IAAA,MAAM,EAAEb,IAAI,CAACP,MAAL,IAAeO,IAAI,CAACP,MAAL,CAAYM,IAAI,CAACQ,KAAjB;AAVzB,KAYGP,IAAI,CAACc,OAZR,CADF;AAgBD,CA1BD;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/wax-prosemirror-components/src/components/ImageUpload.js b/wax-prosemirror-components/src/components/ImageUpload.js index 5858b097b..b4a0ebfad 100644 --- a/wax-prosemirror-components/src/components/ImageUpload.js +++ b/wax-prosemirror-components/src/components/ImageUpload.js @@ -3,6 +3,8 @@ import React from 'react'; import styled from 'styled-components'; const UploadImage = styled.div` + opacity: ${props => (props.select ? 1 : 0.4)}; + pointer-events: ${props => (props.select ? 'default' : 'none')}; color: #777; display: inline-flex; padding: 0px 10px; @@ -15,20 +17,23 @@ const UploadImage = styled.div` display: none; } `; -const ImageUpload = ({ item, fileUpload }) => ( - <UploadImage> - <label - className="custom-file-upload" - title="upload image" - htmlFor="file-upload" - > - {item.content} - <input - id="file-upload" - onChange={e => fileUpload(e.target.files[0])} - type="file" - /> - </label> - </UploadImage> -); +const ImageUpload = ({ item, fileUpload, view }) => { + const { activeViewId } = useContext(WaxContext); + return ( + <UploadImage select={item.select && item.select(view.state, activeViewId)}> + <label + className="custom-file-upload" + title="upload image" + htmlFor="file-upload" + > + {item.content} + <input + id="file-upload" + onChange={e => fileUpload(e.target.files[0])} + type="file" + /> + </label> + </UploadImage> + ); +}; export default ImageUpload; diff --git a/wax-prosemirror-core/dist/index.js b/wax-prosemirror-core/dist/index.js new file mode 100644 index 000000000..9478f87dc --- /dev/null +++ b/wax-prosemirror-core/dist/index.js @@ -0,0 +1,795 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var React = require('react'); +var React__default = _interopDefault(React); +var debounce = _interopDefault(require('lodash/debounce')); +var styled = _interopDefault(require('styled-components')); +var inversify = require('inversify'); +require('reflect-metadata'); +var deepmerge = _interopDefault(require('deepmerge')); +var lodash = require('lodash'); +var waxProsemirrorServices = require('wax-prosemirror-services'); +var prosemirrorModel = require('prosemirror-model'); +var applyDevTools = _interopDefault(require('prosemirror-dev-tools')); +var prosemirrorState = require('prosemirror-state'); +var prosemirrorView = require('prosemirror-view'); +require('prosemirror-view/style/prosemirror.css'); +var uuid = require('uuid'); +var waxProsemirrorUtilities = require('wax-prosemirror-utilities'); +var prosemirrorHistory = require('prosemirror-history'); +var prosemirrorDropcursor = require('prosemirror-dropcursor'); +var prosemirrorGapcursor = require('prosemirror-gapcursor'); +require('prosemirror-gapcursor/style/gapcursor.css'); + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); + } + + return keys; +} + +function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + + if (i % 2) { + ownKeys(Object(source), true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + } + + return target; +} + +function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; +} + +function _iterableToArrayLimit(arr, i) { + if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; +} + +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + + return arr2; +} + +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(n); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} + +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} + +function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); +} + +var WaxContext = React__default.createContext({ + view: {}, + activeView: {}, + activeViewId: null, + app: null, + updateView: null, + updateActiveView: null +}); +var WaxProvider = (function (props) { + var _useState = React.useState({ + app: props.app, + view: props.view || {}, + activeView: props.activeView || {}, + activeViewId: props.activeViewId || {}, + updateView: function updateView(newView, activeViewId) { + var view = Object.assign(context.view, newView); + var activeView = view[activeViewId || context.activeViewId]; + setContext(_objectSpread2({}, context, { + view: view, + activeView: activeView, + activeViewId: activeViewId || context.activeViewId + })); + } + }), + _useState2 = _slicedToArray(_useState, 2), + context = _useState2[0], + setContext = _useState2[1]; + + return /*#__PURE__*/React__default.createElement(WaxContext.Provider, { + value: _objectSpread2({}, context) + }, props.children); +}); +var useInjection = function useInjection(identifier) { + var _useContext = React.useContext(WaxContext), + container = _useContext.app.container; + + if (!container) { + throw new Error(); + } + + return container.isBound(identifier) ? { + instance: container.get(identifier) + } : null; +}; + +function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); +} + +function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); +} + +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} + +function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); +} + +function _taggedTemplateLiteral(strings, raw) { + if (!raw) { + raw = strings.slice(0); + } + + return Object.freeze(Object.defineProperties(strings, { + raw: { + value: Object.freeze(raw) + } + })); +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} + +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; +} + +var _dec, _class, _temp; +var Config = (_dec = inversify.injectable(), _dec(_class = (_temp = /*#__PURE__*/function () { + function Config(config) { + _classCallCheck(this, Config); + + this._config = {}; + this._config = config; + } + + Config = inversify.inject('config')(Config, undefined, 0) || Config; + + _createClass(Config, [{ + key: "set", + value: function set(key, value) { + lodash.set(this._config, key, value); + + return this._config; + } + }, { + key: "get", + value: function get(key) { + return lodash.get(this._config, key); + } + }, { + key: "pushToArray", + value: function pushToArray(key, value) { + var oldValue = this.get(key); + + if (oldValue) { + if (lodash.isArrayLikeObject(value)) { + value.forEach(function (v) { + oldValue.push(v); + }); + } else { + oldValue.push(value); + } + } else { + oldValue = value; + } + + this.set(key, oldValue); + return this; + } + }]); + + return Config; +}(), _temp)) || _class); + +var defaultConfig = { + services: [new waxProsemirrorServices.SchemaService(), new waxProsemirrorServices.RulesService(), new waxProsemirrorServices.ShortCutsService(), new waxProsemirrorServices.LayoutService(), new waxProsemirrorServices.MenuService(), new waxProsemirrorServices.OverlayService()] +}; + +var _dec$1, _class$1, _temp$1; +var PmPlugins = (_dec$1 = inversify.injectable(), _dec$1(_class$1 = (_temp$1 = /*#__PURE__*/function () { + function PmPlugins() { + _classCallCheck(this, PmPlugins); + + this._plugins = new Map(); + } + + _createClass(PmPlugins, [{ + key: "add", + value: function add(key, plugin) { + this._plugins.set(key, plugin); + } + }, { + key: "getAll", + value: function getAll() { + return _toConsumableArray(this._plugins.values()); + } + }, { + key: "get", + value: function get(key) { + return this._plugins.get(key); + } + }]); + + return PmPlugins; +}(), _temp$1)) || _class$1); + +var Application = /*#__PURE__*/function () { + function Application(container) { + _classCallCheck(this, Application); + + this.container = container; + this.PmPlugins = container.get('PmPlugins'); + } + + _createClass(Application, [{ + key: "registerServices", + value: function registerServices() { + var count = 0; + + while (count < this.config.get('config.services').length) { + var allServices = this.config.get('config.services'); + var service = this.config.get('config.services')[count]; + /* + set App to every service + so services can have access to containers and config + */ + + service.setApp(this); + + if (service.dependencies) { + var servicePos = count; + allServices.splice.apply(allServices, [servicePos + 1, 0].concat(_toConsumableArray(service.dependencies))); + } + + if (service.register) { + service.register(); + } + + count += 1; + } + } + }, { + key: "setConfig", + value: function setConfig() { + this.config = this.container.get('Config'); + } + }, { + key: "bootServices", + value: function bootServices() { + var services = this.config.get('config.services'); + services.forEach(function (plugin) { + if (plugin.boot) { + plugin.boot(); + } + }); + } + }, { + key: "getPlugins", + value: function getPlugins() { + return this.PmPlugins.getAll(); + } + }, { + key: "getSchema", + value: function getSchema() { + this.schema = this.container.get('Schema'); + return this.schema.getSchema(); + } + }, { + key: "resetApp", + value: function resetApp() { + this.container = {}; + this.config = {}; + this.PmPlugins = {}; + this.schema = {}; + } + }], [{ + key: "create", + value: function create(config) { + /* Merge Core Config with User Config */ + var appConfig = deepmerge({ + config: defaultConfig + }, config, { + customMerge: function customMerge(key) { + if (key === 'services') { + return function (coreService, configService) { + return coreService.concat(configService); + }; + } + } + }); + /* + Create Container + */ + + var container = new inversify.Container(); + /* + Set base bindings for the App to work + */ + + container.bind('PmPlugins').to(PmPlugins).inSingletonScope(); + container.bind('Wax').toFactory(function () { + return new Application(container); + }); + container.bind('config').toConstantValue(appConfig); + container.bind('Config').to(Config).inSingletonScope(); + /* + Start the App + */ + + var app = container.get('Wax'); + app.setConfig(); + appConfig.config.PmPlugins.forEach(function (configPlugin) { + app.PmPlugins.add(configPlugin.key, configPlugin); + }); + app.registerServices(); + return app; + } + }]); + + return Application; +}(); + +function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + writable: true, + configurable: true + } + }); + if (superClass) _setPrototypeOf(subClass, superClass); +} + +function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); +} + +function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; + } +} + +function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function _typeof(obj) { + return typeof obj; + }; + } else { + _typeof = function _typeof(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); +} + +function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; +} + +function _possibleConstructorReturn(self, call) { + if (call && (_typeof(call) === "object" || typeof call === "function")) { + return call; + } + + return _assertThisInitialized(self); +} + +function _createSuper(Derived) { + return function () { + var Super = _getPrototypeOf(Derived), + result; + + if (_isNativeReflectConstruct()) { + var NewTarget = _getPrototypeOf(this).constructor; + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); + } + + return _possibleConstructorReturn(this, result); + }; +} + +var WaxDOMSerializer = /*#__PURE__*/function (_DOMSerializer) { + _inherits(WaxDOMSerializer, _DOMSerializer); + + var _super = _createSuper(WaxDOMSerializer); + + function WaxDOMSerializer() { + _classCallCheck(this, WaxDOMSerializer); + + return _super.apply(this, arguments); + } + + return WaxDOMSerializer; +}(prosemirrorModel.DOMSerializer); + +var WaxDOMParser = /*#__PURE__*/function (_DOMParser) { + _inherits(WaxDOMParser, _DOMParser); + + var _super = _createSuper(WaxDOMParser); + + function WaxDOMParser() { + _classCallCheck(this, WaxDOMParser); + + return _super.apply(this, arguments); + } + + return WaxDOMParser; +}(prosemirrorModel.DOMParser); + +var transformPasted = function transformPasted(slice, view) { + var content = slice.content; + var commentNodes = waxProsemirrorUtilities.DocumentHelpers.findChildrenByMark(content, view.state.schema.marks.comment, true); + var notes = waxProsemirrorUtilities.DocumentHelpers.findChildrenByType(content, view.state.schema.nodes.footnote, true); + var allComments = []; + commentNodes.map(function (node) { + node.node.marks.map(function (comment) { + if (comment.type.name === 'comment') { + allComments.push(comment); + } + }); + }); + var groupedCommentsById = allComments.reduce(function (obj, mark) { + obj[mark.attrs.id] = [].concat(_toConsumableArray(obj[mark.attrs.id] || []), [mark]); + return obj; + }, {}); + lodash.forEach(Object.keys(groupedCommentsById), function (key) { + var id = uuid.v4(); + lodash.forEach(groupedCommentsById[key], function (comment) { + comment.attrs.id = id; + }); + }); + notes.forEach(function (note) { + note.node.attrs.id = uuid.v4(); + }); + return slice; +}; + +var WaxView = (function (props) { + var readonly = props.readonly, + onBlur = props.onBlur, + options = props.options, + debug = props.debug, + autoFocus = props.autoFocus, + user = props.user; + var editorRef = React.useRef(); + var view; + var context = React.useContext(WaxContext); + var setEditorRef = React.useCallback(function (node) { + if (editorRef.current) ; + + if (node) { + view = new prosemirrorView.EditorView({ + mount: node + }, { + editable: function editable() { + return !readonly; + }, + state: prosemirrorState.EditorState.create(options), + dispatchTransaction: dispatchTransaction, + user: user, + handleDOMEvents: { + blur: onBlur ? function (view) { + onBlur(view.state.doc.content); + } : null + }, + transformPasted: function transformPasted$1(slice) { + return transformPasted(slice, view); + } + }); + context.updateView({ + main: view + }, 'main'); + if (debug) applyDevTools(view); + if (autoFocus) view.focus(); + return function () { + return view.destroy(); + }; + } + + editorRef.current = node; + }, []); + + var dispatchTransaction = function dispatchTransaction(transaction) { + var TrackChange = props.TrackChange; + var tr = TrackChange.enabled ? waxProsemirrorServices.trackedTransaction(transaction, view.state, user) : transaction; + var state = view.state.apply(tr); + view.updateState(state); + /* when a transaction comes from a view other than + main don't keep updating the view ,as this is + the central point of each transaction + */ + + if (!transaction.getMeta('outsideView')) { + context.updateView({ + main: view + }, 'main'); + } + + props.onChange(state.doc.content); + }; + + var editor = /*#__PURE__*/React__default.createElement("div", { + ref: setEditorRef + }); + return props.children({ + editor: editor + }); +}); + +var defaultPlugins = [prosemirrorDropcursor.dropCursor(), prosemirrorGapcursor.gapCursor(), prosemirrorHistory.history()]; + +var placeHolderText = new prosemirrorState.PluginKey("placeHolderText"); +var Placeholder = (function (props) { + return new prosemirrorState.Plugin({ + key: placeHolderText, + props: { + decorations: function decorations(state) { + var decorations = []; + + var decorate = function decorate(node, pos) { + if (node.type.isBlock && node.childCount === 0 && state.doc.content.childCount === 1) { + decorations.push(prosemirrorView.Decoration.node(pos, pos + node.nodeSize, { + "class": "empty-node", + "data-content": props.content + })); + } + }; + + state.doc.descendants(decorate); + return prosemirrorView.DecorationSet.create(state.doc, decorations); + } + } + }); +}); + +function _templateObject() { + var data = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 99%;\n"]); + + _templateObject = function _templateObject() { + return data; + }; + + return data; +} + +var parser = function parser(schema) { + var WaxParser = WaxDOMParser.fromSchema(schema); + return function (content) { + var container = document.createElement('article'); + container.innerHTML = content; + return WaxParser.parse(container); + }; +}; + +var serializer = function serializer(schema) { + var WaxSerializer = WaxDOMSerializer.fromSchema(schema); + return function (content) { + var container = document.createElement('article'); + container.appendChild(WaxSerializer.serializeFragment(content)); + return container.innerHTML; + }; +}; + +var schema; + +var createApplication = function createApplication(props) { + var application = Application.create(props); + schema = application.getSchema(); + application.bootServices(); + return application; +}; + +var createPlaceholder = function createPlaceholder(placeholder) { + return Placeholder({ + content: placeholder + }); +}; + +var LayoutWrapper = styled.div(_templateObject()); + +var Wax = function Wax(props) { + var finalPlugins = []; + + var _useState = React.useState(), + _useState2 = _slicedToArray(_useState, 2), + application = _useState2[0], + setApplication = _useState2[1]; + + React.useEffect(function () { + var newApplication = createApplication(props); + setApplication(newApplication); + return function () { + return newApplication.resetApp(); + }; + }, []); + var autoFocus = props.autoFocus, + className = props.className, + debug = props.debug, + fileUpload = props.fileUpload, + layout = props.layout, + onBlur = props.onBlur, + placeholder = props.placeholder, + readonly = props.readonly, + value = props.value, + user = props.user, + onChange = props.onChange; + if (!application) return null; + var WaxOnchange = onChange ? onChange : function (value) { + return true; + }; + var editorContent = value ? value : ''; + finalPlugins = defaultPlugins.concat([createPlaceholder(placeholder)].concat(_toConsumableArray(application.getPlugins()))); + var WaxOptions = { + schema: schema, + plugins: finalPlugins + }; + var parse = parser(schema); + var serialize = serializer(schema); + WaxOptions.doc = parse(editorContent); + var finalOnChange = debounce(function (value) { + WaxOnchange(serialize(value)); + }, 1000, { + maxWait: 5000 + }); + var TrackChange = application.config.get('config.EnableTrackChangeService'); + var Layout = application.container.get('Layout'); + if (layout) Layout.setLayout(layout); + var WaxRender = Layout.layoutComponent; + return /*#__PURE__*/React__default.createElement(LayoutWrapper, { + className: "".concat(className) + }, /*#__PURE__*/React__default.createElement(WaxProvider, { + app: application + }, /*#__PURE__*/React__default.createElement(WaxView, { + autoFocus: autoFocus, + readonly: readonly, + options: WaxOptions, + placeholder: placeholder, + fileUpload: fileUpload, + onBlur: onBlur || function (v) { + return true; + }, + onChange: finalOnChange || function (v) { + return true; + }, + debug: debug, + TrackChange: TrackChange, + user: user + }, function (_ref) { + var editor = _ref.editor; + return /*#__PURE__*/React__default.createElement(WaxRender, { + editor: editor + }); + }))); +}; + +exports.Wax = Wax; +exports.WaxContext = WaxContext; +exports.useInjection = useInjection; +//# sourceMappingURL=index.js.map diff --git a/wax-prosemirror-core/dist/index.js.map b/wax-prosemirror-core/dist/index.js.map new file mode 100644 index 000000000..0083443fe --- /dev/null +++ b/wax-prosemirror-core/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectSpread2.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray.js","../src/WaxContext.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/iterableToArray.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/classCallCheck.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/createClass.js","../src/config/Config.js","../src/config/defaultConfig.js","../src/PmPlugins.js","../src/Application.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/inherits.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/typeof.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/createSuper.js","../src/WaxDOMSerializer.js","../src/WaxDOMParser.js","../src/helpers/TransformPasted.js","../src/WaxView.js","../src/plugins/defaultPlugins.js","../src/plugins/placeholder.js","../src/Wax.js"],"sourcesContent":["export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import defineProperty from \"./defineProperty\";\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nexport default function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}","export default function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}","export default function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}","import arrayLikeToArray from \"./arrayLikeToArray\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import arrayWithHoles from \"./arrayWithHoles\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray\";\nimport nonIterableRest from \"./nonIterableRest\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","import React, { useContext, useState } from 'react';\n\nexport const WaxContext = React.createContext({\n view: {},\n activeView: {},\n activeViewId: null,\n app: null,\n updateView: null,\n updateActiveView: null,\n});\n\nexport default props => {\n const [context, setContext] = useState({\n app: props.app,\n view: props.view || {},\n activeView: props.activeView || {},\n activeViewId: props.activeViewId || {},\n updateView: (newView, activeViewId) => {\n const view = Object.assign(context.view, newView);\n const activeView = view[activeViewId || context.activeViewId];\n setContext({\n ...context,\n view,\n activeView: activeView,\n activeViewId: activeViewId || context.activeViewId,\n });\n },\n });\n\n return (\n <WaxContext.Provider\n value={{\n ...context,\n }}\n >\n {props.children}\n </WaxContext.Provider>\n );\n};\n\nexport const useInjection = identifier => {\n const {\n app: { container },\n } = useContext(WaxContext);\n\n if (!container) {\n throw new Error();\n }\n\n return container.isBound(identifier)\n ? { instance: container.get(identifier) }\n : null;\n};\n","import arrayLikeToArray from \"./arrayLikeToArray\";\nexport default function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}","export default function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import arrayWithoutHoles from \"./arrayWithoutHoles\";\nimport iterableToArray from \"./iterableToArray\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray\";\nimport nonIterableSpread from \"./nonIterableSpread\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}","export default function _taggedTemplateLiteral(strings, raw) {\n if (!raw) {\n raw = strings.slice(0);\n }\n\n return Object.freeze(Object.defineProperties(strings, {\n raw: {\n value: Object.freeze(raw)\n }\n }));\n}","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","import { set, get, isArrayLikeObject } from 'lodash';\nimport { injectable, inject } from 'inversify';\n\n@injectable()\nexport default class Config {\n _config = {};\n constructor(@inject('config') config) {\n this._config = config;\n }\n\n set(key, value) {\n set(this._config, key, value);\n return this._config;\n }\n\n get(key) {\n return get(this._config, key);\n }\n\n pushToArray(key, value) {\n let oldValue = this.get(key);\n if (oldValue) {\n if (isArrayLikeObject(value)) {\n value.forEach(v => {\n oldValue.push(v);\n });\n } else {\n oldValue.push(value);\n }\n } else {\n oldValue = value;\n }\n this.set(key, oldValue);\n return this;\n }\n}\n","import {\n SchemaService,\n MenuService,\n RulesService,\n ShortCutsService,\n LayoutService,\n OverlayService,\n} from 'wax-prosemirror-services';\n\nexport default {\n services: [\n new SchemaService(),\n new RulesService(),\n new ShortCutsService(),\n new LayoutService(),\n new MenuService(),\n new OverlayService(),\n ],\n};\n","import { injectable } from \"inversify\";\n@injectable()\nexport default class PmPlugins {\n _plugins = new Map();\n add(key, plugin) {\n this._plugins.set(key, plugin);\n }\n\n getAll() {\n return [...this._plugins.values()];\n }\n\n get(key) {\n return this._plugins.get(key);\n }\n}\n","import { Container } from 'inversify';\nimport 'reflect-metadata';\nimport deepmerge from 'deepmerge';\nimport Config from './config/Config';\nimport defaultConfig from './config/defaultConfig';\nimport PmPlugins from './PmPlugins';\n\nexport default class Application {\n constructor(container) {\n this.container = container;\n this.PmPlugins = container.get('PmPlugins');\n }\n\n registerServices() {\n let count = 0;\n while (count < this.config.get('config.services').length) {\n const allServices = this.config.get('config.services');\n const service = this.config.get('config.services')[count];\n /*\n set App to every service\n so services can have access to containers and config\n */\n service.setApp(this);\n\n if (service.dependencies) {\n const servicePos = count;\n allServices.splice(servicePos + 1, 0, ...service.dependencies);\n }\n\n if (service.register) {\n service.register();\n }\n\n count += 1;\n }\n }\n\n setConfig() {\n this.config = this.container.get('Config');\n }\n\n bootServices() {\n const services = this.config.get('config.services');\n services.forEach(plugin => {\n if (plugin.boot) {\n plugin.boot();\n }\n });\n }\n\n getPlugins() {\n return this.PmPlugins.getAll();\n }\n\n getSchema() {\n this.schema = this.container.get('Schema');\n return this.schema.getSchema();\n }\n\n resetApp() {\n this.container = {};\n this.config = {};\n this.PmPlugins = {};\n this.schema = {};\n }\n\n static create(config) {\n /* Merge Core Config with User Config */\n const appConfig = deepmerge({ config: defaultConfig }, config, {\n customMerge: key => {\n if (key === 'services') {\n return (coreService, configService) => {\n return coreService.concat(configService);\n };\n }\n },\n });\n\n /*\n Create Container\n */\n const container = new Container();\n /*\n\n Set base bindings for the App to work\n */\n container.bind('PmPlugins').to(PmPlugins).inSingletonScope();\n\n container.bind('Wax').toFactory(() => new Application(container));\n\n container.bind('config').toConstantValue(appConfig);\n container.bind('Config').to(Config).inSingletonScope();\n\n /*\n Start the App\n */\n const app = container.get('Wax');\n app.setConfig();\n appConfig.config.PmPlugins.forEach(configPlugin => {\n app.PmPlugins.add(configPlugin.key, configPlugin);\n });\n app.registerServices();\n\n return app;\n }\n}\n","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","export default function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","import _typeof from \"../../helpers/esm/typeof\";\nimport assertThisInitialized from \"./assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","import getPrototypeOf from \"./getPrototypeOf\";\nimport isNativeReflectConstruct from \"./isNativeReflectConstruct\";\nimport possibleConstructorReturn from \"./possibleConstructorReturn\";\nexport default function _createSuper(Derived) {\n return function () {\n var Super = getPrototypeOf(Derived),\n result;\n\n if (isNativeReflectConstruct()) {\n var NewTarget = getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return possibleConstructorReturn(this, result);\n };\n}","import { DOMSerializer } from \"prosemirror-model\";\n\nclass WaxDOMSerializer extends DOMSerializer {}\n\nexport default WaxDOMSerializer;\n","import { DOMParser } from \"prosemirror-model\";\n\nclass WaxDOMParser extends DOMParser {}\n\nexport default WaxDOMParser;\n","import { forEach } from 'lodash';\nimport { v4 as uuidv4 } from 'uuid';\nimport { DocumentHelpers } from 'wax-prosemirror-utilities';\n\nconst transformPasted = (slice, view) => {\n const { content } = slice;\n const commentNodes = DocumentHelpers.findChildrenByMark(\n content,\n view.state.schema.marks.comment,\n true,\n );\n\n const notes = DocumentHelpers.findChildrenByType(\n content,\n view.state.schema.nodes.footnote,\n true,\n );\n\n const allComments = [];\n\n commentNodes.map(node => {\n node.node.marks.map(comment => {\n if (comment.type.name === 'comment') {\n allComments.push(comment);\n }\n });\n });\n\n const groupedCommentsById = allComments.reduce((obj, mark) => {\n obj[mark.attrs.id] = [...(obj[mark.attrs.id] || []), mark];\n return obj;\n }, {});\n\n forEach(Object.keys(groupedCommentsById), key => {\n const id = uuidv4();\n forEach(groupedCommentsById[key], comment => {\n comment.attrs.id = id;\n });\n });\n\n notes.forEach(note => {\n note.node.attrs.id = uuidv4();\n });\n\n return slice;\n};\n\nexport default transformPasted;\n","import React, { useRef, useContext, useCallback } from 'react';\n\nimport applyDevTools from 'prosemirror-dev-tools';\nimport { EditorState } from 'prosemirror-state';\nimport { EditorView } from 'prosemirror-view';\n\nimport 'prosemirror-view/style/prosemirror.css';\n\nimport { trackedTransaction } from 'wax-prosemirror-services';\nimport { WaxContext } from './WaxContext';\nimport transformPasted from './helpers/TransformPasted';\n\nexport default props => {\n const { readonly, onBlur, options, debug, autoFocus, user } = props;\n\n const editorRef = useRef();\n let view;\n const context = useContext(WaxContext);\n\n const setEditorRef = useCallback(node => {\n if (editorRef.current) {\n // this is where you do cleanup if you have to. the editorRef.current will\n // still point to the old ref, the old node. so you have some time here to\n // clean up the unmount if you need to.\n }\n\n if (node) {\n view = new EditorView(\n { mount: node },\n {\n editable: () => !readonly,\n state: EditorState.create(options),\n dispatchTransaction,\n user,\n handleDOMEvents: {\n blur: onBlur\n ? view => {\n onBlur(view.state.doc.content);\n }\n : null,\n },\n transformPasted: slice => {\n return transformPasted(slice, view);\n },\n },\n );\n\n context.updateView(\n {\n main: view,\n },\n 'main',\n );\n if (debug) applyDevTools(view);\n if (autoFocus) view.focus();\n\n return () => view.destroy();\n }\n editorRef.current = node;\n }, []);\n\n const dispatchTransaction = transaction => {\n const { TrackChange } = props;\n\n const tr = TrackChange.enabled\n ? trackedTransaction(transaction, view.state, user)\n : transaction;\n\n const state = view.state.apply(tr);\n view.updateState(state);\n\n /* when a transaction comes from a view other than\n main don't keep updating the view ,as this is\n the central point of each transaction\n */\n if (!transaction.getMeta('outsideView')) {\n context.updateView(\n {\n main: view,\n },\n 'main',\n );\n }\n\n props.onChange(state.doc.content);\n };\n\n const editor = <div ref={setEditorRef} />;\n return props.children({\n editor,\n });\n};\n","import { history } from \"prosemirror-history\";\nimport { dropCursor } from \"prosemirror-dropcursor\";\nimport { gapCursor } from \"prosemirror-gapcursor\";\nimport \"prosemirror-gapcursor/style/gapcursor.css\";\n\nexport default [dropCursor(), gapCursor(), history()];\n","import { Plugin, PluginKey } from \"prosemirror-state\";\nimport { Decoration, DecorationSet } from \"prosemirror-view\";\n\nconst placeHolderText = new PluginKey(\"placeHolderText\");\n\nexport default props => {\n return new Plugin({\n key: placeHolderText,\n props: {\n decorations: state => {\n const decorations = [];\n const decorate = (node, pos) => {\n if (\n node.type.isBlock &&\n node.childCount === 0 &&\n state.doc.content.childCount === 1\n ) {\n decorations.push(\n Decoration.node(pos, pos + node.nodeSize, {\n class: \"empty-node\",\n \"data-content\": props.content\n })\n );\n }\n };\n state.doc.descendants(decorate);\n\n return DecorationSet.create(state.doc, decorations);\n }\n }\n });\n};\n","import React, { useEffect, useState } from 'react';\nimport debounce from 'lodash/debounce';\nimport styled from 'styled-components';\n\nimport WaxProvider from './WaxContext';\nimport Application from './Application';\n\nimport WaxDOMSerializer from './WaxDOMSerializer';\nimport WaxDOMParser from './WaxDOMParser';\n\nimport WaxView from './WaxView';\nimport defaultPlugins from './plugins/defaultPlugins';\nimport Placeholder from './plugins/placeholder';\n\nconst parser = schema => {\n const WaxParser = WaxDOMParser.fromSchema(schema);\n\n return content => {\n const container = document.createElement('article');\n container.innerHTML = content;\n return WaxParser.parse(container);\n };\n};\n\nconst serializer = schema => {\n const WaxSerializer = WaxDOMSerializer.fromSchema(schema);\n return content => {\n const container = document.createElement('article');\n container.appendChild(WaxSerializer.serializeFragment(content));\n return container.innerHTML;\n };\n};\n\nlet schema;\nconst createApplication = props => {\n const application = Application.create(props);\n schema = application.getSchema();\n application.bootServices();\n return application;\n};\n\nconst createPlaceholder = placeholder => {\n return Placeholder({ content: placeholder });\n};\n\nconst LayoutWrapper = styled.div`\n display: flex;\n flex-direction: column;\n height: 99%;\n`;\n\nconst Wax = props => {\n let finalPlugins = [];\n const [application, setApplication] = useState();\n\n useEffect(() => {\n const newApplication = createApplication(props);\n setApplication(newApplication);\n return () => newApplication.resetApp();\n }, []);\n\n const {\n autoFocus,\n className,\n debug,\n fileUpload,\n layout,\n onBlur,\n placeholder,\n readonly,\n value,\n user,\n onChange,\n } = props;\n\n if (!application) return null;\n\n const WaxOnchange = onChange ? onChange : value => true;\n\n const editorContent = value ? value : '';\n\n finalPlugins = defaultPlugins.concat([\n createPlaceholder(placeholder),\n ...application.getPlugins(),\n ]);\n\n const WaxOptions = {\n schema,\n plugins: finalPlugins,\n };\n\n const parse = parser(schema);\n const serialize = serializer(schema);\n WaxOptions.doc = parse(editorContent);\n\n const finalOnChange = debounce(\n value => {\n WaxOnchange(serialize(value));\n },\n 1000,\n { maxWait: 5000 },\n );\n const TrackChange = application.config.get('config.EnableTrackChangeService');\n\n const Layout = application.container.get('Layout');\n if (layout) Layout.setLayout(layout);\n const WaxRender = Layout.layoutComponent;\n\n return (\n <LayoutWrapper className={`${className}`}>\n <WaxProvider app={application}>\n <WaxView\n autoFocus={autoFocus}\n readonly={readonly}\n options={WaxOptions}\n placeholder={placeholder}\n fileUpload={fileUpload}\n onBlur={onBlur || (v => true)}\n onChange={finalOnChange || (v => true)}\n debug={debug}\n TrackChange={TrackChange}\n user={user}\n >\n {({ editor }) => <WaxRender editor={editor} />}\n </WaxView>\n </WaxProvider>\n </LayoutWrapper>\n );\n};\nexport default Wax;\n"],"names":["_defineProperty","obj","key","value","Object","defineProperty","enumerable","configurable","writable","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","push","apply","_objectSpread2","target","i","arguments","length","source","forEach","getOwnPropertyDescriptors","defineProperties","_arrayWithHoles","arr","Array","isArray","_iterableToArrayLimit","Symbol","iterator","_arr","_n","_d","_e","undefined","_i","_s","next","done","err","_arrayLikeToArray","len","arr2","_unsupportedIterableToArray","o","minLen","arrayLikeToArray","n","prototype","toString","call","slice","constructor","name","from","test","_nonIterableRest","TypeError","_slicedToArray","arrayWithHoles","iterableToArrayLimit","unsupportedIterableToArray","nonIterableRest","WaxContext","React","createContext","view","activeView","activeViewId","app","updateView","updateActiveView","props","useState","newView","assign","context","setContext","children","useInjection","identifier","useContext","container","Error","isBound","instance","get","_arrayWithoutHoles","_iterableToArray","iter","_nonIterableSpread","_toConsumableArray","arrayWithoutHoles","iterableToArray","nonIterableSpread","_taggedTemplateLiteral","strings","raw","freeze","_classCallCheck","Constructor","_defineProperties","descriptor","_createClass","protoProps","staticProps","Config","injectable","_config","config","inject","set","oldValue","isArrayLikeObject","v","services","SchemaService","RulesService","ShortCutsService","LayoutService","MenuService","OverlayService","PmPlugins","_plugins","Map","plugin","values","Application","count","allServices","service","setApp","dependencies","servicePos","splice","register","boot","getAll","schema","getSchema","appConfig","deepmerge","defaultConfig","customMerge","coreService","configService","concat","Container","bind","to","inSingletonScope","toFactory","toConstantValue","setConfig","configPlugin","add","registerServices","_setPrototypeOf","p","setPrototypeOf","__proto__","_inherits","subClass","superClass","create","_getPrototypeOf","getPrototypeOf","_isNativeReflectConstruct","Reflect","construct","sham","Proxy","Date","e","_typeof","_assertThisInitialized","self","ReferenceError","_possibleConstructorReturn","assertThisInitialized","_createSuper","Derived","Super","result","isNativeReflectConstruct","NewTarget","possibleConstructorReturn","WaxDOMSerializer","DOMSerializer","WaxDOMParser","DOMParser","transformPasted","content","commentNodes","DocumentHelpers","findChildrenByMark","state","marks","comment","notes","findChildrenByType","nodes","footnote","allComments","map","node","type","groupedCommentsById","reduce","mark","attrs","id","uuidv4","note","readonly","onBlur","options","debug","autoFocus","user","editorRef","useRef","setEditorRef","useCallback","current","EditorView","mount","editable","EditorState","dispatchTransaction","handleDOMEvents","blur","doc","main","applyDevTools","focus","destroy","transaction","TrackChange","tr","enabled","trackedTransaction","updateState","getMeta","onChange","editor","dropCursor","gapCursor","history","placeHolderText","PluginKey","Plugin","decorations","decorate","pos","isBlock","childCount","Decoration","nodeSize","descendants","DecorationSet","parser","WaxParser","fromSchema","document","createElement","innerHTML","parse","serializer","WaxSerializer","appendChild","serializeFragment","createApplication","application","bootServices","createPlaceholder","placeholder","Placeholder","LayoutWrapper","styled","div","Wax","finalPlugins","setApplication","useEffect","newApplication","resetApp","className","fileUpload","layout","WaxOnchange","editorContent","defaultPlugins","getPlugins","WaxOptions","plugins","serialize","finalOnChange","debounce","maxWait","Layout","setLayout","WaxRender","layoutComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAe,SAASA,eAAT,CAAyBC,GAAzB,EAA8BC,GAA9B,EAAmCC,KAAnC,EAA0C;AACvD,MAAID,GAAG,IAAID,GAAX,EAAgB;AACdG,IAAAA,MAAM,CAACC,cAAP,CAAsBJ,GAAtB,EAA2BC,GAA3B,EAAgC;AAC9BC,MAAAA,KAAK,EAAEA,KADuB;AAE9BG,MAAAA,UAAU,EAAE,IAFkB;AAG9BC,MAAAA,YAAY,EAAE,IAHgB;AAI9BC,MAAAA,QAAQ,EAAE;AAJoB,KAAhC;AAMD,GAPD,MAOO;AACLP,IAAAA,GAAG,CAACC,GAAD,CAAH,GAAWC,KAAX;AACD;;AAED,SAAOF,GAAP;AACD;;ACXD,SAASQ,OAAT,CAAiBC,MAAjB,EAAyBC,cAAzB,EAAyC;AACvC,MAAIC,IAAI,GAAGR,MAAM,CAACQ,IAAP,CAAYF,MAAZ,CAAX;;AAEA,MAAIN,MAAM,CAACS,qBAAX,EAAkC;AAChC,QAAIC,OAAO,GAAGV,MAAM,CAACS,qBAAP,CAA6BH,MAA7B,CAAd;AACA,QAAIC,cAAJ,EAAoBG,OAAO,GAAGA,OAAO,CAACC,MAAR,CAAe,UAAUC,GAAV,EAAe;AAC1D,aAAOZ,MAAM,CAACa,wBAAP,CAAgCP,MAAhC,EAAwCM,GAAxC,EAA6CV,UAApD;AACD,KAF6B,CAAV;AAGpBM,IAAAA,IAAI,CAACM,IAAL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7ED;;;;;;"} \ No newline at end of file diff --git a/wax-prosemirror-layouts/dist/index.js b/wax-prosemirror-layouts/dist/index.js new file mode 100644 index 000000000..26ce0dd55 --- /dev/null +++ b/wax-prosemirror-layouts/dist/index.js @@ -0,0 +1,239 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var React = require('react'); +var React__default = _interopDefault(React); +var styled = require('styled-components'); +var styled__default = _interopDefault(styled); +var PanelGroup = _interopDefault(require('react-panelgroup')); +var waxProsemirrorComponents = require('wax-prosemirror-components'); +var waxProsemirrorServices = require('wax-prosemirror-services'); +var waxProsemirrorThemes = require('wax-prosemirror-themes'); +var waxProsemirrorUtilities = require('wax-prosemirror-utilities'); +var waxProsemirrorCore = require('wax-prosemirror-core'); + +function _taggedTemplateLiteral(strings, raw) { + if (!raw) { + raw = strings.slice(0); + } + + return Object.freeze(Object.defineProperties(strings, { + raw: { + value: Object.freeze(raw) + } + })); +} + +function _templateObject() { + var data = _taggedTemplateLiteral(["\n .ProseMirror {\n counter-reset: footnote;\n font-family: ", ";\n &:focus {\n outline: none;\n }\n }\n\n .ProseMirror .wax-selection-marker {\n background: #0a78ff;\n color: white;\n }\n\n .ProseMirror footnote {\n font-size: 0;\n display: inline-block;\n text-align: center;\n width: 17px;\n height: 17px;\n background: black;\n color: white;\n cursor: pointer;\n }\n\n .ProseMirror footnote::after {\n content: counter(footnote);\n position: relative;\n bottom: 2px;\n font-size: 16px;\n counter-increment: footnote;\n }\n\n hr {\n padding: 2px 10px;\n border: none;\n margin: 1em 0;\n }\n\n hr:after {\n content: '';\n display: block;\n height: 1px;\n background-color: silver;\n line-height: 2px;\n }\n\n ul,\n ol {\n padding-left: 30px;\n }\n\n blockquote {\n padding-left: 1em;\n border-left: 3px solid #eee;\n margin-left: 0;\n margin-right: 0;\n }\n\n img {\n cursor: default;\n }\n\n sup,\n sub {\n line-height: 0;\n }\n\n /* Tables */\n\n table {\n border-collapse: initial;\n border-spacing: 0;\n border-width: 0 thin thin 0;\n border: 1px solid #eee;\n table-layout: fixed;\n width: 100%;\n margin: 0;\n overflow: hidden;\n page-break-inside: avoid;\n }\n\n th,\n td {\n border: 1px solid #eee;\n /*width: 200px;*/\n padding: 2px 5px;\n vertical-align: top;\n box-sizing: border-box;\n position: relative;\n }\n\n .tableWrapper {\n overflow-x: auto;\n }\n\n .column-resize-handle {\n position: absolute;\n right: -2px;\n top: 0;\n bottom: 0;\n width: 4px;\n z-index: 20;\n background-color: #adf;\n pointer-events: none;\n }\n\n .ProseMirror.resize-cursor {\n cursor: ew-resize;\n cursor: col-resize;\n }\n /* Give selected cells a blue overlay */\n .selectedCell:after {\n z-index: 2;\n position: absolute;\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n background: rgba(200, 200, 255, 0.4);\n pointer-events: none;\n }\n\n /* placeholder */\n .empty-node::before {\n color: #aaa;\n float: left;\n font-style: italic;\n pointer-events: none;\n height: 0;\n }\n\n p.empty-node:first-child::before {\n content: attr(data-content);\n }\n\n /* invisible characters */\n .invisible {\n pointer-events: none;\n user-select: none;\n }\n\n .invisible:before {\n caret-color: inherit;\n color: gray;\n display: inline-block;\n font-weight: 400;\n font-style: normal;\n line-height: 1em;\n width: 0;\n }\n\n .invisible--space:before {\n content: '\xB7';\n }\n\n .invisible--break:before {\n content: '\xAC';\n }\n\n .invisible--par:after {\n content: '\xB6';\n }\n\n span.deletion {\n text-decoration: line-through;\n color: red;\n footnote {\n background: red;\n }\n }\n\n span.insertion {\n color: blue;\n }\n\n .selected-insertion,\n .selected-deletion,\n .selected-format-change,\n .selected-block-change {\n background-color: #fffacf;\n }\n\n .format-change {\n border-bottom: 2px solid blue;\n }\n\n [data-track] {\n position: relative;\n }\n\n [data-track]::before {\n content: '';\n position: absolute;\n border-left: 2px solid blue;\n left: -10px;\n height: 100%;\n }\n\n li[data-track]::before,\n li [data-track]::before {\n left: -5px;\n }\n\n span.comment {\n border-bottom: 2px solid #ffab20;\n border-radius: 3px 3px 0 0;\n\n .active-comment {\n background-color: #ffab20;\n }\n }\n"]); + + _templateObject = function _templateObject() { + return data; + }; + + return data; +} +/* All styles regarding ProseMirror surface and elements */ + +var EditorElements = styled.css(_templateObject(), function (props) { + return props.theme.fontReading; +}); + +function _templateObject12() { + var data = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n width: 35%;\n height: 100%;\n"]); + + _templateObject12 = function _templateObject12() { + return data; + }; + + return data; +} + +function _templateObject11() { + var data = _taggedTemplateLiteral(["\n counter-reset: footnote-view;\n display: flex;\n flex-direction: column;\n padding: 0 0 10px 5px;\n height: 100%;\n width: 65%;\n position: relative;\n"]); + + _templateObject11 = function _templateObject11() { + return data; + }; + + return data; +} + +function _templateObject10() { + var data = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n width: 100%;\n height: 100%;\n overflow-y: scroll;\n position: absolute;\n"]); + + _templateObject10 = function _templateObject10() { + return data; + }; + + return data; +} + +function _templateObject9() { + var data = _taggedTemplateLiteral(["\n display: flex;\n width: 100%;\n > div {\n flex: 1;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n margin-top: 15px;\n button {\n display: flex;\n flex-direction: column;\n font-family: ", ";\n margin-left: 5%;\n width: 90%;\n }\n [data-name='Display'] {\n border-right: none;\n }\n }\n"]); + + _templateObject9 = function _templateObject9() { + return data; + }; + + return data; +} + +function _templateObject8() { + var data = _taggedTemplateLiteral(["\n display: flex;\n width: 14%;\n height: 98%;\n"]); + + _templateObject8 = function _templateObject8() { + return data; + }; + + return data; +} + +function _templateObject7() { + var data = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n background: transparent;\n z-index: 9999;\n div {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n"]); + + _templateObject7 = function _templateObject7() { + return data; + }; + + return data; +} + +function _templateObject6() { + var data = _taggedTemplateLiteral(["\n background: #fff;\n height: 52px;\n line-height: 32px;\n position: relative;\n user-select: none;\n border-bottom: 2px solid #ecedf1;\n"]); + + _templateObject6 = function _templateObject6() { + return data; + }; + + return data; +} + +function _templateObject5() { + var data = _taggedTemplateLiteral(["\n bottom: 0;\n left: 0;\n overflow: auto;\n position: absolute;\n display: flex;\n right: 0;\n top: 0;\n box-sizing: border-box;\n padding: 0 2px 2px 2px;\n height: 100%;\n ", ";\n"]); + + _templateObject5 = function _templateObject5() { + return data; + }; + + return data; +} + +function _templateObject4() { + var data = _taggedTemplateLiteral(["\n width: 65%;\n height: 100%;\n .ProseMirror {\n -moz-box-shadow: 0 0 8px #ecedf1;\n -webkit-box-shadow: 0 0 8px #ecedf1;\n box-shadow: 0 0 8px #ecedf1;\n min-height: 90%;\n padding: 40px;\n }\n"]); + + _templateObject4 = function _templateObject4() { + return data; + }; + + return data; +} + +function _templateObject3() { + var data = _taggedTemplateLiteral(["\n flex: 1;\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n"]); + + _templateObject3 = function _templateObject3() { + return data; + }; + + return data; +} + +function _templateObject2() { + var data = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n height: 100%;\n width: 100%;\n"]); + + _templateObject2 = function _templateObject2() { + return data; + }; + + return data; +} + +function _templateObject$1() { + var data = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n overflow: hidden;\n .divider {\n &:before {\n content: 'Notes';\n position: relative;\n bottom: 14px;\n background: white;\n color: #a3a3a3;\n font-weight: 600;\n letter-spacing: 0.15em;\n }\n &:after {\n color: #a3a3a3;\n content: '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . ';\n float: left;\n font-weight: 400;\n white-space: nowrap;\n width: 0;\n position: relative;\n bottom: 14px;\n }\n }\n"]); + + _templateObject$1 = function _templateObject() { + return data; + }; + + return data; +} +var LayoutWrapper = styled__default.div(_templateObject$1()); +var LeftMenuSurfaceContainer = styled__default.div(_templateObject2()); +var WaxSurfaceContainer = styled__default.div(_templateObject3()); +var EditorContainer = styled__default.div(_templateObject4()); +var WaxSurfaceScroll = styled__default.div(_templateObject5(), EditorElements); +var MainMenuContainer = styled__default.div(_templateObject6()); +var MainMenuInner = styled__default.div(_templateObject7()); +var SideMenuContainer = styled__default.div(_templateObject8()); +var SideMenuInner = styled__default.div(_templateObject9(), function (props) { + return props.theme.fontInterface; +}); +var NotesAreaContainer = styled__default.div(_templateObject10()); +var NotesContainer = styled__default.div(_templateObject11()); +var CommentsContainer = styled__default.div(_templateObject12()); +var surfaceHeight = 700; +var notesHeight = 50; + +var onResizeEnd = function onResizeEnd(arr) { + surfaceHeight = arr[0].size; + notesHeight = arr[1].size; +}; + +var hasNotes = function hasNotes(main) { + var notes = waxProsemirrorUtilities.DocumentHelpers.findChildrenByType(main.state.doc, main.state.schema.nodes.footnote, true); + return notes; +}; + +var LeftSideBar = waxProsemirrorServices.componentPlugin('leftSideBar'); +var RightSideBar = waxProsemirrorServices.componentPlugin('rightSideBar'); +var TopBar = waxProsemirrorServices.componentPlugin('topBar'); +var NotesArea = waxProsemirrorServices.componentPlugin('notesArea'); +var RightArea = waxProsemirrorServices.componentPlugin('rightArea'); +var WaxOverlays = waxProsemirrorServices.componentPlugin('waxOverlays'); + +var withNotes = function withNotes() { + return /*#__PURE__*/React__default.createElement(NotesAreaContainer, null, /*#__PURE__*/React__default.createElement(NotesContainer, { + id: "notes-container" + }, /*#__PURE__*/React__default.createElement(NotesArea, null)), /*#__PURE__*/React__default.createElement(CommentsContainer, null, /*#__PURE__*/React__default.createElement(RightArea, { + area: "notes" + }))); +}; + +var EditoriaLayout = function EditoriaLayout(_ref) { + var editor = _ref.editor; + + var _useContext = React.useContext(waxProsemirrorCore.WaxContext), + main = _useContext.view.main; + + var AreasWithNotes = null; + + if (main) { + var notes = hasNotes(main); + if (notes.length) AreasWithNotes = withNotes(); + } + + return /*#__PURE__*/React__default.createElement(styled.ThemeProvider, { + theme: waxProsemirrorThemes.cokoTheme + }, /*#__PURE__*/React__default.createElement(LayoutWrapper, null, /*#__PURE__*/React__default.createElement(MainMenuContainer, null, /*#__PURE__*/React__default.createElement(MainMenuInner, null, /*#__PURE__*/React__default.createElement(TopBar, null))), /*#__PURE__*/React__default.createElement(LeftMenuSurfaceContainer, null, /*#__PURE__*/React__default.createElement(SideMenuContainer, null, /*#__PURE__*/React__default.createElement(SideMenuInner, null, /*#__PURE__*/React__default.createElement(LeftSideBar, null))), /*#__PURE__*/React__default.createElement(PanelGroup, { + direction: "column", + panelWidths: [{ + size: surfaceHeight, + resize: 'dynamic' + }, { + size: notesHeight, + resize: 'stretch' + }], + onResizeEnd: onResizeEnd + }, /*#__PURE__*/React__default.createElement(WaxSurfaceContainer, null, /*#__PURE__*/React__default.createElement(WaxSurfaceScroll, { + className: "wax-surface-scroll" + }, /*#__PURE__*/React__default.createElement(EditorContainer, null, editor), /*#__PURE__*/React__default.createElement(CommentsContainer, null, /*#__PURE__*/React__default.createElement(RightArea, { + area: "main" + }))), /*#__PURE__*/React__default.createElement(RightSideBar, null)), AreasWithNotes)), /*#__PURE__*/React__default.createElement(waxProsemirrorComponents.InfoArea, null), /*#__PURE__*/React__default.createElement(WaxOverlays, null))); +}; + +exports.EditoriaLayout = EditoriaLayout; +//# sourceMappingURL=index.js.map diff --git a/wax-prosemirror-layouts/dist/index.js.map b/wax-prosemirror-layouts/dist/index.js.map new file mode 100644 index 000000000..b4e23cc1a --- /dev/null +++ b/wax-prosemirror-layouts/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js","../src/layouts/EditorElements.js","../src/layouts/EditoriaLayout.js"],"sourcesContent":["export default function _taggedTemplateLiteral(strings, raw) {\n if (!raw) {\n raw = strings.slice(0);\n }\n\n return Object.freeze(Object.defineProperties(strings, {\n raw: {\n value: Object.freeze(raw)\n }\n }));\n}","import { css } from 'styled-components';\n\n/* All styles regarding ProseMirror surface and elements */\n\nexport default css`\n .ProseMirror {\n counter-reset: footnote;\n font-family: ${props => props.theme.fontReading};\n &:focus {\n outline: none;\n }\n }\n\n .ProseMirror .wax-selection-marker {\n background: #0a78ff;\n color: white;\n }\n\n .ProseMirror footnote {\n font-size: 0;\n display: inline-block;\n text-align: center;\n width: 17px;\n height: 17px;\n background: black;\n color: white;\n cursor: pointer;\n }\n\n .ProseMirror footnote::after {\n content: counter(footnote);\n position: relative;\n bottom: 2px;\n font-size: 16px;\n counter-increment: footnote;\n }\n\n hr {\n padding: 2px 10px;\n border: none;\n margin: 1em 0;\n }\n\n hr:after {\n content: '';\n display: block;\n height: 1px;\n background-color: silver;\n line-height: 2px;\n }\n\n ul,\n ol {\n padding-left: 30px;\n }\n\n blockquote {\n padding-left: 1em;\n border-left: 3px solid #eee;\n margin-left: 0;\n margin-right: 0;\n }\n\n img {\n cursor: default;\n }\n\n sup,\n sub {\n line-height: 0;\n }\n\n /* Tables */\n\n table {\n border-collapse: initial;\n border-spacing: 0;\n border-width: 0 thin thin 0;\n border: 1px solid #eee;\n table-layout: fixed;\n width: 100%;\n margin: 0;\n overflow: hidden;\n page-break-inside: avoid;\n }\n\n th,\n td {\n border: 1px solid #eee;\n /*width: 200px;*/\n padding: 2px 5px;\n vertical-align: top;\n box-sizing: border-box;\n position: relative;\n }\n\n .tableWrapper {\n overflow-x: auto;\n }\n\n .column-resize-handle {\n position: absolute;\n right: -2px;\n top: 0;\n bottom: 0;\n width: 4px;\n z-index: 20;\n background-color: #adf;\n pointer-events: none;\n }\n\n .ProseMirror.resize-cursor {\n cursor: ew-resize;\n cursor: col-resize;\n }\n /* Give selected cells a blue overlay */\n .selectedCell:after {\n z-index: 2;\n position: absolute;\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n background: rgba(200, 200, 255, 0.4);\n pointer-events: none;\n }\n\n /* placeholder */\n .empty-node::before {\n color: #aaa;\n float: left;\n font-style: italic;\n pointer-events: none;\n height: 0;\n }\n\n p.empty-node:first-child::before {\n content: attr(data-content);\n }\n\n /* invisible characters */\n .invisible {\n pointer-events: none;\n user-select: none;\n }\n\n .invisible:before {\n caret-color: inherit;\n color: gray;\n display: inline-block;\n font-weight: 400;\n font-style: normal;\n line-height: 1em;\n width: 0;\n }\n\n .invisible--space:before {\n content: '·';\n }\n\n .invisible--break:before {\n content: '¬';\n }\n\n .invisible--par:after {\n content: '¶';\n }\n\n span.deletion {\n text-decoration: line-through;\n color: red;\n footnote {\n background: red;\n }\n }\n\n span.insertion {\n color: blue;\n }\n\n .selected-insertion,\n .selected-deletion,\n .selected-format-change,\n .selected-block-change {\n background-color: #fffacf;\n }\n\n .format-change {\n border-bottom: 2px solid blue;\n }\n\n [data-track] {\n position: relative;\n }\n\n [data-track]::before {\n content: '';\n position: absolute;\n border-left: 2px solid blue;\n left: -10px;\n height: 100%;\n }\n\n li[data-track]::before,\n li [data-track]::before {\n left: -5px;\n }\n\n span.comment {\n border-bottom: 2px solid #ffab20;\n border-radius: 3px 3px 0 0;\n\n .active-comment {\n background-color: #ffab20;\n }\n }\n`;\n","import React, { useContext } from 'react';\nimport styled, { ThemeProvider } from 'styled-components';\nimport PanelGroup from 'react-panelgroup';\nimport { InfoArea } from 'wax-prosemirror-components';\nimport { componentPlugin } from 'wax-prosemirror-services';\nimport { cokoTheme } from 'wax-prosemirror-themes';\nimport { DocumentHelpers } from 'wax-prosemirror-utilities';\nimport { WaxContext } from 'wax-prosemirror-core';\nimport EditorElements from './EditorElements';\n\nconst LayoutWrapper = styled.div`\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n overflow: hidden;\n .divider {\n &:before {\n content: 'Notes';\n position: relative;\n bottom: 14px;\n background: white;\n color: #a3a3a3;\n font-weight: 600;\n letter-spacing: 0.15em;\n }\n &:after {\n color: #a3a3a3;\n content: '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . '\n '. . . . . . . . . . . . . . . . . . . . ';\n float: left;\n font-weight: 400;\n white-space: nowrap;\n width: 0;\n position: relative;\n bottom: 14px;\n }\n }\n`;\n\nconst LeftMenuSurfaceContainer = styled.div`\n display: flex;\n flex-direction: row;\n height: 100%;\n width: 100%;\n`;\n\nconst WaxSurfaceContainer = styled.div`\n flex: 1;\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n`;\n\nconst EditorContainer = styled.div`\n width: 65%;\n height: 100%;\n .ProseMirror {\n -moz-box-shadow: 0 0 8px #ecedf1;\n -webkit-box-shadow: 0 0 8px #ecedf1;\n box-shadow: 0 0 8px #ecedf1;\n min-height: 90%;\n padding: 40px;\n }\n`;\n\nconst WaxSurfaceScroll = styled.div`\n bottom: 0;\n left: 0;\n overflow: auto;\n position: absolute;\n display: flex;\n right: 0;\n top: 0;\n box-sizing: border-box;\n padding: 0 2px 2px 2px;\n height: 100%;\n ${EditorElements};\n`;\n\nconst MainMenuContainer = styled.div`\n background: #fff;\n height: 52px;\n line-height: 32px;\n position: relative;\n user-select: none;\n border-bottom: 2px solid #ecedf1;\n`;\nconst MainMenuInner = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n background: transparent;\n z-index: 9999;\n div {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n`;\n\nconst SideMenuContainer = styled.div`\n display: flex;\n width: 14%;\n height: 98%;\n`;\n\nconst SideMenuInner = styled.div`\n display: flex;\n width: 100%;\n > div {\n flex: 1;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n margin-top: 15px;\n button {\n display: flex;\n flex-direction: column;\n font-family: ${props => props.theme.fontInterface};\n margin-left: 5%;\n width: 90%;\n }\n [data-name='Display'] {\n border-right: none;\n }\n }\n`;\n\nconst NotesAreaContainer = styled.div`\n display: flex;\n flex-direction: row;\n width: 100%;\n height: 100%;\n overflow-y: scroll;\n position: absolute;\n`;\n\nconst NotesContainer = styled.div`\n counter-reset: footnote-view;\n display: flex;\n flex-direction: column;\n padding: 0 0 10px 5px;\n height: 100%;\n width: 65%;\n position: relative;\n`;\n\nconst CommentsContainer = styled.div`\n display: flex;\n flex-direction: column;\n width: 35%;\n height: 100%;\n`;\n\nlet surfaceHeight = 700;\nlet notesHeight = 50;\n\nconst onResizeEnd = arr => {\n surfaceHeight = arr[0].size;\n notesHeight = arr[1].size;\n};\n\nconst hasNotes = main => {\n const notes = DocumentHelpers.findChildrenByType(\n main.state.doc,\n main.state.schema.nodes.footnote,\n true,\n );\n return notes;\n};\n\nconst LeftSideBar = componentPlugin('leftSideBar');\nconst RightSideBar = componentPlugin('rightSideBar');\nconst TopBar = componentPlugin('topBar');\nconst NotesArea = componentPlugin('notesArea');\nconst RightArea = componentPlugin('rightArea');\nconst WaxOverlays = componentPlugin('waxOverlays');\n\nconst withNotes = () => {\n return (\n <NotesAreaContainer>\n <NotesContainer id=\"notes-container\">\n <NotesArea />\n </NotesContainer>\n <CommentsContainer>\n <RightArea area=\"notes\" />\n </CommentsContainer>\n </NotesAreaContainer>\n );\n};\n\nconst EditoriaLayout = ({ editor }) => {\n const {\n view: { main },\n } = useContext(WaxContext);\n let AreasWithNotes = null;\n\n if (main) {\n const notes = hasNotes(main);\n if (notes.length) AreasWithNotes = withNotes();\n }\n\n return (\n <ThemeProvider theme={cokoTheme}>\n <LayoutWrapper>\n <MainMenuContainer>\n <MainMenuInner>\n <TopBar />\n </MainMenuInner>\n </MainMenuContainer>\n\n <LeftMenuSurfaceContainer>\n <SideMenuContainer>\n <SideMenuInner>\n <LeftSideBar />\n </SideMenuInner>\n </SideMenuContainer>\n\n <PanelGroup\n direction=\"column\"\n panelWidths={[\n { size: surfaceHeight, resize: 'dynamic' },\n { size: notesHeight, resize: 'stretch' },\n ]}\n onResizeEnd={onResizeEnd}\n >\n <WaxSurfaceContainer>\n <WaxSurfaceScroll className=\"wax-surface-scroll\">\n <EditorContainer>{editor}</EditorContainer>\n <CommentsContainer>\n <RightArea area=\"main\" />\n </CommentsContainer>\n </WaxSurfaceScroll>\n <RightSideBar />\n </WaxSurfaceContainer>\n {AreasWithNotes}\n </PanelGroup>\n </LeftMenuSurfaceContainer>\n <InfoArea />\n <WaxOverlays />\n </LayoutWrapper>\n </ThemeProvider>\n );\n};\n\nexport default EditoriaLayout;\n"],"names":["_taggedTemplateLiteral","strings","raw","slice","Object","freeze","defineProperties","value","css","props","theme","fontReading","LayoutWrapper","styled","div","LeftMenuSurfaceContainer","WaxSurfaceContainer","EditorContainer","WaxSurfaceScroll","EditorElements","MainMenuContainer","MainMenuInner","SideMenuContainer","SideMenuInner","fontInterface","NotesAreaContainer","NotesContainer","CommentsContainer","surfaceHeight","notesHeight","onResizeEnd","arr","size","hasNotes","main","notes","DocumentHelpers","findChildrenByType","state","doc","schema","nodes","footnote","LeftSideBar","componentPlugin","RightSideBar","TopBar","NotesArea","RightArea","WaxOverlays","withNotes","React","EditoriaLayout","editor","useContext","WaxContext","view","AreasWithNotes","length","ThemeProvider","cokoTheme","resize","InfoArea"],"mappings":";;;;;;;;;;;;;;;;;AAAe,SAASA,sBAAT,CAAgCC,OAAhC,EAAyCC,GAAzC,EAA8C;AAC3D,MAAI,CAACA,GAAL,EAAU;AACRA,IAAAA,GAAG,GAAGD,OAAO,CAACE,KAAR,CAAc,CAAd,CAAN;AACD;;AAED,SAAOC,MAAM,CAACC,MAAP,CAAcD,MAAM,CAACE,gBAAP,CAAwBL,OAAxB,EAAiC;AACpDC,IAAAA,GAAG,EAAE;AACHK,MAAAA,KAAK,EAAEH,MAAM,CAACC,MAAP,CAAcH,GAAd;AADJ;AAD+C,GAAjC,CAAd,CAAP;AAKD;;;;;;;;;;;ACRD;;AAEA,qBAAeM,UAAf,oBAGmB,UAAAC,KAAK;AAAA,SAAIA,KAAK,CAACC,KAAN,CAAYC,WAAhB;AAAA,CAHxB;;;;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BAAC,aAAD,qBACEA,6BAAC,MAAD,OADF,CADF,CADF,eAOEA,6BAAC,wBAAD,qBACEA,6BAAC,iBAAD,qBACEA,6BAAC,aAAD,qBACEA,6BAAC,WAAD,OADF,CADF,CADF,eAOEA,6BAAC,UAAD;AACE,IAAA,SAAS,EAAC,QADZ;AAEE,IAAA,WAAW,EAAE,CACX;AAAEnB,MAAAA,IAAI,EAAEJ,aAAR;AAAuBiC,MAAAA,MAAM,EAAE;AAA/B,KADW,EAEX;AAAE7B,MAAAA,IAAI,EAAEH,WAAR;AAAqBgC,MAAAA,MAAM,EAAE;AAA7B,KAFW,CAFf;AAME,IAAA,WAAW,EAAE/B;AANf,kBAQEqB,6BAAC,mBAAD,qBACEA,6BAAC,gBAAD;AAAkB,IAAA,SAAS,EAAC;AAA5B,kBACEA,6BAAC,eAAD,QAAkBE,MAAlB,CADF,eAEEF,6BAAC,iBAAD,qBACEA,6BAAC,SAAD;AAAW,IAAA,IAAI,EAAC;AAAhB,IADF,CAFF,CADF,eAOEA,6BAAC,YAAD,OAPF,CARF,EAiBGM,cAjBH,CAPF,CAPF,eAkCEN,6BAACW,iCAAD,OAlCF,eAmCEX,6BAAC,WAAD,OAnCF,CADF,CADF;AAyCD,CApDD;;;;"} \ No newline at end of file diff --git a/wax-prosemirror-plugins/dist/index.js b/wax-prosemirror-plugins/dist/index.js new file mode 100644 index 000000000..c3aff3fcd --- /dev/null +++ b/wax-prosemirror-plugins/dist/index.js @@ -0,0 +1,419 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var prosemirrorState = require('prosemirror-state'); +var prosemirrorView = require('prosemirror-view'); +var lodash = require('lodash'); +var waxProsemirrorUtilities = require('wax-prosemirror-utilities'); +var hljs = _interopDefault(require('highlight.js/lib/core')); +var prosemirrorHighlightjs = require('prosemirror-highlightjs'); + +function deactivateAllSelectedChanges(tr) { + const pluginState = { + decos: prosemirrorView.DecorationSet.empty + }; + return tr.setMeta(key, pluginState).setMeta('track', true); +} // From https://discuss.prosemirror.net/t/expanding-the-selection-to-the-active-mark/478/2 with some bugs fixed + +function getFromToMark(doc, pos, mark) { + const $pos = doc.resolve(pos), + parent = $pos.parent; + const start = parent.childAfter($pos.parentOffset); + + if (!start.node) { + return null; + } + + let startIndex = $pos.index(), + startPos = $pos.start() + start.offset; + + while (startIndex > 0 && mark.isInSet(parent.child(startIndex - 1).marks)) { + startPos -= parent.child(--startIndex).nodeSize; + } + + let endIndex = $pos.index() + 1, + endPos = $pos.start() + start.offset + start.node.nodeSize; + + while (endIndex < parent.childCount && mark.isInSet(parent.child(endIndex).marks)) { + endPos += parent.child(endIndex++).nodeSize; + } + + return { + from: startPos, + to: endPos + }; +} + +const findSelectedChanges = state => { + const selection = state.selection, + selectedChanges = { + insertion: false, + deletion: false, + formatChange: false + }; + let insertionPos = false, + deletionPos = false, + formatChangePos = false, + insertionMark, + deletionMark, + formatChangeMark, + insertionSize, + deletionSize, + formatChangeSize; + + if (selection.empty) { + const resolvedPos = state.doc.resolve(selection.from), + marks = resolvedPos.marks(); + + if (marks) { + insertionMark = marks.find(mark => mark.type.name === 'insertion' && !mark.attrs.approved); + + if (insertionMark) { + insertionPos = selection.from; + } + + deletionMark = marks.find(mark => mark.type.name === 'deletion'); + + if (deletionMark) { + deletionPos = selection.from; + } + + formatChangeMark = marks.find(mark => mark.type.name === 'format_change'); + + if (formatChangeMark) { + formatChangePos = selection.from; + } + } + } else { + state.doc.nodesBetween(selection.from, selection.to, (node, pos) => { + if (pos < selection.from) { + return true; + } + + if (!insertionMark) { + insertionMark = node.attrs.track ? node.attrs.track.find(trackAttr => trackAttr.type === 'insertion') : node.marks.find(mark => mark.type.name === 'insertion' && !mark.attrs.approved); + + if (insertionMark) { + insertionPos = pos; + + if (!node.isInline) { + insertionSize = node.nodeSize; + } + } + } + + if (!deletionMark) { + deletionMark = node.attrs.track ? node.attrs.track.find(trackAttr => trackAttr.type === 'deletion') : node.marks.find(mark => mark.type.name === 'deletion'); + + if (deletionMark) { + deletionPos = pos; + + if (!node.isInline) { + deletionSize = node.nodeSize; + } + } + } + + if (!formatChangeMark) { + formatChangeMark = node.marks.find(mark => mark.type.name === 'format_change'); + + if (formatChangeMark) { + formatChangePos = pos; + + if (!node.isInline) { + formatChangeSize = node.nodeSize; + } + } + } + }); + } + + if (insertionMark) { + selectedChanges.insertion = insertionSize ? { + from: insertionPos, + to: insertionPos + insertionSize + } : getFromToMark(state.doc, insertionPos, insertionMark); + } + + if (deletionMark) { + selectedChanges.deletion = deletionSize ? { + from: deletionPos, + to: deletionPos + deletionSize + } : getFromToMark(state.doc, deletionPos, deletionMark); + } + + if (formatChangeMark) { + selectedChanges.formatChange = formatChangeSize ? { + from: formatChangePos, + to: formatChangePos + formatChangeSize + } : getFromToMark(state.doc, formatChangePos, formatChangeMark); + } + + return selectedChanges; +}; + +const key = new prosemirrorState.PluginKey('track'); +const selectedInsertionSpec = {}; +const selectedDeletionSpec = {}; +const selectedChangeFormatSpec = {}; +var TrackChangePlugin = (options => { + return new prosemirrorState.Plugin({ + key, + state: { + init(config, state) { + const userIds = ['33']; + state.doc.descendants(node => { + if (node.attrs.track) { + node.attrs.track.forEach(track => { + if (!userIds.includes(track.user) && track.user !== 0) { + userIds.push(track.user); + } + }); + } else { + node.marks.forEach(mark => { + if (['deletion', 'insertion', 'format_change'].includes(mark.type.name) && !userIds.includes(mark.attrs.user) && mark.attrs.user !== 0) { + userIds.push(mark.attrs.user); + } + }); + } + }); + return { + decos: prosemirrorView.DecorationSet.empty + }; + }, + + apply(tr, prev, oldState, state) { + const meta = tr.getMeta(key); + + if (meta) { + // There has been an update, return values from meta instead + // of previous values + return meta; + } + + let { + decos + } = this.getState(oldState); + + if (tr.selectionSet) { + const { + insertion, + deletion, + formatChange + } = findSelectedChanges(state); + decos = prosemirrorView.DecorationSet.empty; + const decoType = tr.selection.node ? prosemirrorView.Decoration.node : prosemirrorView.Decoration.inline; + + if (insertion) { + decos = decos.add(tr.doc, [decoType(insertion.from, insertion.to, { + class: 'selected-insertion' + }, selectedInsertionSpec)]); + } + + if (deletion) { + decos = decos.add(tr.doc, [decoType(deletion.from, deletion.to, { + class: 'selected-deletion' + }, selectedDeletionSpec)]); + } + + if (formatChange) { + decos = decos.add(tr.doc, [decoType(formatChange.from, formatChange.to, { + class: 'selected-format-change' + }, selectedChangeFormatSpec)]); + } + } else { + decos = decos.map(tr.mapping, tr.doc); + } + + return { + decos + }; + } + + }, + props: { + decorations(state) { + const { + decos + } = this.getState(state); + return decos; + }, + + handleDOMEvents: { + focus: (view, _event) => { + view.dispatch(deactivateAllSelectedChanges(view.state.tr)); + } + } + } + }); +}); + +const commentPlugin = new prosemirrorState.PluginKey('commentPlugin'); + +const getComment = state => { + const commentMark = state.schema.marks.comment; + const commentOnSelection = waxProsemirrorUtilities.DocumentHelpers.findFragmentedMark(state, commentMark); // Don't allow Active comment if selection is not collapsed + + if (state.selection.from !== state.selection.to && commentOnSelection && commentOnSelection.attrs.conversation.length) { + return; + } + + if (commentOnSelection) { + const commentNodes = waxProsemirrorUtilities.DocumentHelpers.findChildrenByMark(state.doc, commentMark, true); + const allCommentsWithSameId = []; + commentNodes.map(node => { + node.node.marks.filter(mark => { + if (mark.type.name === 'comment' && commentOnSelection.attrs.id === mark.attrs.id) { + allCommentsWithSameId.push(node); + } + }); + }); + + if (allCommentsWithSameId.length > 1) { + const minPos = lodash.minBy(allCommentsWithSameId, 'pos'); + const maxPos = lodash.maxBy(allCommentsWithSameId, 'pos'); + return { + from: minPos.pos, + to: maxPos.pos + lodash.last(allCommentsWithSameId).node.nodeSize, + attrs: commentOnSelection.attrs, + contained: commentOnSelection.contained + }; + } + } + + return commentOnSelection; +}; + +var CommentPlugin = (props => { + return new prosemirrorState.Plugin({ + key: commentPlugin, + state: { + init: (_, state) => { + return { + comment: getComment(state) + }; + }, + + apply(tr, prev, _, newState) { + const comment = getComment(newState); + let createDecoration; + + if (comment) { + createDecoration = prosemirrorView.DecorationSet.create(newState.doc, [prosemirrorView.Decoration.inline(comment.from, comment.to, { + class: 'active-comment' + })]); + } + + return { + comment, + createDecoration + }; + } + + }, + props: { + decorations: state => { + const commentPluginState = state && commentPlugin.getState(state); + return commentPluginState.createDecoration; + }, + setCommentActive: state => {} + } + }); +}); + +const WaxSelectionPlugin = new prosemirrorState.Plugin({ + state: { + init(config, instance) { + return { + deco: prosemirrorView.DecorationSet.empty + }; + }, + + apply(transaction, state, prevEditorState, editorState) { + const sel = transaction.curSelection; // TODO fix the selection when a note is present. + + let flag = false; + const difference = sel.$to.pos - sel.$from.pos; + editorState.doc.nodesBetween(sel.$from.pos, sel.$to.pos, (node, from) => { + if (node.type.name === 'footnote') flag = true; + }); + + if (sel && !flag) { + const decos = [prosemirrorView.Decoration.inline(sel.$from.pos, sel.$to.pos, { + class: 'wax-selection-marker' + })]; + const deco = prosemirrorView.DecorationSet.create(editorState.doc, decos); + return { + deco + }; + } + + return state; + } + + }, + props: { + decorations(state) { + if (state && this.getState(state)) { + return this.getState(state).deco; + } + + return null; + } + + } +}); + +const highlightPlugin = (nodeTypes = ['code_block']) => { + return new prosemirrorState.Plugin({ + state: { + init(_, instance) { + const content = prosemirrorHighlightjs.getHighlightDecorations(instance.doc, hljs, nodeTypes, () => undefined); + return prosemirrorView.DecorationSet.create(instance.doc, content); + }, + + apply(tr, set, state) { + if (!tr.docChanged) { + return set.map(tr.mapping, tr.doc); + } + + const { + selection: { + $from, + $to + }, + doc + } = state; + let codeBlock = false; + doc.nodesBetween($from.pos, $to.pos, (node, from) => { + if (node.type.name === 'code_block') { + codeBlock = true; + } + }); + + if (codeBlock) { + const content = prosemirrorHighlightjs.getHighlightDecorations(tr.doc, hljs, nodeTypes, () => undefined); + return prosemirrorView.DecorationSet.create(tr.doc, content); + } + + return set.map(tr.mapping, tr.doc); + } + + }, + props: { + decorations(state) { + return this.getState(state); + } + + } + }); +}; + +exports.CommentPlugin = CommentPlugin; +exports.TrackChangePlugin = TrackChangePlugin; +exports.WaxSelectionPlugin = WaxSelectionPlugin; +exports.highlightPlugin = highlightPlugin; +//# sourceMappingURL=index.js.map diff --git a/wax-prosemirror-plugins/dist/index.js.map b/wax-prosemirror-plugins/dist/index.js.map new file mode 100644 index 000000000..7a99647d6 --- /dev/null +++ b/wax-prosemirror-plugins/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../src/trackChanges/helpers.js","../src/trackChanges/FindSelectedChanges.js","../src/trackChanges/TrackChangePlugin.js","../src/comments/CommentPlugin.js","../src/WaxSelectionPlugin.js","../src/highlightPlugin.js"],"sourcesContent":["import {Decoration, DecorationSet} from \"prosemirror-view\"\n\nimport {\n key,\n selectedInsertionSpec,\n selectedDeletionSpec,\n selectedChangeFormatSpec,\n selectedChangeBlockSpec\n} from \"./TrackChangePlugin\"\n\nexport function getSelectedChanges(state) {\n const {decos} = key.getState(state)\n\n const insertion = decos.find(undefined, undefined, spec => spec === selectedInsertionSpec)[0],\n deletion = decos.find(undefined, undefined, spec => spec === selectedDeletionSpec)[0],\n format_change = decos.find(undefined, undefined, spec => spec === selectedChangeFormatSpec)[0],\n block_change = decos.find(undefined, undefined, spec => spec === selectedChangeBlockSpec)[0]\n\n return {insertion, deletion, format_change, block_change}\n}\n\nexport function setSelectedChanges(state, type, pos) {\n const tr = state.tr,\n node = tr.doc.nodeAt(pos),\n mark = node.attrs.track ?\n node.attrs.track.find(trackAttr => trackAttr.type===type) :\n node.marks.find(mark => mark.type.name===type)\n if (!mark) {\n return\n }\n const selectedChange = node.isInline ? getFromToMark(tr.doc, pos, mark) : {from: pos, to: pos + node.nodeSize}\n let decos = DecorationSet.empty, spec\n if (type==='insertion') {\n spec = selectedInsertionSpec\n } else if (type==='deletion') {\n spec = selectedDeletionSpec\n } else if (type==='format_change') {\n spec = selectedChangeFormatSpec\n } else if (type==='block_change') {\n spec = selectedChangeBlockSpec\n }\n const decoType = node.isInline ? Decoration.inline : Decoration.node\n decos = decos.add(tr.doc, [decoType(selectedChange.from, selectedChange.to, {\n class: `selected-${type}`\n }, spec)])\n return tr.setMeta(key, {decos}).setMeta('track', true)\n}\n\nexport function deactivateAllSelectedChanges(tr) {\n const pluginState = {\n decos: DecorationSet.empty\n }\n return tr.setMeta(key, pluginState).setMeta('track', true)\n}\n\n// From https://discuss.prosemirror.net/t/expanding-the-selection-to-the-active-mark/478/2 with some bugs fixed\nexport function getFromToMark(doc, pos, mark) {\n const $pos = doc.resolve(pos), parent = $pos.parent\n const start = parent.childAfter($pos.parentOffset)\n if (!start.node) {\n return null\n }\n let startIndex = $pos.index(), startPos = $pos.start() + start.offset\n while (startIndex > 0 && mark.isInSet(parent.child(startIndex - 1).marks)) {\n startPos -= parent.child(--startIndex).nodeSize\n }\n let endIndex = $pos.index() + 1, endPos = $pos.start() + start.offset + start.node.nodeSize\n while (endIndex < parent.childCount && mark.isInSet(parent.child(endIndex).marks)) {\n endPos += parent.child(endIndex++).nodeSize\n }\n return {from: startPos, to: endPos}\n}\n","import { getFromToMark } from './helpers';\n\nconst findSelectedChanges = state => {\n const selection = state.selection,\n selectedChanges = {\n insertion: false,\n deletion: false,\n formatChange: false,\n };\n let insertionPos = false,\n deletionPos = false,\n formatChangePos = false,\n insertionMark,\n deletionMark,\n formatChangeMark,\n insertionSize,\n deletionSize,\n formatChangeSize;\n\n if (selection.empty) {\n const resolvedPos = state.doc.resolve(selection.from),\n marks = resolvedPos.marks();\n if (marks) {\n insertionMark = marks.find(mark => mark.type.name === 'insertion' && !mark.attrs.approved);\n if (insertionMark) {\n insertionPos = selection.from;\n }\n deletionMark = marks.find(mark => mark.type.name === 'deletion');\n if (deletionMark) {\n deletionPos = selection.from;\n }\n formatChangeMark = marks.find(mark => mark.type.name === 'format_change');\n if (formatChangeMark) {\n formatChangePos = selection.from;\n }\n }\n } else {\n state.doc.nodesBetween(selection.from, selection.to, (node, pos) => {\n if (pos < selection.from) {\n return true;\n }\n if (!insertionMark) {\n insertionMark = node.attrs.track\n ? node.attrs.track.find(trackAttr => trackAttr.type === 'insertion')\n : node.marks.find(mark => mark.type.name === 'insertion' && !mark.attrs.approved);\n if (insertionMark) {\n insertionPos = pos;\n if (!node.isInline) {\n insertionSize = node.nodeSize;\n }\n }\n }\n if (!deletionMark) {\n deletionMark = node.attrs.track\n ? node.attrs.track.find(trackAttr => trackAttr.type === 'deletion')\n : node.marks.find(mark => mark.type.name === 'deletion');\n if (deletionMark) {\n deletionPos = pos;\n if (!node.isInline) {\n deletionSize = node.nodeSize;\n }\n }\n }\n if (!formatChangeMark) {\n formatChangeMark = node.marks.find(mark => mark.type.name === 'format_change');\n if (formatChangeMark) {\n formatChangePos = pos;\n if (!node.isInline) {\n formatChangeSize = node.nodeSize;\n }\n }\n }\n });\n }\n if (insertionMark) {\n selectedChanges.insertion = insertionSize\n ? { from: insertionPos, to: insertionPos + insertionSize }\n : getFromToMark(state.doc, insertionPos, insertionMark);\n }\n\n if (deletionMark) {\n selectedChanges.deletion = deletionSize\n ? { from: deletionPos, to: deletionPos + deletionSize }\n : getFromToMark(state.doc, deletionPos, deletionMark);\n }\n\n if (formatChangeMark) {\n selectedChanges.formatChange = formatChangeSize\n ? { from: formatChangePos, to: formatChangePos + formatChangeSize }\n : getFromToMark(state.doc, formatChangePos, formatChangeMark);\n }\n return selectedChanges;\n};\n\nexport { findSelectedChanges };\n","import { Plugin, PluginKey } from 'prosemirror-state';\nimport { Decoration, DecorationSet } from 'prosemirror-view';\n\nimport { findSelectedChanges } from './FindSelectedChanges';\nimport { deactivateAllSelectedChanges } from './helpers';\n\nexport const key = new PluginKey('track');\nexport const selectedInsertionSpec = {};\nexport const selectedDeletionSpec = {};\nexport const selectedChangeFormatSpec = {};\nexport const selectedChangeBlockSpec = {};\n\nexport default options => {\n return new Plugin({\n key,\n state: {\n init(config, state) {\n const userIds = ['33'];\n state.doc.descendants(node => {\n if (node.attrs.track) {\n node.attrs.track.forEach(track => {\n if (!userIds.includes(track.user) && track.user !== 0) {\n userIds.push(track.user);\n }\n });\n } else {\n node.marks.forEach(mark => {\n if (\n ['deletion', 'insertion', 'format_change'].includes(mark.type.name) &&\n !userIds.includes(mark.attrs.user) &&\n mark.attrs.user !== 0\n ) {\n userIds.push(mark.attrs.user);\n }\n });\n }\n });\n\n return {\n decos: DecorationSet.empty,\n };\n },\n apply(tr, prev, oldState, state) {\n const meta = tr.getMeta(key);\n if (meta) {\n // There has been an update, return values from meta instead\n // of previous values\n return meta;\n }\n\n let { decos } = this.getState(oldState);\n\n if (tr.selectionSet) {\n const { insertion, deletion, formatChange } = findSelectedChanges(state);\n decos = DecorationSet.empty;\n const decoType = tr.selection.node ? Decoration.node : Decoration.inline;\n if (insertion) {\n decos = decos.add(tr.doc, [\n decoType(\n insertion.from,\n insertion.to,\n {\n class: 'selected-insertion',\n },\n selectedInsertionSpec,\n ),\n ]);\n }\n if (deletion) {\n decos = decos.add(tr.doc, [\n decoType(\n deletion.from,\n deletion.to,\n {\n class: 'selected-deletion',\n },\n selectedDeletionSpec,\n ),\n ]);\n }\n if (formatChange) {\n decos = decos.add(tr.doc, [\n decoType(\n formatChange.from,\n formatChange.to,\n {\n class: 'selected-format-change',\n },\n selectedChangeFormatSpec,\n ),\n ]);\n }\n } else {\n decos = decos.map(tr.mapping, tr.doc);\n }\n return {\n decos,\n };\n },\n },\n props: {\n decorations(state) {\n const { decos } = this.getState(state);\n return decos;\n },\n handleDOMEvents: {\n focus: (view, _event) => {\n view.dispatch(deactivateAllSelectedChanges(view.state.tr));\n },\n },\n },\n });\n};\n","import { minBy, maxBy, last } from 'lodash';\nimport { Plugin, PluginKey } from 'prosemirror-state';\nimport { Decoration, DecorationSet } from 'prosemirror-view';\nimport { DocumentHelpers } from 'wax-prosemirror-utilities';\n\nconst commentPlugin = new PluginKey('commentPlugin');\n\nconst getComment = state => {\n const commentMark = state.schema.marks.comment;\n const commentOnSelection = DocumentHelpers.findFragmentedMark(state, commentMark);\n\n // Don't allow Active comment if selection is not collapsed\n if (\n state.selection.from !== state.selection.to &&\n commentOnSelection &&\n commentOnSelection.attrs.conversation.length\n ) {\n return;\n }\n\n if (commentOnSelection) {\n const commentNodes = DocumentHelpers.findChildrenByMark(state.doc, commentMark, true);\n\n const allCommentsWithSameId = [];\n commentNodes.map(node => {\n node.node.marks.filter(mark => {\n if (mark.type.name === 'comment' && commentOnSelection.attrs.id === mark.attrs.id) {\n allCommentsWithSameId.push(node);\n }\n });\n });\n\n if (allCommentsWithSameId.length > 1) {\n const minPos = minBy(allCommentsWithSameId, 'pos');\n const maxPos = maxBy(allCommentsWithSameId, 'pos');\n\n return {\n from: minPos.pos,\n to: maxPos.pos + last(allCommentsWithSameId).node.nodeSize,\n attrs: commentOnSelection.attrs,\n contained: commentOnSelection.contained,\n };\n }\n }\n return commentOnSelection;\n};\n\nexport default props => {\n return new Plugin({\n key: commentPlugin,\n state: {\n init: (_, state) => {\n return { comment: getComment(state) };\n },\n apply(tr, prev, _, newState) {\n const comment = getComment(newState);\n let createDecoration;\n if (comment) {\n createDecoration = DecorationSet.create(newState.doc, [\n Decoration.inline(comment.from, comment.to, {\n class: 'active-comment',\n }),\n ]);\n }\n return {\n comment,\n createDecoration,\n };\n },\n },\n props: {\n decorations: state => {\n const commentPluginState = state && commentPlugin.getState(state);\n return commentPluginState.createDecoration;\n },\n setCommentActive: state => {},\n },\n });\n};\n","import { Decoration, DecorationSet } from 'prosemirror-view';\nimport { Plugin } from 'prosemirror-state';\n\nconst WaxSelectionPlugin = new Plugin({\n state: {\n init(config, instance) {\n return { deco: DecorationSet.empty };\n },\n apply(transaction, state, prevEditorState, editorState) {\n const sel = transaction.curSelection;\n\n // TODO fix the selection when a note is present.\n let flag = false;\n const difference = sel.$to.pos - sel.$from.pos;\n editorState.doc.nodesBetween(sel.$from.pos, sel.$to.pos, (node, from) => {\n if (node.type.name === 'footnote') flag = true;\n });\n\n if (sel && !flag) {\n const decos = [\n Decoration.inline(sel.$from.pos, sel.$to.pos, {\n class: 'wax-selection-marker',\n }),\n ];\n const deco = DecorationSet.create(editorState.doc, decos);\n return { deco };\n }\n\n return state;\n },\n },\n props: {\n decorations(state) {\n if (state && this.getState(state)) {\n return this.getState(state).deco;\n }\n return null;\n },\n },\n});\n\nexport default WaxSelectionPlugin;\n","import hljs from 'highlight.js/lib/core';\nimport { getHighlightDecorations } from 'prosemirror-highlightjs';\nimport { DecorationSet } from 'prosemirror-view';\nimport { Plugin } from 'prosemirror-state';\n\nconst highlightPlugin = (nodeTypes = ['code_block']) => {\n return new Plugin({\n state: {\n init(_, instance) {\n const content = getHighlightDecorations(\n instance.doc,\n hljs,\n nodeTypes,\n () => undefined,\n );\n return DecorationSet.create(instance.doc, content);\n },\n apply(tr, set, state) {\n if (!tr.docChanged) {\n return set.map(tr.mapping, tr.doc);\n }\n\n const {\n selection: { $from, $to },\n doc,\n } = state;\n let codeBlock = false;\n\n doc.nodesBetween($from.pos, $to.pos, (node, from) => {\n if (node.type.name === 'code_block') {\n codeBlock = true;\n }\n });\n\n if (codeBlock) {\n const content = getHighlightDecorations(\n tr.doc,\n hljs,\n nodeTypes,\n () => undefined,\n );\n\n return DecorationSet.create(tr.doc, content);\n }\n return set.map(tr.mapping, tr.doc);\n },\n },\n props: {\n decorations(state) {\n return this.getState(state);\n },\n },\n });\n};\n\nexport default highlightPlugin;\n"],"names":["deactivateAllSelectedChanges","tr","pluginState","decos","DecorationSet","empty","setMeta","key","getFromToMark","doc","pos","mark","$pos","resolve","parent","start","childAfter","parentOffset","node","startIndex","index","startPos","offset","isInSet","child","marks","nodeSize","endIndex","endPos","childCount","from","to","findSelectedChanges","state","selection","selectedChanges","insertion","deletion","formatChange","insertionPos","deletionPos","formatChangePos","insertionMark","deletionMark","formatChangeMark","insertionSize","deletionSize","formatChangeSize","resolvedPos","find","type","name","attrs","approved","nodesBetween","track","trackAttr","isInline","PluginKey","selectedInsertionSpec","selectedDeletionSpec","selectedChangeFormatSpec","options","Plugin","init","config","userIds","descendants","forEach","includes","user","push","apply","prev","oldState","meta","getMeta","getState","selectionSet","decoType","Decoration","inline","add","class","map","mapping","props","decorations","handleDOMEvents","focus","view","_event","dispatch","commentPlugin","getComment","commentMark","schema","comment","commentOnSelection","DocumentHelpers","findFragmentedMark","conversation","length","commentNodes","findChildrenByMark","allCommentsWithSameId","filter","id","minPos","minBy","maxPos","maxBy","last","contained","_","newState","createDecoration","create","commentPluginState","setCommentActive","WaxSelectionPlugin","instance","deco","transaction","prevEditorState","editorState","sel","curSelection","flag","difference","$to","$from","highlightPlugin","nodeTypes","content","getHighlightDecorations","hljs","undefined","set","docChanged","codeBlock"],"mappings":";;;;;;;;;;;;;AAgDO,SAASA,4BAAT,CAAsCC,EAAtC,EAA0C;AAC7C,QAAMC,WAAW,GAAG;AAChBC,IAAAA,KAAK,EAAEC,6BAAa,CAACC;AADL,GAApB;AAGA,SAAOJ,EAAE,CAACK,OAAH,CAAWC,GAAX,EAAgBL,WAAhB,EAA6BI,OAA7B,CAAqC,OAArC,EAA8C,IAA9C,CAAP;AACH;;AAGM,SAASE,aAAT,CAAuBC,GAAvB,EAA4BC,GAA5B,EAAiCC,IAAjC,EAAuC;AAC1C,QAAMC,IAAI,GAAGH,GAAG,CAACI,OAAJ,CAAYH,GAAZ,CAAb;AAAA,QAA+BI,MAAM,GAAGF,IAAI,CAACE,MAA7C;AACA,QAAMC,KAAK,GAAGD,MAAM,CAACE,UAAP,CAAkBJ,IAAI,CAACK,YAAvB,CAAd;;AACA,MAAI,CAACF,KAAK,CAACG,IAAX,EAAiB;AACb,WAAO,IAAP;AACH;;AACD,MAAIC,UAAU,GAAGP,IAAI,CAACQ,KAAL,EAAjB;AAAA,MAA+BC,QAAQ,GAAGT,IAAI,CAACG,KAAL,KAAeA,KAAK,CAACO,MAA/D;;AACA,SAAOH,UAAU,GAAG,CAAb,IAAkBR,IAAI,CAACY,OAAL,CAAaT,MAAM,CAACU,KAAP,CAAaL,UAAU,GAAG,CAA1B,EAA6BM,KAA1C,CAAzB,EAA2E;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AE,CAACoF,OAAX,EAAoBpF,EAAE,CAACQ,GAAvB,CAAP;AACD;;AAED,cAAM;AACJyB,UAAAA,SAAS,EAAE;AAAEiG,YAAAA,KAAF;AAASD,YAAAA;AAAT,WADP;AAEJzH,UAAAA;AAFI,YAGFwB,KAHJ;AAIA,YAAI2G,SAAS,GAAG,KAAhB;AAEAnI,QAAAA,GAAG,CAAC6C,YAAJ,CAAiB6E,KAAK,CAACzH,GAAvB,EAA4BwH,GAAG,CAACxH,GAAhC,EAAqC,CAACQ,IAAD,EAAOY,IAAP,KAAgB;AACnD,cAAIZ,IAAI,CAACgC,IAAL,CAAUC,IAAV,KAAmB,YAAvB,EAAqC;AACnCyF,YAAAA,SAAS,GAAG,IAAZ;AACD;AACF,SAJD;;AAMA,YAAIA,SAAJ,EAAe;AACb,gBAAMN,OAAO,GAAGC,8CAAuB,CACrCtI,EAAE,CAACQ,GADkC,EAErC+H,IAFqC,EAGrCH,SAHqC,EAIrC,MAAMI,SAJ+B,CAAvC;AAOA,iBAAOrI,6BAAa,CAACiH,MAAd,CAAqBpH,EAAE,CAACQ,GAAxB,EAA6B6H,OAA7B,CAAP;AACD;;AACD,eAAOI,GAAG,CAACtD,GAAJ,CAAQnF,EAAE,CAACoF,OAAX,EAAoBpF,EAAE,CAACQ,GAAvB,CAAP;AACD;;AAtCI,KADS;AAyChB6E,IAAAA,KAAK,EAAE;AACLC,MAAAA,WAAW,CAACtD,KAAD,EAAQ;AACjB,eAAO,KAAK4C,QAAL,CAAc5C,KAAd,CAAP;AACD;;AAHI;AAzCS,GAAX,CAAP;AA+CD,CAhDD;;;;;;;"} \ No newline at end of file diff --git a/wax-prosemirror-schema/dist/index.js b/wax-prosemirror-schema/dist/index.js new file mode 100644 index 000000000..6f0b2ae28 --- /dev/null +++ b/wax-prosemirror-schema/dist/index.js @@ -0,0 +1,1506 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var waxProsemirrorUtilities = require('wax-prosemirror-utilities'); + +const code = { + parseDOM: { + tag: "code" + }, + + toDOM(hook, next) { + hook.value = ["code", 0]; + next(); + } + +}; + +const strong = { + parseDOM: [{ + tag: "strong" + }, { + tag: "b", + getAttrs: node => node.style.fontWeight != "normal" && null + } // { + // style: "font-weight", + // getAttrs: value => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null + // } + ], + + toDOM(hook, next) { + hook.value = ["strong", 0]; + next(); + } + +}; + +const link = { + attrs: { + href: { + default: null + }, + rel: { + default: "" + }, + target: { + default: "blank" + }, + title: { + default: null + } + }, + inclusive: false, + parseDOM: [{ + tag: "a[href]", + + getAttrs(hook, next) { + const href = hook.dom.getAttribute("href"); + const target = href && href.indexOf("#") === 0 ? "" : "blank"; + Object.assign(hook, { + href: hook.dom.getAttribute("href"), + title: hook.dom.getAttribute("title"), + target + }); + next(); + } + + }], + + toDOM(hook, next) { + hook.value = ["a", hook.node.attrs, 0]; + next(); + } + +}; + +const em = { + parseDOM: [{ + tag: "i" + }, { + tag: "em" + }, { + style: "font-style=italic" + }], + + toDOM(hook, next) { + hook.value = ["em", 0]; + next(); + } + +}; + +const subscript = { + excludes: "superscript", + parseDOM: [{ + tag: "sub" + }, { + style: "vertical-align=sub" + }], + + toDOM(hook, next) { + hook.value = ["sub"]; + next(); + } + +}; + +const superscript = { + excludes: "subscript", + parseDOM: [{ + tag: "sup" + }, { + style: "vertical-align=super" + }], + toDOM: (hook, next) => { + hook.value = ["sup"]; + next(); + } +}; + +const strikethrough = { + parseDOM: [{ + tag: "strike" + }, { + style: "text-decoration:line-through" + }, { + style: "text-decoration-line:line-through" + }], + toDOM: (hook, next) => { + hook.value = ["span", { + style: "text-decoration-line:line-through" + }]; + next(); + } +}; + +const underline = { + parseDOM: [{ + tag: "u" + }, { + style: "text-decoration:underline" + }], + toDOM: (hook, next) => { + hook.value = ["span", { + style: "text-decoration:underline" + }]; + next(); + } +}; + +const smallcaps = { + attrs: { + class: { + default: "small-caps" + } + }, + // inclusive: false, + parseDOM: [{ + tag: "span.small-caps", + + getAttrs(dom) { + return { + class: dom.getAttribute("class") + }; + } + + }], + + toDOM(hook, next) { + hook.value = ["span", hook.node.attrs, 0]; + next(); + } + +}; + +const source = { + parseDOM: [{ + tag: "cite" + }], + + toDOM() { + return ["cite", 0]; + } + +}; + +const comment = { + attrs: { + class: { + default: 'comment' + }, + id: { + default: '' + }, + group: { + default: '' + }, + viewid: { + default: '' + }, + conversation: [] + }, + inclusive: false, + excludes: '', + parseDOM: [{ + tag: 'span.comment', + + getAttrs(hook, next) { + Object.assign(hook, { + class: hook.dom.getAttribute('class'), + id: hook.dom.dataset.id, + group: hook.dom.dataset.group, + viewid: hook.dom.dataset.viewid, + conversation: JSON.parse(hook.dom.dataset.conversation) + }); + next(); + } + + }], + + toDOM(hook, next) { + hook.value = ['span', { + class: hook.node.attrs.class, + 'data-id': hook.node.attrs.id, + 'data-conversation': JSON.stringify(hook.node.attrs.conversation), + 'data-viewid': hook.node.attrs.viewid, + 'data-group': hook.node.attrs.group + }]; + next(); + } + +}; + +const insertion = { + attrs: { + class: { + default: "insertion" + }, + id: { + default: "" + }, + user: { + default: 0 + }, + username: { + default: "" + }, + date: { + default: 0 + }, + group: { + default: "" + } + }, + inclusive: false, + group: "track", + parseDOM: [{ + tag: "span.insertion", + + getAttrs(hook, next) { + Object.assign(hook, { + class: hook.dom.getAttribute("class"), + id: hook.dom.dataset.id, + user: parseInt(hook.dom.dataset.user), + username: hook.dom.dataset.username, + date: parseInt(hook.dom.dataset.date), + group: hook.dom.dataset.group + }); + next(); + } + + }], + + toDOM(hook, next) { + hook.value = ["span", { + class: hook.node.attrs.class, + "data-id": hook.node.attrs.id, + "data-user": hook.node.attrs.user, + "data-username": hook.node.attrs.username, + "data-date": hook.node.attrs.date, + "data-group": hook.node.attrs.group + }]; + next(); + } + +}; + +const deletion = { + attrs: { + class: { + default: "deletion" + }, + id: { + default: "" + }, + user: { + default: 0 + }, + username: { + default: "" + }, + date: { + default: 0 + }, + group: { + default: "" + } + }, + inclusive: false, + group: "track", + parseDOM: [{ + tag: "span.deletion", + + getAttrs(hook, next) { + Object.assign(hook, { + class: hook.dom.getAttribute("class"), + id: hook.dom.dataset.id, + user: parseInt(hook.dom.dataset.user), + username: hook.dom.dataset.username, + date: parseInt(hook.dom.dataset.date), + group: hook.dom.dataset.group + }); + next(); + } + + }], + + toDOM(hook, next) { + hook.value = ["span", { + class: hook.node.attrs.class, + "data-id": hook.node.attrs.id, + "data-user": hook.node.attrs.user, + "data-username": hook.node.attrs.username, + "data-date": hook.node.attrs.date, + "data-group": hook.node.attrs.group + }]; + next(); + } + +}; + +const format_change = { + attrs: { + class: { + default: "format-change" + }, + id: { + default: "" + }, + user: { + default: 0 + }, + username: { + default: "" + }, + date: { + default: 0 + }, + before: { + default: [] + }, + after: { + default: [] + }, + group: { + default: "" + } + }, + inclusive: false, + group: "track", + parseDOM: [{ + tag: "span.format-change", + + getAttrs(hook, next) { + Object.assign(hook, { + class: hook.dom.getAttribute("class"), + id: hook.dom.dataset.id, + user: parseInt(hook.dom.dataset.user), + username: hook.dom.dataset.username, + date: parseInt(hook.dom.dataset.date), + before: waxProsemirrorUtilities.SchemaHelpers.parseFormatList(hook.dom.dataset.before), + after: waxProsemirrorUtilities.SchemaHelpers.parseFormatList(hook.dom.dataset.after), + group: hook.dom.dataset.group + }); + next(); + } + + }], + + toDOM(hook, next) { + hook.value = ["span", { + class: hook.node.attrs.class, + "data-id": hook.node.attrs.id, + "data-user": hook.node.attrs.user, + "data-username": hook.node.attrs.username, + "data-date": hook.node.attrs.date, + "data-before": JSON.stringify(hook.node.attrs.before), + "data-after": JSON.stringify(hook.node.attrs.after), + "data-group": hook.node.attrs.group + }]; + next(); + } + +}; + +var index = { + format_change: format_change, + insertion: insertion, + deletion: deletion +}; + +const author = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + class: { + default: "author" + } + }, + parseDOM: [{ + tag: "p.author", + + getAttrs(hook, next) { + Object.assign(hook, { + class: hook.dom.getAttribute("class") + }); + next(); + } + + }], + + toDOM(hook, next) { + const attrs = { + class: hook.node.attrs.class + }; + hook.value = ["p", attrs, 0]; + next(); + } + +}; + +const epigraphPoetry = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + class: { + default: "epigraph-poetry" + } + }, + parseDOM: [{ + tag: "p.epigraph-poetry", + + getAttrs(hook, next) { + Object.assign(hook, { + class: hook.dom.getAttribute("class") + }); + next(); + } + + }], + + toDOM(hook, next) { + const attrs = { + class: hook.node.attrs.class + }; + hook.value = ["p", attrs, 0]; + next(); + } + +}; + +const epigraphProse = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + class: { + default: "epigraph-prose" + } + }, + parseDOM: [{ + tag: "p.epigraph-prose", + + getAttrs(hook, next) { + Object.assign(hook, { + class: hook.dom.getAttribute("class") + }); + next(); + } + + }], + + toDOM(hook, next) { + const attrs = { + class: hook.node.attrs.class + }; + hook.value = ["p", attrs, 0]; + next(); + } + +}; + +const sourceNote = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + class: { + default: "source-note" + } + }, + parseDOM: [{ + tag: "p.source-note", + + getAttrs(hook, next) { + Object.assign(hook, { + class: hook.dom.getAttribute("class") + }); + next(); + } + + }], + + toDOM(hook, next) { + const attrs = { + class: hook.node.attrs.class + }; + hook.value = ["p", attrs, 0]; + next(); + } + +}; + +const paragraphCont = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + class: { + default: "paragraph-cont" + } + }, + parseDOM: [{ + tag: "p.paragraph-cont", + + getAttrs(hook, next) { + Object.assign(hook, { + class: hook.dom.getAttribute("class") + }); + next(); + } + + }], + + toDOM(hook, next) { + const attrs = { + class: hook.node.attrs.class + }; + hook.value = ["p", attrs, 0]; + next(); + } + +}; + +const extractProse = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + class: { + default: "extract-prose" + } + }, + parseDOM: [{ + tag: "p.extract-prose", + + getAttrs(hook, next) { + Object.assign(hook, { + class: hook.dom.getAttribute("class") + }); + next(); + } + + }], + + toDOM(hook, next) { + const attrs = { + class: hook.node.attrs.class + }; + hook.value = ["p", attrs, 0]; + next(); + } + +}; + +const extractPoetry = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + class: { + default: "extract-poetry" + } + }, + parseDOM: [{ + tag: "p.extract-poetry", + + getAttrs(hook, next) { + Object.assign(hook, { + class: hook.dom.getAttribute("class") + }); + next(); + } + + }], + + toDOM(hook, next) { + const attrs = { + class: hook.node.attrs.class + }; + hook.value = ["p", attrs, 0]; + next(); + } + +}; + +const title = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + class: { + default: "title" + } + }, + parseDOM: [{ + tag: "p.title", + + getAttrs(hook, next) { + Object.assign(hook, { + class: dom.getAttribute("class") + }); + next(); + } + + }], + + toDOM(hook, next) { + const attrs = { + class: hook.node.attrs.class + }; + hook.value = ["p", attrs, 0]; + next(); + } + +}; + +const orderedlist = { + group: "block", + content: "list_item+", + attrs: { + order: { + default: 1 + } + }, + parseDOM: [{ + tag: "ol", + + getAttrs(hook, next) { + Object.assign(hook, { + order: hook.dom.hasAttribute("start") ? +hook.dom.getAttribute("start") : 1 + }); + next(); + } + + }], + + toDOM(hook, next) { + const attrs = {}; + + if (hook.node.attrs.order !== 1) { + attrs.start = hook.node.attrs.order; + } + + hook.value = ["ol", attrs, 0]; + next(); + } + +}; + +const bulletlist = { + group: "block", + content: "list_item+", + attrs: { + track: { + default: [] + } + }, + parseDOM: [{ + tag: "ul", + + getAttrs(hook, next) { + Object.assign(hook, { + track: waxProsemirrorUtilities.SchemaHelpers.parseTracks(hook.dom.dataset.track) + }); + next(); + } + + }], + + toDOM(hook, next) { + const attrs = {}; + + if (hook.node.attrs.track.length) { + attrs["data-track"] = JSON.stringify(hook.node.attrs.track); + } + + hook.value = ["ul", attrs, 0]; + next(); + } + +}; + +const list_item = { + content: "paragraph block*", + attrs: { + track: { + default: [] + } + }, + parseDOM: [{ + tag: "li", + + getAttrs(hook, next) { + Object.assign(hook, { + track: waxProsemirrorUtilities.SchemaHelpers.parseTracks(hook.dom.dataset.track) + }); + next(); + } + + }], + + toDOM(hook, next) { + const attrs = {}; + + if (hook.node.attrs.track.length) { + attrs["data-track"] = JSON.stringify(hook.node.attrs.track); + } + + hook.value = ["li", attrs, 0]; + next(); + }, + + defining: true +}; + +const subtitle = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + class: { + default: "cst" + } + }, + parseDOM: [{ + tag: "p.cst", + + getAttrs(hook, next) { + Object.assign(hook, { + class: dom.getAttribute("class") + }); + next(); + } + + }], + + toDOM(hook, next) { + const attrs = { + class: hook.node.attrs.class + }; + hook.value = ["p", attrs, 0]; + next(); + } + +}; + +const image = { + inline: true, + attrs: { + src: {}, + alt: { + default: null + }, + title: { + default: null + }, + track: { + default: [] + } + }, + group: 'inline', + draggable: true, + parseDOM: [{ + tag: 'img[src]', + + getAttrs(hook, next) { + Object.assign(hook, { + src: hook.dom.getAttribute('src'), + title: hook.dom.getAttribute('title'), + // track: parseTracks(hook.dom.dataset.track), + alt: hook.dom.getAttribute('alt') + }); + next(); + } + + }], + + toDOM(hook, next) { + // // attrs["data-track"] = JSON.stringify(hook.node.attrs.track); + // } + + const { + src, + alt, + title + } = hook.node.attrs; + hook.value = ['img', { + src, + alt, + title + }]; + next(); + } + +}; + +const heading = { + attrs: { + level: { + default: 1 + } + }, + content: "inline*", + group: "block", + defining: true, + parseDOM: [{ + tag: "h1", + attrs: { + level: 1 + } + }, { + tag: "h2", + attrs: { + level: 2 + } + }, { + tag: "h3", + attrs: { + level: 3 + } + }], + + toDOM(hook, next) { + const attrs = {}; + hook.value = [`h${hook.node.attrs.level}`, attrs, 0]; + next(); + } + +}; + +const blockquote = { + content: "block+", + group: "block", + defining: true, + parseDOM: [{ + tag: "blockquote" + }], + + toDOM() { + return ["blockquote", 0]; + } + +}; + +// TODO Write the node in WaxSchema +const footnote = { + group: 'inline', + content: 'block*', + inline: true, + atom: true, + attrs: { + id: { + default: '' + } + }, + toDOM: node => { + return ['footnote', node.attrs, 0]; + }, + parseDOM: [{ + tag: 'footnote', + + getAttrs(dom) { + return { + id: dom.getAttribute('id') + }; + } + + }] +}; + +const codeBlock = { + content: 'text*', + group: 'block', + code: true, + defining: true, + marks: 'comment insertion deletion', + attrs: { + params: { + default: '' + } + }, + parseDOM: [{ + tag: 'pre', + preserveWhitespace: 'full', + + getAttrs(dom) { + return { + params: dom.dataset.params + }; + } + + }], + + toDOM(node) { + return ['pre', { + 'data-params': node.attrs.params + }, ['code', 0]]; + } + +}; + +const author$1 = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + id: { + default: "" + }, + track: { + default: [] + }, + group: { + default: "" + } + }, + parseDOM: [{ + tag: "p.author", + + getAttrs(hook, next) { + Object.assign(hook, { + id: hook.dom.dataset.id, + track: waxProsemirrorUtilities.SchemaHelpers.parseTracks(hook.dom.dataset.track), + group: hook.dom.dataset.group + }); + next(); + } + + }], + + toDOM(hook, next) { + if (hook.node.attrs.track.length) { + Object.assign(hook.value[1], { + "data-id": hook.node.attrs.id, + "data-track": JSON.stringify(hook.node.attrs.track), + "data-group": hook.node.attrs.group + }); + } + + next(); + } + +}; + +const title$1 = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + id: { + default: "" + }, + track: { + default: [] + }, + group: { + default: "" + } + }, + parseDOM: [{ + tag: "p.title", + + getAttrs(hook, next) { + Object.assign(hook, { + id: hook.dom.dataset.id, + track: waxProsemirrorUtilities.SchemaHelpers.parseTracks(hook.dom.dataset.track), + group: hook.dom.dataset.group + }); + next(); + } + + }], + + toDOM(hook, next) { + if (hook.node.attrs.track.length) { + Object.assign(hook.value[1], { + "data-id": hook.node.attrs.id, + "data-track": JSON.stringify(hook.node.attrs.track), + "data-group": hook.node.attrs.group + }); + } + + next(); + } + +}; + +const subtitle$1 = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + id: { + default: "" + }, + track: { + default: [] + }, + group: { + default: "" + } + }, + parseDOM: [{ + tag: "p.cst", + + getAttrs(hook, next) { + Object.assign(hook, { + id: hook.dom.dataset.id, + track: waxProsemirrorUtilities.SchemaHelpers.parseTracks(hook.dom.dataset.track), + group: hook.dom.dataset.group + }); + next(); + } + + }], + + toDOM(hook, next) { + if (hook.node.attrs.track.length) { + Object.assign(hook.value[1], { + "data-id": hook.node.attrs.id, + "data-track": JSON.stringify(hook.node.attrs.track), + "data-group": hook.node.attrs.group + }); + } + + next(); + } + +}; + +const epigraphProse$1 = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + id: { + default: "" + }, + track: { + default: [] + }, + group: { + default: "" + } + }, + parseDOM: [{ + tag: "p.epigraph-prose", + + getAttrs(hook, next) { + Object.assign(hook, { + id: hook.dom.dataset.id, + track: waxProsemirrorUtilities.SchemaHelpers.parseTracks(hook.dom.dataset.track), + group: hook.dom.dataset.group + }); + next(); + } + + }], + + toDOM(hook, next) { + if (hook.node.attrs.track.length) { + Object.assign(hook.value[1], { + "data-id": hook.node.attrs.id, + "data-track": JSON.stringify(hook.node.attrs.track), + "data-group": hook.node.attrs.group + }); + } + + next(); + } + +}; + +const epigraphPoetry$1 = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + id: { + default: "" + }, + track: { + default: [] + }, + group: { + default: "" + } + }, + parseDOM: [{ + tag: "p.epigraph-poetry", + + getAttrs(hook, next) { + Object.assign(hook, { + id: hook.dom.dataset.id, + track: waxProsemirrorUtilities.SchemaHelpers.parseTracks(hook.dom.dataset.track), + group: hook.dom.dataset.group + }); + next(); + } + + }], + + toDOM(hook, next) { + if (hook.node.attrs.track.length) { + Object.assign(hook.value[1], { + "data-id": hook.node.attrs.id, + "data-track": JSON.stringify(hook.node.attrs.track), + "data-group": hook.node.attrs.group + }); + } + + next(); + } + +}; + +const heading$1 = { + attrs: { + id: { + default: "" + }, + track: { + default: [] + }, + group: { + default: "" + } + }, + content: "inline*", + group: "block", + defining: true, + parseDOM: [{ + tag: "h1", + + getAttrs(hook, next) { + Object.assign(hook, { + id: hook.dom.dataset.id, + track: waxProsemirrorUtilities.SchemaHelpers.parseTracks(hook.dom.dataset.track), + group: hook.dom.dataset.group + }); + next(); + } + + }, { + tag: "h2", + + getAttrs(hook, next) { + Object.assign(hook, { + id: hook.dom.dataset.id, + track: waxProsemirrorUtilities.SchemaHelpers.parseTracks(hook.dom.dataset.track), + group: hook.dom.dataset.group + }); + next(); + } + + }, { + tag: "h3", + + getAttrs(hook, next) { + Object.assign(hook, { + id: hook.dom.dataset.id, + track: waxProsemirrorUtilities.SchemaHelpers.parseTracks(hook.dom.dataset.track), + group: hook.dom.dataset.group + }); + next(); + } + + }], + + toDOM(hook, next) { + if (hook.node.attrs.track.length) { + Object.assign(hook.value[1], { + "data-id": hook.node.attrs.id, + "data-track": JSON.stringify(hook.node.attrs.track), + "data-group": hook.node.attrs.group + }); + } + + next(); + } + +}; + +const paragraphCont$1 = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + id: { + default: "" + }, + track: { + default: [] + }, + group: { + default: "" + } + }, + parseDOM: [{ + tag: "p.paragraph-cont", + + getAttrs(hook, next) { + Object.assign(hook, { + id: hook.dom.dataset.id, + track: waxProsemirrorUtilities.SchemaHelpers.parseTracks(hook.dom.dataset.track), + group: hook.dom.dataset.group + }); + next(); + } + + }], + + toDOM(hook, next) { + if (hook.node.attrs.track.length) { + Object.assign(hook.value[1], { + "data-id": hook.node.attrs.id, + "data-track": JSON.stringify(hook.node.attrs.track), + "data-group": hook.node.attrs.group + }); + } + + next(); + } + +}; + +const extractProse$1 = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + id: { + default: "" + }, + track: { + default: [] + }, + group: { + default: "" + } + }, + parseDOM: [{ + tag: "p.extract-prose", + + getAttrs(hook, next) { + Object.assign(hook, { + id: hook.dom.dataset.id, + track: waxProsemirrorUtilities.SchemaHelpers.parseTracks(hook.dom.dataset.track), + group: hook.dom.dataset.group + }); + next(); + } + + }], + + toDOM(hook, next) { + if (hook.node.attrs.track.length) { + Object.assign(hook.value[1], { + "data-id": hook.node.attrs.id, + "data-track": JSON.stringify(hook.node.attrs.track), + "data-group": hook.node.attrs.group + }); + } + + next(); + } + +}; + +const extractPoetry$1 = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + id: { + default: "" + }, + track: { + default: [] + }, + group: { + default: "" + } + }, + parseDOM: [{ + tag: "p.extract-poetry", + + getAttrs(hook, next) { + Object.assign(hook, { + id: hook.dom.dataset.id, + track: waxProsemirrorUtilities.SchemaHelpers.parseTracks(hook.dom.dataset.track), + group: hook.dom.dataset.group + }); + next(); + } + + }], + + toDOM(hook, next) { + if (hook.node.attrs.track.length) { + Object.assign(hook.value[1], { + "data-id": hook.node.attrs.id, + "data-track": JSON.stringify(hook.node.attrs.track), + "data-group": hook.node.attrs.group + }); + } + + next(); + } + +}; + +const sourceNote$1 = { + content: "inline*", + group: "block", + priority: 0, + defining: true, + attrs: { + id: { + default: "" + }, + track: { + default: [] + }, + group: { + default: "" + } + }, + parseDOM: [{ + tag: "p.source-note", + + getAttrs(hook, next) { + Object.assign(hook, { + id: hook.dom.dataset.id, + track: waxProsemirrorUtilities.SchemaHelpers.parseTracks(hook.dom.dataset.track), + group: hook.dom.dataset.group + }); + next(); + } + + }], + + toDOM(hook, next) { + if (hook.node.attrs.track.length) { + Object.assign(hook.value[1], { + "data-id": hook.node.attrs.id, + "data-track": JSON.stringify(hook.node.attrs.track), + "data-group": hook.node.attrs.group + }); + } + + next(); + } + +}; + +const orderedlist$1 = { + group: "block", + content: "list_item+", + attrs: { + id: { + default: "" + }, + track: { + default: [] + }, + group: { + default: "" + } + }, + parseDOM: [{ + tag: "ol", + + getAttrs(hook, next) { + Object.assign(hook, { + id: hook.dom.dataset.id, + track: waxProsemirrorUtilities.SchemaHelpers.parseTracks(hook.dom.dataset.track), + group: hook.dom.dataset.group + }); + next(); + } + + }], + + toDOM(hook, next) { + if (hook.node.attrs.track.length) { + Object.assign(hook.value[1], { + "data-id": hook.node.attrs.id, + "data-track": JSON.stringify(hook.node.attrs.track), + "data-group": hook.node.attrs.group + }); + } + + next(); + } + +}; + +var index$1 = { + author: author$1, + title: title$1, + subtitle: subtitle$1, + epigraphProse: epigraphProse$1, + epigraphPoetry: epigraphPoetry$1, + paragraphCont: paragraphCont$1, + extractProse: extractProse$1, + extractPoetry: extractPoetry$1, + orderedlist: orderedlist$1, + sourceNote: sourceNote$1, + heading: heading$1 // bulletlist: bulletListTrackNode, + // list_item: listItemTrackNode, + // image: imageTrackNode + +}; + +exports.authorNode = author; +exports.blockQuoteNode = blockquote; +exports.bulletListNode = bulletlist; +exports.codeBlockNode = codeBlock; +exports.codeMark = code; +exports.commentMark = comment; +exports.emphasisMark = em; +exports.epigraphPoetryNode = epigraphPoetry; +exports.epigraphProseNode = epigraphProse; +exports.extractPoetryNode = extractPoetry; +exports.extractProseNode = extractProse; +exports.footNoteNode = footnote; +exports.headingNode = heading; +exports.imageNode = image; +exports.linkMark = link; +exports.listItemNode = list_item; +exports.orderedListNode = orderedlist; +exports.paragraphContNode = paragraphCont; +exports.smallcapsMark = smallcaps; +exports.sourceMark = source; +exports.sourceNoteNode = sourceNote; +exports.strikethroughMark = strikethrough; +exports.strongMark = strong; +exports.subTitleNode = subtitle; +exports.subscriptMark = subscript; +exports.superscriptMark = superscript; +exports.titleNode = title; +exports.trackChangesMarks = index; +exports.trackChangesNodes = index$1; +exports.underlineMark = underline; +//# sourceMappingURL=index.js.map diff --git a/wax-prosemirror-schema/dist/index.js.map b/wax-prosemirror-schema/dist/index.js.map new file mode 100644 index 000000000..0b674c63f --- /dev/null +++ b/wax-prosemirror-schema/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../src/marks/codeMark.js","../src/marks/strongMark.js","../src/marks/linkMark.js","../src/marks/emphasisMark.js","../src/marks/subscriptMark.js","../src/marks/superscriptMark.js","../src/marks/strikethroughMark.js","../src/marks/underlineMark.js","../src/marks/smallcapsMark.js","../src/marks/sourceMark.js","../src/marks/commentMark.js","../src/marks/trackChangesMarks/insertionMark.js","../src/marks/trackChangesMarks/deletionMark.js","../src/marks/trackChangesMarks/formatChangeMark.js","../src/marks/trackChangesMarks/index.js","../src/nodes/authorNode.js","../src/nodes/epigraphPoetryNode.js","../src/nodes/epigraphProseNode.js","../src/nodes/sourceNoteNode.js","../src/nodes/paragraphContNode.js","../src/nodes/extractProseNode.js","../src/nodes/extractPoetryNode.js","../src/nodes/titleNode.js","../src/nodes/orderedListNode.js","../src/nodes/bulletListNode.js","../src/nodes/listItemNode.js","../src/nodes/subTitleNode.js","../src/nodes/imageNode.js","../src/nodes/headingNode.js","../src/nodes/blockQuoteNode.js","../src/nodes/footNoteNode.js","../src/nodes/codeBlockNode.js","../src/nodes/trackChangesNodes/authorTrackNode.js","../src/nodes/trackChangesNodes/titleTrackNode.js","../src/nodes/trackChangesNodes/subTitleTrackNode.js","../src/nodes/trackChangesNodes/epigraphProseTrackNode.js","../src/nodes/trackChangesNodes/epigraphPoetryTrackNode.js","../src/nodes/trackChangesNodes/headingTrackNode.js","../src/nodes/trackChangesNodes/paragraphContTrackNode.js","../src/nodes/trackChangesNodes/extractProseTrackNode.js","../src/nodes/trackChangesNodes/extractPoetryTrackNode.js","../src/nodes/trackChangesNodes/sourceNoteTrackNode.js","../src/nodes/trackChangesNodes/orderedListTrackNode.js","../src/nodes/trackChangesNodes/index.js"],"sourcesContent":["const code = {\n parseDOM: { tag: \"code\" },\n toDOM(hook, next) {\n hook.value = [\"code\", 0];\n next();\n }\n};\n\nexport default code;\n","const strong = {\n parseDOM: [\n { tag: \"strong\" },\n {\n tag: \"b\",\n getAttrs: node => node.style.fontWeight != \"normal\" && null\n }\n // {\n // style: \"font-weight\",\n // getAttrs: value => /^(bold(er)?|[5-9]\\d{2,})$/.test(value) && null\n // }\n ],\n toDOM(hook, next) {\n hook.value = [\"strong\", 0];\n next();\n }\n};\n\nexport default strong;\n","const link = {\n attrs: {\n href: { default: null },\n rel: { default: \"\" },\n target: { default: \"blank\" },\n title: { default: null }\n },\n inclusive: false,\n parseDOM: [\n {\n tag: \"a[href]\",\n getAttrs(hook, next) {\n const href = hook.dom.getAttribute(\"href\");\n const target = href && href.indexOf(\"#\") === 0 ? \"\" : \"blank\";\n Object.assign(hook, {\n href: hook.dom.getAttribute(\"href\"),\n title: hook.dom.getAttribute(\"title\"),\n target\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n hook.value = [\"a\", hook.node.attrs, 0];\n next();\n }\n};\n\nexport default link;\n","const em = {\n parseDOM: [{ tag: \"i\" }, { tag: \"em\" }, { style: \"font-style=italic\" }],\n toDOM(hook, next) {\n hook.value = [\"em\", 0];\n next();\n }\n};\n\nexport default em;\n","const subscript = {\n excludes: \"superscript\",\n parseDOM: [{ tag: \"sub\" }, { style: \"vertical-align=sub\" }],\n toDOM(hook, next) {\n hook.value = [\"sub\"];\n next();\n }\n};\n\nexport default subscript;\n","const superscript = {\n excludes: \"subscript\",\n parseDOM: [{ tag: \"sup\" }, { style: \"vertical-align=super\" }],\n toDOM: (hook, next) => {\n hook.value = [\"sup\"];\n next();\n }\n};\n\nexport default superscript;\n","const strikethrough = {\n parseDOM: [\n { tag: \"strike\" },\n { style: \"text-decoration:line-through\" },\n { style: \"text-decoration-line:line-through\" }\n ],\n toDOM: (hook, next) => {\n hook.value = [\n \"span\",\n {\n style: \"text-decoration-line:line-through\"\n }\n ];\n next();\n }\n};\n\nexport default strikethrough;\n","const underline = {\n parseDOM: [{ tag: \"u\" }, { style: \"text-decoration:underline\" }],\n toDOM: (hook, next) => {\n hook.value = [\n \"span\",\n {\n style: \"text-decoration:underline\"\n }\n ];\n next();\n }\n};\n\nexport default underline;\n","const smallcaps = {\n attrs: {\n class: { default: \"small-caps\" }\n },\n // inclusive: false,\n parseDOM: [\n {\n tag: \"span.small-caps\",\n getAttrs(dom) {\n return { class: dom.getAttribute(\"class\") };\n }\n }\n ],\n toDOM(hook, next) {\n hook.value = [\"span\", hook.node.attrs, 0];\n next();\n }\n};\n\nexport default smallcaps;\n","const source = {\n parseDOM: [{ tag: \"cite\" }],\n toDOM() {\n return [\"cite\", 0];\n }\n};\n\nexport default source;\n","const comment = {\n attrs: {\n class: { default: 'comment' },\n id: { default: '' },\n group: { default: '' },\n viewid: { default: '' },\n conversation: [],\n },\n inclusive: false,\n excludes: '',\n parseDOM: [\n {\n tag: 'span.comment',\n getAttrs(hook, next) {\n Object.assign(hook, {\n class: hook.dom.getAttribute('class'),\n id: hook.dom.dataset.id,\n group: hook.dom.dataset.group,\n viewid: hook.dom.dataset.viewid,\n conversation: JSON.parse(hook.dom.dataset.conversation),\n });\n next();\n },\n },\n ],\n toDOM(hook, next) {\n hook.value = [\n 'span',\n {\n class: hook.node.attrs.class,\n 'data-id': hook.node.attrs.id,\n 'data-conversation': JSON.stringify(hook.node.attrs.conversation),\n 'data-viewid': hook.node.attrs.viewid,\n 'data-group': hook.node.attrs.group,\n },\n ];\n next();\n },\n};\n\nexport default comment;\n","const insertion = {\n attrs: {\n class: { default: \"insertion\" },\n id: { default: \"\" },\n user: { default: 0 },\n username: { default: \"\" },\n date: { default: 0 },\n group: { default: \"\" }\n },\n inclusive: false,\n group: \"track\",\n parseDOM: [\n {\n tag: \"span.insertion\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n class: hook.dom.getAttribute(\"class\"),\n id: hook.dom.dataset.id,\n user: parseInt(hook.dom.dataset.user),\n username: hook.dom.dataset.username,\n date: parseInt(hook.dom.dataset.date),\n group: hook.dom.dataset.group\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n hook.value = [\n \"span\",\n {\n class: hook.node.attrs.class,\n \"data-id\": hook.node.attrs.id,\n \"data-user\": hook.node.attrs.user,\n \"data-username\": hook.node.attrs.username,\n \"data-date\": hook.node.attrs.date,\n \"data-group\": hook.node.attrs.group\n }\n ];\n next();\n }\n};\n\nexport default insertion;\n","const deletion = {\n attrs: {\n class: { default: \"deletion\" },\n id: { default: \"\" },\n user: { default: 0 },\n username: { default: \"\" },\n date: { default: 0 },\n group: { default: \"\" }\n },\n inclusive: false,\n group: \"track\",\n parseDOM: [\n {\n tag: \"span.deletion\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n class: hook.dom.getAttribute(\"class\"),\n id: hook.dom.dataset.id,\n user: parseInt(hook.dom.dataset.user),\n username: hook.dom.dataset.username,\n date: parseInt(hook.dom.dataset.date),\n group: hook.dom.dataset.group\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n hook.value = [\n \"span\",\n {\n class: hook.node.attrs.class,\n \"data-id\": hook.node.attrs.id,\n \"data-user\": hook.node.attrs.user,\n \"data-username\": hook.node.attrs.username,\n \"data-date\": hook.node.attrs.date,\n \"data-group\": hook.node.attrs.group\n }\n ];\n next();\n }\n};\nexport default deletion;\n","import { SchemaHelpers } from \"wax-prosemirror-utilities\";\n\nconst format_change = {\n attrs: {\n class: { default: \"format-change\" },\n id: { default: \"\" },\n user: { default: 0 },\n username: { default: \"\" },\n date: { default: 0 },\n before: { default: [] },\n after: { default: [] },\n group: { default: \"\" }\n },\n inclusive: false,\n group: \"track\",\n parseDOM: [\n {\n tag: \"span.format-change\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n class: hook.dom.getAttribute(\"class\"),\n id: hook.dom.dataset.id,\n user: parseInt(hook.dom.dataset.user),\n username: hook.dom.dataset.username,\n date: parseInt(hook.dom.dataset.date),\n before: SchemaHelpers.parseFormatList(hook.dom.dataset.before),\n after: SchemaHelpers.parseFormatList(hook.dom.dataset.after),\n group: hook.dom.dataset.group\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n hook.value = [\n \"span\",\n {\n class: hook.node.attrs.class,\n \"data-id\": hook.node.attrs.id,\n \"data-user\": hook.node.attrs.user,\n \"data-username\": hook.node.attrs.username,\n \"data-date\": hook.node.attrs.date,\n \"data-before\": JSON.stringify(hook.node.attrs.before),\n \"data-after\": JSON.stringify(hook.node.attrs.after),\n \"data-group\": hook.node.attrs.group\n }\n ];\n next();\n }\n};\n\nexport default format_change;\n","import insertionMark from \"./insertionMark\";\nimport deletionMark from \"./deletionMark\";\nimport formatChangeMark from \"./formatChangeMark\";\n\nexport default {\n format_change: formatChangeMark,\n insertion: insertionMark,\n deletion: deletionMark\n};\n","const author = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n class: { default: \"author\" }\n },\n parseDOM: [\n {\n tag: \"p.author\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n class: hook.dom.getAttribute(\"class\")\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n const attrs = { class: hook.node.attrs.class };\n hook.value = [\"p\", attrs, 0];\n next();\n }\n};\n\nexport default author;\n","const epigraphPoetry = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n class: { default: \"epigraph-poetry\" }\n },\n parseDOM: [\n {\n tag: \"p.epigraph-poetry\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n class: hook.dom.getAttribute(\"class\")\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n const attrs = { class: hook.node.attrs.class };\n hook.value = [\"p\", attrs, 0];\n next();\n }\n};\n\nexport default epigraphPoetry;\n","const epigraphProse = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n class: { default: \"epigraph-prose\" }\n },\n parseDOM: [\n {\n tag: \"p.epigraph-prose\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n class: hook.dom.getAttribute(\"class\")\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n const attrs = { class: hook.node.attrs.class };\n hook.value = [\"p\", attrs, 0];\n next();\n }\n};\n\nexport default epigraphProse;\n","const sourceNote = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n class: { default: \"source-note\" }\n },\n parseDOM: [\n {\n tag: \"p.source-note\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n class: hook.dom.getAttribute(\"class\")\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n const attrs = { class: hook.node.attrs.class };\n hook.value = [\"p\", attrs, 0];\n next();\n }\n};\n\nexport default sourceNote;\n","const paragraphCont = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n class: { default: \"paragraph-cont\" }\n },\n parseDOM: [\n {\n tag: \"p.paragraph-cont\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n class: hook.dom.getAttribute(\"class\")\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n const attrs = { class: hook.node.attrs.class };\n hook.value = [\"p\", attrs, 0];\n next();\n }\n};\n\nexport default paragraphCont;\n","const extractProse = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n class: { default: \"extract-prose\" }\n },\n parseDOM: [\n {\n tag: \"p.extract-prose\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n class: hook.dom.getAttribute(\"class\")\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n const attrs = { class: hook.node.attrs.class };\n hook.value = [\"p\", attrs, 0];\n next();\n }\n};\n\nexport default extractProse;\n","const extractPoetry = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n class: { default: \"extract-poetry\" }\n },\n parseDOM: [\n {\n tag: \"p.extract-poetry\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n class: hook.dom.getAttribute(\"class\")\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n const attrs = { class: hook.node.attrs.class };\n hook.value = [\"p\", attrs, 0];\n next();\n }\n};\n\nexport default extractPoetry;\n","const title = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n class: { default: \"title\" }\n },\n parseDOM: [\n {\n tag: \"p.title\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n class: dom.getAttribute(\"class\")\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n const attrs = { class: hook.node.attrs.class };\n hook.value = [\"p\", attrs, 0];\n next();\n }\n};\n\nexport default title;\n","const orderedlist = {\n group: \"block\",\n content: \"list_item+\",\n attrs: {\n order: { default: 1 }\n },\n parseDOM: [\n {\n tag: \"ol\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n order: hook.dom.hasAttribute(\"start\")\n ? +hook.dom.getAttribute(\"start\")\n : 1\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n const attrs = {};\n if (hook.node.attrs.order !== 1) {\n attrs.start = hook.node.attrs.order;\n }\n hook.value = [\"ol\", attrs, 0];\n next();\n }\n};\n\nexport default orderedlist;\n","import { SchemaHelpers } from \"wax-prosemirror-utilities\";\n\nconst bulletlist = {\n group: \"block\",\n content: \"list_item+\",\n attrs: {\n track: { default: [] }\n },\n parseDOM: [\n {\n tag: \"ul\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n track: SchemaHelpers.parseTracks(hook.dom.dataset.track)\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n const attrs = {};\n if (hook.node.attrs.track.length) {\n attrs[\"data-track\"] = JSON.stringify(hook.node.attrs.track);\n }\n hook.value = [\"ul\", attrs, 0];\n next();\n }\n};\n\nexport default bulletlist;\n","import { SchemaHelpers } from \"wax-prosemirror-utilities\";\n\nconst list_item = {\n content: \"paragraph block*\",\n attrs: {\n track: { default: [] }\n },\n parseDOM: [\n {\n tag: \"li\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n track: SchemaHelpers.parseTracks(hook.dom.dataset.track)\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n const attrs = {};\n if (hook.node.attrs.track.length) {\n attrs[\"data-track\"] = JSON.stringify(hook.node.attrs.track);\n }\n hook.value = [\"li\", attrs, 0];\n next();\n },\n defining: true\n};\n\nexport default list_item;\n","const subtitle = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n class: { default: \"cst\" }\n },\n parseDOM: [\n {\n tag: \"p.cst\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n class: dom.getAttribute(\"class\")\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n const attrs = { class: hook.node.attrs.class };\n hook.value = [\"p\", attrs, 0];\n next();\n }\n};\n\nexport default subtitle;\n","const image = {\n inline: true,\n attrs: {\n src: {},\n alt: { default: null },\n title: { default: null },\n track: { default: [] },\n },\n group: 'inline',\n draggable: true,\n parseDOM: [\n {\n tag: 'img[src]',\n getAttrs(hook, next) {\n Object.assign(hook, {\n src: hook.dom.getAttribute('src'),\n title: hook.dom.getAttribute('title'),\n // track: parseTracks(hook.dom.dataset.track),\n alt: hook.dom.getAttribute('alt'),\n });\n next();\n },\n },\n ],\n toDOM(hook, next) {\n const attrs = {};\n let temp = '';\n // if (hook.node.attrs.track.length) {\n // // attrs[\"data-track\"] = JSON.stringify(hook.node.attrs.track);\n // }\n const { src, alt, title } = hook.node.attrs;\n hook.value = ['img', { src, alt, title }];\n next();\n },\n};\n\nexport default image;\n","const heading = {\n attrs: {\n level: { default: 1 }\n },\n content: \"inline*\",\n group: \"block\",\n defining: true,\n parseDOM: [\n {\n tag: \"h1\",\n attrs: { level: 1 }\n },\n {\n tag: \"h2\",\n attrs: { level: 2 }\n },\n {\n tag: \"h3\",\n attrs: { level: 3 }\n }\n ],\n toDOM(hook, next) {\n const attrs = {};\n hook.value = [`h${hook.node.attrs.level}`, attrs, 0];\n next();\n }\n};\n\nexport default heading;\n","const blockquote = {\n content: \"block+\",\n group: \"block\",\n defining: true,\n parseDOM: [{ tag: \"blockquote\" }],\n toDOM() {\n return [\"blockquote\", 0];\n }\n};\n\nexport default blockquote;\n","// TODO Write the node in WaxSchema\nconst footnote = {\n group: 'inline',\n content: 'block*',\n inline: true,\n atom: true,\n attrs: {\n id: { default: '' },\n },\n toDOM: node => {\n return ['footnote', node.attrs, 0];\n },\n parseDOM: [\n {\n tag: 'footnote',\n getAttrs(dom) {\n return {\n id: dom.getAttribute('id'),\n };\n },\n },\n ],\n};\n\nexport default footnote;\n","const codeBlock = {\n content: 'text*',\n group: 'block',\n code: true,\n defining: true,\n marks: 'comment insertion deletion',\n attrs: { params: { default: '' } },\n parseDOM: [\n {\n tag: 'pre',\n preserveWhitespace: 'full',\n getAttrs(dom) {\n return {\n params: dom.dataset.params,\n };\n },\n },\n ],\n toDOM(node) {\n return ['pre', { 'data-params': node.attrs.params }, ['code', 0]];\n },\n};\n\nexport default codeBlock;\n","import { SchemaHelpers } from \"wax-prosemirror-utilities\";\n\nconst author = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n id: { default: \"\" },\n track: { default: [] },\n group: { default: \"\" }\n },\n parseDOM: [\n {\n tag: \"p.author\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n id: hook.dom.dataset.id,\n track: SchemaHelpers.parseTracks(hook.dom.dataset.track),\n group: hook.dom.dataset.group\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n if (hook.node.attrs.track.length) {\n Object.assign(hook.value[1], {\n \"data-id\": hook.node.attrs.id,\n \"data-track\": JSON.stringify(hook.node.attrs.track),\n \"data-group\": hook.node.attrs.group\n });\n }\n next();\n }\n};\n\nexport default author;\n","import { SchemaHelpers } from \"wax-prosemirror-utilities\";\n\nconst title = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n id: { default: \"\" },\n track: { default: [] },\n group: { default: \"\" }\n },\n parseDOM: [\n {\n tag: \"p.title\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n id: hook.dom.dataset.id,\n track: SchemaHelpers.parseTracks(hook.dom.dataset.track),\n group: hook.dom.dataset.group\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n if (hook.node.attrs.track.length) {\n Object.assign(hook.value[1], {\n \"data-id\": hook.node.attrs.id,\n \"data-track\": JSON.stringify(hook.node.attrs.track),\n \"data-group\": hook.node.attrs.group\n });\n }\n next();\n }\n};\n\nexport default title;\n","import { SchemaHelpers } from \"wax-prosemirror-utilities\";\n\nconst subtitle = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n id: { default: \"\" },\n track: { default: [] },\n group: { default: \"\" }\n },\n parseDOM: [\n {\n tag: \"p.cst\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n id: hook.dom.dataset.id,\n track: SchemaHelpers.parseTracks(hook.dom.dataset.track),\n group: hook.dom.dataset.group\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n if (hook.node.attrs.track.length) {\n Object.assign(hook.value[1], {\n \"data-id\": hook.node.attrs.id,\n \"data-track\": JSON.stringify(hook.node.attrs.track),\n \"data-group\": hook.node.attrs.group\n });\n }\n next();\n }\n};\n\nexport default subtitle;\n","import { SchemaHelpers } from \"wax-prosemirror-utilities\";\n\nconst epigraphProse = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n id: { default: \"\" },\n track: { default: [] },\n group: { default: \"\" }\n },\n parseDOM: [\n {\n tag: \"p.epigraph-prose\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n id: hook.dom.dataset.id,\n track: SchemaHelpers.parseTracks(hook.dom.dataset.track),\n group: hook.dom.dataset.group\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n if (hook.node.attrs.track.length) {\n Object.assign(hook.value[1], {\n \"data-id\": hook.node.attrs.id,\n \"data-track\": JSON.stringify(hook.node.attrs.track),\n \"data-group\": hook.node.attrs.group\n });\n }\n next();\n }\n};\n\nexport default epigraphProse;\n","import { SchemaHelpers } from \"wax-prosemirror-utilities\";\n\nconst epigraphPoetry = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n id: { default: \"\" },\n track: { default: [] },\n group: { default: \"\" }\n },\n parseDOM: [\n {\n tag: \"p.epigraph-poetry\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n id: hook.dom.dataset.id,\n track: SchemaHelpers.parseTracks(hook.dom.dataset.track),\n group: hook.dom.dataset.group\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n if (hook.node.attrs.track.length) {\n Object.assign(hook.value[1], {\n \"data-id\": hook.node.attrs.id,\n \"data-track\": JSON.stringify(hook.node.attrs.track),\n \"data-group\": hook.node.attrs.group\n });\n }\n next();\n }\n};\n\nexport default epigraphPoetry;\n","import { SchemaHelpers } from \"wax-prosemirror-utilities\";\n\nconst heading = {\n attrs: {\n id: { default: \"\" },\n track: { default: [] },\n group: { default: \"\" }\n },\n content: \"inline*\",\n group: \"block\",\n defining: true,\n parseDOM: [\n {\n tag: \"h1\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n id: hook.dom.dataset.id,\n track: SchemaHelpers.parseTracks(hook.dom.dataset.track),\n group: hook.dom.dataset.group\n });\n next();\n }\n },\n {\n tag: \"h2\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n id: hook.dom.dataset.id,\n track: SchemaHelpers.parseTracks(hook.dom.dataset.track),\n group: hook.dom.dataset.group\n });\n next();\n }\n },\n {\n tag: \"h3\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n id: hook.dom.dataset.id,\n track: SchemaHelpers.parseTracks(hook.dom.dataset.track),\n group: hook.dom.dataset.group\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n if (hook.node.attrs.track.length) {\n Object.assign(hook.value[1], {\n \"data-id\": hook.node.attrs.id,\n \"data-track\": JSON.stringify(hook.node.attrs.track),\n \"data-group\": hook.node.attrs.group\n });\n }\n next();\n }\n};\n\nexport default heading;\n","import { SchemaHelpers } from \"wax-prosemirror-utilities\";\n\nconst paragraphCont = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n id: { default: \"\" },\n track: { default: [] },\n group: { default: \"\" }\n },\n parseDOM: [\n {\n tag: \"p.paragraph-cont\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n id: hook.dom.dataset.id,\n track: SchemaHelpers.parseTracks(hook.dom.dataset.track),\n group: hook.dom.dataset.group\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n if (hook.node.attrs.track.length) {\n Object.assign(hook.value[1], {\n \"data-id\": hook.node.attrs.id,\n \"data-track\": JSON.stringify(hook.node.attrs.track),\n \"data-group\": hook.node.attrs.group\n });\n }\n next();\n }\n};\n\nexport default paragraphCont;\n","import { SchemaHelpers } from \"wax-prosemirror-utilities\";\n\nconst extractProse = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n id: { default: \"\" },\n track: { default: [] },\n group: { default: \"\" }\n },\n parseDOM: [\n {\n tag: \"p.extract-prose\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n id: hook.dom.dataset.id,\n track: SchemaHelpers.parseTracks(hook.dom.dataset.track),\n group: hook.dom.dataset.group\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n if (hook.node.attrs.track.length) {\n Object.assign(hook.value[1], {\n \"data-id\": hook.node.attrs.id,\n \"data-track\": JSON.stringify(hook.node.attrs.track),\n \"data-group\": hook.node.attrs.group\n });\n }\n next();\n }\n};\n\nexport default extractProse;\n","import { SchemaHelpers } from \"wax-prosemirror-utilities\";\n\nconst extractPoetry = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n id: { default: \"\" },\n track: { default: [] },\n group: { default: \"\" }\n },\n parseDOM: [\n {\n tag: \"p.extract-poetry\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n id: hook.dom.dataset.id,\n track: SchemaHelpers.parseTracks(hook.dom.dataset.track),\n group: hook.dom.dataset.group\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n if (hook.node.attrs.track.length) {\n Object.assign(hook.value[1], {\n \"data-id\": hook.node.attrs.id,\n \"data-track\": JSON.stringify(hook.node.attrs.track),\n \"data-group\": hook.node.attrs.group\n });\n }\n next();\n }\n};\n\nexport default extractPoetry;\n","import { SchemaHelpers } from \"wax-prosemirror-utilities\";\n\nconst sourceNote = {\n content: \"inline*\",\n group: \"block\",\n priority: 0,\n defining: true,\n attrs: {\n id: { default: \"\" },\n track: { default: [] },\n group: { default: \"\" }\n },\n parseDOM: [\n {\n tag: \"p.source-note\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n id: hook.dom.dataset.id,\n track: SchemaHelpers.parseTracks(hook.dom.dataset.track),\n group: hook.dom.dataset.group\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n if (hook.node.attrs.track.length) {\n Object.assign(hook.value[1], {\n \"data-id\": hook.node.attrs.id,\n \"data-track\": JSON.stringify(hook.node.attrs.track),\n \"data-group\": hook.node.attrs.group\n });\n }\n next();\n }\n};\n\nexport default sourceNote;\n","import { SchemaHelpers } from \"wax-prosemirror-utilities\";\n\nconst orderedlist = {\n group: \"block\",\n content: \"list_item+\",\n attrs: {\n id: { default: \"\" },\n track: { default: [] },\n group: { default: \"\" }\n },\n parseDOM: [\n {\n tag: \"ol\",\n getAttrs(hook, next) {\n Object.assign(hook, {\n id: hook.dom.dataset.id,\n track: SchemaHelpers.parseTracks(hook.dom.dataset.track),\n group: hook.dom.dataset.group\n });\n next();\n }\n }\n ],\n toDOM(hook, next) {\n if (hook.node.attrs.track.length) {\n Object.assign(hook.value[1], {\n \"data-id\": hook.node.attrs.id,\n \"data-track\": JSON.stringify(hook.node.attrs.track),\n \"data-group\": hook.node.attrs.group\n });\n }\n next();\n }\n};\n\nexport default orderedlist;\n","import authorTrackNode from \"./authorTrackNode\";\nimport titleTrackNode from \"./titleTrackNode\";\nimport subTitleTrackNode from \"./subTitleTrackNode\";\nimport epigraphProseTrackNode from \"./epigraphProseTrackNode\";\nimport epigraphPoetryTrackNode from \"./epigraphPoetryTrackNode\";\nimport headingTrackNode from \"./headingTrackNode\";\nimport paragraphContTrackNode from \"./paragraphContTrackNode\";\nimport extractProseTrackNode from \"./extractProseTrackNode\";\nimport extractPoetryTrackNode from \"./extractPoetryTrackNode\";\nimport sourceNoteTrackNode from \"./sourceNoteTrackNode\";\nimport bulletListTrackNode from \"./bulletListTrackNode\";\nimport orderedListTrackNode from \"./orderedListTrackNode\";\nimport listItemTrackNode from \"./listItemTrackNode\";\nimport imageTrackNode from \"./imageTrackNode\";\n\nexport default {\n author: authorTrackNode,\n title: titleTrackNode,\n subtitle: subTitleTrackNode,\n epigraphProse: epigraphProseTrackNode,\n epigraphPoetry: epigraphPoetryTrackNode,\n paragraphCont: paragraphContTrackNode,\n extractProse: extractProseTrackNode,\n extractPoetry: extractPoetryTrackNode,\n orderedlist: orderedListTrackNode,\n sourceNote: sourceNoteTrackNode,\n heading: headingTrackNode\n // bulletlist: bulletListTrackNode,\n // list_item: listItemTrackNode,\n // image: imageTrackNode\n};\n"],"names":["code","parseDOM","tag","toDOM","hook","next","value","strong","getAttrs","node","style","fontWeight","link","attrs","href","default","rel","target","title","inclusive","dom","getAttribute","indexOf","Object","assign","em","subscript","excludes","superscript","strikethrough","underline","smallcaps","class","source","comment","id","group","viewid","conversation","dataset","JSON","parse","stringify","insertion","user","username","date","parseInt","deletion","format_change","before","after","SchemaHelpers","parseFormatList","formatChangeMark","insertionMark","deletionMark","author","content","priority","defining","epigraphPoetry","epigraphProse","sourceNote","paragraphCont","extractProse","extractPoetry","orderedlist","order","hasAttribute","start","bulletlist","track","parseTracks","length","list_item","subtitle","image","inline","src","alt","draggable","heading","level","blockquote","footnote","atom","codeBlock","marks","params","preserveWhitespace","authorTrackNode","titleTrackNode","subTitleTrackNode","epigraphProseTrackNode","epigraphPoetryTrackNode","paragraphContTrackNode","extractProseTrackNode","extractPoetryTrackNode","orderedListTrackNode","sourceNoteTrackNode","headingTrackNode"],"mappings":";;;;;;AAAA,MAAMA,IAAI,GAAG;AACXC,EAAAA,QAAQ,EAAE;AAAEC,IAAAA,GAAG,EAAE;AAAP,GADC;;AAEXC,EAAAA,KAAK,CAACC,IAAD,EAAOC,IAAP,EAAa;AAChBD,IAAAA,IAAI,CAACE,KAAL,GAAa,CAAC,MAAD,EAAS,CAAT,CAAb;AACAD,IAAAA,IAAI;AACL;;AALU,CAAb;;ACAA,MAAME,MAAM,GAAG;AACbN,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AAL,CAAUI,KAAV,CAAgBsB,EADA;AAE3B,sBAAcK,IAAI,CAACE,SAAL,CAAetC,IAAI,CAACK,IAAL,CAAUI,KAAV,CAAgB2D,KAA/B,CAFa;AAG3B,sBAAcpE,IAAI,CAACK,IAAL,CAAUI,KAAV,CAAgBuB;AAHH,OAA7B;AAKD;;AACD/B,IAAAA,IAAI;AACL;;AA9BiB,CAApB;;ACaA,cAAe;AACboD,EAAAA,MAAM,EAAEkC,QADK;AAEbzE,EAAAA,KAAK,EAAE0E,OAFM;AAGbhB,EAAAA,QAAQ,EAAEiB,UAHG;AAIb/B,EAAAA,aAAa,EAAEgC,eAJF;AAKbjC,EAAAA,cAAc,EAAEkC,gBALH;AAMb/B,EAAAA,aAAa,EAAEgC,eANF;AAOb/B,EAAAA,YAAY,EAAEgC,cAPD;AAQb/B,EAAAA,aAAa,EAAEgC,eARF;AASb/B,EAAAA,WAAW,EAAEgC,aATA;AAUbpC,EAAAA,UAAU,EAAEqC,YAVC;AAWblB,EAAAA,OAAO,EAAEmB,SAXI;AAab;AACA;;AAda,CAAf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/wax-prosemirror-services/dist/index.js b/wax-prosemirror-services/dist/index.js new file mode 100644 index 000000000..153839128 --- /dev/null +++ b/wax-prosemirror-services/dist/index.js @@ -0,0 +1,6142 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var React = require('react'); +var React__default = _interopDefault(React); +var waxProsemirrorCore = require('wax-prosemirror-core'); +var inversify = require('inversify'); +var lodash = require('lodash'); +var waxProsemirrorComponents = require('wax-prosemirror-components'); +var uuid = require('uuid'); +var styled = _interopDefault(require('styled-components')); +var waxProsemirrorSchema = require('wax-prosemirror-schema'); +var prosemirrorCommands = require('prosemirror-commands'); +var waxProsemirrorUtilities = require('wax-prosemirror-utilities'); +var prosemirrorState = require('prosemirror-state'); +var prosemirrorView = require('prosemirror-view'); +var prosemirrorInputrules = require('prosemirror-inputrules'); +var prosemirrorModel = require('prosemirror-model'); +var prosemirrorKeymap = require('prosemirror-keymap'); +var prosemirrorHistory = require('prosemirror-history'); +var prosemirrorSchemaList = require('prosemirror-schema-list'); +var prosemirrorTransform = require('prosemirror-transform'); +var prosemirrorTables = require('prosemirror-tables'); +var waxProsemirrorPlugins = require('wax-prosemirror-plugins'); +require('highlight.js/styles/github.css'); + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} + +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; +} + +var Service = /*#__PURE__*/function () { + function Service() { + _classCallCheck(this, Service); + } + + _createClass(Service, [{ + key: "setApp", + value: function setApp(app) { + this.app = app; + } + }, { + key: "container", + get: function get() { + return this.app.container; + } + }, { + key: "config", + get: function get() { + return this.app.config.get("config.".concat(this.name)) || this.app.config; + } + }, { + key: "schema", + get: function get() { + return this.app.getSchema(); + } + }]); + + return Service; +}(); + +function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + writable: true, + configurable: true + } + }); + if (superClass) _setPrototypeOf(subClass, superClass); +} + +function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); +} + +function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; + } +} + +function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function _typeof(obj) { + return typeof obj; + }; + } else { + _typeof = function _typeof(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); +} + +function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; +} + +function _possibleConstructorReturn(self, call) { + if (call && (_typeof(call) === "object" || typeof call === "function")) { + return call; + } + + return _assertThisInitialized(self); +} + +function _createSuper(Derived) { + return function () { + var Super = _getPrototypeOf(Derived), + result; + + if (_isNativeReflectConstruct()) { + var NewTarget = _getPrototypeOf(this).constructor; + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); + } + + return _possibleConstructorReturn(this, result); + }; +} + +var ComponentPlugin = function ComponentPlugin(renderArea) { + return function (layoutProps) { + var _useInjection = waxProsemirrorCore.useInjection("Layout"), + instance = _useInjection.instance; + + var components = instance.render(renderArea); + return components ? components.map(function (_ref, key) { + var Component = _ref.component, + componentProps = _ref.componentProps; + return /*#__PURE__*/React__default.createElement(Component, Object.assign({ + key: "".concat(renderArea, "-").concat(key) + }, layoutProps, componentProps)); + }) : null; + }; +}; + +var DefaultLayout = function DefaultLayout(_ref) { + var editor = _ref.editor; + return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, editor); +}; + +var LayoutFactory = (function (Component) { + return function (props) { + return /*#__PURE__*/React__default.createElement(Component, props); + }; +}); + +var _dec, _class, _temp; +var Layout = (_dec = inversify.injectable(), _dec(_class = (_temp = /*#__PURE__*/function () { + function Layout() { + _classCallCheck(this, Layout); + + this.components = []; + this.layoutComponent = LayoutFactory(DefaultLayout); + } + + _createClass(Layout, [{ + key: "addComponent", + value: function addComponent(renderArea, component, componentProps) { + if (!this.components[renderArea]) { + this.createArea(renderArea); + } + + var size = this.components[renderArea].size; + this.components[renderArea].set(size + 1, { + component: component, + componentProps: componentProps + }); + return this; + } + }, { + key: "render", + value: function render(renderArea) { + if (!this.components[renderArea]) return null; + return this.getArray(this.components[renderArea]); + } + }, { + key: "createArea", + value: function createArea(area) { + this.components[area] = new Map(); + } + }, { + key: "getArray", + value: function getArray(iterator) { + var components = []; + iterator.forEach(function (component) { + return components.push(component); + }); + return components; + } + }, { + key: "setLayout", + value: function setLayout(component) { + this.layoutComponent = LayoutFactory(component); + } + }]); + + return Layout; +}(), _temp)) || _class); + +var LayoutService = /*#__PURE__*/function (_Service) { + _inherits(LayoutService, _Service); + + var _super = _createSuper(LayoutService); + + function LayoutService() { + var _this; + + _classCallCheck(this, LayoutService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.name = "LayoutService"; + return _this; + } + + _createClass(LayoutService, [{ + key: "register", + value: function register() { + this.container.bind("Layout").to(Layout).inSingletonScope(); + } + }]); + + return LayoutService; +}(Service); + +var _dec$1, _class$1, _temp$1; +var ToolGroup = (_dec$1 = inversify.injectable(), _dec$1(_class$1 = (_temp$1 = /*#__PURE__*/function () { + function ToolGroup() { + _classCallCheck(this, ToolGroup); + + this._config = {}; + this.title = ""; + this._tools = []; + } + + _createClass(ToolGroup, [{ + key: "setGroupConfig", + value: function setGroupConfig(config) { + this._config = config; + } + }, { + key: "excludeIncludeTools", + value: function excludeIncludeTools() { + var _this$_config = this._config, + _this$_config$exclude = _this$_config.exclude, + exclude = _this$_config$exclude === void 0 ? [] : _this$_config$exclude, + _this$_config$include = _this$_config.include, + include = _this$_config$include === void 0 ? [] : _this$_config$include; + + if (include.length > 0) { + this._tools.map(function (tool) { + if (include.includes(tool.constructor.name)) { + tool.displayTool(); + } else { + tool.hideTool(); + } + }); + } else { + this._tools.map(function (tool) { + if (exclude.includes(tool.constructor.name)) { + tool.hideTool(); + } + }); + } + } + }, { + key: "addToolIntoMore", + value: function addToolIntoMore() { + var _this$_config$more = this._config.more, + more = _this$_config$more === void 0 ? [] : _this$_config$more; + + if (more.length > 0) { + this._tools.map(function (tool) { + if (more.includes(tool.constructor.name)) { + tool.hideInToolGroup(); + } else { + tool.displayInToolGroup(); + } + }); + } + } + }, { + key: "renderTools", + value: function renderTools(view) { + var name = this.constructor.name; + return /*#__PURE__*/React__default.createElement(waxProsemirrorComponents.ToolGroupComponent, { + key: uuid.v4(), + view: view, + tools: this._tools, + title: this.title, + name: name + }); + } + }, { + key: "tools", + set: function set(tools) { + this._tools = tools; + } + }]); + + return ToolGroup; +}(), _temp$1)) || _class$1); + +function _taggedTemplateLiteral(strings, raw) { + if (!raw) { + raw = strings.slice(0); + } + + return Object.freeze(Object.defineProperties(strings, { + raw: { + value: Object.freeze(raw) + } + })); +} + +function _templateObject() { + var data = _taggedTemplateLiteral(["\n background: #fff;\n padding: 2px 2px 2px 0;\n position: relative;\n background: transparent;\n"]); + + _templateObject = function _templateObject() { + return data; + }; + + return data; +} +var MainMenu = styled.div(_templateObject()); + +var MainMenuBar = function MainMenuBar(_ref) { + var _ref$items = _ref.items, + items = _ref$items === void 0 ? [] : _ref$items, + view = _ref.view; + return /*#__PURE__*/React__default.createElement(MainMenu, { + key: "MainMenu" + }, lodash.map(items, function (item) { + return item.renderTools(view); + })); +}; + +var _dec$2, _class$2, _temp$2; +var Menu = (_dec$2 = inversify.injectable(), _dec$2(_class$2 = (_temp$2 = /*#__PURE__*/function () { + function Menu(config, createTools) { + _classCallCheck(this, Menu); + + this.toolGroups = []; + this.config = {}; + this.name = ''; + this.name = config.name; + this.config = config; + this.toolGroups = createTools(this.config.toolGroups); + this.excludeIncludeTools(); + this.addToolIntoMore(); + } + + _createClass(Menu, [{ + key: "excludeIncludeTools", + value: function excludeIncludeTools() { + this.toolGroups.forEach(function (toolGroup) { + if (toolGroup instanceof ToolGroup) { + toolGroup.excludeIncludeTools(); + } + }); + } + }, { + key: "addToolIntoMore", + value: function addToolIntoMore() { + this.toolGroups.forEach(function (toolGroup) { + if (toolGroup instanceof ToolGroup) { + toolGroup.addToolIntoMore(); + } + }); + } + }, { + key: "render", + value: function render() { + var _this = this; + + return function () { + var _useContext = React.useContext(waxProsemirrorCore.WaxContext), + main = _useContext.view.main, + activeView = _useContext.activeView; + + var Bar = React.useMemo(function () { + return /*#__PURE__*/React__default.createElement(MainMenuBar, { + items: _this.toolGroups, + view: activeView || {} + }); + }); + return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, Bar); + }; + } + }]); + + return Menu; +}(), _temp$2)) || _class$2); + +var _dec$3, _class$3, _temp$3; +var MenuCollection = (_dec$3 = inversify.injectable(), _dec$3(_class$3 = (_temp$3 = /*#__PURE__*/function () { + function MenuCollection(menus) { + _classCallCheck(this, MenuCollection); + + this.menus = []; + this.menus = menus; + } + + MenuCollection = inversify.multiInject('Menu')(MenuCollection, undefined, 0) || MenuCollection; + + _createClass(MenuCollection, [{ + key: "getMenu", + value: function getMenu(name) { + return this.menus.find(function (menu) { + return menu.name === name; + }); + } + }]); + + return MenuCollection; +}(), _temp$3)) || _class$3); + +var MenuService = /*#__PURE__*/function (_Service) { + _inherits(MenuService, _Service); + + var _super = _createSuper(MenuService); + + function MenuService() { + var _this; + + _classCallCheck(this, MenuService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.name = 'MenuService'; + return _this; + } + + _createClass(MenuService, [{ + key: "boot", + value: function boot() { + var _this$container$get = this.container.get('MenuCollection'), + menus = _this$container$get.menus; + + var layout = this.container.get('Layout'); + menus.forEach(function (menu) { + layout.addComponent(menu.config.templateArea, menu.render()); + }); + } + }, { + key: "register", + value: function register() { + var _this2 = this; + + /* create Menu Factory */ + this.config.map(function (conf) { + _this2.container.bind('Menu').toFactory(function (context) { + return new Menu(conf, context.container.get('createTools')); + }); + }); + /*create MenuCollection of Menus */ + + this.container.bind('MenuCollection').to(MenuCollection).inSingletonScope(); + /* create factory of tools */ + + this.container.bind('createTools').toFactory(function (context) { + return function (configTools) { + var tools = []; + configTools.forEach(function (tool) { + try { + var tl = {}; + + if (lodash.isPlainObject(tool)) { + tl = context.container.get(tool.name); + tl.setGroupConfig(tool); + } else if (lodash.isFunction(tool)) { + tl = context.container.get(tool()); + } else { + tl = context.container.get(tool); + } + + tools.push(tl); + } catch (error) { + throw Error("Could not load Service ".concat(tool.name, ". Please configure service through config")); + } + }); + return tools; + }; + }); + } + }]); + + return MenuService; +}(Service); + +var _dec$4, _class$4, _temp$4; +var Tools = (_dec$4 = inversify.injectable(), _dec$4(_class$4 = (_temp$4 = /*#__PURE__*/function () { + function Tools(config, pmplugins) { + _classCallCheck(this, Tools); + + this.title = 'title'; + this.content = 'content'; + this._isDisplayed = true; + this._isHiddenInToolGroup = false; + this.onlyOnMain = false; + this.config = {}; + this.pmplugins = {}; + this.config = config; + this.pmplugins = pmplugins; + } + + Tools = inversify.inject('PmPlugins')(Tools, undefined, 1) || Tools; + Tools = inversify.inject('Config')(Tools, undefined, 0) || Tools; + + _createClass(Tools, [{ + key: "select", + value: function select() { + return function () { + return true; + }; + } + }, { + key: "toJSON", + value: function toJSON() { + return { + title: this.title, + content: this.content, + active: this.active, + run: this.run, + enable: this.enable, + select: this.select, + onlyOnMain: this.onlyOnMain + }; + } + }, { + key: "renderTool", + value: function renderTool(view) { + if (lodash.isEmpty(view)) return null; + return this._isDisplayed ? /*#__PURE__*/React__default.createElement(waxProsemirrorComponents.Button, { + key: uuid.v4(), + item: this.toJSON(), + view: view + }) : null; + } + }, { + key: "displayTool", + value: function displayTool() { + this._isDisplayed = true; + } + }, { + key: "hideTool", + value: function hideTool() { + this._isDisplayed = false; + } + }, { + key: "isDisplayed", + value: function isDisplayed() { + return this._isDisplayed; + } + }, { + key: "displayInToolGroup", + value: function displayInToolGroup() { + this._isHiddenInToolGroup = false; + } + }, { + key: "hideInToolGroup", + value: function hideInToolGroup() { + this._isHiddenInToolGroup = true; + } + }, { + key: "isIntoMoreSection", + value: function isIntoMoreSection() { + return this._isHiddenInToolGroup; + } + }, { + key: "run", + get: function get() { + return true; + } + }, { + key: "enable", + get: function get() { + return function () { + return true; + }; + } + }, { + key: "active", + get: function get() { + return function () { + return false; + }; + } + }]); + + return Tools; +}(), _temp$4)) || _class$4); + +var _dec$5, _class$5, _temp$5; +var LinkTool = (_dec$5 = inversify.injectable(), _dec$5(_class$5 = (_temp$5 = /*#__PURE__*/function (_Tools) { + _inherits(LinkTool, _Tools); + + var _super = _createSuper(LinkTool); + + function LinkTool() { + var _this; + + _classCallCheck(this, LinkTool); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = "Add or remove link"; + _this.content = waxProsemirrorComponents.icons.link; + return _this; + } + + _createClass(LinkTool, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + if (waxProsemirrorUtilities.Commands.markActive(state.config.schema.marks.link)(state)) { + prosemirrorCommands.toggleMark(state.config.schema.marks.link)(state, dispatch); + return true; + } + + waxProsemirrorUtilities.Commands.createLink(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.isOnSameTextBlock(state); + }; + } + }, { + key: "active", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.markActive(state.config.schema.marks.link)(state); + }; + } + }]); + + return LinkTool; +}(Tools), _temp$5)) || _class$5); + +var LinkService = /*#__PURE__*/function (_Service) { + _inherits(LinkService, _Service); + + var _super = _createSuper(LinkService); + + function LinkService() { + var _this; + + _classCallCheck(this, LinkService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.name = 'LinkService'; + return _this; + } + + _createClass(LinkService, [{ + key: "boot", + value: function boot() { + var createOverlay = this.container.get('CreateOverlay'); + createOverlay(waxProsemirrorComponents.LinkComponent, {}, { + markType: 'link', + followCursor: false, + selection: false + }); + } + }, { + key: "register", + value: function register() { + this.container.bind('Link').to(LinkTool); + var createMark = this.container.get('CreateMark'); + createMark({ + link: waxProsemirrorSchema.linkMark + }, { + toWaxSchema: true + }); + } // dependencies = [new OverlayService()]; + + }]); + + return LinkService; +}(Service); + +var placeholderPlugin = (function (key) { + return new prosemirrorState.Plugin({ + key: new prosemirrorState.PluginKey(key), + state: { + init: function init() { + return prosemirrorView.DecorationSet.empty; + }, + apply: function apply(tr, set) { + // Adjust decoration positions to changes made by the transaction + set = set.map(tr.mapping, tr.doc); // See if the transaction adds or removes any placeholders + + var action = tr.getMeta(this); + + if (action && action.add) { + var widget = document.createElement("placeholder"); + var deco = prosemirrorView.Decoration.widget(action.add.pos, widget, { + id: action.add.id + }); + set = set.add(tr.doc, [deco]); + } else if (action && action.remove) { + set = set.remove(set.find(null, null, function (spec) { + return spec.id === action.remove.id; + })); + } + + return set; + } + }, + props: { + decorations: function decorations(state) { + return this.getState(state); + } + } + }); +}); + +var PLUGIN_KEY = "imagePlaceHolder"; + +var PlaceholderService = /*#__PURE__*/function (_Service) { + _inherits(PlaceholderService, _Service); + + var _super = _createSuper(PlaceholderService); + + function PlaceholderService() { + var _this; + + _classCallCheck(this, PlaceholderService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.name = "PlaceholderService"; + return _this; + } + + _createClass(PlaceholderService, [{ + key: "boot", + value: function boot() { + this.app.PmPlugins.add(PLUGIN_KEY, placeholderPlugin(PLUGIN_KEY)); + } + }]); + + return PlaceholderService; +}(Service); + +function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; +} + +function _iterableToArrayLimit(arr, i) { + if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; +} + +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + + return arr2; +} + +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(n); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} + +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} + +function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); + } + + return keys; +} + +function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + + if (i % 2) { + ownKeys(Object(source), true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + } + + return target; +} + +var defaultOverlay = { + left: null, + top: null, + from: null, + to: null, + mark: null +}; +var usePosition = (function (options) { + var _useContext = React.useContext(waxProsemirrorCore.WaxContext), + main = _useContext.view.main, + activeView = _useContext.activeView; + + var _useState = React.useState(_objectSpread2({ + position: "absolute" + }, defaultOverlay)), + _useState2 = _slicedToArray(_useState, 2), + position = _useState2[0], + setPosition = _useState2[1]; + + var mark = {}; + /* Sets Default position at the end of the annotation. You + can overwrite the default position in your component. + Check: wax-prosemirror-components/src/components/comments/CommentBubbleComponent.js + for reposition the create new comment component. + */ + + var calculatePosition = function calculatePosition(activeView, from, to) { + var WaxSurface = activeView.dom.getBoundingClientRect(); + var start = activeView.coordsAtPos(from); + var end = activeView.coordsAtPos(to); + var left = end.left; + var top = end.top + 20; + return { + top: top, + left: left + }; + }; + + var displayOnSelection = function displayOnSelection(activeView, options) { + var selection = activeView.state.selection; + var from = selection.from, + to = selection.to; + if (from === to) return defaultOverlay; + + var _calculatePosition = calculatePosition(activeView, from, to), + left = _calculatePosition.left, + top = _calculatePosition.top; + + return { + left: left, + top: top, + from: from, + to: to, + selection: selection + }; + }; + + var displayOnMark = function displayOnMark(activeView, options) { + var markType = options.markType, + followCursor = options.followCursor; + var PMmark = activeView.state.schema.marks[markType]; + mark = waxProsemirrorUtilities.DocumentHelpers.getSelectionMark(activeView.state, PMmark); + if (!lodash.isObject(mark)) return defaultOverlay; + + var _ref = followCursor ? activeView.state.selection : mark, + from = _ref.from, + to = _ref.to; + + var _calculatePosition2 = calculatePosition(activeView, from, to), + left = _calculatePosition2.left, + top = _calculatePosition2.top; + + return { + left: left, + top: top, + from: from, + to: to, + mark: mark + }; + }; + + var updatePosition = React.useCallback(function () { + if (Object.keys(activeView).length === 0) return defaultOverlay; + var markType = options.markType, + selection = options.selection; + if (selection) return displayOnSelection(activeView); + return displayOnMark(activeView, options); + }); + React.useLayoutEffect(function () { + setPosition(_objectSpread2({ + position: "absolute" + }, updatePosition(options.followCursor))); + }, [JSON.stringify(updatePosition(options.followCursor))]); + return [position, setPosition, mark]; +}); + +var OverlayComponent = (function (Component, markType) { + return function (props) { + var _usePosition = usePosition(markType), + _usePosition2 = _slicedToArray(_usePosition, 3), + position = _usePosition2[0], + setPosition = _usePosition2[1], + mark = _usePosition2[2]; + + var component = React.useMemo(function () { + return /*#__PURE__*/React__default.createElement(Component, Object.assign({ + setPosition: setPosition, + mark: mark, + position: position + }, props)); + }, [JSON.stringify(mark), position]); + var visible = position.left ? true : false; + return /*#__PURE__*/React__default.createElement(waxProsemirrorComponents.Overlay, { + position: position + }, visible && component); + }; +}); + +var OverlayService = /*#__PURE__*/function (_Service) { + _inherits(OverlayService, _Service); + + var _super = _createSuper(OverlayService); + + function OverlayService() { + _classCallCheck(this, OverlayService); + + return _super.apply(this, arguments); + } + + _createClass(OverlayService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + this.container.bind("CreateOverlay").toFactory(function (context) { + return function (Component, componentProps, options) { + var layout = context.container.get("Layout"); + layout.addComponent("waxOverlays", OverlayComponent(Component, options), componentProps); + }; + }); + } + }]); + + return OverlayService; +}(Service); + +var findPlaceholder = function findPlaceholder(state, id, placeholderPlugin) { + var decos = placeholderPlugin.getState(state); + var found = decos.find(null, null, function (spec) { + return spec.id === id; + }); + return found.length ? found[0].from : null; +}; + +var fileUpload = (function (view, fileUpload, placeholderPlugin) { + return function (file) { + var state = view.state; // A fresh object to act as the ID for this upload + + var id = {}; // Replace the selection with a placeholder + + var tr = state.tr; + if (!tr.selection.empty) tr.deleteSelection(); + tr.setMeta(placeholderPlugin, { + add: { + id: id, + pos: tr.selection.from + } + }); + view.dispatch(tr); + fileUpload(file).then(function (url) { + var pos = findPlaceholder(view.state, id, placeholderPlugin); // If the content around the placeholder has been deleted, drop + // the image + + if (pos == null) { + return; + } // Otherwise, insert it at the placeholder's position, and remove + // the placeholder + + + view.dispatch(state.tr.replaceWith(pos, pos, view.state.schema.nodes.image.create({ + src: url + })).setMeta(placeholderPlugin, { + remove: { + id: id + } + })); + }, function () { + // On failure, just clean up the placeholder + view.dispatch(tr.setMeta(placeholderPlugin, { + remove: { + id: id + } + })); + }); + }; +}); + +var _dec$6, _class$6, _temp$6; +var Image = (_dec$6 = inversify.injectable(), _dec$6(_class$6 = (_temp$6 = /*#__PURE__*/function (_Tools) { + _inherits(Image, _Tools); + + var _super = _createSuper(Image); + + function Image() { + var _this; + + _classCallCheck(this, Image); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Insert image'; + _this.content = waxProsemirrorComponents.icons.image; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(Image, [{ + key: "renderTool", + value: function renderTool(view) { + if (lodash.isEmpty(view)) return null; + var upload = fileUpload(view, this.config.get('fileUpload'), this.pmplugins.get('imagePlaceHolder')); + return this._isDisplayed ? /*#__PURE__*/React__default.createElement(waxProsemirrorComponents.ImageUpload, { + key: uuid.v4(), + item: this.toJSON(), + fileUpload: upload, + view: view + }) : null; + } + }, { + key: "run", + get: function get() { + return function () { + return true; + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.canInsert(state.config.schema.nodes.image)(state); + }; + } + }]); + + return Image; +}(Tools), _temp$6)) || _class$6); + +var ImageService = /*#__PURE__*/function (_Service) { + _inherits(ImageService, _Service); + + var _super = _createSuper(ImageService); + + function ImageService() { + var _this; + + _classCallCheck(this, ImageService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.name = 'ImageService'; + return _this; + } + + _createClass(ImageService, [{ + key: "register", + value: function register() { + this.container.bind('Image').to(Image); + var createNode = this.container.get('CreateNode'); + createNode({ + image: waxProsemirrorSchema.imageNode + }, { + toWaxSchema: true + }); + } + }]); + + return ImageService; +}(Service); + +function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); +} + +function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); +} + +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} + +function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); +} + +var _dec$7, _class$7; +var Rules = (_dec$7 = inversify.injectable(), _dec$7(_class$7 = /*#__PURE__*/function () { + function Rules(plugins, schema) { + _classCallCheck(this, Rules); + + this.PmPlugins = plugins; + this.schema = schema; + this.extendedRules = this.allRules(); + } + + _createClass(Rules, [{ + key: "addRule", + value: function addRule(rules) { + var _this$extendedRules; + + (_this$extendedRules = this.extendedRules).push.apply(_this$extendedRules, _toConsumableArray(rules)); + } + }, { + key: "createRules", + value: function createRules() { + var rulesCreated = prosemirrorInputrules.inputRules({ + rules: this.extendedRules + }); + this.PmPlugins.add("rules", rulesCreated); + } + }, { + key: "allRules", + value: function allRules() { + return [].concat(_toConsumableArray(prosemirrorInputrules.smartQuotes), [// > blockquote + prosemirrorInputrules.wrappingInputRule(/^\s*>\s$/, this.schema.nodes.blockquote), // 1. ordered list + prosemirrorInputrules.wrappingInputRule(/^(\d+)\.\s$/, this.schema.nodes.orderedlist, function (match) { + return { + order: +match[1] + }; + }, function (match, node) { + return node.childCount + node.attrs.order === +match[1]; + }), // * bullet list + prosemirrorInputrules.wrappingInputRule(/^\s*([-+*])\s$/, this.schema.nodes.bulletlist), // ``` code block + // textblockTypeInputRule(/^```$/, this.schema.nodes.code_block), + // # heading + prosemirrorInputrules.textblockTypeInputRule(new RegExp("^(#{1,6})\\s$"), this.schema.nodes.heading, function (match) { + return { + level: match[1].length + }; + })]); + } + }]); + + return Rules; +}()) || _class$7); + +var RulesService = /*#__PURE__*/function (_Service) { + _inherits(RulesService, _Service); + + var _super = _createSuper(RulesService); + + function RulesService() { + var _this; + + _classCallCheck(this, RulesService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.name = 'RulesService'; + return _this; + } + + _createClass(RulesService, [{ + key: "boot", + value: function boot() { + var configRules = this.config; + var rules = this.container.get('Rules'); + rules.addRule(configRules); + rules.createRules(); + } + }, { + key: "register", + value: function register() { + var _this2 = this; + + var PmPlugins = this.app.PmPlugins; + this.container.bind('Rules').toDynamicValue(function () { + var schema = _this2.app.schema.schema; + return new Rules(PmPlugins, schema); + }).inSingletonScope(); + } + }]); + + return RulesService; +}(Service); + +var DefaultSchema = { + nodes: { + doc: { + content: "block+" + }, + text: { + group: "inline" + }, + hard_break: { + inline: true, + group: "inline", + selectable: false, + parseDOM: [{ + tag: "br" + }], + toDOM: function toDOM() { + return ["br"]; + } + }, + paragraph: { + group: "block", + content: "inline*", + attrs: { + id: { + "default": "" + }, + "class": { + "default": "paragraph" + }, + track: { + "default": [] + }, + group: { + "default": "" + } + }, + parseDOM: [{ + tag: "p.paragraph", + getAttrs: function getAttrs(dom) { + return { + id: dom.dataset.id, + "class": dom.getAttribute("class"), + track: waxProsemirrorUtilities.SchemaHelpers.parseTracks(dom.dataset.track), + group: dom.dataset.group + }; + } + }], + toDOM: function toDOM(node) { + var attrs = waxProsemirrorUtilities.SchemaHelpers.blockLevelToDOM(node); + return ["p", attrs, 0]; + } + } + }, + marks: {} +}; + +var Middleware = /*#__PURE__*/function () { + function Middleware() { + _classCallCheck(this, Middleware); + + // Array prototype last + if (!Array.prototype.last) { + Array.prototype.last = function () { + return this[this.length - 1]; + }; + } // Array prototype reduceOneRight + + + if (!Array.prototype.reduceOneRight) { + Array.prototype.reduceOneRight = function () { + return this.slice(0, -1); + }; + } + } + + _createClass(Middleware, [{ + key: "use", + value: function use(fn) { + var _this = this; + + this.go = function (stack) { + return function () { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return stack.apply(void 0, _toConsumableArray(args.reduceOneRight()).concat([function () { + var _next = args.last(); + + fn.apply(_this, [].concat(_toConsumableArray(args.reduceOneRight()), [_next.bind.apply(_next, [null].concat(_toConsumableArray(args.reduceOneRight())))])); + }])); + }; + }(this.go); + } + }, { + key: "go", + value: function go() { + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + + var _next = args.last(); + + _next.apply(this, args.reduceOneRight()); + } + }]); + + return Middleware; +}(); + +var ParseRule = /*#__PURE__*/function () { + function ParseRule(_ref) { + var getAttrs = _ref.getAttrs, + tag = _ref.tag, + style = _ref.style; + + _classCallCheck(this, ParseRule); + + this.tag = null; + this.style = null; + this.exporter = null; + + this.defaultMiddleware = function (hook, next) { + next(); + }; + + this.tag = tag; + this.style = style; // if (getAttrs) { + + this.exporter = new Middleware(); // } + + this.addStack(getAttrs); + } + + _createClass(ParseRule, [{ + key: "addStack", + value: function addStack(getAttrs) { + if (getAttrs) { + this.exporter.use(getAttrs); + } else { + this.exporter.use(this.defaultMiddleware); + } + } + }, { + key: "parseSchema", + value: function parseSchema(exporter) { + var rule = {}; + + if (this.tag) { + rule = { + tag: this.tag + }; + } + + if (this.style) { + rule = { + style: this.style + }; + } + + if (this.exporter) { + rule.getAttrs = function (dom) { + var hooks = {}; + exporter.go({ + dom: dom + }, function (hook) { + hooks = hook; + }); + return lodash.omit(hooks, ["dom"]); + }; + } + + return rule; + } + }, { + key: "combineRules", + value: function combineRules() { + var exporter = this.exporter; + return this.parseSchema(exporter); + } + }]); + + return ParseRule; +}(); + +var Node = /*#__PURE__*/function () { + function Node(name) { + _classCallCheck(this, Node); + + this.name = ""; + this.importer = {}; + this.atom = false; + this.inline = false; + this.isolating = false; + this.draggable = false; + this.group = ""; + this.content = ""; + this._attrs = {}; + this._parseRules = []; + this.name = name; + this.importer = new Middleware(); + } + + _createClass(Node, [{ + key: "fromJSON", + value: function fromJSON(config) { + for (var key in config) { + var value = config[key]; + this[key] = value; + } + } + }, { + key: "toJSON", + value: function toJSON() { + var importer = this.importer; + return { + atom: this.atom, + inline: this.inline, + group: this.group, + content: this.content, + isolating: this.isolating, + draggable: this.draggable, + attrs: this._attrs, + parseDOM: this._parseRules.map(function (rule) { + return rule.combineRules(); + }), + toDOM: function toDOM(node) { + var hooks = {}; + importer.go({ + node: node + }, function (hook) { + hooks = hook; + }); + return hooks.value; + } + }; + } + }, { + key: "toDOM", + set: function set(value) { + this.importer.use(value); + } + }, { + key: "attrs", + set: function set(value) { + Object.assign(this._attrs, value); + } + }, { + key: "parseDOM", + set: function set(parseDom) { + var _this = this; + + var values = parseDom; + + if (lodash.isPlainObject(parseDom)) { + values = [parseDom]; + } + + values.forEach(function (value) { + var parseRule = _this._parseRules.find(function (parseRule) { + if (value.tag) return parseRule.tag === value.tag; + if (value.style) return parseRule.style === value.style; + return false; + }); + + if (!parseRule) { + parseRule = new ParseRule(value); + + _this._parseRules.push(parseRule); + } + + parseRule.addStack(value.getAttrs); + }); + } + }]); + + return Node; +}(); + +var Mark = /*#__PURE__*/function () { + function Mark(name) { + _classCallCheck(this, Mark); + + this.name = ""; + this.importer = {}; + this.inline = false; + this.group = ""; + this.content = ""; + this.draggable = false; + this.inclusive = true; + this._attrs = {}; + this._parseRules = []; + this.name = name; + this.importer = new Middleware(); + } + + _createClass(Mark, [{ + key: "fromJSON", + value: function fromJSON(config) { + for (var key in config) { + var value = config[key]; + this[key] = value; + } + } + }, { + key: "toJSON", + value: function toJSON() { + var importer = this.importer; + return { + inline: this.inline, + group: this.group, + content: this.content, + draggable: this.draggable, + inclusive: this.inclusive, + attrs: this._attrs, + parseDOM: this._parseRules.map(function (rule) { + return rule.combineRules(); + }), + toDOM: function toDOM(node) { + var hooks = {}; + importer.go({ + node: node + }, function (hook) { + hooks = hook; + }); + return hooks.value; + } + }; + } + }, { + key: "toDOM", + set: function set(value) { + this.importer.use(value); + } + }, { + key: "attrs", + set: function set(value) { + Object.assign(this._attrs, value); + } + }, { + key: "parseDOM", + set: function set(parseDom) { + var _this = this; + + var values = parseDom; + + if (lodash.isPlainObject(parseDom)) { + values = [parseDom]; + } + + values.forEach(function (value) { + var parseRule = _this._parseRules.find(function (parseRule) { + if (value.tag) return parseRule.tag === value.tag; + if (value.style) return parseRule.style === value.style; + return false; + }); + + if (!parseRule) { + parseRule = new ParseRule(value); + + _this._parseRules.push(parseRule); + } + + parseRule.addStack(value.getAttrs); + }); + } + }]); + + return Mark; +}(); + +var _dec$8, _class$8, _temp$7; +var Schema = (_dec$8 = inversify.injectable(), _dec$8(_class$8 = (_temp$7 = /*#__PURE__*/function () { + function Schema() { + _classCallCheck(this, Schema); + + this._nodes = {}; + this._marks = {}; + this.prosemirrorSchema = { + nodes: {}, + marks: {} + }; + this.schema = null; + } + + _createClass(Schema, [{ + key: "addNode", + value: function addNode(schemaConfig) { + var name = Object.keys(schemaConfig)[0]; + var config = schemaConfig[name]; + var node = new Node(name); + var nd = {}; + + if (nd = this.has(node)) { + nd.fromJSON(config); + return nd; + } else { + node.fromJSON(config); + this.addSchema(node); + return _defineProperty({}, name, node); + } + } + }, { + key: "addMark", + value: function addMark(schemaConfig) { + var name = Object.keys(schemaConfig)[0]; + var config = schemaConfig[name]; + var mark = new Mark(name); + var mr = {}; + + if (mr = this.has(mark)) { + mr.fromJSON(config); + return mr; + } else { + mark.fromJSON(config); + this.addSchema(mark); + return _defineProperty({}, name, mark); + } + } + }, { + key: "has", + value: function has(instance) { + if (instance instanceof Node) { + return this._nodes[instance.name] ? this._nodes[instance.name] : false; + } + + if (instance instanceof Mark) { + return this._marks[instance.name] ? this._marks[instance.name] : false; + } + } + }, { + key: "addSchema", + value: function addSchema(instance) { + if (instance instanceof Node) { + return this._nodes[instance.name] ? this._nodes[instance.name] : Object.assign(this._nodes, _defineProperty({}, instance.name, instance)); + } + + if (instance instanceof Mark) { + return this._marks[instance.name] ? this._marks[instance.name] : Object.assign(this._marks, _defineProperty({}, instance.name, instance)); + } + } + }, { + key: "addProsemirrorSchema", + value: function addProsemirrorSchema(nodes, type) { + this.prosemirrorSchema[type] = Object.assign(this.prosemirrorSchema[type], nodes); + } + }, { + key: "getSchema", + value: function getSchema() { + var nodes = DefaultSchema.nodes; + var marks = {}; + + for (var index in this._nodes) { + nodes[index] = this._nodes[index].toJSON(); + } + + for (var _index in this._marks) { + marks[_index] = this._marks[_index].toJSON(); + } + + this.schema = new prosemirrorModel.Schema({ + nodes: Object.assign(nodes, this.prosemirrorSchema.nodes), + marks: Object.assign(marks, this.prosemirrorSchema.marks) + }); + return this.schema; + } + }]); + + return Schema; +}(), _temp$7)) || _class$8); + +var SchemaService = /*#__PURE__*/function (_Service) { + _inherits(SchemaService, _Service); + + var _super = _createSuper(SchemaService); + + function SchemaService() { + var _this; + + _classCallCheck(this, SchemaService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.name = "SchemaService"; + return _this; + } + + _createClass(SchemaService, [{ + key: "register", + value: function register() { + this.container.bind("Schema").to(Schema).inSingletonScope(); + this.container.bind("CreateNode").toFactory(function (context) { + return function (schema) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { + toWaxSchema: false + }; + var schemaInstance = context.container.get("Schema"); + + if (options.toWaxSchema) { + schemaInstance.addNode(schema); + } else { + schemaInstance.addProsemirrorSchema(schema, "nodes"); + } + }; + }); + this.container.bind("CreateMark").toFactory(function (context) { + return function (schema) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { + toWaxSchema: false + }; + var schemaInstance = context.container.get("Schema"); + + if (options.toWaxSchema) { + schemaInstance.addMark(schema); + } else { + schemaInstance.addProsemirrorSchema(schema, "marks"); + } + }; + }); + } + }]); + + return SchemaService; +}(Service); + +var _dec$9, _class$9; +var backSpace = prosemirrorCommands.chainCommands(prosemirrorCommands.deleteSelection, prosemirrorCommands.joinBackward, prosemirrorCommands.selectNodeBackward); + +var backSpaceShortCut = function backSpaceShortCut(state, dispatch, view) { + return backSpace(state, function (tr) { + return dispatch(tr.setMeta('inputType', 'deleteContentBackward')); + }, view); +}; + +var undoShortCut = function undoShortCut(state, dispatch, view) { + return prosemirrorHistory.undo(state, function (tr) { + return dispatch(tr.setMeta('inputType', 'historyUndo')); + }, view); +}; + +var redoShortCut = function redoShortCut(state, dispatch, view) { + return prosemirrorHistory.redo(state, function (tr) { + return dispatch(tr.setMeta('inputType', 'historyRedo')); + }, view); +}; + +var ShortCuts = (_dec$9 = inversify.injectable(), _dec$9(_class$9 = /*#__PURE__*/function () { + function ShortCuts(plugins, schema) { + _classCallCheck(this, ShortCuts); + + this.insertBreak = this.insertBreak.bind(this); + this.insertRule = this.insertRule.bind(this); + this.PmPlugins = plugins; + this.schema = schema; + this.keys = this.getKeys(); + } + + _createClass(ShortCuts, [{ + key: "insertBreak", + value: function insertBreak(state, dispatch) { + var br = this.schema.nodes.hard_break.create(); + dispatch(state.tr.replaceSelectionWith(br).scrollIntoView()); + return true; + } + }, { + key: "insertRule", + value: function insertRule(state, dispatch) { + var hr = this.schema.nodes.horizontal_rule.create(); + dispatch(state.tr.replaceSelectionWith(hr).scrollIntoView()); + return true; + } + }, { + key: "createShortCuts", + value: function createShortCuts() { + var shortCuts = prosemirrorKeymap.keymap(this.createKeyBindings()); + this.PmPlugins.add('shortcuts', shortCuts); + } + }, { + key: "addShortCut", + value: function addShortCut(shortcut) { + Object.assign(this.keys, shortcut); + this.createShortCuts(); + } + }, { + key: "createKeyBindings", + value: function createKeyBindings() { + var _this = this; + + Object.keys(prosemirrorCommands.baseKeymap).forEach(function (key) { + if (_this.keys[key]) { + _this.keys[key] = prosemirrorCommands.chainCommands(_this.keys[key], prosemirrorCommands.baseKeymap[key]); + } else { + _this.keys[key] = prosemirrorCommands.baseKeymap[key]; + } + }); + return this.keys; + } + }, { + key: "getKeys", + value: function getKeys() { + return { + 'Mod-z': undoShortCut, + 'Shift-Mod-z': redoShortCut, + Backspace: backSpaceShortCut, + 'Mod-y': redoShortCut, + Escape: prosemirrorCommands.selectParentNode, + 'Mod-Enter': prosemirrorCommands.chainCommands(prosemirrorCommands.exitCode, this.insertBreak), + 'Shift-Enter': prosemirrorCommands.chainCommands(prosemirrorCommands.exitCode, this.insertBreak), + 'Ctrl-Enter': prosemirrorCommands.chainCommands(prosemirrorCommands.exitCode, this.insertBreak), + 'Mod-_': this.insertRule, + 'Mod-[': prosemirrorSchemaList.liftListItem(this.schema.nodes.list_item), + 'Mod-]': prosemirrorSchemaList.sinkListItem(this.schema.nodes.list_item), + Enter: prosemirrorSchemaList.splitListItem(this.schema.nodes.list_item), + 'Shift-Ctrl-8': prosemirrorSchemaList.wrapInList(this.schema.nodes.bulletlist), + 'Shift-Ctrl-9': prosemirrorSchemaList.wrapInList(this.schema.nodes.orderedlist) + }; + } + }]); + + return ShortCuts; +}()) || _class$9); + +var ShortCutsService = /*#__PURE__*/function (_Service) { + _inherits(ShortCutsService, _Service); + + var _super = _createSuper(ShortCutsService); + + function ShortCutsService() { + var _this; + + _classCallCheck(this, ShortCutsService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.name = "ShortCutsService"; + return _this; + } + + _createClass(ShortCutsService, [{ + key: "boot", + value: function boot() { + var shortCuts = this.container.get("ShortCuts"); + shortCuts.createShortCuts(); + } + }, { + key: "register", + value: function register() { + var _this2 = this; + + var PmPlugins = this.app.PmPlugins; + this.container.bind("ShortCuts").toDynamicValue(function () { + var schema = _this2.app.schema.schema; + return new ShortCuts(PmPlugins, schema); + }).inSingletonScope(); + } + }]); + + return ShortCutsService; +}(Service); + +var _dec$a, _class$a, _temp$8; +var EnableTrackChange = (_dec$a = inversify.injectable(), _dec$a(_class$a = (_temp$8 = /*#__PURE__*/function (_Tools) { + _inherits(EnableTrackChange, _Tools); + + var _super = _createSuper(EnableTrackChange); + + function EnableTrackChange() { + var _this; + + _classCallCheck(this, EnableTrackChange); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Toggle Track Changes'; + _this.content = 'track changes'; + return _this; + } + + _createClass(EnableTrackChange, [{ + key: "renderTool", + value: function renderTool(view) { + if (lodash.isEmpty(view)) return null; + return this._isDisplayed ? /*#__PURE__*/React__default.createElement(waxProsemirrorComponents.TrackChangeEnable, { + key: uuid.v4(), + view: view, + item: this.toJSON(), + enabled: this.config.enabled + }) : null; + } + }, { + key: "run", + get: function get() { + var _this2 = this; + + return function (state) { + _this2.config.enabled = !_this2.config.enabled; + return true; + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return true; + }; + } + }]); + + return EnableTrackChange; +}(Tools), _temp$8)) || _class$a); + +var EnableTrackChangeService = /*#__PURE__*/function (_Service) { + _inherits(EnableTrackChangeService, _Service); + + var _super = _createSuper(EnableTrackChangeService); + + function EnableTrackChangeService() { + var _this; + + _classCallCheck(this, EnableTrackChangeService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.name = 'EnableTrackChangeService'; + return _this; + } + + _createClass(EnableTrackChangeService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + var _this2 = this; + + this.container.bind('EnableTrackChange').toDynamicValue(function () { + return new EnableTrackChange(_this2.config); + }); + } + }]); + + return EnableTrackChangeService; +}(Service); + +var removeNode = function removeNode(tr, node, nodePos, map) { + var newNodePos = map.map(nodePos); + var selectionBefore = prosemirrorState.Selection.findFrom(tr.doc.resolve(newNodePos), -1); + var start = selectionBefore.$anchor.pos; + var end = newNodePos + 1; + var delStep = prosemirrorTransform.replaceStep(tr.doc, start, end); + tr.step(delStep); + var stepMap = delStep.getMap(); + map.appendMap(stepMap); +}; + +var _dec$b, _class$b, _temp$9; +var AcceptTrackChange = (_dec$b = inversify.injectable(), _dec$b(_class$b = (_temp$9 = /*#__PURE__*/function (_Tools) { + _inherits(AcceptTrackChange, _Tools); + + var _super = _createSuper(AcceptTrackChange); + + function AcceptTrackChange() { + var _this; + + _classCallCheck(this, AcceptTrackChange); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Accept Changes'; + _this.content = 'Accept'; + + _this.select = function (state, activeViewId) { + var _state$selection = state.selection, + from = _state$selection.from, + to = _state$selection.to; + if (from === to && activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(AcceptTrackChange, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + var tr = state.tr, + _state$selection2 = state.selection, + from = _state$selection2.from, + to = _state$selection2.to; + tr.setMeta('AcceptReject', true); + var map = new prosemirrorTransform.Mapping(); + state.doc.nodesBetween(from, to, function (node, pos) { + if (node.attrs.track && node.attrs.track.find(function (track) { + return track.type === 'deletion'; + })) { + removeNode(tr, node, pos, map); + } + + if (node.marks && node.marks.find(function (mark) { + return mark.type.name === 'deletion'; + })) { + var deletionStep = new prosemirrorTransform.ReplaceStep(map.map(Math.max(pos, from)), map.map(Math.min(pos + node.nodeSize, to)), prosemirrorModel.Slice.empty); + tr.step(deletionStep); + map.appendMap(deletionStep.getMap()); + } else if (node.attrs.track && node.attrs.track.find(function (track) { + return track.type === 'insertion'; + })) { + var track = node.attrs.track.filter(function (track) { + return track.type !== 'insertion'; + }); + tr.setNodeMarkup(map.map(pos), null, Object.assign(node.attrs.track, { + track: track + }), node.marks); + } else if (node.marks && node.marks.find(function (mark) { + return mark.type.name === 'insertion'; + })) { + var insertionMark = node.marks.find(function (mark) { + return mark.type.name === 'insertion'; + }); + tr.step(new prosemirrorTransform.RemoveMarkStep(map.map(Math.max(pos, from)), map.map(Math.min(pos + node.nodeSize, to)), insertionMark)); + } else if (node.marks && node.marks.find(function (mark) { + return mark.type.name === 'format_change'; + })) { + var formatChangeMark = node.marks.find(function (mark) { + return mark.type.name === 'format_change'; + }); + tr.step(new prosemirrorTransform.RemoveMarkStep(map.map(Math.max(pos, from)), map.map(Math.min(pos + node.nodeSize, to)), formatChangeMark)); + } else if (node.attrs.track && node.attrs.track.find(function (track) { + return track.type === 'block_change'; + })) { + var blockChangeTrack = node.attrs.track.find(function (track) { + return track.type === 'block_change'; + }); + + var _track = node.attrs.track.filter(function (track) { + return track !== blockChangeTrack; + }); + + tr.setNodeMarkup(map.map(pos), null, Object.assign(node.attrs.track, { + track: _track + }), node.marks); + } + }); + if (tr.steps.length) dispatch(tr); + }; + } + }, { + key: "active", + get: function get() { + return function (state) {}; + } + }]); + + return AcceptTrackChange; +}(Tools), _temp$9)) || _class$b); + +var AcceptTrackChangeService = /*#__PURE__*/function (_Service) { + _inherits(AcceptTrackChangeService, _Service); + + var _super = _createSuper(AcceptTrackChangeService); + + function AcceptTrackChangeService() { + var _this; + + _classCallCheck(this, AcceptTrackChangeService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.name = 'AcceptTrackChangeService'; + return _this; + } + + _createClass(AcceptTrackChangeService, [{ + key: "register", + // boot() {} + value: function register() { + this.container.bind('AcceptTrackChange').to(AcceptTrackChange); + } + }]); + + return AcceptTrackChangeService; +}(Service); + +var _dec$c, _class$c, _temp$a; +var RejectTrackChange = (_dec$c = inversify.injectable(), _dec$c(_class$c = (_temp$a = /*#__PURE__*/function (_Tools) { + _inherits(RejectTrackChange, _Tools); + + var _super = _createSuper(RejectTrackChange); + + function RejectTrackChange() { + var _this; + + _classCallCheck(this, RejectTrackChange); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Reject Changes'; + _this.content = 'Reject'; + + _this.select = function (state, activeViewId) { + var _state$selection = state.selection, + from = _state$selection.from, + to = _state$selection.to; + if (from === to && activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(RejectTrackChange, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + var tr = state.tr, + _state$selection2 = state.selection, + from = _state$selection2.from, + to = _state$selection2.to; + tr.setMeta('AcceptReject', true); + var map = new prosemirrorTransform.Mapping(); + state.doc.nodesBetween(from, to, function (node, pos) { + if (node.marks && node.marks.find(function (mark) { + return mark.type.name === 'deletion'; + })) { + var deletionMark = node.marks.find(function (mark) { + return mark.type.name === 'deletion'; + }); + tr.step(new prosemirrorTransform.RemoveMarkStep(map.map(Math.max(pos, from)), map.map(Math.min(pos + node.nodeSize, to)), deletionMark)); + } else if (node.attrs.track && node.attrs.track.find(function (track) { + return track.type === 'insertion'; + })) { + removeNode(tr, node, pos, map); + } else if (node.marks && node.marks.find(function (mark) { + return mark.type.name === 'insertion'; + })) { + var deletionStep = new prosemirrorTransform.ReplaceStep(map.map(Math.max(pos, from)), map.map(Math.min(pos + node.nodeSize, to)), prosemirrorModel.Slice.empty); + tr.step(deletionStep); + map.appendMap(deletionStep.getMap()); + } else if (node.marks && node.marks.find(function (mark) { + return mark.type.name === 'format_change'; + })) { + var formatChangeMark = node.marks.find(function (mark) { + return mark.type.name === 'format_change'; + }); + formatChangeMark.attrs.before.forEach(function (oldMark) { + tr.step(new prosemirrorTransform.AddMarkStep(map.map(Math.max(pos, from)), map.map(Math.min(pos + node.nodeSize, to)), state.schema.marks[oldMark].create())); + }); + formatChangeMark.attrs.after.forEach(function (newMark) { + tr.step(new prosemirrorTransform.RemoveMarkStep(map.map(Math.max(pos, from)), map.map(Math.min(pos + node.nodeSize, to)), node.marks.find(function (mark) { + return mark.type.name === newMark; + }))); + }); + tr.step(new prosemirrorTransform.RemoveMarkStep(map.map(Math.max(pos, from)), map.map(Math.min(pos + node.nodeSize, to)), formatChangeMark)); + } + }); + if (tr.steps.length) dispatch(tr); + }; + } + }, { + key: "active", + get: function get() { + return function (state) {}; + } + }]); + + return RejectTrackChange; +}(Tools), _temp$a)) || _class$c); + +var RejectTrackChangeService = /*#__PURE__*/function (_Service) { + _inherits(RejectTrackChangeService, _Service); + + var _super = _createSuper(RejectTrackChangeService); + + function RejectTrackChangeService() { + var _this; + + _classCallCheck(this, RejectTrackChangeService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.name = 'RejectTrackChangeService'; + return _this; + } + + _createClass(RejectTrackChangeService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + this.container.bind('RejectTrackChange').to(RejectTrackChange); + } + }]); + + return RejectTrackChangeService; +}(Service); + +var TrackChangeServices = [new EnableTrackChangeService(), new AcceptTrackChangeService(), new RejectTrackChangeService()]; + +var TrackChangeService = /*#__PURE__*/function (_Service) { + _inherits(TrackChangeService, _Service); + + var _super = _createSuper(TrackChangeService); + + function TrackChangeService() { + var _this; + + _classCallCheck(this, TrackChangeService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.dependencies = TrackChangeServices; + return _this; + } + + _createClass(TrackChangeService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + var createMark = this.container.get('CreateMark'); + var createNode = this.container.get('CreateNode'); + Object.keys(waxProsemirrorSchema.trackChangesMarks).forEach(function (mark) { + createMark(_defineProperty({}, mark, waxProsemirrorSchema.trackChangesMarks[mark]), { + toWaxSchema: true + }); + }); + Object.keys(waxProsemirrorSchema.trackChangesNodes).forEach(function (node) { + createNode(_defineProperty({}, node, waxProsemirrorSchema.trackChangesNodes[node]), { + toWaxSchema: true + }); + }); + } + }]); + + return TrackChangeService; +}(Service); + +var markDeletion = function markDeletion(tr, from, to, user, date, group) { + var deletionMark = tr.doc.type.schema.marks.deletion.create({ + user: user.userId, + username: user.username // date + + }); + var deletionMap = new prosemirrorTransform.Mapping(); + tr.doc.nodesBetween(from, to, function (node, pos) { + if (node.type.name.includes('table')) { + return; + } + + if (node.isInline && node.marks.find(function (mark) { + return mark.type.name === 'insertion' && mark.attrs.user === user.userId; + })) { + var removeStep = new prosemirrorTransform.ReplaceStep(deletionMap.map(Math.max(from, pos)), deletionMap.map(Math.min(to, pos + node.nodeSize)), prosemirrorModel.Slice.empty); + + if (!tr.maybeStep(removeStep).failed) { + deletionMap.appendMap(removeStep.getMap()); + } + } else if (node.isInline && !node.marks.find(function (mark) { + return mark.type.name === 'deletion'; + })) { + tr.addMark(deletionMap.map(Math.max(from, pos)), deletionMap.map(Math.min(to, pos + node.nodeSize)), deletionMark); + } else if (node.attrs.track && !node.attrs.track.find(function (trackAttr) { + return trackAttr.type === 'deletion'; + }) && !['bullet_list', 'ordered_list'].includes(node.type.name)) { + if (node.attrs.track.find(function (trackAttr) { + return trackAttr.type === 'insertion' && trackAttr.user === user.userId; + })) { + var _removeStep; + + if (node.isTextblock && to < pos + node.nodeSize) { + var selectionBefore = prosemirrorState.Selection.findFrom(tr.doc.resolve(pos), -1); + + if (selectionBefore instanceof prosemirrorState.TextSelection) { + _removeStep = new prosemirrorTransform.ReplaceStep(deletionMap.map(selectionBefore.$anchor.pos), deletionMap.map(to), prosemirrorModel.Slice.empty); + } + } else { + _removeStep = new prosemirrorTransform.ReplaceStep(deletionMap.map(Math.max(from, pos)), deletionMap.map(Math.min(to, pos + node.nodeSize)), prosemirrorModel.Slice.empty); + } + + if (!tr.maybeStep(_removeStep).failed) { + deletionMap.appendMap(_removeStep.getMap()); + } + } + + var counter = 2; + node.content.forEach(function (item, i) { + item.marks.forEach(function (mark) { + if (mark.type.name === 'deletion') { + counter += item.nodeSize; + } + }); + }); + + if (node.content.size === 0 || counter === node.nodeSize) { + var track = node.attrs.track.slice(); + track.push({ + type: 'deletion', + user: user.userId, + username: user.username // date + + }); + tr.setNodeMarkup(deletionMap.map(pos), null, Object.assign(node.attrs.track, { + track: track + }), node.marks); + } + } + }); + return deletionMap; +}; + +var markInsertion = function markInsertion(tr, from, to, user, date, group) { + tr.removeMark(from, to, tr.doc.type.schema.marks.deletion); + tr.removeMark(from, to, tr.doc.type.schema.marks.insertion); + var insertionMark = tr.doc.type.schema.marks.insertion.create({ + user: user.userId, + username: user.username // date + + }); + tr.addMark(from, to, insertionMark); // Add insertion mark also to block nodes (figures, text blocks) but not table cells/rows and lists. + + tr.doc.nodesBetween(from, to, function (node, pos) { + if (pos < from || ["bullet_list", "ordered_list"].includes(node.type.name)) { + return true; + } else if (node.isInline || ["table_row", "table_cell"].includes(node.type.name)) { + return false; + } + + if (node.attrs.track) { + var track = []; + track.push({ + type: "insertion", + user: user.userId, + username: user.username, + date: date, + group: group + }); + tr.setNodeMarkup(pos, null, Object.assign({}, node.attrs, { + track: track, + group: group, + id: uuid.v4() + }), node.marks); + } + + if (node.type.name === "table") { + // A table was inserted. We don't add track marks to elements inside of it. + return false; + } + }); +}; + +var replaceStep = function replaceStep(state, tr, step, newTr, map, doc, user, date, group) { + var cellDeleteTr = ["deleteContentBackward", "deleteContentForward"].includes(tr.getMeta("inputType")) && state.selection instanceof prosemirrorTables.CellSelection; // if deletion mark move to the end of deletion + + var deletionMarkSchema = state.schema.marks.deletion; + var deletionMark = waxProsemirrorUtilities.DocumentHelpers.findMark(state, deletionMarkSchema, false); + var positionTo = deletionMark ? deletionMark.to : step.to; + var newStep = !cellDeleteTr ? new prosemirrorTransform.ReplaceStep(positionTo, // We insert all the same steps, but with "from"/"to" both set to "to" in order not to delete content. Mapped as needed. + positionTo, step.slice, step.structure) : false; // We didn't apply the original step in its original place. We adjust the map accordingly. + + map.appendMap(step.invert(doc).getMap()); + + if (newStep) { + var trTemp = state.apply(newTr).tr; + + if (trTemp.maybeStep(newStep).failed) { + return; + } + + var mappedNewStepTo = newStep.getMap().map(newStep.to); + markInsertion(trTemp, newStep.from, mappedNewStepTo, user, date, group); // We condense it down to a single replace step. + + var condensedStep = new prosemirrorTransform.ReplaceStep(newStep.from, newStep.to, trTemp.doc.slice(newStep.from, mappedNewStepTo)); + newTr.step(condensedStep); + var mirrorIndex = map.maps.length - 1; + map.appendMap(condensedStep.getMap(), mirrorIndex); + + if (!newTr.selection.eq(trTemp.selection)) { + newTr.setSelection(trTemp.selection); + } + } + + if (step.from !== step.to) { + map.appendMap(markDeletion(newTr, step.from, step.to, user)); + } +}; + +var markWrapping = function markWrapping(tr, pos, oldNode, newNode, user, date, group) { + var track = oldNode.attrs.track.slice(); + var blockTrack = track.find(function (track) { + return track.type === 'block_change'; + }); + + if (blockTrack) { + track = track.filter(function (track) { + return track !== blockTrack; + }); + + if (blockTrack.before.type !== newNode.type.name || blockTrack.before.attrs.level !== newNode.attrs.level) { + blockTrack = { + type: 'block_change', + user: user.userId, + username: user.username, + date: date, + before: blockTrack.before + }; + track.push(blockTrack); + } + } else { + blockTrack = { + type: 'block_change', + user: user.userId, + username: user.username, + date: date, + before: { + type: oldNode.type.name, + attrs: oldNode.attrs + } + }; + + if (blockTrack.before.attrs.id) { + delete blockTrack.before.attrs.id; + } + + if (blockTrack.before.attrs.track) { + delete blockTrack.before.attrs.track; + } + + track.push(blockTrack); + } + + tr.setNodeMarkup(pos, null, Object.assign({}, newNode.attrs, { + track: track, + group: group, + id: uuid.v4() + })); +}; + +var replaceAroundStep = function replaceAroundStep(state, tr, step, newTr, map, doc, user, date, group) { + if (step.from === step.gapFrom && step.to === step.gapTo) { + // wrapped in something + newTr.step(step); + var from = step.getMap().map(step.from, -1); + var to = step.getMap().map(step.gapFrom); + markInsertion(newTr, from, to, user, date, group); + } else if (!step.slice.size) { + // unwrapped from something + map.appendMap(step.invert(doc).getMap()); + map.appendMap(markDeletion(newTr, step.from, step.gapFrom, user)); + } else if (step.slice.size === 2 && step.gapFrom - step.from === 1 && step.to - step.gapTo === 1) { + // Replaced one wrapping with another + newTr.step(step); + var oldNode = doc.nodeAt(step.from); + + if (oldNode.attrs.track) { + markWrapping(newTr, step.from, oldNode, step.slice.content.firstChild, user, date, group); + } + } else { + console.log("to fix"); // newTr.step(step); + // const ranges = [ + // { + // from: step.getMap().map(step.from, -1), + // to: step.getMap().map(step.gapFrom) + // }, + // { + // from: step.getMap().map(step.gapTo, -1), + // to: step.getMap().map(step.to) + // } + // ]; + // ranges.forEach(range => + // doc.nodesBetween(range.from, range.to, (node, pos) => { + // if (pos < range.from) { + // return true; + // } + // markInsertion(newTr, range.from, range.to, user, date); + // }) + // ); + } +}; + +var addMarkStep = function addMarkStep(state, tr, step, newTr, map, doc, user, date, group) { + doc.nodesBetween(step.from, step.to, function (node, pos) { + if (!node.isInline) { + return true; + } + + if (node.marks.find(function (mark) { + return mark.type.name === 'deletion'; + })) { + return false; + } + + newTr.addMark(Math.max(step.from, pos), Math.min(step.to, pos + node.nodeSize), step.mark); + + if (!['comment'].includes(step.mark.type.name) && !node.marks.find(function (mark) { + return mark.type === step.mark.type; + })) { + var formatChangeMark = node.marks.find(function (mark) { + return mark.type.name === 'format_change'; + }); + var after, before; + + if (formatChangeMark) { + if (formatChangeMark.attrs.before.includes(step.mark.type.name)) { + before = formatChangeMark.attrs.before.filter(function (markName) { + return markName !== step.mark.type.name; + }); + after = formatChangeMark.attrs.after; + } else { + before = formatChangeMark.attrs.before; + after = formatChangeMark.attrs.after.concat(step.mark.type.name); + } + } else { + before = []; + after = [step.mark.type.name]; + } + + if (after.length || before.length) { + // Math.max(step.from, pos), + // Math.min(step.to, pos + node.nodeSize), + newTr.addMark(step.from, step.to, state.schema.marks.format_change.create({ + user: user.userId, + username: user.username, + date: date, + before: before, + after: after, + group: group, + id: uuid.v4() + })); + } else if (formatChangeMark) { + newTr.removeMark(Math.max(step.from, pos), Math.min(step.to, pos + node.nodeSize), formatChangeMark); + } + } + }); +}; + +var removeMarkStep = function removeMarkStep(state, tr, step, newTr, map, doc, user, date) { + doc.nodesBetween(step.from, step.to, function (node, pos) { + if (!node.isInline) { + return true; + } + + if (node.marks.find(function (mark) { + return mark.type.name === 'deletion'; + })) { + return false; + } + + newTr.removeMark(Math.max(step.from, pos), Math.min(step.to, pos + node.nodeSize), step.mark); + + if (['em', 'strong', 'underline'].includes(step.mark.type.name) && node.marks.find(function (mark) { + return mark.type === step.mark.type; + })) { + var formatChangeMark = node.marks.find(function (mark) { + return mark.type.name === 'format_change'; + }); + var after, before; + + if (formatChangeMark) { + if (formatChangeMark.attrs.after.includes(step.mark.type.name)) { + after = formatChangeMark.attrs.after.filter(function (markName) { + return markName !== step.mark.type.name; + }); + before = formatChangeMark.attrs.before; + } else { + after = formatChangeMark.attrs.after; + before = formatChangeMark.attrs.before.concat(step.mark.type.name); + } + } else { + after = []; + before = [step.mark.type.name]; + } + + if (after.length || before.length) { + newTr.addMark(Math.max(step.from, pos), Math.min(step.to, pos + node.nodeSize), state.schema.marks.format_change.create({ + user: user.userId, + username: user.username, + date: date, + before: before, + after: after + })); + } else if (formatChangeMark) { + newTr.removeMark(Math.max(step.from, pos), Math.min(step.to, pos + node.nodeSize), formatChangeMark); + } + } + }); +}; + +/* +This belongs to https://github.com/fiduswriter/fiduswriter +check: https://github.com/fiduswriter/fiduswriter/blob/develop/fiduswriter/document/static/js/modules/editor/track/amend_transaction.js +License included in folder. +*/ + +var trackedTransaction = function trackedTransaction(tr, state, user) { + if (!tr.steps.length || tr.meta && !Object.keys(tr.meta).every(function (metadata) { + return ['inputType', 'uiEvent', 'paste', 'outsideView'].includes(metadata); + }) || ['historyUndo', 'historyRedo', 'AcceptReject'].includes(tr.getMeta('inputType'))) { + return tr; + } + + var group = tr.getMeta('outsideView') ? tr.getMeta('outsideView') : 'main'; + var newTr = state.tr; + var map = new prosemirrorTransform.Mapping(); + var date = Math.floor(Date.now() / 300000); + tr.steps.forEach(function (originalStep) { + var step = originalStep.map(map); + var doc = newTr.doc; + + if (!step) { + return; + } + + switch (step.constructor) { + case prosemirrorTransform.ReplaceStep: + replaceStep(state, tr, step, newTr, map, doc, user, date, group); + break; + + case prosemirrorTransform.ReplaceAroundStep: + replaceAroundStep(state, tr, step, newTr, map, doc, user, date, group); + break; + + case prosemirrorTransform.AddMarkStep: + addMarkStep(state, tr, step, newTr, map, doc, user, date, group); + break; + + case prosemirrorTransform.RemoveMarkStep: + removeMarkStep(state, tr, step, newTr, map, doc, user, date); + break; + } + }); + if (tr.getMeta('inputType')) newTr.setMeta(tr.getMeta('inputType')); + if (tr.getMeta('uiEvent')) newTr.setMeta(tr.getMeta('uiEvent')); + + if (tr.selectionSet) { + var deletionMarkSchema = state.schema.marks.deletion; + var deletionMark = waxProsemirrorUtilities.DocumentHelpers.findMark(state, deletionMarkSchema, false); + + if (tr.selection instanceof prosemirrorState.TextSelection && (tr.selection.from < state.selection.from || tr.getMeta('inputType') === 'deleteContentBackward')) { + var caretPos = map.map(tr.selection.from, -1); + newTr.setSelection(new prosemirrorState.TextSelection(newTr.doc.resolve(caretPos))); + } else if (tr.selection.from > state.selection.from && deletionMark) { + var _caretPos = map.map(deletionMark.to + 1, 1); + + newTr.setSelection(new prosemirrorState.TextSelection(newTr.doc.resolve(_caretPos))); + } else { + newTr.setSelection(tr.selection.map(newTr.doc, map)); + } + } + + if (state.selection.from - tr.selection.from > 1 && tr.selection.$head.depth > 1) { + var _caretPos2 = map.map(tr.selection.from - 2, -1); + + newTr.setSelection(new prosemirrorState.TextSelection(newTr.doc.resolve(_caretPos2))); + } else { + var _caretPos3 = map.map(tr.selection.from, -1); + + newTr.setSelection(new prosemirrorState.TextSelection(newTr.doc.resolve(_caretPos3))); // const slice = map.slice(newTr.selection.from, newTr.selection.to); + // map.appendMap(slice); + } + + if (tr.storedMarksSet) newTr.setStoredMarks(tr.storedMarks); + if (tr.scrolledIntoView) newTr.scrollIntoView(); + return newTr; +}; + +var _dec$d, _class$d, _temp$b; +var Undo = (_dec$d = inversify.injectable(), _dec$d(_class$d = (_temp$b = /*#__PURE__*/function (_Tools) { + _inherits(Undo, _Tools); + + var _super = _createSuper(Undo); + + function Undo() { + var _this; + + _classCallCheck(this, Undo); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Undo last change'; + _this.content = waxProsemirrorComponents.icons.undo; + _this.onlyOnMain = true; + return _this; + } + + _createClass(Undo, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + prosemirrorHistory.undo(state, function (tr) { + return dispatch(tr.setMeta('inputType', 'historyUndo')); + }); + }; + } + }, { + key: "enable", + get: function get() { + return prosemirrorHistory.undo; + } + }]); + + return Undo; +}(Tools), _temp$b)) || _class$d); + +var UndoService = /*#__PURE__*/function (_Service) { + _inherits(UndoService, _Service); + + var _super = _createSuper(UndoService); + + function UndoService() { + _classCallCheck(this, UndoService); + + return _super.apply(this, arguments); + } + + _createClass(UndoService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + this.container.bind("Undo").to(Undo); + } + }]); + + return UndoService; +}(Service); + +var _dec$e, _class$e, _temp$c; +var Redo = (_dec$e = inversify.injectable(), _dec$e(_class$e = (_temp$c = /*#__PURE__*/function (_Tools) { + _inherits(Redo, _Tools); + + var _super = _createSuper(Redo); + + function Redo() { + var _this; + + _classCallCheck(this, Redo); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Redo last undone change'; + _this.content = waxProsemirrorComponents.icons.redo; + _this.onlyOnMain = true; + return _this; + } + + _createClass(Redo, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + prosemirrorHistory.redo(state, function (tr) { + return dispatch(tr.setMeta('inputType', 'historyRedo')); + }); + }; + } + }, { + key: "enable", + get: function get() { + return prosemirrorHistory.redo; + } + }]); + + return Redo; +}(Tools), _temp$c)) || _class$e); + +var RedoService = /*#__PURE__*/function (_Service) { + _inherits(RedoService, _Service); + + var _super = _createSuper(RedoService); + + function RedoService() { + _classCallCheck(this, RedoService); + + return _super.apply(this, arguments); + } + + _createClass(RedoService, [{ + key: "register", + // boot() {} + value: function register() { + this.container.bind('Redo').to(Redo); + } + }]); + + return RedoService; +}(Service); + +var _dec$f, _class$f, _temp$d; +var Save = (_dec$f = inversify.injectable(), _dec$f(_class$f = (_temp$d = /*#__PURE__*/function (_Tools) { + _inherits(Save, _Tools); + + var _super = _createSuper(Save); + + function Save() { + var _this; + + _classCallCheck(this, Save); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = "Save changes"; + _this.content = waxProsemirrorComponents.icons.save; + return _this; + } + + _createClass(Save, [{ + key: "run", + get: function get() {} + }, { + key: "enable", + get: function get() {} + }]); + + return Save; +}(Tools), _temp$d)) || _class$f); + +var BaseServices = [new UndoService(), new RedoService()]; + +var BaseService = /*#__PURE__*/function (_Service) { + _inherits(BaseService, _Service); + + var _super = _createSuper(BaseService); + + function BaseService() { + var _this; + + _classCallCheck(this, BaseService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.dependencies = BaseServices; + return _this; + } + + return BaseService; +}(Service); + +var _dec$g, _class$g, _temp$e; +var Code = (_dec$g = inversify.injectable(), _dec$g(_class$g = (_temp$e = /*#__PURE__*/function (_Tools) { + _inherits(Code, _Tools); + + var _super = _createSuper(Code); + + function Code() { + var _this; + + _classCallCheck(this, Code); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Toggle code'; + _this.content = waxProsemirrorComponents.icons.code; + return _this; + } + + _createClass(Code, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + prosemirrorCommands.toggleMark(state.config.schema.marks.code)(state, dispatch); + }; + } + }, { + key: "active", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.markActive(state.config.schema.marks.code)(state); + }; + } + }]); + + return Code; +}(Tools), _temp$e)) || _class$g); + +var CodeService = /*#__PURE__*/function (_Service) { + _inherits(CodeService, _Service); + + var _super = _createSuper(CodeService); + + function CodeService() { + _classCallCheck(this, CodeService); + + return _super.apply(this, arguments); + } + + _createClass(CodeService, [{ + key: "boot", + value: function boot() { + var shortCuts = this.container.get('ShortCuts'); + shortCuts.addShortCut({ + 'Mod-`': prosemirrorCommands.toggleMark(this.schema.marks.code) + }); + } + }, { + key: "register", + value: function register() { + this.container.bind('Code').to(Code); + var createMark = this.container.get('CreateMark'); + createMark({ + code: waxProsemirrorSchema.codeMark + }, { + toWaxSchema: true + }); + } + }]); + + return CodeService; +}(Service); + +var _dec$h, _class$h, _temp$f; +var Strong = (_dec$h = inversify.injectable(), _dec$h(_class$h = (_temp$f = /*#__PURE__*/function (_Tools) { + _inherits(Strong, _Tools); + + var _super = _createSuper(Strong); + + function Strong() { + var _this; + + _classCallCheck(this, Strong); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = "Toggle strong"; + _this.content = waxProsemirrorComponents.icons.strong; + return _this; + } + + _createClass(Strong, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + prosemirrorCommands.toggleMark(state.config.schema.marks.strong)(state, dispatch); + }; + } + }, { + key: "active", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.markActive(state.config.schema.marks.strong)(state); + }; + } + }]); + + return Strong; +}(Tools), _temp$f)) || _class$h); + +var StrongService = /*#__PURE__*/function (_Service) { + _inherits(StrongService, _Service); + + var _super = _createSuper(StrongService); + + function StrongService() { + _classCallCheck(this, StrongService); + + return _super.apply(this, arguments); + } + + _createClass(StrongService, [{ + key: "boot", + value: function boot() { + var shortCuts = this.container.get("ShortCuts"); + shortCuts.addShortCut({ + "Mod-b": prosemirrorCommands.toggleMark(this.schema.marks.strong) + }); + } + }, { + key: "register", + value: function register() { + this.container.bind("Strong").to(Strong); + var createMark = this.container.get("CreateMark"); + createMark({ + strong: waxProsemirrorSchema.strongMark + }, { + toWaxSchema: true + }); + } + }]); + + return StrongService; +}(Service); + +var _dec$i, _class$i, _temp$g; +var Emphasis = (_dec$i = inversify.injectable(), _dec$i(_class$i = (_temp$g = /*#__PURE__*/function (_Tools) { + _inherits(Emphasis, _Tools); + + var _super = _createSuper(Emphasis); + + function Emphasis() { + var _this; + + _classCallCheck(this, Emphasis); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Toggle emphasis'; + _this.content = waxProsemirrorComponents.icons.em; + return _this; + } + + _createClass(Emphasis, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + prosemirrorCommands.toggleMark(state.config.schema.marks.em)(state, dispatch); + }; + } + }, { + key: "active", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.markActive(state.config.schema.marks.em)(state); + }; + } + }]); + + return Emphasis; +}(Tools), _temp$g)) || _class$i); + +var EmphasisService = /*#__PURE__*/function (_Service) { + _inherits(EmphasisService, _Service); + + var _super = _createSuper(EmphasisService); + + function EmphasisService() { + _classCallCheck(this, EmphasisService); + + return _super.apply(this, arguments); + } + + _createClass(EmphasisService, [{ + key: "boot", + value: function boot() { + var shortCuts = this.container.get('ShortCuts'); + shortCuts.addShortCut({ + 'Mod-i': prosemirrorCommands.toggleMark(this.schema.marks.em) + }); + } + }, { + key: "register", + value: function register() { + this.container.bind('Emphasis').to(Emphasis); + var createMark = this.container.get('CreateMark'); + createMark({ + em: waxProsemirrorSchema.emphasisMark + }, { + toWaxSchema: true + }); + } + }]); + + return EmphasisService; +}(Service); + +var _dec$j, _class$j, _temp$h; +var Subscript = (_dec$j = inversify.injectable(), _dec$j(_class$j = (_temp$h = /*#__PURE__*/function (_Tools) { + _inherits(Subscript, _Tools); + + var _super = _createSuper(Subscript); + + function Subscript() { + var _this; + + _classCallCheck(this, Subscript); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = "Toggle subscript"; + _this.content = waxProsemirrorComponents.icons.subscript; + return _this; + } + + _createClass(Subscript, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + prosemirrorCommands.toggleMark(state.config.schema.marks.subscript)(state, dispatch); + }; + } + }, { + key: "active", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.markActive(state.config.schema.marks.subscript)(state); + }; + } + }]); + + return Subscript; +}(Tools), _temp$h)) || _class$j); + +var SubscriptService = /*#__PURE__*/function (_Service) { + _inherits(SubscriptService, _Service); + + var _super = _createSuper(SubscriptService); + + function SubscriptService() { + _classCallCheck(this, SubscriptService); + + return _super.apply(this, arguments); + } + + _createClass(SubscriptService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + this.container.bind("Subscript").to(Subscript); + var createMark = this.container.get("CreateMark"); + createMark({ + subscript: waxProsemirrorSchema.subscriptMark + }, { + toWaxSchema: true + }); + } + }]); + + return SubscriptService; +}(Service); + +var _dec$k, _class$k, _temp$i; +var Superscript = (_dec$k = inversify.injectable(), _dec$k(_class$k = (_temp$i = /*#__PURE__*/function (_Tools) { + _inherits(Superscript, _Tools); + + var _super = _createSuper(Superscript); + + function Superscript() { + var _this; + + _classCallCheck(this, Superscript); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = "Toggle superscript"; + _this.content = waxProsemirrorComponents.icons.superscript; + return _this; + } + + _createClass(Superscript, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + prosemirrorCommands.toggleMark(state.config.schema.marks.superscript)(state, dispatch); + }; + } + }, { + key: "active", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.markActive(state.config.schema.marks.superscript)(state); + }; + } + }]); + + return Superscript; +}(Tools), _temp$i)) || _class$k); + +var SuperscriptService = /*#__PURE__*/function (_Service) { + _inherits(SuperscriptService, _Service); + + var _super = _createSuper(SuperscriptService); + + function SuperscriptService() { + _classCallCheck(this, SuperscriptService); + + return _super.apply(this, arguments); + } + + _createClass(SuperscriptService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + this.container.bind("Superscript").to(Superscript); + var createMark = this.container.get("CreateMark"); + createMark({ + superscript: waxProsemirrorSchema.superscriptMark + }, { + toWaxSchema: true + }); + } + }]); + + return SuperscriptService; +}(Service); + +var _dec$l, _class$l, _temp$j; +var StrikeThrough = (_dec$l = inversify.injectable(), _dec$l(_class$l = (_temp$j = /*#__PURE__*/function (_Tools) { + _inherits(StrikeThrough, _Tools); + + var _super = _createSuper(StrikeThrough); + + function StrikeThrough() { + var _this; + + _classCallCheck(this, StrikeThrough); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = "Toggle strikethrough"; + _this.content = waxProsemirrorComponents.icons.strikethrough; + return _this; + } + + _createClass(StrikeThrough, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + prosemirrorCommands.toggleMark(state.config.schema.marks.strikethrough)(state, dispatch); + }; + } + }, { + key: "active", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.markActive(state.config.schema.marks.strikethrough)(state); + }; + } + }]); + + return StrikeThrough; +}(Tools), _temp$j)) || _class$l); + +var StrikeThroughService = /*#__PURE__*/function (_Service) { + _inherits(StrikeThroughService, _Service); + + var _super = _createSuper(StrikeThroughService); + + function StrikeThroughService() { + _classCallCheck(this, StrikeThroughService); + + return _super.apply(this, arguments); + } + + _createClass(StrikeThroughService, [{ + key: "register", + value: function register() { + this.container.bind("StrikeThrough").to(StrikeThrough); + var createMark = this.container.get("CreateMark"); + createMark({ + strikethrough: waxProsemirrorSchema.strikethroughMark + }, { + toWaxSchema: true + }); + } + }]); + + return StrikeThroughService; +}(Service); + +var _dec$m, _class$m, _temp$k; +var Underline = (_dec$m = inversify.injectable(), _dec$m(_class$m = (_temp$k = /*#__PURE__*/function (_Tools) { + _inherits(Underline, _Tools); + + var _super = _createSuper(Underline); + + function Underline() { + var _this; + + _classCallCheck(this, Underline); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = "Toggle underline"; + _this.content = waxProsemirrorComponents.icons.underline; + return _this; + } + + _createClass(Underline, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + prosemirrorCommands.toggleMark(state.config.schema.marks.underline)(state, dispatch); + }; + } + }, { + key: "active", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.markActive(state.config.schema.marks.underline)(state); + }; + } + }]); + + return Underline; +}(Tools), _temp$k)) || _class$m); + +var UnderlineService = /*#__PURE__*/function (_Service) { + _inherits(UnderlineService, _Service); + + var _super = _createSuper(UnderlineService); + + function UnderlineService() { + _classCallCheck(this, UnderlineService); + + return _super.apply(this, arguments); + } + + _createClass(UnderlineService, [{ + key: "boot", + value: function boot() { + var shortCuts = this.container.get("ShortCuts"); + shortCuts.addShortCut({ + "Mod-u": prosemirrorCommands.toggleMark(this.schema.marks.underline) + }); + } + }, { + key: "register", + value: function register() { + this.container.bind("Underline").to(Underline); + var createMark = this.container.get("CreateMark"); + createMark({ + underline: waxProsemirrorSchema.underlineMark + }, { + toWaxSchema: true + }); + } + }]); + + return UnderlineService; +}(Service); + +var _dec$n, _class$n, _temp$l; +var SmallCaps = (_dec$n = inversify.injectable(), _dec$n(_class$n = (_temp$l = /*#__PURE__*/function (_Tools) { + _inherits(SmallCaps, _Tools); + + var _super = _createSuper(SmallCaps); + + function SmallCaps() { + var _this; + + _classCallCheck(this, SmallCaps); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = "Toggle Small Caps"; + _this.content = waxProsemirrorComponents.icons.small_caps; + return _this; + } + + _createClass(SmallCaps, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + prosemirrorCommands.toggleMark(state.config.schema.marks.smallcaps)(state, dispatch); + }; + } + }, { + key: "active", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.markActive(state.config.schema.marks.smallcaps)(state); + }; + } + }]); + + return SmallCaps; +}(Tools), _temp$l)) || _class$n); + +var SmallCapsService = /*#__PURE__*/function (_Service) { + _inherits(SmallCapsService, _Service); + + var _super = _createSuper(SmallCapsService); + + function SmallCapsService() { + _classCallCheck(this, SmallCapsService); + + return _super.apply(this, arguments); + } + + _createClass(SmallCapsService, [{ + key: "register", + value: function register() { + this.container.bind("SmallCaps").to(SmallCaps); + var createMark = this.container.get("CreateMark"); + createMark({ + smallcaps: waxProsemirrorSchema.smallcapsMark + }, { + toWaxSchema: true + }); + } + }]); + + return SmallCapsService; +}(Service); + +var InlineServices = [new CodeService(), new StrongService(), new EmphasisService(), new SubscriptService(), new SuperscriptService(), new StrikeThroughService(), new UnderlineService(), new SmallCapsService()]; + +var InlineAnnotationsService = /*#__PURE__*/function (_Service) { + _inherits(InlineAnnotationsService, _Service); + + var _super = _createSuper(InlineAnnotationsService); + + function InlineAnnotationsService() { + var _this; + + _classCallCheck(this, InlineAnnotationsService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.dependencies = InlineServices; + return _this; + } + + return InlineAnnotationsService; +}(Service); + +var _dec$o, _class$o, _temp$m; +var BulletList = (_dec$o = inversify.injectable(), _dec$o(_class$o = (_temp$m = /*#__PURE__*/function (_Tools) { + _inherits(BulletList, _Tools); + + var _super = _createSuper(BulletList); + + function BulletList() { + var _this; + + _classCallCheck(this, BulletList); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Wrap in bullet list'; + _this.content = waxProsemirrorComponents.icons.bullet_list; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(BulletList, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + return prosemirrorSchemaList.wrapInList(state.config.schema.nodes.bulletlist)(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return prosemirrorSchemaList.wrapInList(state.config.schema.nodes.bulletlist)(state); + }; + } + }, { + key: "active", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.blockActive(state.config.schema.nodes.bulletlist)(state); + }; + } + }]); + + return BulletList; +}(Tools), _temp$m)) || _class$o); + +var BulletListService = /*#__PURE__*/function (_Service) { + _inherits(BulletListService, _Service); + + var _super = _createSuper(BulletListService); + + function BulletListService() { + _classCallCheck(this, BulletListService); + + return _super.apply(this, arguments); + } + + _createClass(BulletListService, [{ + key: "boot", + value: function boot() { + var shortCuts = this.container.get('ShortCuts'); // shortCuts.addShortCut({ + // "Shift-Ctrl-8": wrapInList(this.schema.nodes.bulletlist) + // }); + } + }, { + key: "register", + value: function register() { + this.container.bind('BulletList').to(BulletList); + var createNode = this.container.get('CreateNode'); + createNode({ + bulletlist: waxProsemirrorSchema.bulletListNode + }, { + toWaxSchema: true + }); + } + }]); + + return BulletListService; +}(Service); + +var _dec$p, _class$p, _temp$n; +var OrderedList = (_dec$p = inversify.injectable(), _dec$p(_class$p = (_temp$n = /*#__PURE__*/function (_Tools) { + _inherits(OrderedList, _Tools); + + var _super = _createSuper(OrderedList); + + function OrderedList() { + var _this; + + _classCallCheck(this, OrderedList); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Wrap in ordered list'; + _this.content = waxProsemirrorComponents.icons.ordered_list; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(OrderedList, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + prosemirrorSchemaList.wrapInList(state.config.schema.nodes.orderedlist)(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return prosemirrorSchemaList.wrapInList(state.config.schema.nodes.orderedlist)(state); + }; + } + }, { + key: "active", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.blockActive(state.config.schema.nodes.orderedlist)(state); + }; + } + }]); + + return OrderedList; +}(Tools), _temp$n)) || _class$p); + +var OrderedListService = /*#__PURE__*/function (_Service) { + _inherits(OrderedListService, _Service); + + var _super = _createSuper(OrderedListService); + + function OrderedListService() { + _classCallCheck(this, OrderedListService); + + return _super.apply(this, arguments); + } + + _createClass(OrderedListService, [{ + key: "boot", + value: function boot() { + var shortCuts = this.container.get("ShortCuts"); // shortCuts.addShortCut({ + // "Shift-Ctrl-9": wrapInList(this.schema.nodes.orderedlist) + // }); + } + }, { + key: "register", + value: function register() { + this.container.bind("OrderedList").to(OrderedList); + var createNode = this.container.get("CreateNode"); + createNode({ + orderedlist: waxProsemirrorSchema.orderedListNode + }, { + toWaxSchema: true + }); + } + }]); + + return OrderedListService; +}(Service); + +var _dec$q, _class$q, _temp$o; +var JoinUp = (_dec$q = inversify.injectable(), _dec$q(_class$q = (_temp$o = /*#__PURE__*/function (_Tools) { + _inherits(JoinUp, _Tools); + + var _super = _createSuper(JoinUp); + + function JoinUp() { + var _this; + + _classCallCheck(this, JoinUp); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = "Join with above block"; + _this.content = waxProsemirrorComponents.icons.join_up; + return _this; + } + + _createClass(JoinUp, [{ + key: "select", + value: function select(state) { + return prosemirrorCommands.joinUp(state); + } + }, { + key: "run", + get: function get() { + return prosemirrorCommands.joinUp; + } + }, { + key: "enable", + get: function get() { + return prosemirrorCommands.joinUp; + } + }]); + + return JoinUp; +}(Tools), _temp$o)) || _class$q); + +var JoinUpService = /*#__PURE__*/function (_Service) { + _inherits(JoinUpService, _Service); + + var _super = _createSuper(JoinUpService); + + function JoinUpService() { + _classCallCheck(this, JoinUpService); + + return _super.apply(this, arguments); + } + + _createClass(JoinUpService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + this.container.bind("JoinUp").to(JoinUp); + } + }]); + + return JoinUpService; +}(Service); + +var _dec$r, _class$r, _temp$p; +var Lift = (_dec$r = inversify.injectable(), _dec$r(_class$r = (_temp$p = /*#__PURE__*/function (_Tools) { + _inherits(Lift, _Tools); + + var _super = _createSuper(Lift); + + function Lift() { + var _this; + + _classCallCheck(this, Lift); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = "Lift out of enclosing block"; + _this.content = waxProsemirrorComponents.icons.lift; + return _this; + } + + _createClass(Lift, [{ + key: "run", + get: function get() { + return prosemirrorCommands.lift; + } + }, { + key: "enable", + get: function get() { + return prosemirrorCommands.lift; + } + }]); + + return Lift; +}(Tools), _temp$p)) || _class$r); + +var LiftService = /*#__PURE__*/function (_Service) { + _inherits(LiftService, _Service); + + var _super = _createSuper(LiftService); + + function LiftService() { + _classCallCheck(this, LiftService); + + return _super.apply(this, arguments); + } + + _createClass(LiftService, [{ + key: "boot", + value: function boot() { + var shortCuts = this.container.get("ShortCuts"); // shortCuts.addShortCut({ + // "Mod-[": liftListItem(this.schema.nodes.list_item), + // "Mod-]": sinkListItem(this.schema.nodes.list_item) + // }); + } + }, { + key: "register", + value: function register() { + this.container.bind("Lift").to(Lift); + } + }]); + + return LiftService; +}(Service); + +var ListItemService = /*#__PURE__*/function (_Service) { + _inherits(ListItemService, _Service); + + var _super = _createSuper(ListItemService); + + function ListItemService() { + _classCallCheck(this, ListItemService); + + return _super.apply(this, arguments); + } + + _createClass(ListItemService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + var createNode = this.container.get("CreateNode"); + createNode({ + list_item: waxProsemirrorSchema.listItemNode + }, { + toWaxSchema: true + }); + } + }]); + + return ListItemService; +}(Service); + +var ListsServices = [new BulletListService(), new OrderedListService(), new JoinUpService(), new LiftService(), new ListItemService()]; + +var ListsService = /*#__PURE__*/function (_Service) { + _inherits(ListsService, _Service); + + var _super = _createSuper(ListsService); + + function ListsService() { + var _this; + + _classCallCheck(this, ListsService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.dependencies = ListsServices; + return _this; + } + + return ListsService; +}(Service); + +var _dec$s, _class$s, _temp$q; +var Table = (_dec$s = inversify.injectable(), _dec$s(_class$s = (_temp$q = /*#__PURE__*/function (_Tools) { + _inherits(Table, _Tools); + + var _super = _createSuper(Table); + + function Table() { + var _this; + + _classCallCheck(this, Table); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Insert table'; + _this.content = waxProsemirrorComponents.icons.table; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(Table, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + return waxProsemirrorUtilities.Commands.createTable(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.canInsert(state.config.schema.nodes.table)(state); + }; + } + }]); + + return Table; +}(Tools), _temp$q)) || _class$s); + +var InsertTableService = /*#__PURE__*/function (_Service) { + _inherits(InsertTableService, _Service); + + var _super = _createSuper(InsertTableService); + + function InsertTableService() { + _classCallCheck(this, InsertTableService); + + return _super.apply(this, arguments); + } + + _createClass(InsertTableService, [{ + key: "boot", + value: function boot() { + var shortCuts = this.container.get("ShortCuts"); + shortCuts.addShortCut({ + Tab: prosemirrorTables.goToNextCell(1), + "Shift-Tab": prosemirrorTables.goToNextCell(-1) + }); + } + }, { + key: "register", + value: function register() { + this.container.bind("Table").to(Table); + + var _tableNodes = prosemirrorTables.tableNodes({ + tableGroup: "block", + cellContent: "block+" + }), + table = _tableNodes.table, + table_row = _tableNodes.table_row, + table_cell = _tableNodes.table_cell, + table_header = _tableNodes.table_header; + + var createNode = this.container.get("CreateNode"); + createNode({ + table: table + }); + createNode({ + table_row: table_row + }); + createNode({ + table_cell: table_cell + }); + createNode({ + table_header: table_header + }); + } + }]); + + return InsertTableService; +}(Service); + +var _dec$t, _class$t, _temp$r; +var TableDropDownOptions = (_dec$t = inversify.injectable(), _dec$t(_class$t = (_temp$r = /*#__PURE__*/function (_Tools) { + _inherits(TableDropDownOptions, _Tools); + + var _super = _createSuper(TableDropDownOptions); + + function TableDropDownOptions() { + var _this; + + _classCallCheck(this, TableDropDownOptions); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = "Select Options"; + _this.content = "table"; + return _this; + } + + _createClass(TableDropDownOptions, [{ + key: "select", + value: function select(state) { + return prosemirrorTables.addColumnBefore(state); + } + }, { + key: "renderTool", + value: function renderTool(view) { + if (lodash.isEmpty(view)) return null; + return this._isDisplayed ? /*#__PURE__*/React__default.createElement(waxProsemirrorComponents.TableDropDown, { + key: uuid.v4(), + item: this.toJSON(), + view: view + }) : null; + } + }, { + key: "run", + get: function get() { + return function () { + return true; + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.canInsert(state.config.schema.nodes.table)(state); + }; + } + }]); + + return TableDropDownOptions; +}(Tools), _temp$r)) || _class$t); + +var EditTableService = /*#__PURE__*/function (_Service) { + _inherits(EditTableService, _Service); + + var _super = _createSuper(EditTableService); + + function EditTableService() { + _classCallCheck(this, EditTableService); + + return _super.apply(this, arguments); + } + + _createClass(EditTableService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + this.container.bind("TableDropDownOptions").to(TableDropDownOptions); + } + }]); + + return EditTableService; +}(Service); + +var TablesServices = [new InsertTableService(), new EditTableService()]; + +var TablesService = /*#__PURE__*/function (_Service) { + _inherits(TablesService, _Service); + + var _super = _createSuper(TablesService); + + function TablesService() { + var _this; + + _classCallCheck(this, TablesService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.dependencies = TablesServices; + return _this; + } + + return TablesService; +}(Service); + +var _dec$u, _class$u, _temp$s; +var ExtractPoetry = (_dec$u = inversify.injectable(), _dec$u(_class$u = (_temp$s = /*#__PURE__*/function (_Tools) { + _inherits(ExtractPoetry, _Tools); + + var _super = _createSuper(ExtractPoetry); + + function ExtractPoetry() { + var _this; + + _classCallCheck(this, ExtractPoetry); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Change to Extract Poetry'; + _this.content = 'Extract Poetry'; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(ExtractPoetry, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.extractPoetry, { + "class": 'extract-poetry' + })(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.extractPoetry)(state); + }; + } + }]); + + return ExtractPoetry; +}(Tools), _temp$s)) || _class$u); + +var ExtractPoetryService = /*#__PURE__*/function (_Service) { + _inherits(ExtractPoetryService, _Service); + + var _super = _createSuper(ExtractPoetryService); + + function ExtractPoetryService() { + _classCallCheck(this, ExtractPoetryService); + + return _super.apply(this, arguments); + } + + _createClass(ExtractPoetryService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + this.container.bind("ExtractPoetry").to(ExtractPoetry); + var createNode = this.container.get("CreateNode"); + createNode({ + extractPoetry: waxProsemirrorSchema.extractPoetryNode + }, { + toWaxSchema: true + }); + } + }]); + + return ExtractPoetryService; +}(Service); + +var _dec$v, _class$v, _temp$t; +var ExtractProse = (_dec$v = inversify.injectable(), _dec$v(_class$v = (_temp$t = /*#__PURE__*/function (_Tools) { + _inherits(ExtractProse, _Tools); + + var _super = _createSuper(ExtractProse); + + function ExtractProse() { + var _this; + + _classCallCheck(this, ExtractProse); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Change to Extract Prose'; + _this.content = 'Extract Prose'; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(ExtractProse, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.extractProse, { + "class": 'extract-prose' + })(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.extractProse)(state); + }; + } + }]); + + return ExtractProse; +}(Tools), _temp$t)) || _class$v); + +var ExtractProseService = /*#__PURE__*/function (_Service) { + _inherits(ExtractProseService, _Service); + + var _super = _createSuper(ExtractProseService); + + function ExtractProseService() { + _classCallCheck(this, ExtractProseService); + + return _super.apply(this, arguments); + } + + _createClass(ExtractProseService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + this.container.bind("ExtractProse").to(ExtractProse); + var createNode = this.container.get("CreateNode"); + createNode({ + extractProse: waxProsemirrorSchema.extractProseNode + }, { + toWaxSchema: true + }); + } + }]); + + return ExtractProseService; +}(Service); + +var _dec$w, _class$w, _temp$u; +var ParagraphContinued = (_dec$w = inversify.injectable(), _dec$w(_class$w = (_temp$u = /*#__PURE__*/function (_Tools) { + _inherits(ParagraphContinued, _Tools); + + var _super = _createSuper(ParagraphContinued); + + function ParagraphContinued() { + var _this; + + _classCallCheck(this, ParagraphContinued); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Change to Paragraph Continued'; + _this.content = 'Paragraph Continued'; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(ParagraphContinued, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.paragraphCont, { + "class": 'paragraph-cont' + })(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.paragraphCont)(state); + }; + } + }]); + + return ParagraphContinued; +}(Tools), _temp$u)) || _class$w); + +var ParagraphContinuedService = /*#__PURE__*/function (_Service) { + _inherits(ParagraphContinuedService, _Service); + + var _super = _createSuper(ParagraphContinuedService); + + function ParagraphContinuedService() { + _classCallCheck(this, ParagraphContinuedService); + + return _super.apply(this, arguments); + } + + _createClass(ParagraphContinuedService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + this.container.bind("ParagraphContinued").to(ParagraphContinued); + var createNode = this.container.get("CreateNode"); + createNode({ + paragraphCont: waxProsemirrorSchema.paragraphContNode + }, { + toWaxSchema: true + }); + } + }]); + + return ParagraphContinuedService; +}(Service); + +var _dec$x, _class$x, _temp$v; +var Paragraph = (_dec$x = inversify.injectable(), _dec$x(_class$x = (_temp$v = /*#__PURE__*/function (_Tools) { + _inherits(Paragraph, _Tools); + + var _super = _createSuper(Paragraph); + + function Paragraph() { + var _this; + + _classCallCheck(this, Paragraph); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Change to Paragraph'; + _this.content = 'Paragraph'; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(Paragraph, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.paragraph, { + "class": 'paragraph' + })(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.paragraph)(state); + }; + } + }]); + + return Paragraph; +}(Tools), _temp$v)) || _class$x); + +var ParagraphService = /*#__PURE__*/function (_Service) { + _inherits(ParagraphService, _Service); + + var _super = _createSuper(ParagraphService); + + function ParagraphService() { + _classCallCheck(this, ParagraphService); + + return _super.apply(this, arguments); + } + + _createClass(ParagraphService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + this.container.bind("Paragraph").to(Paragraph); + } + }]); + + return ParagraphService; +}(Service); + +var _dec$y, _class$y, _temp$w; +var SourceNote = (_dec$y = inversify.injectable(), _dec$y(_class$y = (_temp$w = /*#__PURE__*/function (_Tools) { + _inherits(SourceNote, _Tools); + + var _super = _createSuper(SourceNote); + + function SourceNote() { + var _this; + + _classCallCheck(this, SourceNote); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Change to Source Note'; + _this.content = 'Source Note'; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(SourceNote, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.sourceNote, { + "class": 'source-note' + })(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.sourceNote)(state); + }; + } + }]); + + return SourceNote; +}(Tools), _temp$w)) || _class$y); + +var SourceNoteService = /*#__PURE__*/function (_Service) { + _inherits(SourceNoteService, _Service); + + var _super = _createSuper(SourceNoteService); + + function SourceNoteService() { + _classCallCheck(this, SourceNoteService); + + return _super.apply(this, arguments); + } + + _createClass(SourceNoteService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + this.container.bind("SourceNote").to(SourceNote); + var createNode = this.container.get("CreateNode"); + createNode({ + sourceNote: waxProsemirrorSchema.sourceNoteNode + }, { + toWaxSchema: true + }); + } + }]); + + return SourceNoteService; +}(Service); + +var _dec$z, _class$z, _temp$x; +var BlockQuote = (_dec$z = inversify.injectable(), _dec$z(_class$z = (_temp$x = /*#__PURE__*/function (_Tools) { + _inherits(BlockQuote, _Tools); + + var _super = _createSuper(BlockQuote); + + function BlockQuote() { + var _this; + + _classCallCheck(this, BlockQuote); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Change to Block Quote'; + _this.content = 'Block Quote'; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(BlockQuote, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + prosemirrorCommands.wrapIn(state.config.schema.nodes.blockquote)(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return prosemirrorCommands.wrapIn(state.config.schema.nodes.blockquote)(state); + }; + } + }]); + + return BlockQuote; +}(Tools), _temp$x)) || _class$z); + +var BlockQuoteService = /*#__PURE__*/function (_Service) { + _inherits(BlockQuoteService, _Service); + + var _super = _createSuper(BlockQuoteService); + + function BlockQuoteService() { + _classCallCheck(this, BlockQuoteService); + + return _super.apply(this, arguments); + } + + _createClass(BlockQuoteService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + this.container.bind("BlockQuote").to(BlockQuote); + var createNode = this.container.get("CreateNode"); + createNode({ + blockquote: waxProsemirrorSchema.blockQuoteNode + }); + } + }]); + + return BlockQuoteService; +}(Service); + +var TextServices = [new ExtractPoetryService(), new ExtractProseService(), new ParagraphContinuedService(), new ParagraphService(), new SourceNoteService(), new BlockQuoteService()]; + +var TextBlockLevelService = /*#__PURE__*/function (_Service) { + _inherits(TextBlockLevelService, _Service); + + var _super = _createSuper(TextBlockLevelService); + + function TextBlockLevelService() { + var _this; + + _classCallCheck(this, TextBlockLevelService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.dependencies = TextServices; + return _this; + } + + return TextBlockLevelService; +}(Service); + +var _dec$A, _class$A, _temp$y; +var Author = (_dec$A = inversify.injectable(), _dec$A(_class$A = (_temp$y = /*#__PURE__*/function (_Tools) { + _inherits(Author, _Tools); + + var _super = _createSuper(Author); + + function Author() { + var _this; + + _classCallCheck(this, Author); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Change to Author'; + _this.content = 'Author'; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(Author, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.author, { + "class": 'author' + })(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.author)(state); + }; + } + }]); + + return Author; +}(Tools), _temp$y)) || _class$A); + +var AuthorService = /*#__PURE__*/function (_Service) { + _inherits(AuthorService, _Service); + + var _super = _createSuper(AuthorService); + + function AuthorService() { + _classCallCheck(this, AuthorService); + + return _super.apply(this, arguments); + } + + _createClass(AuthorService, [{ + key: "register", + // boot() {} + value: function register() { + this.container.bind('Author').to(Author); + var createNode = this.container.get('CreateNode'); + createNode({ + author: waxProsemirrorSchema.authorNode + }, { + toWaxSchema: true + }); + } + }]); + + return AuthorService; +}(Service); + +var _dec$B, _class$B, _temp$z; +var EpigraphPoetry = (_dec$B = inversify.injectable(), _dec$B(_class$B = (_temp$z = /*#__PURE__*/function (_Tools) { + _inherits(EpigraphPoetry, _Tools); + + var _super = _createSuper(EpigraphPoetry); + + function EpigraphPoetry() { + var _this; + + _classCallCheck(this, EpigraphPoetry); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Change to Epigraph Poetry'; + _this.content = 'Epigraph Poetry'; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(EpigraphPoetry, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.epigraphPoetry, { + "class": 'epigraph-poetry' + })(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.epigraphPoetry)(state); + }; + } + }]); + + return EpigraphPoetry; +}(Tools), _temp$z)) || _class$B); + +var EpigraphPoetryService = /*#__PURE__*/function (_Service) { + _inherits(EpigraphPoetryService, _Service); + + var _super = _createSuper(EpigraphPoetryService); + + function EpigraphPoetryService() { + _classCallCheck(this, EpigraphPoetryService); + + return _super.apply(this, arguments); + } + + _createClass(EpigraphPoetryService, [{ + key: "register", + // boot() {} + value: function register() { + this.container.bind('EpigraphPoetry').to(EpigraphPoetry); + var createNode = this.container.get('CreateNode'); + createNode({ + epigraphPoetry: waxProsemirrorSchema.epigraphPoetryNode + }, { + toWaxSchema: true + }); + } + }]); + + return EpigraphPoetryService; +}(Service); + +var _dec$C, _class$C, _temp$A; +var EpigraphProse = (_dec$C = inversify.injectable(), _dec$C(_class$C = (_temp$A = /*#__PURE__*/function (_Tools) { + _inherits(EpigraphProse, _Tools); + + var _super = _createSuper(EpigraphProse); + + function EpigraphProse() { + var _this; + + _classCallCheck(this, EpigraphProse); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Change to Epigraph Prose'; + _this.content = 'Epigraph Prose'; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(EpigraphProse, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.epigraphProse, { + "class": 'epigraph-prose' + })(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.epigraphProse)(state); + }; + } + }]); + + return EpigraphProse; +}(Tools), _temp$A)) || _class$C); + +var EpigraphProseService = /*#__PURE__*/function (_Service) { + _inherits(EpigraphProseService, _Service); + + var _super = _createSuper(EpigraphProseService); + + function EpigraphProseService() { + _classCallCheck(this, EpigraphProseService); + + return _super.apply(this, arguments); + } + + _createClass(EpigraphProseService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + this.container.bind('EpigraphProse').to(EpigraphProse); + var createNode = this.container.get('CreateNode'); + createNode({ + epigraphProse: waxProsemirrorSchema.epigraphProseNode + }, { + toWaxSchema: true + }); + } + }]); + + return EpigraphProseService; +}(Service); + +var _dec$D, _class$D, _temp$B; +var Heading1 = (_dec$D = inversify.injectable(), _dec$D(_class$D = (_temp$B = /*#__PURE__*/function (_Tools) { + _inherits(Heading1, _Tools); + + var _super = _createSuper(Heading1); + + function Heading1() { + var _this; + + _classCallCheck(this, Heading1); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Change to heading level 1'; + _this.content = 'Heading 1'; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(Heading1, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.heading, { + level: 1 + })(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.heading, { + level: 1 + })(state); + }; + } + }]); + + return Heading1; +}(Tools), _temp$B)) || _class$D); + +var _dec$E, _class$E, _temp$C; +var Heading2 = (_dec$E = inversify.injectable(), _dec$E(_class$E = (_temp$C = /*#__PURE__*/function (_Tools) { + _inherits(Heading2, _Tools); + + var _super = _createSuper(Heading2); + + function Heading2() { + var _this; + + _classCallCheck(this, Heading2); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Change to heading level 2'; + _this.content = 'Heading 2'; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(Heading2, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.heading, { + level: 2 + })(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.heading, { + level: 2 + })(state); + }; + } + }]); + + return Heading2; +}(Tools), _temp$C)) || _class$E); + +var _dec$F, _class$F, _temp$D; +var Heading3 = (_dec$F = inversify.injectable(), _dec$F(_class$F = (_temp$D = /*#__PURE__*/function (_Tools) { + _inherits(Heading3, _Tools); + + var _super = _createSuper(Heading3); + + function Heading3() { + var _this; + + _classCallCheck(this, Heading3); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Change to heading level 3'; + _this.content = 'Heading 3'; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(Heading3, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.heading, { + level: 3 + })(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.heading, { + level: 3 + })(state); + }; + } + }]); + + return Heading3; +}(Tools), _temp$D)) || _class$F); + +var HeadingService = /*#__PURE__*/function (_Service) { + _inherits(HeadingService, _Service); + + var _super = _createSuper(HeadingService); + + function HeadingService() { + _classCallCheck(this, HeadingService); + + return _super.apply(this, arguments); + } + + _createClass(HeadingService, [{ + key: "register", + // boot() {} + value: function register() { + this.container.bind('Heading1').to(Heading1); + this.container.bind('Heading2').to(Heading2); + this.container.bind('Heading3').to(Heading3); + var createNode = this.container.get('CreateNode'); + createNode({ + heading: waxProsemirrorSchema.headingNode + }, { + toWaxSchema: true + }); + } + }]); + + return HeadingService; +}(Service); + +var _dec$G, _class$G, _temp$E; +var SubTitle = (_dec$G = inversify.injectable(), _dec$G(_class$G = (_temp$E = /*#__PURE__*/function (_Tools) { + _inherits(SubTitle, _Tools); + + var _super = _createSuper(SubTitle); + + function SubTitle() { + var _this; + + _classCallCheck(this, SubTitle); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Change to Subtitle'; + _this.content = 'Subtitle'; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(SubTitle, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.subtitle, { + "class": 'cst' + })(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.subtitle)(state); + }; + } + }]); + + return SubTitle; +}(Tools), _temp$E)) || _class$G); + +var SubTitleService = /*#__PURE__*/function (_Service) { + _inherits(SubTitleService, _Service); + + var _super = _createSuper(SubTitleService); + + function SubTitleService() { + _classCallCheck(this, SubTitleService); + + return _super.apply(this, arguments); + } + + _createClass(SubTitleService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + this.container.bind("SubTitle").to(SubTitle); + var createNode = this.container.get("CreateNode"); + createNode({ + subtitle: waxProsemirrorSchema.subTitleNode + }, { + toWaxSchema: true + }); + } + }]); + + return SubTitleService; +}(Service); + +var _dec$H, _class$H, _temp$F; +var Title = (_dec$H = inversify.injectable(), _dec$H(_class$H = (_temp$F = /*#__PURE__*/function (_Tools) { + _inherits(Title, _Tools); + + var _super = _createSuper(Title); + + function Title() { + var _this; + + _classCallCheck(this, Title); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Change to Title'; + _this.content = 'Title'; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(Title, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.title, { + "class": 'title' + })(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return waxProsemirrorUtilities.Commands.setBlockType(state.config.schema.nodes.title)(state); + }; + } + }]); + + return Title; +}(Tools), _temp$F)) || _class$H); + +var TitleService = /*#__PURE__*/function (_Service) { + _inherits(TitleService, _Service); + + var _super = _createSuper(TitleService); + + function TitleService() { + _classCallCheck(this, TitleService); + + return _super.apply(this, arguments); + } + + _createClass(TitleService, [{ + key: "boot", + value: function boot() {} + }, { + key: "register", + value: function register() { + this.container.bind("Title").to(Title); + var createNode = this.container.get("CreateNode"); + createNode({ + title: waxProsemirrorSchema.titleNode + }, { + toWaxSchema: true + }); + } + }]); + + return TitleService; +}(Service); + +var DisplayServices = [new AuthorService(), new EpigraphProseService(), new EpigraphPoetryService(), new HeadingService(), new SubTitleService(), new TitleService()]; + +var DisplayBlockLevelService = /*#__PURE__*/function (_Service) { + _inherits(DisplayBlockLevelService, _Service); + + var _super = _createSuper(DisplayBlockLevelService); + + function DisplayBlockLevelService() { + var _this; + + _classCallCheck(this, DisplayBlockLevelService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.dependencies = DisplayServices; + return _this; + } + + return DisplayBlockLevelService; +}(Service); + +var _dec$I, _class$I, _temp$G; +var Note = (_dec$I = inversify.injectable(), _dec$I(_class$I = (_temp$G = /*#__PURE__*/function (_Tools) { + _inherits(Note, _Tools); + + var _super = _createSuper(Note); + + function Note() { + var _this; + + _classCallCheck(this, Note); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Insert Note'; + _this.content = waxProsemirrorComponents.icons.footnote; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(Note, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + var _state$selection = state.selection, + empty = _state$selection.empty, + $from = _state$selection.$from, + $to = _state$selection.$to, + content = prosemirrorModel.Fragment.empty; + if (!empty && $from.sameParent($to) && $from.parent.inlineContent) content = $from.parent.content.cut($from.parentOffset, $to.parentOffset); + var footnote = state.config.schema.nodes.footnote.create({ + id: uuid.v4() + }, content); + dispatch(state.tr.replaceSelectionWith(footnote)); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return true; + }; + } + }]); + + return Note; +}(Tools), _temp$G)) || _class$I); + +var transformPasted = function transformPasted(slice, view) { + var content = slice.content; + var commentNodes = waxProsemirrorUtilities.DocumentHelpers.findChildrenByMark(content, view.state.schema.marks.comment, true); + var allComments = []; + commentNodes.map(function (node) { + node.node.marks.map(function (comment) { + if (comment.type.name === "comment") { + allComments.push(comment); + } + }); + }); + var groupedCommentsById = allComments.reduce(function (obj, mark) { + obj[mark.attrs.id] = [].concat(_toConsumableArray(obj[mark.attrs.id] || []), [mark]); + return obj; + }, {}); + lodash.forEach(Object.keys(groupedCommentsById), function (key) { + var id = uuid.v4(); + lodash.forEach(groupedCommentsById[key], function (comment) { + comment.attrs.id = id; + }); + }); + return slice; +}; + +var Editor = (function (_ref) { + var node = _ref.node, + view = _ref.view; + var editorRef = React.useRef(); + var context = React.useContext(waxProsemirrorCore.WaxContext); + var noteId = node.attrs.id; + var noteView; + React.useEffect(function () { + noteView = new prosemirrorView.EditorView({ + mount: editorRef.current + }, { + state: prosemirrorState.EditorState.create({ + doc: node, + plugins: [prosemirrorKeymap.keymap(createKeyBindings())].concat(_toConsumableArray(context.app.getPlugins())) + }), + // This is the magic part + dispatchTransaction: dispatchTransaction, + handleDOMEvents: { + mousedown: function mousedown() { + context.updateView({}, noteId); // Kludge to prevent issues due to the fact that the whole + // footnote is node-selected (and thus DOM-selected) when + // the parent editor is focused. + + if (noteView.hasFocus()) noteView.focus(); + } + }, + transformPasted: function transformPasted$1(slice) { + return transformPasted(slice, noteView); + } + }); // Set Each note into Wax's Context + + context.updateView(_defineProperty({}, noteId, noteView), noteId); + + if (context.view[noteId]) { + context.view[noteId].focus(); + } + }, []); + + var dispatchTransaction = function dispatchTransaction(transaction) { + // const tr = TrackChange.enabled + // ? trackedTransaction(transaction, view.state, user) + // : transaction; + var _noteView$state$apply = noteView.state.applyTransaction(transaction), + state = _noteView$state$apply.state, + transactions = _noteView$state$apply.transactions; + + noteView.updateState(state); + var allNotes = waxProsemirrorUtilities.DocumentHelpers.findChildrenByType(view.state.doc, view.state.schema.nodes.footnote, true); + var noteFound = lodash.filter(allNotes, { + node: { + attrs: { + id: noteId + } + } + }); // TODO Remove timeout and use state to check if noteView has changed + + setTimeout(function () { + context.updateView({}, noteId); + }, 20); + + if (!transaction.getMeta('fromOutside')) { + var outerTr = view.state.tr; + var offsetMap = prosemirrorTransform.StepMap.offset(noteFound[0].pos + 1); + + for (var i = 0; i < transactions.length; i + 1) { + var steps = transactions[i].steps; + + for (var j = 0; j < steps.length; j + 1) { + outerTr.step(steps[j].map(offsetMap)); + } + } + + if (outerTr.docChanged) view.dispatch(outerTr.setMeta('outsideView', 'notes')); + } + }; + + var createKeyBindings = function createKeyBindings() { + var keys = getKeys(); + Object.keys(prosemirrorCommands.baseKeymap).forEach(function (key) { + keys[key] = prosemirrorCommands.baseKeymap[key]; + }); + return keys; + }; + + var getKeys = function getKeys() { + return { + 'Mod-z': function ModZ() { + return prosemirrorHistory.undo(view.state, view.dispatch); + }, + 'Mod-y': function ModY() { + return prosemirrorHistory.redo(view.state, view.dispatch); + } // 'Mod-u': () => Commands.markActive(noteView.state.config.schema.marks.underline)(noteView.state), + + }; + }; + + if (context.view[noteId]) { + var state = context.view[noteId].state; + var start = node.content.findDiffStart(state.doc.content); + + if (start != null) { + var _node$content$findDif = node.content.findDiffEnd(state.doc.content), + endA = _node$content$findDif.a, + endB = _node$content$findDif.b; + + var overlap = start - Math.min(endA, endB); + + if (overlap > 0) { + endA += overlap; + endB += overlap; + } + + context.view[noteId].dispatch(state.tr.replace(start, endB, node.slice(start, endA)).setMeta('fromOutside', true)); + } + } + + return /*#__PURE__*/React__default.createElement(waxProsemirrorComponents.NoteEditorContainer, { + ref: editorRef + }); +}); + +var NoteEditor = (function (_ref) { + var notes = _ref.notes, + view = _ref.view; + return /*#__PURE__*/React__default.createElement(React.Fragment, null, notes.map(function (note) { + return /*#__PURE__*/React__default.createElement(Editor, { + key: note.node.attrs.id, + node: note.node, + view: view + }); + })); +}); + +var NoteComponent = (function () { + var _useContext = React.useContext(waxProsemirrorCore.WaxContext), + main = _useContext.view.main; + + var _useState = React.useState([]), + _useState2 = _slicedToArray(_useState, 2), + notes = _useState2[0], + setNotes = _useState2[1]; + + React.useEffect(function () { + setNotes(updateNotes(main)); + }, [JSON.stringify(updateNotes(main))]); + var noteComponent = React.useMemo(function () { + return /*#__PURE__*/React__default.createElement(NoteEditor, { + notes: notes, + view: main + }); + }, [notes]); + return /*#__PURE__*/React__default.createElement(React.Fragment, null, noteComponent); +}); + +var updateNotes = function updateNotes(view) { + if (view) { + return waxProsemirrorUtilities.DocumentHelpers.findChildrenByType(view.state.doc, view.state.schema.nodes.footnote, true); + } + + return []; +}; + +var NoteService = /*#__PURE__*/function (_Service) { + _inherits(NoteService, _Service); + + var _super = _createSuper(NoteService); + + function NoteService() { + var _this; + + _classCallCheck(this, NoteService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.name = "NoteService"; + return _this; + } + + _createClass(NoteService, [{ + key: "boot", + value: function boot() { + var layout = this.container.get("Layout"); + var createOverlay = this.container.get("CreateOverlay"); + layout.addComponent("notesArea", NoteComponent); + createOverlay(waxProsemirrorComponents.CommentBubbleComponent, { + showComment: function showComment(activeViewId) { + return activeViewId !== "main"; + }, + group: "notes" + }, { + markType: "", + followCursor: false, + selection: true + }); + } + }, { + key: "register", + value: function register() { + var createNode = this.container.get("CreateNode"); + this.container.bind("Note").to(Note); + createNode({ + footnote: waxProsemirrorSchema.footNoteNode + }); + } + }]); + + return NoteService; +}(Service); + +var PLUGIN_KEY$1 = 'commentPlugin'; + +var CommentsService = /*#__PURE__*/function (_Service) { + _inherits(CommentsService, _Service); + + var _super = _createSuper(CommentsService); + + function CommentsService() { + _classCallCheck(this, CommentsService); + + return _super.apply(this, arguments); + } + + _createClass(CommentsService, [{ + key: "boot", + value: function boot() { + this.app.PmPlugins.add(PLUGIN_KEY$1, waxProsemirrorPlugins.CommentPlugin(PLUGIN_KEY$1)); + var createOverlay = this.container.get('CreateOverlay'); + var layout = this.container.get('Layout'); + createOverlay(waxProsemirrorComponents.CommentBubbleComponent, { + showComment: function showComment(activeViewId) { + return activeViewId === 'main'; + }, + group: 'main' + }, { + markType: '', + followCursor: false, + selection: true + }); + layout.addComponent('rightArea', waxProsemirrorComponents.RightArea); + } + }, { + key: "register", + value: function register() { + var createMark = this.container.get('CreateMark'); + createMark({ + comment: waxProsemirrorSchema.commentMark + }, { + toWaxSchema: true + }); + } + }]); + + return CommentsService; +}(Service); + +var _dec$J, _class$J, _temp$H; +var CodeBlockTool = (_dec$J = inversify.injectable(), _dec$J(_class$J = (_temp$H = /*#__PURE__*/function (_Tools) { + _inherits(CodeBlockTool, _Tools); + + var _super = _createSuper(CodeBlockTool); + + function CodeBlockTool() { + var _this; + + _classCallCheck(this, CodeBlockTool); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.title = 'Insert Code Block'; + _this.content = waxProsemirrorComponents.icons.code_block; + + _this.select = function (state, activeViewId) { + if (activeViewId !== 'main') return false; + return true; + }; + + return _this; + } + + _createClass(CodeBlockTool, [{ + key: "run", + get: function get() { + return function (state, dispatch) { + prosemirrorCommands.setBlockType(state.config.schema.nodes.code_block)(state, dispatch); + }; + } + }, { + key: "enable", + get: function get() { + return function (state) { + return prosemirrorCommands.setBlockType(state.config.schema.nodes.code_block)(state); + }; + } + }]); + + return CodeBlockTool; +}(Tools), _temp$H)) || _class$J); + +var CodeBlockService = /*#__PURE__*/function (_Service) { + _inherits(CodeBlockService, _Service); + + var _super = _createSuper(CodeBlockService); + + function CodeBlockService() { + _classCallCheck(this, CodeBlockService); + + return _super.apply(this, arguments); + } + + _createClass(CodeBlockService, [{ + key: "boot", + value: function boot() { + this.app.PmPlugins.add('highlightPlugin', waxProsemirrorPlugins.highlightPlugin()); + } + }, { + key: "register", + value: function register() { + this.container.bind('CodeBlockTool').to(CodeBlockTool); + var createNode = this.container.get('CreateNode'); + createNode({ + code_block: waxProsemirrorSchema.codeBlockNode + }); + } + }]); + + return CodeBlockService; +}(Service); + +var _dec$K, _class$K, _temp$I; +var Base = (_dec$K = inversify.injectable(), _dec$K(_class$K = (_temp$I = /*#__PURE__*/function (_ToolGroup) { + _inherits(Base, _ToolGroup); + + var _super = _createSuper(Base); + + function Base(undo, redo) { + var _this; + + _classCallCheck(this, Base); + + _this = _super.call(this); + _this.tools = []; + _this.tools = [undo, redo]; + return _this; + } + + Base = inversify.inject('Redo')(Base, undefined, 1) || Base; + Base = inversify.inject('Undo')(Base, undefined, 0) || Base; + return Base; +}(ToolGroup), _temp$I)) || _class$K); + +var BaseToolGroupService = /*#__PURE__*/function (_Service) { + _inherits(BaseToolGroupService, _Service); + + var _super = _createSuper(BaseToolGroupService); + + function BaseToolGroupService() { + _classCallCheck(this, BaseToolGroupService); + + return _super.apply(this, arguments); + } + + _createClass(BaseToolGroupService, [{ + key: "register", + value: function register() { + this.container.bind('Base').to(Base); + } + }]); + + return BaseToolGroupService; +}(Service); + +var _dec$L, _class$L, _temp$J; +var Annotations = (_dec$L = inversify.injectable(), _dec$L(_class$L = (_temp$J = /*#__PURE__*/function (_ToolGroup) { + _inherits(Annotations, _ToolGroup); + + var _super = _createSuper(Annotations); + + function Annotations(code, emphasis, link, strikethrough, strong, subscript, superscript, underline, smallcaps) { + var _this; + + _classCallCheck(this, Annotations); + + _this = _super.call(this); + _this.tools = []; + _this.tools = [strong, emphasis, code, link, strikethrough, underline, subscript, superscript, smallcaps]; + return _this; + } + + Annotations = inversify.inject("SmallCaps")(Annotations, undefined, 8) || Annotations; + Annotations = inversify.inject("Underline")(Annotations, undefined, 7) || Annotations; + Annotations = inversify.inject("Superscript")(Annotations, undefined, 6) || Annotations; + Annotations = inversify.inject("Subscript")(Annotations, undefined, 5) || Annotations; + Annotations = inversify.inject("Strong")(Annotations, undefined, 4) || Annotations; + Annotations = inversify.inject("StrikeThrough")(Annotations, undefined, 3) || Annotations; + Annotations = inversify.inject("Link")(Annotations, undefined, 2) || Annotations; + Annotations = inversify.inject("Emphasis")(Annotations, undefined, 1) || Annotations; + Annotations = inversify.inject("Code")(Annotations, undefined, 0) || Annotations; + return Annotations; +}(ToolGroup), _temp$J)) || _class$L); + +var AnnotationToolGroupService = /*#__PURE__*/function (_Service) { + _inherits(AnnotationToolGroupService, _Service); + + var _super = _createSuper(AnnotationToolGroupService); + + function AnnotationToolGroupService() { + var _this; + + _classCallCheck(this, AnnotationToolGroupService); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _super.call.apply(_super, [this].concat(args)); + _this.name = "AnnotationToolGroupService"; + return _this; + } + + _createClass(AnnotationToolGroupService, [{ + key: "register", + value: function register() { + this.container.bind("Annotations").to(Annotations); + } + }]); + + return AnnotationToolGroupService; +}(Service); + +var _dec$M, _class$M, _temp$K; +var Lists = (_dec$M = inversify.injectable(), _dec$M(_class$M = (_temp$K = /*#__PURE__*/function (_ToolGroup) { + _inherits(Lists, _ToolGroup); + + var _super = _createSuper(Lists); + + function Lists(orderedlist, bulletlist, joinup, lift) { + var _this; + + _classCallCheck(this, Lists); + + _this = _super.call(this); + _this.tools = []; + _this.tools = [orderedlist, bulletlist, joinup, lift]; + return _this; + } + + Lists = inversify.inject("Lift")(Lists, undefined, 3) || Lists; + Lists = inversify.inject("JoinUp")(Lists, undefined, 2) || Lists; + Lists = inversify.inject("BulletList")(Lists, undefined, 1) || Lists; + Lists = inversify.inject("OrderedList")(Lists, undefined, 0) || Lists; + return Lists; +}(ToolGroup), _temp$K)) || _class$M); + +var ListToolGroupService = /*#__PURE__*/function (_Service) { + _inherits(ListToolGroupService, _Service); + + var _super = _createSuper(ListToolGroupService); + + function ListToolGroupService() { + _classCallCheck(this, ListToolGroupService); + + return _super.apply(this, arguments); + } + + _createClass(ListToolGroupService, [{ + key: "register", + value: function register() { + this.container.bind('Lists').to(Lists); + } + }]); + + return ListToolGroupService; +}(Service); + +var _dec$N, _class$N, _temp$L; +var Images = (_dec$N = inversify.injectable(), _dec$N(_class$N = (_temp$L = /*#__PURE__*/function (_ToolGroup) { + _inherits(Images, _ToolGroup); + + var _super = _createSuper(Images); + + function Images(image) { + var _this; + + _classCallCheck(this, Images); + + _this = _super.call(this); + _this.tools = []; + _this.tools = [image]; + return _this; + } + + Images = inversify.inject("Image")(Images, undefined, 0) || Images; + return Images; +}(ToolGroup), _temp$L)) || _class$N); + +var ImageToolGroupService = /*#__PURE__*/function (_Service) { + _inherits(ImageToolGroupService, _Service); + + var _super = _createSuper(ImageToolGroupService); + + function ImageToolGroupService() { + _classCallCheck(this, ImageToolGroupService); + + return _super.apply(this, arguments); + } + + _createClass(ImageToolGroupService, [{ + key: "register", + value: function register() { + this.container.bind('Images').to(Images); + } + }]); + + return ImageToolGroupService; +}(Service); + +var _dec$O, _class$O, _temp$M; +var Tables = (_dec$O = inversify.injectable(), _dec$O(_class$O = (_temp$M = /*#__PURE__*/function (_ToolGroup) { + _inherits(Tables, _ToolGroup); + + var _super = _createSuper(Tables); + + function Tables(table, tableDropDownOptions) { + var _this; + + _classCallCheck(this, Tables); + + _this = _super.call(this); + _this.tools = []; + _this.tools = [table, tableDropDownOptions]; + return _this; + } + + Tables = inversify.inject("TableDropDownOptions")(Tables, undefined, 1) || Tables; + Tables = inversify.inject("Table")(Tables, undefined, 0) || Tables; + return Tables; +}(ToolGroup), _temp$M)) || _class$O); + +var TableToolGroupService = /*#__PURE__*/function (_Service) { + _inherits(TableToolGroupService, _Service); + + var _super = _createSuper(TableToolGroupService); + + function TableToolGroupService() { + _classCallCheck(this, TableToolGroupService); + + return _super.apply(this, arguments); + } + + _createClass(TableToolGroupService, [{ + key: "register", + value: function register() { + this.container.bind('Tables').to(Tables); + } + }]); + + return TableToolGroupService; +}(Service); + +var _dec$P, _class$P, _temp$N; +var Display = (_dec$P = inversify.injectable(), _dec$P(_class$P = (_temp$N = /*#__PURE__*/function (_ToolGroup) { + _inherits(Display, _ToolGroup); + + var _super = _createSuper(Display); + + function Display(author, title, subtitle, epigraphprose, epigraphpoetry, heading1, heading2, heading3) { + var _this; + + _classCallCheck(this, Display); + + _this = _super.call(this); + _this.tools = []; + _this.title = /*#__PURE__*/React__default.createElement(waxProsemirrorComponents.LeftMenuTitle, { + title: "Display" + }); + _this.tools = [title, author, subtitle, epigraphprose, epigraphpoetry, heading1, heading2, heading3]; + return _this; + } + + Display = inversify.inject("Heading3")(Display, undefined, 7) || Display; + Display = inversify.inject("Heading2")(Display, undefined, 6) || Display; + Display = inversify.inject("Heading1")(Display, undefined, 5) || Display; + Display = inversify.inject("EpigraphPoetry")(Display, undefined, 4) || Display; + Display = inversify.inject("EpigraphProse")(Display, undefined, 3) || Display; + Display = inversify.inject("SubTitle")(Display, undefined, 2) || Display; + Display = inversify.inject("Title")(Display, undefined, 1) || Display; + Display = inversify.inject("Author")(Display, undefined, 0) || Display; + return Display; +}(ToolGroup), _temp$N)) || _class$P); + +var DisplayToolGroupService = /*#__PURE__*/function (_Service) { + _inherits(DisplayToolGroupService, _Service); + + var _super = _createSuper(DisplayToolGroupService); + + function DisplayToolGroupService() { + _classCallCheck(this, DisplayToolGroupService); + + return _super.apply(this, arguments); + } + + _createClass(DisplayToolGroupService, [{ + key: "register", + value: function register() { + this.container.bind('Display').to(Display); + } + }]); + + return DisplayToolGroupService; +}(Service); + +var _dec$Q, _class$Q, _temp$O; +var Text = (_dec$Q = inversify.injectable(), _dec$Q(_class$Q = (_temp$O = /*#__PURE__*/function (_ToolGroup) { + _inherits(Text, _ToolGroup); + + var _super = _createSuper(Text); + + function Text(paragraph, paragraphContinued, extractProse, extractPoetry, sourceNote, blockQuote) { + var _this; + + _classCallCheck(this, Text); + + _this = _super.call(this); + _this.tools = []; + _this.title = /*#__PURE__*/React__default.createElement(waxProsemirrorComponents.LeftMenuTitle, { + title: "Text" + }); + _this.tools = [paragraph, paragraphContinued, extractProse, extractPoetry, sourceNote, blockQuote]; + return _this; + } + + Text = inversify.inject("BlockQuote")(Text, undefined, 5) || Text; + Text = inversify.inject("SourceNote")(Text, undefined, 4) || Text; + Text = inversify.inject("ExtractPoetry")(Text, undefined, 3) || Text; + Text = inversify.inject("ExtractProse")(Text, undefined, 2) || Text; + Text = inversify.inject("ParagraphContinued")(Text, undefined, 1) || Text; + Text = inversify.inject("Paragraph")(Text, undefined, 0) || Text; + return Text; +}(ToolGroup), _temp$O)) || _class$Q); + +var TextToolGroupService = /*#__PURE__*/function (_Service) { + _inherits(TextToolGroupService, _Service); + + var _super = _createSuper(TextToolGroupService); + + function TextToolGroupService() { + _classCallCheck(this, TextToolGroupService); + + return _super.apply(this, arguments); + } + + _createClass(TextToolGroupService, [{ + key: "register", + value: function register() { + this.container.bind('Text').to(Text); + } + }]); + + return TextToolGroupService; +}(Service); + +var _dec$R, _class$R, _temp$P; +var Notes = (_dec$R = inversify.injectable(), _dec$R(_class$R = (_temp$P = /*#__PURE__*/function (_ToolGroup) { + _inherits(Notes, _ToolGroup); + + var _super = _createSuper(Notes); + + function Notes(note) { + var _this; + + _classCallCheck(this, Notes); + + _this = _super.call(this); + _this.tools = []; + _this.tools = [note]; + return _this; + } + + Notes = inversify.inject("Note")(Notes, undefined, 0) || Notes; + return Notes; +}(ToolGroup), _temp$P)) || _class$R); + +var NoteToolGroupService = /*#__PURE__*/function (_Service) { + _inherits(NoteToolGroupService, _Service); + + var _super = _createSuper(NoteToolGroupService); + + function NoteToolGroupService() { + _classCallCheck(this, NoteToolGroupService); + + return _super.apply(this, arguments); + } + + _createClass(NoteToolGroupService, [{ + key: "register", + value: function register() { + this.container.bind('Notes').to(Notes); + } + }]); + + return NoteToolGroupService; +}(Service); + +var _dec$S, _class$S, _temp$Q; +var CodeBlock = (_dec$S = inversify.injectable(), _dec$S(_class$S = (_temp$Q = /*#__PURE__*/function (_ToolGroup) { + _inherits(CodeBlock, _ToolGroup); + + var _super = _createSuper(CodeBlock); + + function CodeBlock(codeblock) { + var _this; + + _classCallCheck(this, CodeBlock); + + _this = _super.call(this); + _this.tools = []; + _this.tools = [codeblock]; + return _this; + } + + CodeBlock = inversify.inject('CodeBlockTool')(CodeBlock, undefined, 0) || CodeBlock; + return CodeBlock; +}(ToolGroup), _temp$Q)) || _class$S); + +var CodeBlockToolGroupService = /*#__PURE__*/function (_Service) { + _inherits(CodeBlockToolGroupService, _Service); + + var _super = _createSuper(CodeBlockToolGroupService); + + function CodeBlockToolGroupService() { + _classCallCheck(this, CodeBlockToolGroupService); + + return _super.apply(this, arguments); + } + + _createClass(CodeBlockToolGroupService, [{ + key: "register", + value: function register() { + this.container.bind('CodeBlock').to(CodeBlock); + } + }]); + + return CodeBlockToolGroupService; +}(Service); + +var _dec$T, _class$T, _temp$R; +var TrackChange = (_dec$T = inversify.injectable(), _dec$T(_class$T = (_temp$R = /*#__PURE__*/function (_ToolGroup) { + _inherits(TrackChange, _ToolGroup); + + var _super = _createSuper(TrackChange); + + function TrackChange(enableTrackChange, acceptTrackChange, rejectTrackChange) { + var _this; + + _classCallCheck(this, TrackChange); + + _this = _super.call(this); + _this.tools = []; + _this.tools = [enableTrackChange, acceptTrackChange, rejectTrackChange]; + return _this; + } + + TrackChange = inversify.inject('RejectTrackChange')(TrackChange, undefined, 2) || TrackChange; + TrackChange = inversify.inject('AcceptTrackChange')(TrackChange, undefined, 1) || TrackChange; + TrackChange = inversify.inject('EnableTrackChange')(TrackChange, undefined, 0) || TrackChange; + return TrackChange; +}(ToolGroup), _temp$R)) || _class$T); + +var TrackChangeToolGroupService = /*#__PURE__*/function (_Service) { + _inherits(TrackChangeToolGroupService, _Service); + + var _super = _createSuper(TrackChangeToolGroupService); + + function TrackChangeToolGroupService() { + _classCallCheck(this, TrackChangeToolGroupService); + + return _super.apply(this, arguments); + } + + _createClass(TrackChangeToolGroupService, [{ + key: "register", + value: function register() { + this.container.bind('TrackChange').to(TrackChange); + } + }]); + + return TrackChangeToolGroupService; +}(Service); + +exports.AnnotationToolGroupService = AnnotationToolGroupService; +exports.BaseService = BaseService; +exports.BaseToolGroupService = BaseToolGroupService; +exports.CodeBlockService = CodeBlockService; +exports.CodeBlockToolGroupService = CodeBlockToolGroupService; +exports.CommentsService = CommentsService; +exports.DisplayBlockLevelService = DisplayBlockLevelService; +exports.DisplayToolGroupService = DisplayToolGroupService; +exports.ImageService = ImageService; +exports.ImageToolGroupService = ImageToolGroupService; +exports.InlineAnnotationsService = InlineAnnotationsService; +exports.LayoutService = LayoutService; +exports.LinkService = LinkService; +exports.ListToolGroupService = ListToolGroupService; +exports.ListsService = ListsService; +exports.MenuService = MenuService; +exports.NoteService = NoteService; +exports.NoteToolGroupService = NoteToolGroupService; +exports.OverlayService = OverlayService; +exports.PlaceholderService = PlaceholderService; +exports.RulesService = RulesService; +exports.SchemaService = SchemaService; +exports.Service = Service; +exports.ShortCutsService = ShortCutsService; +exports.TableToolGroupService = TableToolGroupService; +exports.TablesService = TablesService; +exports.TextBlockLevelService = TextBlockLevelService; +exports.TextToolGroupService = TextToolGroupService; +exports.Tool = Tools; +exports.TrackChangeService = TrackChangeService; +exports.TrackChangeToolGroupService = TrackChangeToolGroupService; +exports.componentPlugin = ComponentPlugin; +exports.trackedTransaction = trackedTransaction; +//# sourceMappingURL=index.js.map diff --git a/wax-prosemirror-services/dist/index.js.map b/wax-prosemirror-services/dist/index.js.map new file mode 100644 index 000000000..3f5446982 --- /dev/null +++ b/wax-prosemirror-services/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/classCallCheck.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/createClass.js","../src/Service.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/inherits.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/typeof.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/createSuper.js","../src/LayoutService/components/componentPlugin.js","../src/LayoutService/DefaultLayout/DefaultLayout.js","../src/LayoutService/components/LayoutFactory.js","../src/LayoutService/Layout.js","../src/LayoutService/LayoutService.js","../src/lib/ToolGroup.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js","../src/MenuService/MenuWrapper.js","../src/MenuService/Menu.js","../src/MenuService/MenuCollection.js","../src/MenuService/MenuService.js","../src/lib/Tools.js","../src/LinkService/LinkTool.js","../src/LinkService/LinkService.js","../src/PlaceholderService/pmPlugins/placeholderPlugin.js","../src/PlaceholderService/PlaceholderService.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectSpread2.js","../src/OverlayService/usePosition.js","../src/OverlayService/OverlayComponent.js","../src/OverlayService/OverlayService.js","../src/ImageService/fileUpload.js","../src/ImageService/Image.js","../src/ImageService/ImageService.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/iterableToArray.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js","../src/RulesService/Rules.js","../src/RulesService/RulesService.js","../src/SchemaService/DefaultSchema.js","../src/lib/Middleware.js","../src/SchemaService/ParseRule.js","../src/SchemaService/Node.js","../src/SchemaService/Mark.js","../src/SchemaService/Schema.js","../src/SchemaService/SchemaService.js","../src/ShortCutsService/ShortCuts.js","../src/ShortCutsService/ShortCutsService.js","../src/TrackChangeService/EnableTrackChangeService/EnableTrackChange.js","../src/TrackChangeService/EnableTrackChangeService/EnableTrackChangeService.js","../src/TrackChangeService/track-changes/helpers/removeNode.js","../src/TrackChangeService/AcceptTrackChangeService/AcceptTrackChange.js","../src/TrackChangeService/AcceptTrackChangeService/AcceptTrackChangeService.js","../src/TrackChangeService/RejectTrackChangeService/RejectTrackChange.js","../src/TrackChangeService/RejectTrackChangeService/RejectTrackChangeService.js","../src/TrackChangeService/index.js","../src/TrackChangeService/TrackChangeService.js","../src/TrackChangeService/track-changes/helpers/markDeletion.js","../src/TrackChangeService/track-changes/helpers/markInsertion.js","../src/TrackChangeService/track-changes/helpers/replaceStep.js","../src/TrackChangeService/track-changes/helpers/markWrapping.js","../src/TrackChangeService/track-changes/helpers/replaceAroundStep.js","../src/TrackChangeService/track-changes/helpers/addMarkStep.js","../src/TrackChangeService/track-changes/helpers/removeMarkStep.js","../src/TrackChangeService/track-changes/trackedTransaction.js","../src/BaseService/UndoService/Undo.js","../src/BaseService/UndoService/UndoService.js","../src/BaseService/RedoService/Redo.js","../src/BaseService/RedoService/RedoService.js","../src/BaseService/SaveService/Save.js","../src/BaseService/index.js","../src/BaseService/BaseService.js","../src/InlineAnnotations/CodeService/Code.js","../src/InlineAnnotations/CodeService/CodeService.js","../src/InlineAnnotations/StrongService/Strong.js","../src/InlineAnnotations/StrongService/StrongService.js","../src/InlineAnnotations/EmphasisService/Emphasis.js","../src/InlineAnnotations/EmphasisService/EmphasisService.js","../src/InlineAnnotations/SubscriptService/Subscript.js","../src/InlineAnnotations/SubscriptService/SubscriptService.js","../src/InlineAnnotations/SuperscriptService/Superscript.js","../src/InlineAnnotations/SuperscriptService/SuperscriptService.js","../src/InlineAnnotations/StrikeThroughService/StrikeThrough.js","../src/InlineAnnotations/StrikeThroughService/StrikeThroughService.js","../src/InlineAnnotations/UnderlineService/Underline.js","../src/InlineAnnotations/UnderlineService/UnderlineService.js","../src/InlineAnnotations/SmallCapsService/SmallCaps.js","../src/InlineAnnotations/SmallCapsService/SmallCapsService.js","../src/InlineAnnotations/index.js","../src/InlineAnnotations/InlineAnnotationsService.js","../src/ListsService/BulletListService/BulletList.js","../src/ListsService/BulletListService/BulletListService.js","../src/ListsService/OrderedListService/OrderedList.js","../src/ListsService/OrderedListService/OrderedListService.js","../src/ListsService/JoinUpService/JoinUp.js","../src/ListsService/JoinUpService/JoinUpService.js","../src/ListsService/LiftService/Lift.js","../src/ListsService/LiftService/LiftService.js","../src/ListsService/ListItemService/ListItemService.js","../src/ListsService/index.js","../src/ListsService/ListsService.js","../src/TablesService/InsertTableService/Table.js","../src/TablesService/InsertTableService/InsertTableService.js","../src/TablesService/EditTableService/TableDropDownOptions.js","../src/TablesService/EditTableService/EditTableService.js","../src/TablesService/index.js","../src/TablesService/TablesService.js","../src/TextBlockLevel/ExtractPoetryService/ExtractPoetry.js","../src/TextBlockLevel/ExtractPoetryService/ExtractPoetryService.js","../src/TextBlockLevel/ExtractProseService/ExtractProse.js","../src/TextBlockLevel/ExtractProseService/ExtractProseService.js","../src/TextBlockLevel/ParagraphContinuedService/ParagraphContinued.js","../src/TextBlockLevel/ParagraphContinuedService/ParagraphContinuedService.js","../src/TextBlockLevel/ParagraphService/Paragraph.js","../src/TextBlockLevel/ParagraphService/ParagraphService.js","../src/TextBlockLevel/SourceNoteService/SourceNote.js","../src/TextBlockLevel/SourceNoteService/SourceNoteService.js","../src/TextBlockLevel/BlockQuoteService/BlockQuote.js","../src/TextBlockLevel/BlockQuoteService/BlockQuoteService.js","../src/TextBlockLevel/index.js","../src/TextBlockLevel/TextBlockLevelService.js","../src/DisplayBlockLevel/AuthorService/Author.js","../src/DisplayBlockLevel/AuthorService/AuthorService.js","../src/DisplayBlockLevel/EpigraphPoetryService/EpigraphPoetry.js","../src/DisplayBlockLevel/EpigraphPoetryService/EpigraphPoetryService.js","../src/DisplayBlockLevel/EpigraphProseService/EpigraphProse.js","../src/DisplayBlockLevel/EpigraphProseService/EpigraphProseService.js","../src/DisplayBlockLevel/HeadingService/Heading1.js","../src/DisplayBlockLevel/HeadingService/Heading2.js","../src/DisplayBlockLevel/HeadingService/Heading3.js","../src/DisplayBlockLevel/HeadingService/HeadingService.js","../src/DisplayBlockLevel/SubTitleService/SubTitle.js","../src/DisplayBlockLevel/SubTitleService/SubTitleService.js","../src/DisplayBlockLevel/TitleService/Title.js","../src/DisplayBlockLevel/TitleService/TitleService.js","../src/DisplayBlockLevel/index.js","../src/DisplayBlockLevel/DisplayBlockLevelService.js","../src/NoteService/Note.js","../src/NoteService/helpers/TransformPasted.js","../src/NoteService/Editor.js","../src/NoteService/NoteEditor.js","../src/NoteService/NoteComponent.js","../src/NoteService/NoteService.js","../src/CommentsService/CommentsService.js","../src/CodeBlockService/CodeBlockTool.js","../src/CodeBlockService/CodeBlockService.js","../src/WaxToolGroups/BaseToolGroupService/Base.js","../src/WaxToolGroups/BaseToolGroupService/BaseToolGroupService.js","../src/WaxToolGroups/AnnotationToolGroupService/Annotations.js","../src/WaxToolGroups/AnnotationToolGroupService/AnnotationToolGroupService.js","../src/WaxToolGroups/ListToolGroupService/Lists.js","../src/WaxToolGroups/ListToolGroupService/ListToolGroupService.js","../src/WaxToolGroups/ImageToolGroupService/Images.js","../src/WaxToolGroups/ImageToolGroupService/ImageToolGroupService.js","../src/WaxToolGroups/TableToolGroupService/Tables.js","../src/WaxToolGroups/TableToolGroupService/TableToolGroupService.js","../src/WaxToolGroups/DisplayToolGroupService/Display.js","../src/WaxToolGroups/DisplayToolGroupService/DisplayToolGroupService.js","../src/WaxToolGroups/TextToolGroupService/Text.js","../src/WaxToolGroups/TextToolGroupService/TextToolGroupService.js","../src/WaxToolGroups/NoteToolGroupService/Notes.js","../src/WaxToolGroups/NoteToolGroupService/NoteToolGroupService.js","../src/WaxToolGroups/CodeBlockToolGroupService/CodeBlock.js","../src/WaxToolGroups/CodeBlockToolGroupService/CodeBlockToolGroupService.js","../src/WaxToolGroups/TrackChangeToolGroupService/TrackChange.js","../src/WaxToolGroups/TrackChangeToolGroupService/TrackChangeToolGroupService.js"],"sourcesContent":["export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","class Service {\n setApp(app) {\n this.app = app;\n }\n\n get container() {\n return this.app.container;\n }\n\n get config() {\n return this.app.config.get(`config.${this.name}`) || this.app.config;\n }\n\n get schema() {\n return this.app.getSchema();\n }\n}\n\nexport default Service;\n","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","export default function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","import _typeof from \"../../helpers/esm/typeof\";\nimport assertThisInitialized from \"./assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","import getPrototypeOf from \"./getPrototypeOf\";\nimport isNativeReflectConstruct from \"./isNativeReflectConstruct\";\nimport possibleConstructorReturn from \"./possibleConstructorReturn\";\nexport default function _createSuper(Derived) {\n return function () {\n var Super = getPrototypeOf(Derived),\n result;\n\n if (isNativeReflectConstruct()) {\n var NewTarget = getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return possibleConstructorReturn(this, result);\n };\n}","import React, { Component } from \"react\";\nimport { useInjection } from \"wax-prosemirror-core\";\n\nclass UpdateView extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n view: this.props.view\n };\n }\n\n updateView(view) {\n this.setState(view);\n }\n\n render() {\n return this.props.children({ view: this.state.view });\n }\n}\n\nconst ComponentPlugin = renderArea => layoutProps => {\n const { instance } = useInjection(\"Layout\");\n\n const components = instance.render(renderArea);\n\n return components\n ? components.map(({ component: Component, componentProps }, key) => {\n return (\n <Component\n key={`${renderArea}-${key}`}\n {...layoutProps}\n {...componentProps}\n />\n );\n })\n : null;\n};\nexport default ComponentPlugin;\n","import React from 'react'\n\nconst DefaultLayout = ({ editor }) => <>{editor}</>\n\nexport default DefaultLayout\n","import React from \"react\";\n\nexport default Component => props => <Component {...props} />;\n","import { injectable } from \"inversify\";\nimport DefaultLayout from \"./DefaultLayout/DefaultLayout\";\nimport LayoutFactory from \"./components/LayoutFactory\";\n\n@injectable()\nexport default class Layout {\n components = [];\n layoutComponent = LayoutFactory(DefaultLayout);\n addComponent(renderArea, component, componentProps) {\n if (!this.components[renderArea]) {\n this.createArea(renderArea);\n }\n const size = this.components[renderArea].size;\n this.components[renderArea].set(size + 1, { component, componentProps });\n return this;\n }\n\n render(renderArea) {\n if (!this.components[renderArea]) return null;\n return this.getArray(this.components[renderArea]);\n }\n\n createArea(area) {\n this.components[area] = new Map();\n }\n\n getArray(iterator) {\n const components = [];\n iterator.forEach(component => components.push(component));\n return components;\n }\n\n setLayout(component) {\n this.layoutComponent = LayoutFactory(component);\n }\n}\n","import Service from \"../Service\";\nimport Layout from \"./Layout\";\n\nexport default class LayoutService extends Service {\n name = \"LayoutService\";\n\n register() {\n this.container\n .bind(\"Layout\")\n .to(Layout)\n .inSingletonScope();\n }\n}\n","import React, { useState } from \"react\";\nimport { injectable } from \"inversify\";\nimport { ToolGroupComponent } from \"wax-prosemirror-components\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n@injectable()\nexport default class ToolGroup {\n _config = {};\n title = \"\";\n _tools = [];\n constructor() {}\n setGroupConfig(config) {\n this._config = config;\n }\n\n excludeIncludeTools() {\n const { exclude = [], include = [] } = this._config;\n\n if (include.length > 0) {\n this._tools.map(tool => {\n if (include.includes(tool.constructor.name)) {\n tool.displayTool();\n } else {\n tool.hideTool();\n }\n });\n } else {\n this._tools.map(tool => {\n if (exclude.includes(tool.constructor.name)) {\n tool.hideTool();\n }\n });\n }\n }\n\n addToolIntoMore() {\n const { more = [] } = this._config;\n if (more.length > 0) {\n this._tools.map(tool => {\n if (more.includes(tool.constructor.name)) {\n tool.hideInToolGroup();\n } else {\n tool.displayInToolGroup();\n }\n });\n }\n }\n\n set tools(tools) {\n this._tools = tools;\n }\n\n renderTools(view) {\n const { name } = this.constructor;\n return (\n <ToolGroupComponent\n key={uuidv4()}\n view={view}\n tools={this._tools}\n title={this.title}\n name={name}\n />\n );\n }\n}\n","export default function _taggedTemplateLiteral(strings, raw) {\n if (!raw) {\n raw = strings.slice(0);\n }\n\n return Object.freeze(Object.defineProperties(strings, {\n raw: {\n value: Object.freeze(raw)\n }\n }));\n}","import React from \"react\";\nimport styled from \"styled-components\";\n\nimport { map } from \"lodash\";\n\nconst MainMenu = styled.div`\n background: #fff;\n padding: 2px 2px 2px 0;\n position: relative;\n background: transparent;\n`;\n\nconst MainMenuBar = ({ items = [], view }) => {\n return (\n <MainMenu key=\"MainMenu\">\n {map(items, item => item.renderTools(view))}\n </MainMenu>\n );\n};\n\nexport default MainMenuBar;\n","import React, { useMemo, useContext } from 'react';\nimport { injectable } from 'inversify';\nimport { WaxContext } from 'wax-prosemirror-core';\nimport ToolGroup from '../lib/ToolGroup';\nimport MenuWrapper from './MenuWrapper';\n\n@injectable()\nclass Menu {\n toolGroups = [];\n config = {};\n name = '';\n constructor(config, createTools) {\n this.name = config.name;\n this.config = config;\n this.toolGroups = createTools(this.config.toolGroups);\n this.excludeIncludeTools();\n this.addToolIntoMore();\n }\n\n excludeIncludeTools() {\n this.toolGroups.forEach(toolGroup => {\n if (toolGroup instanceof ToolGroup) {\n toolGroup.excludeIncludeTools();\n }\n });\n }\n\n addToolIntoMore() {\n this.toolGroups.forEach(toolGroup => {\n if (toolGroup instanceof ToolGroup) {\n toolGroup.addToolIntoMore();\n }\n });\n }\n\n render() {\n return () => {\n const {\n view: { main },\n activeView,\n } = useContext(WaxContext);\n const Bar = useMemo(() => (\n <MenuWrapper items={this.toolGroups} view={activeView || {}} />\n ));\n return <>{Bar}</>;\n };\n }\n}\n\nexport default Menu;\n","import { injectable, multiInject } from 'inversify';\n\n@injectable()\nclass MenuCollection {\n menus = [];\n constructor(@multiInject('Menu') menus) {\n this.menus = menus;\n }\n\n getMenu(name) {\n return this.menus.find(menu => menu.name === name);\n }\n}\n\nexport default MenuCollection;\n","import { isPlainObject, isFunction } from 'lodash';\nimport Service from '../Service';\nimport Menu from './Menu';\nimport MenuCollection from './MenuCollection';\n\nclass MenuService extends Service {\n name = 'MenuService';\n boot() {\n const { menus } = this.container.get('MenuCollection');\n const layout = this.container.get('Layout');\n menus.forEach(menu => {\n layout.addComponent(menu.config.templateArea, menu.render());\n });\n }\n\n register() {\n /* create Menu Factory */\n this.config.map(conf => {\n this.container.bind('Menu').toFactory(context => {\n return new Menu(conf, context.container.get('createTools'));\n });\n });\n\n /*create MenuCollection of Menus */\n this.container.bind('MenuCollection').to(MenuCollection).inSingletonScope();\n\n /* create factory of tools */\n this.container.bind('createTools').toFactory(context => {\n return configTools => {\n const tools = [];\n configTools.forEach(tool => {\n try {\n let tl = {};\n if (isPlainObject(tool)) {\n tl = context.container.get(tool.name);\n tl.setGroupConfig(tool);\n } else if (isFunction(tool)) {\n tl = context.container.get(tool());\n } else {\n tl = context.container.get(tool);\n }\n tools.push(tl);\n } catch (error) {\n throw Error(\n `Could not load Service ${tool.name}. Please configure service through config`,\n );\n }\n });\n return tools;\n };\n });\n }\n}\nexport default MenuService;\n","import React from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport { isEmpty } from 'lodash';\nimport { injectable, inject } from 'inversify';\nimport { Button } from 'wax-prosemirror-components';\n\n@injectable()\nclass Tools {\n title = 'title';\n content = 'content';\n _isDisplayed = true;\n _isHiddenInToolGroup = false;\n onlyOnMain = false;\n config = {};\n pmplugins = {};\n\n constructor(@inject('Config') config, @inject('PmPlugins') pmplugins) {\n this.config = config;\n this.pmplugins = pmplugins;\n }\n\n get run() {\n return true;\n }\n\n get enable() {\n return () => true;\n }\n\n select() {\n return () => true;\n }\n\n get active() {\n return () => false;\n }\n\n toJSON() {\n return {\n title: this.title,\n content: this.content,\n active: this.active,\n run: this.run,\n enable: this.enable,\n select: this.select,\n onlyOnMain: this.onlyOnMain,\n };\n }\n\n renderTool(view) {\n if (isEmpty(view)) return null;\n\n return this._isDisplayed ? (\n <Button key={uuidv4()} item={this.toJSON()} view={view} />\n ) : null;\n }\n\n displayTool() {\n this._isDisplayed = true;\n }\n\n hideTool() {\n this._isDisplayed = false;\n }\n\n isDisplayed() {\n return this._isDisplayed;\n }\n\n displayInToolGroup() {\n this._isHiddenInToolGroup = false;\n }\n\n hideInToolGroup() {\n this._isHiddenInToolGroup = true;\n }\n\n isIntoMoreSection() {\n return this._isHiddenInToolGroup;\n }\n}\nexport default Tools;\n","import { injectable } from \"inversify\";\nimport { toggleMark } from \"prosemirror-commands\";\nimport { Commands } from \"wax-prosemirror-utilities\";\nimport Tools from \"../lib/Tools\";\nimport { icons } from \"wax-prosemirror-components\";\n\n@injectable()\nexport default class LinkTool extends Tools {\n title = \"Add or remove link\";\n content = icons.link;\n\n get run() {\n return (state, dispatch) => {\n if (Commands.markActive(state.config.schema.marks.link)(state)) {\n toggleMark(state.config.schema.marks.link)(state, dispatch);\n return true;\n }\n Commands.createLink(state, dispatch);\n };\n }\n\n get enable() {\n return state => {\n return Commands.isOnSameTextBlock(state);\n };\n }\n\n get active() {\n return state => {\n return Commands.markActive(state.config.schema.marks.link)(state);\n };\n }\n}\n","import Service from '../Service';\nimport { LinkComponent } from 'wax-prosemirror-components';\nimport { linkMark } from 'wax-prosemirror-schema';\nimport LinkTool from './LinkTool';\n// import { OverlayService } from '../..';\n\nexport default class LinkService extends Service {\n name = 'LinkService';\n\n boot() {\n const createOverlay = this.container.get('CreateOverlay');\n createOverlay(\n LinkComponent,\n {},\n {\n markType: 'link',\n followCursor: false,\n selection: false,\n },\n );\n }\n\n register() {\n this.container.bind('Link').to(LinkTool);\n const createMark = this.container.get('CreateMark');\n createMark(\n {\n link: linkMark,\n },\n { toWaxSchema: true },\n );\n }\n\n // dependencies = [new OverlayService()];\n}\n","import { Plugin, PluginKey } from \"prosemirror-state\";\nimport { Decoration, DecorationSet } from \"prosemirror-view\";\n\nexport default key =>\n new Plugin({\n key: new PluginKey(key),\n state: {\n init: function init() {\n return DecorationSet.empty;\n },\n apply: function apply(tr, set) {\n // Adjust decoration positions to changes made by the transaction\n set = set.map(tr.mapping, tr.doc);\n // See if the transaction adds or removes any placeholders\n const action = tr.getMeta(this);\n if (action && action.add) {\n const widget = document.createElement(\"placeholder\");\n const deco = Decoration.widget(action.add.pos, widget, {\n id: action.add.id\n });\n set = set.add(tr.doc, [deco]);\n } else if (action && action.remove) {\n set = set.remove(\n set.find(null, null, spec => spec.id === action.remove.id)\n );\n }\n return set;\n }\n },\n props: {\n decorations: function decorations(state) {\n return this.getState(state);\n }\n }\n });\n","import Service from \"../Service\";\nimport placeholderPlugin from \"./pmPlugins/placeholderPlugin\";\nconst PLUGIN_KEY = \"imagePlaceHolder\";\n\nexport default class PlaceholderService extends Service {\n name = \"PlaceholderService\";\n\n boot() {\n this.app.PmPlugins.add(PLUGIN_KEY, placeholderPlugin(PLUGIN_KEY));\n }\n}\n","export default function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}","export default function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}","import arrayLikeToArray from \"./arrayLikeToArray\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import arrayWithHoles from \"./arrayWithHoles\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray\";\nimport nonIterableRest from \"./nonIterableRest\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import defineProperty from \"./defineProperty\";\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nexport default function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}","import { useState, useContext, useLayoutEffect, useCallback } from \"react\";\nimport { isObject } from \"lodash\";\nimport { WaxContext } from \"wax-prosemirror-core\";\nimport { DocumentHelpers } from \"wax-prosemirror-utilities\";\n\nconst defaultOverlay = {\n left: null,\n top: null,\n from: null,\n to: null,\n mark: null\n};\n\nexport default options => {\n const { view: { main }, activeView } = useContext(WaxContext);\n\n const [position, setPosition] = useState({\n position: \"absolute\",\n ...defaultOverlay\n });\n\n let mark = {};\n\n /* Sets Default position at the end of the annotation. You\n can overwrite the default position in your component.\n Check: wax-prosemirror-components/src/components/comments/CommentBubbleComponent.js\n for reposition the create new comment component.\n */\n const calculatePosition = (activeView, from, to) => {\n const WaxSurface = activeView.dom.getBoundingClientRect();\n const start = activeView.coordsAtPos(from);\n const end = activeView.coordsAtPos(to);\n const left = end.left;\n const top = end.top + 20;\n return {\n top,\n left\n };\n };\n\n const displayOnSelection = (activeView, options) => {\n const { selection } = activeView.state;\n const { from, to } = selection;\n if (from === to) return defaultOverlay;\n const { left, top } = calculatePosition(activeView, from, to);\n return {\n left,\n top,\n from,\n to,\n selection\n };\n };\n\n const displayOnMark = (activeView, options) => {\n const { markType, followCursor } = options;\n const PMmark = activeView.state.schema.marks[markType];\n mark = DocumentHelpers.getSelectionMark(activeView.state, PMmark);\n\n if (!isObject(mark)) return defaultOverlay;\n const { from, to } = followCursor ? activeView.state.selection : mark;\n\n const { left, top } = calculatePosition(activeView, from, to);\n\n return {\n left,\n top,\n from,\n to,\n mark\n };\n };\n\n const updatePosition = useCallback((followCursor = true) => {\n if (Object.keys(activeView).length === 0) return defaultOverlay;\n\n const { markType, selection } = options;\n\n if (selection) return displayOnSelection(activeView, options);\n\n return displayOnMark(activeView, options);\n });\n\n useLayoutEffect(\n () => {\n setPosition({\n position: \"absolute\",\n ...updatePosition(options.followCursor)\n });\n },\n [JSON.stringify(updatePosition(options.followCursor))]\n );\n\n return [position, setPosition, mark];\n};\n","import React, { useMemo } from \"react\";\nimport usePosition from \"./usePosition\";\nimport { Overlay } from \"wax-prosemirror-components\";\n\nexport default (Component, markType) => props => {\n const [position, setPosition, mark] = usePosition(markType);\n const component = useMemo(\n () => (\n <Component\n setPosition={setPosition}\n mark={mark}\n position={position}\n {...props}\n />\n ),\n [JSON.stringify(mark), position]\n );\n const visible = position.left ? true : false;\n\n return <Overlay position={position}>{visible && component}</Overlay>;\n};\n","import Service from \"../Service\";\nimport OverlayComponent from \"./OverlayComponent\";\n\nexport default class OverlayService extends Service {\n boot() {}\n\n register() {\n this.container.bind(\"CreateOverlay\").toFactory(context => {\n return (Component, componentProps, options) => {\n const layout = context.container.get(\"Layout\");\n layout.addComponent(\n \"waxOverlays\",\n OverlayComponent(Component, options),\n componentProps\n );\n };\n });\n }\n}\n","const findPlaceholder = (state, id, placeholderPlugin) => {\n const decos = placeholderPlugin.getState(state);\n const found = decos.find(null, null, spec => spec.id === id);\n return found.length ? found[0].from : null;\n};\n\nexport default (view, fileUpload, placeholderPlugin) => file => {\n const { state } = view;\n\n // A fresh object to act as the ID for this upload\n const id = {};\n\n // Replace the selection with a placeholder\n const { tr } = state;\n if (!tr.selection.empty) tr.deleteSelection();\n\n tr.setMeta(placeholderPlugin, {\n add: { id, pos: tr.selection.from }\n });\n\n view.dispatch(tr);\n fileUpload(file).then(\n url => {\n const pos = findPlaceholder(view.state, id, placeholderPlugin);\n // If the content around the placeholder has been deleted, drop\n // the image\n if (pos == null) {\n return;\n }\n // Otherwise, insert it at the placeholder's position, and remove\n // the placeholder\n view.dispatch(\n state.tr\n .replaceWith(\n pos,\n pos,\n view.state.schema.nodes.image.create({\n src: url\n })\n )\n .setMeta(placeholderPlugin, { remove: { id } })\n );\n },\n () => {\n // On failure, just clean up the placeholder\n view.dispatch(tr.setMeta(placeholderPlugin, { remove: { id } }));\n }\n );\n};\n","import React from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport { isEmpty } from 'lodash';\nimport { injectable } from 'inversify';\nimport { icons, ImageUpload } from 'wax-prosemirror-components';\nimport { Commands } from 'wax-prosemirror-utilities';\nimport Tools from '../lib/Tools';\nimport fileUpload from './fileUpload';\n\nexport default\n@injectable()\nclass Image extends Tools {\n title = 'Insert image';\n content = icons.image;\n\n get run() {\n return () => true;\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return Commands.canInsert(state.config.schema.nodes.image)(state);\n };\n }\n\n renderTool(view) {\n if (isEmpty(view)) return null;\n const upload = fileUpload(\n view,\n this.config.get('fileUpload'),\n this.pmplugins.get('imagePlaceHolder'),\n );\n return this._isDisplayed ? (\n <ImageUpload\n key={uuidv4()}\n item={this.toJSON()}\n fileUpload={upload}\n view={view}\n />\n ) : null;\n }\n}\n","import { imageNode } from 'wax-prosemirror-schema';\nimport Service from '../Service';\nimport Image from './Image';\n\nexport default class ImageService extends Service {\n name = 'ImageService';\n\n register() {\n this.container.bind('Image').to(Image);\n const createNode = this.container.get('CreateNode');\n createNode(\n {\n image: imageNode,\n },\n { toWaxSchema: true },\n );\n }\n}\n","import arrayLikeToArray from \"./arrayLikeToArray\";\nexport default function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}","export default function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import arrayWithoutHoles from \"./arrayWithoutHoles\";\nimport iterableToArray from \"./iterableToArray\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray\";\nimport nonIterableSpread from \"./nonIterableSpread\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}","import { injectable } from \"inversify\";\nimport {\n inputRules,\n wrappingInputRule,\n textblockTypeInputRule,\n smartQuotes\n} from \"prosemirror-inputrules\";\n\n@injectable()\nclass Rules {\n constructor(plugins, schema) {\n this.PmPlugins = plugins;\n\n this.schema = schema;\n this.extendedRules = this.allRules();\n }\n\n addRule(rules) {\n this.extendedRules.push(...rules);\n }\n\n createRules() {\n const rulesCreated = inputRules({ rules: this.extendedRules });\n this.PmPlugins.add(\"rules\", rulesCreated);\n }\n\n allRules() {\n return [\n ...smartQuotes,\n // > blockquote\n wrappingInputRule(/^\\s*>\\s$/, this.schema.nodes.blockquote),\n\n // 1. ordered list\n wrappingInputRule(\n /^(\\d+)\\.\\s$/,\n this.schema.nodes.orderedlist,\n match => ({ order: +match[1] }),\n (match, node) => node.childCount + node.attrs.order === +match[1]\n ),\n\n // * bullet list\n wrappingInputRule(/^\\s*([-+*])\\s$/, this.schema.nodes.bulletlist),\n\n // ``` code block\n // textblockTypeInputRule(/^```$/, this.schema.nodes.code_block),\n\n // # heading\n textblockTypeInputRule(\n new RegExp(\"^(#{1,6})\\\\s$\"),\n this.schema.nodes.heading,\n match => ({ level: match[1].length })\n )\n ];\n }\n}\n\nexport default Rules;\n","import Service from '../Service';\nimport Rules from './Rules';\n\nexport default class RulesService extends Service {\n name = 'RulesService';\n\n boot() {\n const configRules = this.config;\n const rules = this.container.get('Rules');\n rules.addRule(configRules);\n rules.createRules();\n }\n\n register() {\n const { PmPlugins } = this.app;\n\n this.container\n .bind('Rules')\n .toDynamicValue(() => {\n const {\n schema: { schema },\n } = this.app;\n\n return new Rules(PmPlugins, schema);\n })\n .inSingletonScope();\n }\n}\n","import { SchemaHelpers } from \"wax-prosemirror-utilities\";\n\nexport default {\n nodes: {\n doc: {\n content: \"block+\"\n },\n text: {\n group: \"inline\"\n },\n hard_break: {\n inline: true,\n group: \"inline\",\n selectable: false,\n parseDOM: [{ tag: \"br\" }],\n toDOM() {\n return [\"br\"];\n }\n },\n paragraph: {\n group: \"block\",\n content: \"inline*\",\n attrs: {\n id: { default: \"\" },\n class: { default: \"paragraph\" },\n track: { default: [] },\n group: { default: \"\" }\n },\n parseDOM: [\n {\n tag: \"p.paragraph\",\n getAttrs(dom) {\n return {\n id: dom.dataset.id,\n class: dom.getAttribute(\"class\"),\n track: SchemaHelpers.parseTracks(dom.dataset.track),\n group: dom.dataset.group\n };\n }\n }\n ],\n toDOM(node) {\n const attrs = SchemaHelpers.blockLevelToDOM(node);\n return [\"p\", attrs, 0];\n }\n }\n },\n marks: {}\n};\n","export default class Middleware {\n constructor() {\n // Array prototype last\n if (!Array.prototype.last) {\n Array.prototype.last = function() {\n return this[this.length - 1];\n };\n }\n\n // Array prototype reduceOneRight\n if (!Array.prototype.reduceOneRight) {\n Array.prototype.reduceOneRight = function() {\n return this.slice(0, -1);\n };\n }\n }\n\n use(fn) {\n this.go = (stack => (...args) =>\n stack(...args.reduceOneRight(), () => {\n let _next = args.last();\n fn.apply(this, [\n ...args.reduceOneRight(),\n _next.bind.apply(_next, [null, ...args.reduceOneRight()])\n ]);\n }))(this.go);\n }\n\n go(...args) {\n let _next = args.last();\n _next.apply(this, args.reduceOneRight());\n }\n}\n","import { omit } from \"lodash\";\nimport Middleware from \"../lib/Middleware\";\n\nexport default class ParseRule {\n tag = null;\n style = null;\n exporter = null;\n defaultMiddleware = (hook, next) => {\n hook = {};\n next();\n };\n\n constructor({ getAttrs, tag, style }) {\n this.tag = tag;\n this.style = style;\n // if (getAttrs) {\n this.exporter = new Middleware();\n // }\n this.addStack(getAttrs);\n }\n\n addStack(getAttrs) {\n if (getAttrs) {\n this.exporter.use(getAttrs);\n } else {\n this.exporter.use(this.defaultMiddleware);\n }\n }\n\n parseSchema(exporter) {\n let rule = {};\n if (this.tag) {\n rule = { tag: this.tag };\n }\n\n if (this.style) {\n rule = { style: this.style };\n }\n\n if (this.exporter) {\n rule.getAttrs = dom => {\n let hooks = {};\n\n exporter.go({ dom }, hook => {\n hooks = hook;\n });\n return omit(hooks, [\"dom\"]);\n };\n }\n\n return rule;\n }\n\n combineRules() {\n const exporter = this.exporter;\n return this.parseSchema(exporter);\n }\n}\n","import { isPlainObject } from \"lodash\";\nimport ParseRule from \"./ParseRule\";\nimport Middleware from \"../lib/Middleware\";\n\nexport default class Node {\n name = \"\";\n importer = {};\n\n atom = false;\n inline = false;\n isolating = false;\n draggable = false;\n group = \"\";\n content = \"\";\n _attrs = {};\n _parseRules = [];\n\n constructor(name) {\n this.name = name;\n this.importer = new Middleware();\n }\n\n fromJSON(config) {\n for (let key in config) {\n let value = config[key];\n this[key] = value;\n }\n }\n\n set toDOM(value) {\n this.importer.use(value);\n }\n\n set attrs(value) {\n Object.assign(this._attrs, value);\n }\n\n set parseDOM(parseDom) {\n let values = parseDom;\n if (isPlainObject(parseDom)) {\n values = [parseDom];\n }\n values.forEach(value => {\n let parseRule = this._parseRules.find(parseRule => {\n if (value.tag) return parseRule.tag === value.tag;\n if (value.style) return parseRule.style === value.style;\n return false;\n });\n if (!parseRule) {\n parseRule = new ParseRule(value);\n this._parseRules.push(parseRule);\n }\n parseRule.addStack(value.getAttrs);\n });\n }\n\n toJSON() {\n const importer = this.importer;\n\n return {\n atom: this.atom,\n inline: this.inline,\n group: this.group,\n content: this.content,\n isolating: this.isolating,\n draggable: this.draggable,\n attrs: this._attrs,\n parseDOM: this._parseRules.map(rule => rule.combineRules()),\n toDOM: node => {\n let hooks = {};\n\n importer.go({ node }, hook => {\n hooks = hook;\n });\n return hooks.value;\n }\n };\n }\n}\n","import { isPlainObject } from \"lodash\";\nimport ParseRule from \"./ParseRule\";\nimport Middleware from \"../lib/Middleware\";\n\nexport default class Mark {\n name = \"\";\n importer = {};\n\n inline = false;\n group = \"\";\n content = \"\";\n draggable = false;\n inclusive = true;\n _attrs = {};\n _parseRules = [];\n\n constructor(name) {\n this.name = name;\n this.importer = new Middleware();\n }\n\n fromJSON(config) {\n for (let key in config) {\n let value = config[key];\n this[key] = value;\n }\n }\n\n set toDOM(value) {\n this.importer.use(value);\n }\n\n set attrs(value) {\n Object.assign(this._attrs, value);\n }\n\n set parseDOM(parseDom) {\n let values = parseDom;\n if (isPlainObject(parseDom)) {\n values = [parseDom];\n }\n values.forEach(value => {\n let parseRule = this._parseRules.find(parseRule => {\n if (value.tag) return parseRule.tag === value.tag;\n if (value.style) return parseRule.style === value.style;\n return false;\n });\n if (!parseRule) {\n parseRule = new ParseRule(value);\n this._parseRules.push(parseRule);\n }\n parseRule.addStack(value.getAttrs);\n });\n }\n\n toJSON() {\n const importer = this.importer;\n\n return {\n inline: this.inline,\n group: this.group,\n content: this.content,\n draggable: this.draggable,\n inclusive: this.inclusive,\n attrs: this._attrs,\n parseDOM: this._parseRules.map(rule => rule.combineRules()),\n toDOM: node => {\n let hooks = {};\n\n importer.go({ node }, hook => {\n hooks = hook;\n });\n return hooks.value;\n }\n };\n }\n}\n","import { Schema as PmPschema } from \"prosemirror-model\";\nimport { injectable } from \"inversify\";\nimport DefaultSchema from \"./DefaultSchema\";\n\nimport Node from \"./Node\";\nimport Mark from \"./Mark\";\n\n@injectable()\nexport default class Schema {\n _nodes = {};\n _marks = {};\n prosemirrorSchema = { nodes: {}, marks: {} };\n schema = null;\n\n addNode(schemaConfig) {\n const name = Object.keys(schemaConfig)[0];\n const config = schemaConfig[name];\n\n const node = new Node(name);\n let nd = {};\n\n if ((nd = this.has(node))) {\n nd.fromJSON(config);\n return nd;\n } else {\n node.fromJSON(config);\n this.addSchema(node);\n\n return { [name]: node };\n }\n }\n\n addMark(schemaConfig) {\n const name = Object.keys(schemaConfig)[0];\n const config = schemaConfig[name];\n\n const mark = new Mark(name);\n let mr = {};\n if ((mr = this.has(mark))) {\n mr.fromJSON(config);\n return mr;\n } else {\n mark.fromJSON(config);\n this.addSchema(mark);\n return { [name]: mark };\n }\n }\n\n has(instance) {\n if (instance instanceof Node) {\n return this._nodes[instance.name] ? this._nodes[instance.name] : false;\n }\n if (instance instanceof Mark) {\n return this._marks[instance.name] ? this._marks[instance.name] : false;\n }\n }\n\n addSchema(instance) {\n if (instance instanceof Node) {\n return this._nodes[instance.name]\n ? this._nodes[instance.name]\n : Object.assign(this._nodes, {\n [instance.name]: instance\n });\n }\n\n if (instance instanceof Mark) {\n return this._marks[instance.name]\n ? this._marks[instance.name]\n : Object.assign(this._marks, {\n [instance.name]: instance\n });\n }\n }\n\n addProsemirrorSchema(nodes, type) {\n this.prosemirrorSchema[type] = Object.assign(\n this.prosemirrorSchema[type],\n nodes\n );\n }\n\n getSchema() {\n const nodes = DefaultSchema.nodes;\n const marks = {};\n\n for (let index in this._nodes) {\n nodes[index] = this._nodes[index].toJSON();\n }\n\n for (let index in this._marks) {\n marks[index] = this._marks[index].toJSON();\n }\n\n this.schema = new PmPschema({\n nodes: Object.assign(nodes, this.prosemirrorSchema.nodes),\n marks: Object.assign(marks, this.prosemirrorSchema.marks)\n });\n return this.schema;\n }\n}\n","import Service from \"../Service\";\nimport Schema from \"./Schema\";\nimport Node from \"./Node\";\nimport Mark from \"./Mark\";\n\nexport default class SchemaService extends Service {\n name = \"SchemaService\";\n\n register() {\n this.container\n .bind(\"Schema\")\n .to(Schema)\n .inSingletonScope();\n\n this.container.bind(\"CreateNode\").toFactory(context => {\n return (schema, options = { toWaxSchema: false }) => {\n const schemaInstance = context.container.get(\"Schema\");\n if (options.toWaxSchema) {\n schemaInstance.addNode(schema);\n } else {\n schemaInstance.addProsemirrorSchema(schema, \"nodes\");\n }\n };\n });\n\n this.container.bind(\"CreateMark\").toFactory(context => {\n return (schema, options = { toWaxSchema: false }) => {\n const schemaInstance = context.container.get(\"Schema\");\n if (options.toWaxSchema) {\n schemaInstance.addMark(schema);\n } else {\n schemaInstance.addProsemirrorSchema(schema, \"marks\");\n }\n };\n });\n }\n}\n","import { injectable } from 'inversify';\nimport { keymap } from 'prosemirror-keymap';\nimport { undo, redo } from 'prosemirror-history';\n\nimport {\n wrapInList,\n splitListItem,\n liftListItem,\n sinkListItem,\n} from 'prosemirror-schema-list';\n\nimport {\n baseKeymap,\n chainCommands,\n exitCode,\n selectParentNode,\n joinBackward,\n selectNodeBackward,\n deleteSelection,\n} from 'prosemirror-commands';\n\nconst backSpace = chainCommands(\n deleteSelection,\n joinBackward,\n selectNodeBackward,\n);\n\nconst backSpaceShortCut = (state, dispatch, view) =>\n backSpace(\n state,\n tr => dispatch(tr.setMeta('inputType', 'deleteContentBackward')),\n view,\n );\n\nconst undoShortCut = (state, dispatch, view) =>\n undo(state, tr => dispatch(tr.setMeta('inputType', 'historyUndo')), view);\n\nconst redoShortCut = (state, dispatch, view) =>\n redo(state, tr => dispatch(tr.setMeta('inputType', 'historyRedo')), view);\n\n@injectable()\nclass ShortCuts {\n constructor(plugins, schema) {\n this.insertBreak = this.insertBreak.bind(this);\n this.insertRule = this.insertRule.bind(this);\n this.PmPlugins = plugins;\n this.schema = schema;\n this.keys = this.getKeys();\n }\n\n insertBreak(state, dispatch) {\n const br = this.schema.nodes.hard_break.create();\n dispatch(state.tr.replaceSelectionWith(br).scrollIntoView());\n return true;\n }\n\n insertRule(state, dispatch) {\n const hr = this.schema.nodes.horizontal_rule.create();\n dispatch(state.tr.replaceSelectionWith(hr).scrollIntoView());\n return true;\n }\n\n createShortCuts() {\n const shortCuts = keymap(this.createKeyBindings());\n this.PmPlugins.add('shortcuts', shortCuts);\n }\n\n addShortCut(shortcut) {\n Object.assign(this.keys, shortcut);\n this.createShortCuts();\n }\n\n createKeyBindings() {\n Object.keys(baseKeymap).forEach(key => {\n if (this.keys[key]) {\n this.keys[key] = chainCommands(this.keys[key], baseKeymap[key]);\n } else {\n this.keys[key] = baseKeymap[key];\n }\n });\n return this.keys;\n }\n\n getKeys() {\n return {\n 'Mod-z': undoShortCut,\n 'Shift-Mod-z': redoShortCut,\n Backspace: backSpaceShortCut,\n 'Mod-y': redoShortCut,\n Escape: selectParentNode,\n 'Mod-Enter': chainCommands(exitCode, this.insertBreak),\n 'Shift-Enter': chainCommands(exitCode, this.insertBreak),\n 'Ctrl-Enter': chainCommands(exitCode, this.insertBreak),\n 'Mod-_': this.insertRule,\n 'Mod-[': liftListItem(this.schema.nodes.list_item),\n 'Mod-]': sinkListItem(this.schema.nodes.list_item),\n Enter: splitListItem(this.schema.nodes.list_item),\n 'Shift-Ctrl-8': wrapInList(this.schema.nodes.bulletlist),\n 'Shift-Ctrl-9': wrapInList(this.schema.nodes.orderedlist),\n };\n }\n}\n\nexport default ShortCuts;\n","import Service from \"../Service\";\nimport ShortCuts from \"./ShortCuts\";\n\nexport default class ShortCutsService extends Service {\n name = \"ShortCutsService\";\n\n boot() {\n const shortCuts = this.container.get(\"ShortCuts\");\n shortCuts.createShortCuts();\n }\n\n register() {\n const PmPlugins = this.app.PmPlugins;\n this.container\n .bind(\"ShortCuts\")\n .toDynamicValue(() => {\n const { schema: { schema } } = this.app;\n\n return new ShortCuts(PmPlugins, schema);\n })\n .inSingletonScope();\n }\n}\n","import React from 'react';\nimport { injectable } from 'inversify';\nimport { isEmpty } from 'lodash';\nimport { v4 as uuidv4 } from 'uuid';\nimport { TrackChangeEnable } from 'wax-prosemirror-components';\nimport Tools from '../../lib/Tools';\n\nexport default\n@injectable()\nclass EnableTrackChange extends Tools {\n title = 'Toggle Track Changes';\n content = 'track changes';\n\n get run() {\n return state => {\n this.config.enabled = !this.config.enabled;\n return true;\n };\n }\n\n get enable() {\n return state => {\n return true;\n };\n }\n\n renderTool(view) {\n if (isEmpty(view)) return null;\n return this._isDisplayed ? (\n <TrackChangeEnable\n key={uuidv4()}\n view={view}\n item={this.toJSON()}\n enabled={this.config.enabled}\n />\n ) : null;\n }\n}\n","import Service from '../../Service';\nimport EnableTrackChange from './EnableTrackChange';\n\nclass EnableTrackChangeService extends Service {\n name = 'EnableTrackChangeService';\n boot() {}\n\n register() {\n this.container.bind('EnableTrackChange').toDynamicValue(() => {\n return new EnableTrackChange(this.config);\n });\n }\n}\n\nexport default EnableTrackChangeService;\n","import { replaceStep } from 'prosemirror-transform';\nimport { Selection } from 'prosemirror-state';\n\nconst removeNode = (tr, node, nodePos, map) => {\n const newNodePos = map.map(nodePos);\n const selectionBefore = Selection.findFrom(tr.doc.resolve(newNodePos), -1);\n const start = selectionBefore.$anchor.pos;\n const end = newNodePos + 1;\n\n const delStep = replaceStep(tr.doc, start, end);\n\n tr.step(delStep);\n const stepMap = delStep.getMap();\n map.appendMap(stepMap);\n};\n\nexport default removeNode;\n","import { Mapping, RemoveMarkStep, ReplaceStep } from 'prosemirror-transform';\nimport { Slice } from 'prosemirror-model';\nimport { injectable } from 'inversify';\nimport removeNode from '../track-changes/helpers/removeNode';\nimport Tools from '../../lib/Tools';\n\nexport default\n@injectable()\nclass AcceptTrackChange extends Tools {\n title = 'Accept Changes';\n content = 'Accept';\n\n get run() {\n return (state, dispatch) => {\n const {\n tr,\n selection: { from, to },\n } = state;\n\n tr.setMeta('AcceptReject', true);\n const map = new Mapping();\n\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (\n node.attrs.track &&\n node.attrs.track.find(track => track.type === 'deletion')\n ) {\n removeNode(tr, node, pos, map);\n }\n if (\n node.marks &&\n node.marks.find(mark => mark.type.name === 'deletion')\n ) {\n const deletionStep = new ReplaceStep(\n map.map(Math.max(pos, from)),\n map.map(Math.min(pos + node.nodeSize, to)),\n Slice.empty,\n );\n tr.step(deletionStep);\n map.appendMap(deletionStep.getMap());\n } else if (\n node.attrs.track &&\n node.attrs.track.find(track => track.type === 'insertion')\n ) {\n const track = node.attrs.track.filter(\n track => track.type !== 'insertion',\n );\n tr.setNodeMarkup(\n map.map(pos),\n null,\n Object.assign(node.attrs.track, { track }),\n node.marks,\n );\n } else if (\n node.marks &&\n node.marks.find(mark => mark.type.name === 'insertion')\n ) {\n const insertionMark = node.marks.find(\n mark => mark.type.name === 'insertion',\n );\n tr.step(\n new RemoveMarkStep(\n map.map(Math.max(pos, from)),\n map.map(Math.min(pos + node.nodeSize, to)),\n insertionMark,\n ),\n );\n } else if (\n node.marks &&\n node.marks.find(mark => mark.type.name === 'format_change')\n ) {\n const formatChangeMark = node.marks.find(\n mark => mark.type.name === 'format_change',\n );\n tr.step(\n new RemoveMarkStep(\n map.map(Math.max(pos, from)),\n map.map(Math.min(pos + node.nodeSize, to)),\n formatChangeMark,\n ),\n );\n } else if (\n node.attrs.track &&\n node.attrs.track.find(track => track.type === 'block_change')\n ) {\n const blockChangeTrack = node.attrs.track.find(\n track => track.type === 'block_change',\n );\n\n const track = node.attrs.track.filter(\n track => track !== blockChangeTrack,\n );\n\n tr.setNodeMarkup(\n map.map(pos),\n null,\n Object.assign(node.attrs.track, { track }),\n node.marks,\n );\n }\n });\n if (tr.steps.length) dispatch(tr);\n };\n }\n\n select = (state, activeViewId) => {\n const {\n selection: { from, to },\n } = state;\n if (from === to && activeViewId !== 'main') return false;\n return true;\n };\n\n get active() {\n return state => {};\n }\n}\n","import Service from '../../Service';\nimport AcceptTrackChange from './AcceptTrackChange';\n\nclass AcceptTrackChangeService extends Service {\n name = 'AcceptTrackChangeService';\n // boot() {}\n\n register() {\n this.container.bind('AcceptTrackChange').to(AcceptTrackChange);\n }\n}\n\nexport default AcceptTrackChangeService;\n","import {\n Mapping,\n RemoveMarkStep,\n ReplaceStep,\n AddMarkStep,\n} from 'prosemirror-transform';\nimport { Slice } from 'prosemirror-model';\nimport { injectable } from 'inversify';\nimport removeNode from '../track-changes/helpers/removeNode';\nimport Tools from '../../lib/Tools';\n\nexport default\n@injectable()\nclass RejectTrackChange extends Tools {\n title = 'Reject Changes';\n content = 'Reject';\n\n get run() {\n return (state, dispatch) => {\n const {\n tr,\n selection: { from, to },\n } = state;\n tr.setMeta('AcceptReject', true);\n const map = new Mapping();\n\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (\n node.marks &&\n node.marks.find(mark => mark.type.name === 'deletion')\n ) {\n const deletionMark = node.marks.find(\n mark => mark.type.name === 'deletion',\n );\n tr.step(\n new RemoveMarkStep(\n map.map(Math.max(pos, from)),\n map.map(Math.min(pos + node.nodeSize, to)),\n deletionMark,\n ),\n );\n } else if (\n node.attrs.track &&\n node.attrs.track.find(track => track.type === 'insertion')\n ) {\n removeNode(tr, node, pos, map);\n } else if (\n node.marks &&\n node.marks.find(mark => mark.type.name === 'insertion')\n ) {\n const deletionStep = new ReplaceStep(\n map.map(Math.max(pos, from)),\n map.map(Math.min(pos + node.nodeSize, to)),\n Slice.empty,\n );\n tr.step(deletionStep);\n map.appendMap(deletionStep.getMap());\n } else if (\n node.marks &&\n node.marks.find(mark => mark.type.name === 'format_change')\n ) {\n const formatChangeMark = node.marks.find(\n mark => mark.type.name === 'format_change',\n );\n formatChangeMark.attrs.before.forEach(oldMark => {\n tr.step(\n new AddMarkStep(\n map.map(Math.max(pos, from)),\n map.map(Math.min(pos + node.nodeSize, to)),\n state.schema.marks[oldMark].create(),\n ),\n );\n });\n formatChangeMark.attrs.after.forEach(newMark => {\n tr.step(\n new RemoveMarkStep(\n map.map(Math.max(pos, from)),\n map.map(Math.min(pos + node.nodeSize, to)),\n node.marks.find(mark => mark.type.name === newMark),\n ),\n );\n });\n\n tr.step(\n new RemoveMarkStep(\n map.map(Math.max(pos, from)),\n map.map(Math.min(pos + node.nodeSize, to)),\n formatChangeMark,\n ),\n );\n }\n });\n if (tr.steps.length) dispatch(tr);\n };\n }\n\n select = (state, activeViewId) => {\n const {\n selection: { from, to },\n } = state;\n if (from === to && activeViewId !== 'main') return false;\n return true;\n };\n\n get active() {\n return state => {};\n }\n}\n","import Service from '../../Service';\nimport RejectTrackChange from './RejectTrackChange';\n\nclass RejectTrackChangeService extends Service {\n name = 'RejectTrackChangeService';\n boot() {}\n\n register() {\n this.container.bind('RejectTrackChange').to(RejectTrackChange);\n }\n}\n\nexport default RejectTrackChangeService;\n","import EnableTrackChangeService from './EnableTrackChangeService/EnableTrackChangeService';\nimport AcceptTrackChangeService from './AcceptTrackChangeService/AcceptTrackChangeService';\nimport RejectTrackChangeService from './RejectTrackChangeService/RejectTrackChangeService';\n\nexport default [\n new EnableTrackChangeService(),\n new AcceptTrackChangeService(),\n new RejectTrackChangeService(),\n];\n","import { trackChangesMarks, trackChangesNodes } from 'wax-prosemirror-schema';\nimport Service from '../Service';\nimport TrackChangeServices from './index';\n\nclass TrackChangeService extends Service {\n boot() {}\n\n register() {\n const createMark = this.container.get('CreateMark');\n const createNode = this.container.get('CreateNode');\n\n Object.keys(trackChangesMarks).forEach(mark => {\n createMark(\n {\n [mark]: trackChangesMarks[mark],\n },\n { toWaxSchema: true },\n );\n });\n\n Object.keys(trackChangesNodes).forEach(node => {\n createNode(\n {\n [node]: trackChangesNodes[node],\n },\n { toWaxSchema: true },\n );\n });\n }\n\n dependencies = TrackChangeServices;\n}\n\nexport default TrackChangeService;\n","import { Selection, TextSelection } from 'prosemirror-state';\nimport { Slice } from 'prosemirror-model';\nimport { ReplaceStep, Mapping } from 'prosemirror-transform';\n\nconst markDeletion = (tr, from, to, user, date, group) => {\n const deletionMark = tr.doc.type.schema.marks.deletion.create({\n user: user.userId,\n username: user.username,\n // date\n });\n\n const deletionMap = new Mapping();\n\n tr.doc.nodesBetween(from, to, (node, pos) => {\n if (node.type.name.includes('table')) {\n return;\n }\n if (\n node.isInline &&\n node.marks.find(\n mark =>\n mark.type.name === 'insertion' && mark.attrs.user === user.userId,\n )\n ) {\n const removeStep = new ReplaceStep(\n deletionMap.map(Math.max(from, pos)),\n deletionMap.map(Math.min(to, pos + node.nodeSize)),\n Slice.empty,\n );\n if (!tr.maybeStep(removeStep).failed) {\n deletionMap.appendMap(removeStep.getMap());\n }\n } else if (\n node.isInline &&\n !node.marks.find(mark => mark.type.name === 'deletion')\n ) {\n tr.addMark(\n deletionMap.map(Math.max(from, pos)),\n deletionMap.map(Math.min(to, pos + node.nodeSize)),\n deletionMark,\n );\n } else if (\n node.attrs.track &&\n !node.attrs.track.find(trackAttr => trackAttr.type === 'deletion') &&\n !['bullet_list', 'ordered_list'].includes(node.type.name)\n ) {\n if (\n node.attrs.track.find(\n trackAttr =>\n trackAttr.type === 'insertion' && trackAttr.user === user.userId,\n )\n ) {\n let removeStep;\n if (node.isTextblock && to < pos + node.nodeSize) {\n const selectionBefore = Selection.findFrom(tr.doc.resolve(pos), -1);\n if (selectionBefore instanceof TextSelection) {\n removeStep = new ReplaceStep(\n deletionMap.map(selectionBefore.$anchor.pos),\n deletionMap.map(to),\n Slice.empty,\n );\n }\n } else {\n removeStep = new ReplaceStep(\n deletionMap.map(Math.max(from, pos)),\n deletionMap.map(Math.min(to, pos + node.nodeSize)),\n Slice.empty,\n );\n }\n\n if (!tr.maybeStep(removeStep).failed) {\n deletionMap.appendMap(removeStep.getMap());\n }\n }\n\n let counter = 2;\n node.content.forEach((item, i) => {\n item.marks.forEach(mark => {\n if (mark.type.name === 'deletion') {\n counter += item.nodeSize;\n }\n });\n });\n\n if (node.content.size === 0 || counter === node.nodeSize) {\n const track = node.attrs.track.slice();\n track.push({\n type: 'deletion',\n user: user.userId,\n username: user.username,\n // date\n });\n tr.setNodeMarkup(\n deletionMap.map(pos),\n null,\n Object.assign(node.attrs.track, { track }),\n node.marks,\n );\n }\n }\n });\n\n return deletionMap;\n};\n\nexport default markDeletion;\n","import { v4 as uuidv4 } from \"uuid\";\n\nconst markInsertion = (tr, from, to, user, date, group) => {\n tr.removeMark(from, to, tr.doc.type.schema.marks.deletion);\n tr.removeMark(from, to, tr.doc.type.schema.marks.insertion);\n\n const insertionMark = tr.doc.type.schema.marks.insertion.create({\n user: user.userId,\n username: user.username\n // date\n });\n\n tr.addMark(from, to, insertionMark);\n // Add insertion mark also to block nodes (figures, text blocks) but not table cells/rows and lists.\n tr.doc.nodesBetween(from, to, (node, pos) => {\n if (\n pos < from ||\n [\"bullet_list\", \"ordered_list\"].includes(node.type.name)\n ) {\n return true;\n } else if (\n node.isInline ||\n [\"table_row\", \"table_cell\"].includes(node.type.name)\n ) {\n return false;\n }\n if (node.attrs.track) {\n const track = [];\n\n track.push({\n type: \"insertion\",\n user: user.userId,\n username: user.username,\n date,\n group\n });\n\n tr.setNodeMarkup(\n pos,\n null,\n Object.assign({}, node.attrs, { track, group, id: uuidv4() }),\n node.marks\n );\n }\n if (node.type.name === \"table\") {\n // A table was inserted. We don't add track marks to elements inside of it.\n return false;\n }\n });\n};\n\nexport default markInsertion;\n","import { ReplaceStep } from \"prosemirror-transform\";\nimport { CellSelection } from \"prosemirror-tables\";\nimport { DocumentHelpers } from \"wax-prosemirror-utilities\";\n\nimport markDeletion from \"./markDeletion\";\nimport markInsertion from \"./markInsertion\";\n\nconst replaceStep = (state, tr, step, newTr, map, doc, user, date, group) => {\n const cellDeleteTr =\n [\"deleteContentBackward\", \"deleteContentForward\"].includes(\n tr.getMeta(\"inputType\")\n ) && state.selection instanceof CellSelection;\n\n // if deletion mark move to the end of deletion\n const deletionMarkSchema = state.schema.marks.deletion;\n const deletionMark = DocumentHelpers.findMark(\n state,\n deletionMarkSchema,\n false\n );\n const positionTo = deletionMark ? deletionMark.to : step.to;\n\n const newStep = !cellDeleteTr\n ? new ReplaceStep(\n positionTo, // We insert all the same steps, but with \"from\"/\"to\" both set to \"to\" in order not to delete content. Mapped as needed.\n positionTo,\n step.slice,\n step.structure\n )\n : false;\n\n // We didn't apply the original step in its original place. We adjust the map accordingly.\n map.appendMap(step.invert(doc).getMap());\n if (newStep) {\n const trTemp = state.apply(newTr).tr;\n if (trTemp.maybeStep(newStep).failed) {\n return;\n }\n const mappedNewStepTo = newStep.getMap().map(newStep.to);\n\n markInsertion(trTemp, newStep.from, mappedNewStepTo, user, date, group);\n // We condense it down to a single replace step.\n const condensedStep = new ReplaceStep(\n newStep.from,\n newStep.to,\n trTemp.doc.slice(newStep.from, mappedNewStepTo)\n );\n\n newTr.step(condensedStep);\n const mirrorIndex = map.maps.length - 1;\n map.appendMap(condensedStep.getMap(), mirrorIndex);\n if (!newTr.selection.eq(trTemp.selection)) {\n newTr.setSelection(trTemp.selection);\n }\n }\n if (step.from !== step.to) {\n map.appendMap(markDeletion(newTr, step.from, step.to, user, date, group));\n }\n};\n\nexport default replaceStep;\n","import { v4 as uuidv4 } from 'uuid';\n\nconst markWrapping = (tr, pos, oldNode, newNode, user, date, group) => {\n let track = oldNode.attrs.track.slice();\n let blockTrack = track.find(track => track.type === 'block_change');\n\n if (blockTrack) {\n track = track.filter(track => track !== blockTrack);\n if (\n blockTrack.before.type !== newNode.type.name ||\n blockTrack.before.attrs.level !== newNode.attrs.level\n ) {\n blockTrack = {\n type: 'block_change',\n user: user.userId,\n username: user.username,\n date,\n before: blockTrack.before,\n };\n track.push(blockTrack);\n }\n } else {\n blockTrack = {\n type: 'block_change',\n user: user.userId,\n username: user.username,\n date,\n before: { type: oldNode.type.name, attrs: oldNode.attrs },\n };\n if (blockTrack.before.attrs.id) {\n delete blockTrack.before.attrs.id;\n }\n if (blockTrack.before.attrs.track) {\n delete blockTrack.before.attrs.track;\n }\n track.push(blockTrack);\n }\n tr.setNodeMarkup(\n pos,\n null,\n Object.assign({}, newNode.attrs, { track, group, id: uuidv4() }),\n );\n};\n\nexport default markWrapping;\n","import markDeletion from \"./markDeletion\";\nimport markInsertion from \"./markInsertion\";\nimport markWrapping from \"./markWrapping\";\n\nconst replaceAroundStep = (\n state,\n tr,\n step,\n newTr,\n map,\n doc,\n user,\n date,\n group\n) => {\n if (step.from === step.gapFrom && step.to === step.gapTo) {\n // wrapped in something\n newTr.step(step);\n const from = step.getMap().map(step.from, -1);\n const to = step.getMap().map(step.gapFrom);\n markInsertion(newTr, from, to, user, date, group);\n } else if (!step.slice.size) {\n // unwrapped from something\n map.appendMap(step.invert(doc).getMap());\n map.appendMap(\n markDeletion(newTr, step.from, step.gapFrom, user, date, group)\n );\n } else if (\n step.slice.size === 2 &&\n step.gapFrom - step.from === 1 &&\n step.to - step.gapTo === 1\n ) {\n // Replaced one wrapping with another\n newTr.step(step);\n const oldNode = doc.nodeAt(step.from);\n if (oldNode.attrs.track) {\n markWrapping(\n newTr,\n step.from,\n oldNode,\n step.slice.content.firstChild,\n user,\n date,\n group\n );\n }\n } else {\n console.log(\"to fix\");\n // newTr.step(step);\n // const ranges = [\n // {\n // from: step.getMap().map(step.from, -1),\n // to: step.getMap().map(step.gapFrom)\n // },\n // {\n // from: step.getMap().map(step.gapTo, -1),\n // to: step.getMap().map(step.to)\n // }\n // ];\n // ranges.forEach(range =>\n // doc.nodesBetween(range.from, range.to, (node, pos) => {\n // if (pos < range.from) {\n // return true;\n // }\n // markInsertion(newTr, range.from, range.to, user, date);\n // })\n // );\n }\n};\n\nexport default replaceAroundStep;\n","import { v4 as uuidv4 } from 'uuid';\n\nconst addMarkStep = (state, tr, step, newTr, map, doc, user, date, group) => {\n doc.nodesBetween(step.from, step.to, (node, pos) => {\n if (!node.isInline) {\n return true;\n }\n if (node.marks.find(mark => mark.type.name === 'deletion')) {\n return false;\n }\n newTr.addMark(\n Math.max(step.from, pos),\n Math.min(step.to, pos + node.nodeSize),\n step.mark,\n );\n\n if (\n !['comment'].includes(step.mark.type.name) &&\n !node.marks.find(mark => mark.type === step.mark.type)\n ) {\n const formatChangeMark = node.marks.find(\n mark => mark.type.name === 'format_change',\n );\n let after, before;\n if (formatChangeMark) {\n if (formatChangeMark.attrs.before.includes(step.mark.type.name)) {\n before = formatChangeMark.attrs.before.filter(\n markName => markName !== step.mark.type.name,\n );\n after = formatChangeMark.attrs.after;\n } else {\n before = formatChangeMark.attrs.before;\n after = formatChangeMark.attrs.after.concat(step.mark.type.name);\n }\n } else {\n before = [];\n after = [step.mark.type.name];\n }\n if (after.length || before.length) {\n // Math.max(step.from, pos),\n // Math.min(step.to, pos + node.nodeSize),\n newTr.addMark(\n step.from,\n step.to,\n state.schema.marks.format_change.create({\n user: user.userId,\n username: user.username,\n date,\n before,\n after,\n group,\n id: uuidv4(),\n }),\n );\n } else if (formatChangeMark) {\n newTr.removeMark(\n Math.max(step.from, pos),\n Math.min(step.to, pos + node.nodeSize),\n formatChangeMark,\n );\n }\n }\n });\n};\n\nexport default addMarkStep;\n","const removeMarkStep = (state, tr, step, newTr, map, doc, user, date) => {\n doc.nodesBetween(step.from, step.to, (node, pos) => {\n if (!node.isInline) {\n return true;\n }\n if (node.marks.find(mark => mark.type.name === 'deletion')) {\n return false;\n }\n newTr.removeMark(\n Math.max(step.from, pos),\n Math.min(step.to, pos + node.nodeSize),\n step.mark,\n );\n\n if (\n ['em', 'strong', 'underline'].includes(step.mark.type.name) &&\n node.marks.find(mark => mark.type === step.mark.type)\n ) {\n const formatChangeMark = node.marks.find(\n mark => mark.type.name === 'format_change',\n );\n let after, before;\n if (formatChangeMark) {\n if (formatChangeMark.attrs.after.includes(step.mark.type.name)) {\n after = formatChangeMark.attrs.after.filter(\n markName => markName !== step.mark.type.name,\n );\n before = formatChangeMark.attrs.before;\n } else {\n after = formatChangeMark.attrs.after;\n before = formatChangeMark.attrs.before.concat(step.mark.type.name);\n }\n } else {\n after = [];\n before = [step.mark.type.name];\n }\n if (after.length || before.length) {\n newTr.addMark(\n Math.max(step.from, pos),\n Math.min(step.to, pos + node.nodeSize),\n state.schema.marks.format_change.create({\n user: user.userId,\n username: user.username,\n date,\n before,\n after,\n }),\n );\n } else if (formatChangeMark) {\n newTr.removeMark(\n Math.max(step.from, pos),\n Math.min(step.to, pos + node.nodeSize),\n formatChangeMark,\n );\n }\n }\n });\n};\n\nexport default removeMarkStep;\n","/*\nThis belongs to https://github.com/fiduswriter/fiduswriter\ncheck: https://github.com/fiduswriter/fiduswriter/blob/develop/fiduswriter/document/static/js/modules/editor/track/amend_transaction.js\nLicense included in folder.\n*/\n\nimport { TextSelection } from 'prosemirror-state';\nimport {\n ReplaceStep,\n ReplaceAroundStep,\n AddMarkStep,\n RemoveMarkStep,\n Mapping,\n} from 'prosemirror-transform';\n\nimport { DocumentHelpers } from 'wax-prosemirror-utilities';\nimport replaceStep from './helpers/replaceStep';\nimport replaceAroundStep from './helpers/replaceAroundStep';\nimport addMarkStep from './helpers/addMarkStep';\nimport removeMarkStep from './helpers/removeMarkStep';\n\nconst trackedTransaction = (tr, state, user) => {\n if (\n !tr.steps.length ||\n (tr.meta &&\n !Object.keys(tr.meta).every(metadata =>\n ['inputType', 'uiEvent', 'paste', 'outsideView'].includes(metadata),\n )) ||\n ['historyUndo', 'historyRedo', 'AcceptReject'].includes(\n tr.getMeta('inputType'),\n )\n ) {\n return tr;\n }\n\n const group = tr.getMeta('outsideView') ? tr.getMeta('outsideView') : 'main';\n const newTr = state.tr;\n const map = new Mapping();\n const date = Math.floor(Date.now() / 300000);\n\n tr.steps.forEach(originalStep => {\n const step = originalStep.map(map);\n const { doc } = newTr;\n if (!step) {\n return;\n }\n\n switch (step.constructor) {\n case ReplaceStep:\n replaceStep(state, tr, step, newTr, map, doc, user, date, group);\n break;\n case ReplaceAroundStep:\n replaceAroundStep(state, tr, step, newTr, map, doc, user, date, group);\n break;\n case AddMarkStep:\n addMarkStep(state, tr, step, newTr, map, doc, user, date, group);\n break;\n case RemoveMarkStep:\n removeMarkStep(state, tr, step, newTr, map, doc, user, date, group);\n break;\n default:\n }\n });\n\n if (tr.getMeta('inputType')) newTr.setMeta(tr.getMeta('inputType'));\n\n if (tr.getMeta('uiEvent')) newTr.setMeta(tr.getMeta('uiEvent'));\n\n if (tr.selectionSet) {\n const deletionMarkSchema = state.schema.marks.deletion;\n const deletionMark = DocumentHelpers.findMark(\n state,\n deletionMarkSchema,\n false,\n );\n\n if (\n tr.selection instanceof TextSelection &&\n (tr.selection.from < state.selection.from ||\n tr.getMeta('inputType') === 'deleteContentBackward')\n ) {\n const caretPos = map.map(tr.selection.from, -1);\n newTr.setSelection(new TextSelection(newTr.doc.resolve(caretPos)));\n } else if (tr.selection.from > state.selection.from && deletionMark) {\n const caretPos = map.map(deletionMark.to + 1, 1);\n newTr.setSelection(new TextSelection(newTr.doc.resolve(caretPos)));\n } else {\n newTr.setSelection(tr.selection.map(newTr.doc, map));\n }\n }\n\n if (\n state.selection.from - tr.selection.from > 1 &&\n tr.selection.$head.depth > 1\n ) {\n const caretPos = map.map(tr.selection.from - 2, -1);\n newTr.setSelection(new TextSelection(newTr.doc.resolve(caretPos)));\n } else {\n const caretPos = map.map(tr.selection.from, -1);\n newTr.setSelection(new TextSelection(newTr.doc.resolve(caretPos)));\n // const slice = map.slice(newTr.selection.from, newTr.selection.to);\n // map.appendMap(slice);\n }\n\n if (tr.storedMarksSet) newTr.setStoredMarks(tr.storedMarks);\n\n if (tr.scrolledIntoView) newTr.scrollIntoView();\n\n return newTr;\n};\n\nexport default trackedTransaction;\n","import { undo } from 'prosemirror-history';\nimport { injectable } from 'inversify';\nimport { icons } from 'wax-prosemirror-components';\nimport Tools from '../../lib/Tools';\n\nexport default\n@injectable()\nclass Undo extends Tools {\n title = 'Undo last change';\n content = icons.undo;\n onlyOnMain = true;\n\n get run() {\n return (state, dispatch) => {\n undo(state, tr => dispatch(tr.setMeta('inputType', 'historyUndo')));\n };\n }\n\n get enable() {\n return undo;\n }\n}\n","import Service from \"../../Service\";\nimport Undo from \"./Undo\";\n\nclass UndoService extends Service {\n boot() {}\n\n register() {\n this.container.bind(\"Undo\").to(Undo);\n }\n}\n\nexport default UndoService;\n","import { redo } from 'prosemirror-history';\nimport Tools from '../../lib/Tools';\nimport { injectable } from 'inversify';\nimport { icons } from 'wax-prosemirror-components';\n\nexport default\n@injectable()\nclass Redo extends Tools {\n title = 'Redo last undone change';\n content = icons.redo;\n onlyOnMain = true;\n\n get run() {\n return (state, dispatch) => {\n redo(state, tr => dispatch(tr.setMeta('inputType', 'historyRedo')));\n };\n }\n\n get enable() {\n return redo;\n }\n}\n","import Service from '../../Service';\nimport Redo from './Redo';\n\nclass RedoService extends Service {\n // boot() {}\n\n register() {\n this.container.bind('Redo').to(Redo);\n }\n}\n\nexport default RedoService;\n","import Tools from \"../../lib/Tools\";\nimport { injectable } from \"inversify\";\nimport { icons } from \"wax-prosemirror-components\";\n\n@injectable()\nexport default class Save extends Tools {\n title = \"Save changes\";\n content = icons.save;\n\n get run() {}\n\n get enable() {}\n}\n","import UndoService from \"./UndoService/UndoService\";\nimport RedoService from \"./RedoService/RedoService\";\nimport SaveService from \"./SaveService/SaveService\";\n\nexport default [new UndoService(), new RedoService()];\n","import Service from \"../Service\";\nimport BaseServices from \"./index\";\n\nclass BaseService extends Service {\n dependencies = BaseServices;\n}\n\nexport default BaseService;\n","import { toggleMark } from 'prosemirror-commands';\nimport { Commands } from 'wax-prosemirror-utilities';\nimport Tools from '../../lib/Tools';\nimport { injectable } from 'inversify';\nimport { icons } from 'wax-prosemirror-components';\n\nexport default\n@injectable()\nclass Code extends Tools {\n title = 'Toggle code';\n content = icons.code;\n\n get run() {\n return (state, dispatch) => {\n toggleMark(state.config.schema.marks.code)(state, dispatch);\n };\n }\n\n get active() {\n return state => {\n return Commands.markActive(state.config.schema.marks.code)(state);\n };\n }\n}\n","import { toggleMark } from 'prosemirror-commands';\nimport { codeMark } from 'wax-prosemirror-schema';\nimport Code from './Code';\nimport Service from '../../Service';\n\nclass CodeService extends Service {\n boot() {\n const shortCuts = this.container.get('ShortCuts');\n shortCuts.addShortCut({ 'Mod-`': toggleMark(this.schema.marks.code) });\n }\n\n register() {\n this.container.bind('Code').to(Code);\n const createMark = this.container.get('CreateMark');\n createMark(\n {\n code: codeMark,\n },\n { toWaxSchema: true },\n );\n }\n}\n\nexport default CodeService;\n","import { toggleMark } from \"prosemirror-commands\";\nimport { Commands } from \"wax-prosemirror-utilities\";\nimport Tools from \"../../lib/Tools\";\nimport { injectable } from \"inversify\";\nimport { icons } from \"wax-prosemirror-components\";\n\n@injectable()\nexport default class Strong extends Tools {\n title = \"Toggle strong\";\n content = icons.strong;\n\n get run() {\n return (state, dispatch) => {\n toggleMark(state.config.schema.marks.strong)(state, dispatch);\n };\n }\n\n get active() {\n return state => {\n return Commands.markActive(state.config.schema.marks.strong)(state);\n };\n }\n}\n","import Service from \"../../Service\";\nimport { toggleMark } from \"prosemirror-commands\";\nimport { strongMark } from \"wax-prosemirror-schema\";\nimport Strong from \"./Strong\";\n\nclass StrongService extends Service {\n boot() {\n const shortCuts = this.container.get(\"ShortCuts\");\n shortCuts.addShortCut({ \"Mod-b\": toggleMark(this.schema.marks.strong) });\n }\n\n register() {\n this.container.bind(\"Strong\").to(Strong);\n const createMark = this.container.get(\"CreateMark\");\n createMark(\n {\n strong: strongMark\n },\n { toWaxSchema: true }\n );\n }\n}\n\nexport default StrongService;\n","import { toggleMark } from 'prosemirror-commands';\nimport { Commands } from 'wax-prosemirror-utilities';\nimport Tools from '../../lib/Tools';\nimport { injectable } from 'inversify';\nimport { icons } from 'wax-prosemirror-components';\n\nexport default\n@injectable()\nclass Emphasis extends Tools {\n title = 'Toggle emphasis';\n content = icons.em;\n\n get run() {\n return (state, dispatch) => {\n toggleMark(state.config.schema.marks.em)(state, dispatch);\n };\n }\n\n get active() {\n return state => {\n return Commands.markActive(state.config.schema.marks.em)(state);\n };\n }\n}\n","import { toggleMark } from 'prosemirror-commands';\nimport { emphasisMark } from 'wax-prosemirror-schema';\nimport Emphasis from './Emphasis';\nimport Service from '../../Service';\n\nclass EmphasisService extends Service {\n boot() {\n const shortCuts = this.container.get('ShortCuts');\n shortCuts.addShortCut({ 'Mod-i': toggleMark(this.schema.marks.em) });\n }\n\n register() {\n this.container.bind('Emphasis').to(Emphasis);\n const createMark = this.container.get('CreateMark');\n createMark(\n {\n em: emphasisMark,\n },\n { toWaxSchema: true },\n );\n }\n}\n\nexport default EmphasisService;\n","import { toggleMark } from \"prosemirror-commands\";\nimport { Commands } from \"wax-prosemirror-utilities\";\nimport Tools from \"../../lib/Tools\";\nimport { injectable } from \"inversify\";\nimport { icons } from \"wax-prosemirror-components\";\n\n@injectable()\nexport default class Subscript extends Tools {\n title = \"Toggle subscript\";\n content = icons.subscript;\n\n get run() {\n return (state, dispatch) => {\n toggleMark(state.config.schema.marks.subscript)(state, dispatch);\n };\n }\n\n get active() {\n return state => {\n return Commands.markActive(state.config.schema.marks.subscript)(state);\n };\n }\n}\n","import Service from \"../../Service\";\nimport { subscriptMark } from \"wax-prosemirror-schema\";\nimport Subscript from \"./Subscript\";\n\nclass SubscriptService extends Service {\n boot() {}\n\n register() {\n this.container.bind(\"Subscript\").to(Subscript);\n const createMark = this.container.get(\"CreateMark\");\n createMark(\n {\n subscript: subscriptMark\n },\n { toWaxSchema: true }\n );\n }\n}\n\nexport default SubscriptService;\n","import { toggleMark } from \"prosemirror-commands\";\nimport { Commands } from \"wax-prosemirror-utilities\";\nimport Tools from \"../../lib/Tools\";\nimport { injectable } from \"inversify\";\nimport { icons } from \"wax-prosemirror-components\";\n\n@injectable()\nexport default class Superscript extends Tools {\n title = \"Toggle superscript\";\n content = icons.superscript;\n\n get run() {\n return (state, dispatch) => {\n toggleMark(state.config.schema.marks.superscript)(state, dispatch);\n };\n }\n\n get active() {\n return state => {\n return Commands.markActive(state.config.schema.marks.superscript)(state);\n };\n }\n}\n","import Service from \"../../Service\";\nimport { superscriptMark } from \"wax-prosemirror-schema\";\nimport Superscript from \"./Superscript\";\n\nclass SuperscriptService extends Service {\n boot() {}\n\n register() {\n this.container.bind(\"Superscript\").to(Superscript);\n const createMark = this.container.get(\"CreateMark\");\n createMark(\n {\n superscript: superscriptMark\n },\n { toWaxSchema: true }\n );\n }\n}\n\nexport default SuperscriptService;\n","import { toggleMark } from \"prosemirror-commands\";\nimport { Commands } from \"wax-prosemirror-utilities\";\nimport Tools from \"../../lib/Tools\";\nimport { injectable } from \"inversify\";\nimport { icons } from \"wax-prosemirror-components\";\n\n@injectable()\nexport default class StrikeThrough extends Tools {\n title = \"Toggle strikethrough\";\n content = icons.strikethrough;\n\n get run() {\n return (state, dispatch) => {\n toggleMark(state.config.schema.marks.strikethrough)(state, dispatch);\n };\n }\n\n get active() {\n return state => {\n return Commands.markActive(state.config.schema.marks.strikethrough)(\n state\n );\n };\n }\n}\n","import Service from \"../../Service\";\nimport { strikethroughMark } from \"wax-prosemirror-schema\";\nimport StrikeThrough from \"./StrikeThrough\";\nclass StrikeThroughService extends Service {\n register() {\n this.container.bind(\"StrikeThrough\").to(StrikeThrough);\n const createMark = this.container.get(\"CreateMark\");\n createMark(\n {\n strikethrough: strikethroughMark\n },\n { toWaxSchema: true }\n );\n }\n}\n\nexport default StrikeThroughService;\n","import { toggleMark } from \"prosemirror-commands\";\nimport { Commands } from \"wax-prosemirror-utilities\";\nimport Tools from \"../../lib/Tools\";\nimport { injectable } from \"inversify\";\nimport { icons } from \"wax-prosemirror-components\";\n\n@injectable()\nexport default class Underline extends Tools {\n title = \"Toggle underline\";\n content = icons.underline;\n\n get run() {\n return (state, dispatch) => {\n toggleMark(state.config.schema.marks.underline)(state, dispatch);\n };\n }\n\n get active() {\n return state => {\n return Commands.markActive(state.config.schema.marks.underline)(state);\n };\n }\n}\n","import Service from \"../../Service\";\nimport { toggleMark } from \"prosemirror-commands\";\nimport { underlineMark } from \"wax-prosemirror-schema\";\nimport Underline from \"./Underline\";\n\nclass UnderlineService extends Service {\n boot() {\n const shortCuts = this.container.get(\"ShortCuts\");\n shortCuts.addShortCut({ \"Mod-u\": toggleMark(this.schema.marks.underline) });\n }\n\n register() {\n this.container.bind(\"Underline\").to(Underline);\n const createMark = this.container.get(\"CreateMark\");\n createMark(\n {\n underline: underlineMark\n },\n { toWaxSchema: true }\n );\n }\n}\n\nexport default UnderlineService;\n","import { toggleMark } from \"prosemirror-commands\";\nimport { Commands } from \"wax-prosemirror-utilities\";\nimport Tools from \"../../lib/Tools\";\nimport { injectable } from \"inversify\";\nimport { icons } from \"wax-prosemirror-components\";\n\n@injectable()\nexport default class SmallCaps extends Tools {\n title = \"Toggle Small Caps\";\n content = icons.small_caps;\n\n get run() {\n return (state, dispatch) => {\n toggleMark(state.config.schema.marks.smallcaps)(state, dispatch);\n };\n }\n\n get active() {\n return state => {\n return Commands.markActive(state.config.schema.marks.smallcaps)(state);\n };\n }\n}\n","import Service from \"../../Service\";\nimport { smallcapsMark } from \"wax-prosemirror-schema\";\nimport SmallCaps from \"./SmallCaps\";\n\nclass SmallCapsService extends Service {\n register() {\n this.container.bind(\"SmallCaps\").to(SmallCaps);\n const createMark = this.container.get(\"CreateMark\");\n createMark(\n {\n smallcaps: smallcapsMark\n },\n { toWaxSchema: true }\n );\n }\n}\n\nexport default SmallCapsService;\n","import CodeService from \"./CodeService/CodeService\";\nimport StrongService from \"./StrongService/StrongService\";\nimport EmphasisService from \"./EmphasisService/EmphasisService\";\nimport SubscriptService from \"./SubscriptService/SubscriptService\";\nimport SuperscriptService from \"./SuperscriptService/SuperscriptService\";\nimport StrikeThroughService from \"./StrikeThroughService/StrikeThroughService\";\nimport UnderlineService from \"./UnderlineService/UnderlineService\";\nimport SmallCapsService from \"./SmallCapsService/SmallCapsService\";\n\nexport default [\n new CodeService(),\n new StrongService(),\n new EmphasisService(),\n new SubscriptService(),\n new SuperscriptService(),\n new StrikeThroughService(),\n new UnderlineService(),\n new SmallCapsService()\n];\n","import Service from \"../Service\";\nimport InlineServices from \"./index\";\n\nclass InlineAnnotationsService extends Service {\n dependencies = InlineServices;\n}\n\nexport default InlineAnnotationsService;\n","import Tools from '../../lib/Tools';\nimport { injectable } from 'inversify';\nimport { icons } from 'wax-prosemirror-components';\nimport { wrapInList } from 'prosemirror-schema-list';\nimport { Commands } from 'wax-prosemirror-utilities';\n\n@injectable()\nexport default class BulletList extends Tools {\n title = 'Wrap in bullet list';\n content = icons.bullet_list;\n\n get run() {\n return (state, dispatch) => {\n return wrapInList(state.config.schema.nodes.bulletlist)(state, dispatch);\n };\n }\n\n get enable() {\n return state => {\n return wrapInList(state.config.schema.nodes.bulletlist)(state);\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get active() {\n return state => {\n return Commands.blockActive(state.config.schema.nodes.bulletlist)(state);\n };\n }\n}\n","// import { wrapInList } from 'prosemirror-schema-list';\nimport { bulletListNode } from 'wax-prosemirror-schema';\nimport Service from '../../Service';\nimport BulletList from './BulletList';\n\nclass BulletListService extends Service {\n boot() {\n const shortCuts = this.container.get('ShortCuts');\n // shortCuts.addShortCut({\n // \"Shift-Ctrl-8\": wrapInList(this.schema.nodes.bulletlist)\n // });\n }\n\n register() {\n this.container.bind('BulletList').to(BulletList);\n const createNode = this.container.get('CreateNode');\n createNode(\n {\n bulletlist: bulletListNode,\n },\n { toWaxSchema: true },\n );\n }\n}\n\nexport default BulletListService;\n","import Tools from '../../lib/Tools';\nimport { injectable } from 'inversify';\nimport { icons } from 'wax-prosemirror-components';\nimport { wrapInList } from 'prosemirror-schema-list';\nimport { Commands } from 'wax-prosemirror-utilities';\n\n@injectable()\nexport default class OrderedList extends Tools {\n title = 'Wrap in ordered list';\n content = icons.ordered_list;\n\n get run() {\n return (state, dispatch) => {\n wrapInList(state.config.schema.nodes.orderedlist)(state, dispatch);\n };\n }\n\n get enable() {\n return state => {\n return wrapInList(state.config.schema.nodes.orderedlist)(state);\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get active() {\n return state => {\n return Commands.blockActive(state.config.schema.nodes.orderedlist)(state);\n };\n }\n}\n","import Service from \"../../Service\";\nimport { wrapInList } from \"prosemirror-schema-list\";\nimport { orderedListNode } from \"wax-prosemirror-schema\";\nimport OrderedList from \"./OrderedList\";\n\nclass OrderedListService extends Service {\n boot() {\n const shortCuts = this.container.get(\"ShortCuts\");\n // shortCuts.addShortCut({\n // \"Shift-Ctrl-9\": wrapInList(this.schema.nodes.orderedlist)\n // });\n }\n\n register() {\n this.container.bind(\"OrderedList\").to(OrderedList);\n const createNode = this.container.get(\"CreateNode\");\n createNode(\n {\n orderedlist: orderedListNode\n },\n { toWaxSchema: true }\n );\n }\n}\n\nexport default OrderedListService;\n","import { joinUp } from \"prosemirror-commands\";\nimport Tools from \"../../lib/Tools\";\nimport { injectable } from \"inversify\";\nimport { icons } from \"wax-prosemirror-components\";\n\n@injectable()\nexport default class JoinUp extends Tools {\n title = \"Join with above block\";\n content = icons.join_up;\n\n get run() {\n return joinUp;\n }\n\n get enable() {\n return joinUp;\n }\n\n select(state) {\n return joinUp(state);\n }\n}\n","import Service from \"../../Service\";\nimport JoinUp from \"./JoinUp\";\n\nclass JoinUpService extends Service {\n boot() {}\n\n register() {\n this.container.bind(\"JoinUp\").to(JoinUp);\n }\n}\n\nexport default JoinUpService;\n","import { lift } from \"prosemirror-commands\";\nimport Tools from \"../../lib/Tools\";\nimport { injectable } from \"inversify\";\nimport { icons } from \"wax-prosemirror-components\";\n\n@injectable()\nexport default class Lift extends Tools {\n title = \"Lift out of enclosing block\";\n content = icons.lift;\n\n get run() {\n return lift;\n }\n\n get enable() {\n return lift;\n }\n}\n","import Service from \"../../Service\";\nimport { liftListItem, sinkListItem } from \"prosemirror-schema-list\";\nimport Lift from \"./Lift\";\n\nclass LiftService extends Service {\n boot() {\n const shortCuts = this.container.get(\"ShortCuts\");\n // shortCuts.addShortCut({\n // \"Mod-[\": liftListItem(this.schema.nodes.list_item),\n // \"Mod-]\": sinkListItem(this.schema.nodes.list_item)\n // });\n }\n\n register() {\n this.container.bind(\"Lift\").to(Lift);\n }\n}\n\nexport default LiftService;\n","import Service from \"../../Service\";\nimport { listItemNode } from \"wax-prosemirror-schema\";\n\nclass ListItemService extends Service {\n boot() {}\n\n register() {\n const createNode = this.container.get(\"CreateNode\");\n createNode(\n {\n list_item: listItemNode\n },\n { toWaxSchema: true }\n );\n }\n}\n\nexport default ListItemService;\n","import BulletListService from \"./BulletListService/BulletListService\";\nimport OrderedListService from \"./OrderedListService/OrderedListService\";\nimport JoinUpService from \"./JoinUpService/JoinUpService\";\nimport LiftService from \"./LiftService/LiftService\";\nimport ListItemService from \"./ListItemService/ListItemService\";\n\nexport default [\n new BulletListService(),\n new OrderedListService(),\n new JoinUpService(),\n new LiftService(),\n new ListItemService()\n];\n","import Service from \"../Service\";\nimport ListsServices from \"./index\";\n\nclass ListsService extends Service {\n dependencies = ListsServices;\n}\n\nexport default ListsService;\n","import { Commands } from 'wax-prosemirror-utilities';\nimport { injectable } from 'inversify';\nimport { icons } from 'wax-prosemirror-components';\nimport Tools from '../../lib/Tools';\n\nexport default\n@injectable()\nclass Table extends Tools {\n title = 'Insert table';\n content = icons.table;\n\n get run() {\n return (state, dispatch) => {\n return Commands.createTable(state, dispatch);\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return Commands.canInsert(state.config.schema.nodes.table)(state);\n };\n }\n}\n","import Service from \"../../Service\";\nimport { tableNodes, goToNextCell } from \"prosemirror-tables\";\nimport Table from \"./Table\";\n\nclass InsertTableService extends Service {\n boot() {\n const shortCuts = this.container.get(\"ShortCuts\");\n shortCuts.addShortCut({\n Tab: goToNextCell(1),\n \"Shift-Tab\": goToNextCell(-1)\n });\n }\n\n register() {\n this.container.bind(\"Table\").to(Table);\n\n const { table, table_row, table_cell, table_header } = tableNodes({\n tableGroup: \"block\",\n cellContent: \"block+\"\n });\n const createNode = this.container.get(\"CreateNode\");\n\n createNode({\n table\n });\n createNode({\n table_row\n });\n createNode({\n table_cell\n });\n createNode({\n table_header\n });\n }\n}\n\nexport default InsertTableService;\n","import React from \"react\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { injectable } from \"inversify\";\nimport { isEmpty } from \"lodash\";\nimport { TableDropDown } from \"wax-prosemirror-components\";\nimport { addColumnBefore } from \"prosemirror-tables\";\nimport { Commands } from \"wax-prosemirror-utilities\";\nimport Tools from \"../../lib/Tools\";\n\n@injectable()\nexport default class TableDropDownOptions extends Tools {\n title = \"Select Options\";\n content = \"table\";\n\n get run() {\n return () => {\n return true;\n };\n }\n\n get enable() {\n return state => {\n return Commands.canInsert(state.config.schema.nodes.table)(state);\n };\n }\n\n select(state) {\n return addColumnBefore(state);\n }\n\n renderTool(view) {\n if (isEmpty(view)) return null;\n return this._isDisplayed ? (\n <TableDropDown key={uuidv4()} item={this.toJSON()} view={view} />\n ) : null;\n }\n}\n","import Service from \"../../Service\";\nimport TableDropDownOptions from \"./TableDropDownOptions\";\n\nclass EditTableService extends Service {\n boot() {}\n\n register() {\n this.container.bind(\"TableDropDownOptions\").to(TableDropDownOptions);\n }\n}\n\nexport default EditTableService;\n","import InsertTableService from \"./InsertTableService/InsertTableService\";\nimport EditTableService from \"./EditTableService/EditTableService\";\n\nexport default [new InsertTableService(), new EditTableService()];\n","import Service from \"../Service\";\nimport TablesServices from \"./index\";\n\nclass TablesService extends Service {\n dependencies = TablesServices;\n}\n\nexport default TablesService;\n","import Tools from '../../lib/Tools';\nimport { injectable } from 'inversify';\nimport { Commands } from 'wax-prosemirror-utilities';\n\n@injectable()\nclass ExtractPoetry extends Tools {\n title = 'Change to Extract Poetry';\n content = 'Extract Poetry';\n\n get run() {\n return (state, dispatch) => {\n Commands.setBlockType(state.config.schema.nodes.extractPoetry, {\n class: 'extract-poetry',\n })(state, dispatch);\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return Commands.setBlockType(state.config.schema.nodes.extractPoetry)(\n state,\n );\n };\n }\n}\nexport default ExtractPoetry;\n","import Service from \"../../Service\";\nimport { extractPoetryNode } from \"wax-prosemirror-schema\";\nimport ExtractPoetry from \"./ExtractPoetry\";\n\nclass ExtractPoetryService extends Service {\n boot() {}\n\n register() {\n this.container.bind(\"ExtractPoetry\").to(ExtractPoetry);\n const createNode = this.container.get(\"CreateNode\");\n createNode(\n {\n extractPoetry: extractPoetryNode\n },\n { toWaxSchema: true }\n );\n }\n}\n\nexport default ExtractPoetryService;\n","import Tools from '../../lib/Tools';\nimport { injectable } from 'inversify';\nimport { Commands } from 'wax-prosemirror-utilities';\n\n@injectable()\nclass ExtractProse extends Tools {\n title = 'Change to Extract Prose';\n content = 'Extract Prose';\n\n get run() {\n return (state, dispatch) => {\n Commands.setBlockType(state.config.schema.nodes.extractProse, {\n class: 'extract-prose',\n })(state, dispatch);\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return Commands.setBlockType(state.config.schema.nodes.extractProse)(\n state,\n );\n };\n }\n}\nexport default ExtractProse;\n","import Service from \"../../Service\";\nimport { extractProseNode } from \"wax-prosemirror-schema\";\nimport ExtractProse from \"./ExtractProse\";\n\nclass ExtractProseService extends Service {\n boot() {}\n\n register() {\n this.container.bind(\"ExtractProse\").to(ExtractProse);\n const createNode = this.container.get(\"CreateNode\");\n createNode(\n {\n extractProse: extractProseNode\n },\n { toWaxSchema: true }\n );\n }\n}\n\nexport default ExtractProseService;\n","import Tools from '../../lib/Tools';\nimport { injectable } from 'inversify';\nimport { Commands } from 'wax-prosemirror-utilities';\n\n@injectable()\nclass ParagraphContinued extends Tools {\n title = 'Change to Paragraph Continued';\n content = 'Paragraph Continued';\n\n get run() {\n return (state, dispatch) => {\n Commands.setBlockType(state.config.schema.nodes.paragraphCont, {\n class: 'paragraph-cont',\n })(state, dispatch);\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return Commands.setBlockType(state.config.schema.nodes.paragraphCont)(\n state,\n );\n };\n }\n}\n\nexport default ParagraphContinued;\n","import Service from \"../../Service\";\nimport { paragraphContNode } from \"wax-prosemirror-schema\";\nimport ParagraphContinued from \"./ParagraphContinued\";\n\nclass ParagraphContinuedService extends Service {\n boot() {}\n\n register() {\n this.container.bind(\"ParagraphContinued\").to(ParagraphContinued);\n const createNode = this.container.get(\"CreateNode\");\n createNode(\n {\n paragraphCont: paragraphContNode\n },\n { toWaxSchema: true }\n );\n }\n}\n\nexport default ParagraphContinuedService;\n","import Tools from '../../lib/Tools';\nimport { injectable } from 'inversify';\nimport { Commands } from 'wax-prosemirror-utilities';\n\n@injectable()\nexport default class Paragraph extends Tools {\n title = 'Change to Paragraph';\n content = 'Paragraph';\n\n get run() {\n return (state, dispatch) => {\n Commands.setBlockType(state.config.schema.nodes.paragraph, {\n class: 'paragraph',\n })(state, dispatch);\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return Commands.setBlockType(state.config.schema.nodes.paragraph)(state);\n };\n }\n}\n","import Service from \"../../Service\";\nimport Paragraph from \"./Paragraph\";\n\nclass ParagraphService extends Service {\n boot() {}\n\n register() {\n this.container.bind(\"Paragraph\").to(Paragraph);\n }\n}\n\nexport default ParagraphService;\n","import Tools from '../../lib/Tools';\nimport { injectable } from 'inversify';\nimport { Commands } from 'wax-prosemirror-utilities';\n\n@injectable()\nclass SourceNote extends Tools {\n title = 'Change to Source Note';\n content = 'Source Note';\n\n get run() {\n return (state, dispatch) => {\n Commands.setBlockType(state.config.schema.nodes.sourceNote, {\n class: 'source-note',\n })(state, dispatch);\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return Commands.setBlockType(state.config.schema.nodes.sourceNote)(state);\n };\n }\n}\nexport default SourceNote;\n","import Service from \"../../Service\";\nimport { sourceNoteNode } from \"wax-prosemirror-schema\";\nimport SourceNote from \"./SourceNote\";\n\nclass SourceNoteService extends Service {\n boot() {}\n\n register() {\n this.container.bind(\"SourceNote\").to(SourceNote);\n const createNode = this.container.get(\"CreateNode\");\n createNode(\n {\n sourceNote: sourceNoteNode\n },\n { toWaxSchema: true }\n );\n }\n}\n\nexport default SourceNoteService;\n","import Tools from '../../lib/Tools';\nimport { injectable } from 'inversify';\nimport { wrapIn } from 'prosemirror-commands';\n\n@injectable()\nclass BlockQuote extends Tools {\n title = 'Change to Block Quote';\n content = 'Block Quote';\n\n get run() {\n return (state, dispatch) => {\n wrapIn(state.config.schema.nodes.blockquote)(state, dispatch);\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return wrapIn(state.config.schema.nodes.blockquote)(state);\n };\n }\n}\nexport default BlockQuote;\n","import Service from \"../../Service\";\nimport { blockQuoteNode } from \"wax-prosemirror-schema\";\nimport BlockQuote from \"./BlockQuote\";\n\nclass BlockQuoteService extends Service {\n boot() {}\n\n register() {\n this.container.bind(\"BlockQuote\").to(BlockQuote);\n const createNode = this.container.get(\"CreateNode\");\n createNode({\n blockquote: blockQuoteNode\n });\n }\n}\n\nexport default BlockQuoteService;\n","import ExtractPoetryService from \"./ExtractPoetryService/ExtractPoetryService\";\nimport ExtractProseService from \"./ExtractProseService/ExtractProseService\";\nimport ParagraphContinuedService from \"./ParagraphContinuedService/ParagraphContinuedService\";\nimport ParagraphService from \"./ParagraphService/ParagraphService\";\nimport SourceNoteService from \"./SourceNoteService/SourceNoteService\";\nimport BlockQuoteService from \"./BlockQuoteService/BlockQuoteService\";\n\nexport default [\n new ExtractPoetryService(),\n new ExtractProseService(),\n new ParagraphContinuedService(),\n new ParagraphService(),\n new SourceNoteService(),\n new BlockQuoteService()\n];\n","import Service from \"../Service\";\nimport TextServices from \"./index\";\n\nclass TextBlockLevelService extends Service {\n dependencies = TextServices;\n}\n\nexport default TextBlockLevelService;\n","import { injectable } from 'inversify';\nimport { Commands } from 'wax-prosemirror-utilities';\nimport Tools from '../../lib/Tools';\n\n@injectable()\nclass Author extends Tools {\n title = 'Change to Author';\n content = 'Author';\n\n get run() {\n return (state, dispatch) => {\n Commands.setBlockType(state.config.schema.nodes.author, {\n class: 'author',\n })(state, dispatch);\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return Commands.setBlockType(state.config.schema.nodes.author)(state);\n };\n }\n}\n\nexport default Author;\n","import { authorNode } from 'wax-prosemirror-schema';\nimport Service from '../../Service';\nimport Author from './Author';\n\nclass AuthorService extends Service {\n // boot() {}\n\n register() {\n this.container.bind('Author').to(Author);\n const createNode = this.container.get('CreateNode');\n createNode(\n {\n author: authorNode,\n },\n { toWaxSchema: true },\n );\n }\n}\n\nexport default AuthorService;\n","import { injectable } from 'inversify';\nimport { Commands } from 'wax-prosemirror-utilities';\nimport Tools from '../../lib/Tools';\n\n@injectable()\nclass EpigraphPoetry extends Tools {\n title = 'Change to Epigraph Poetry';\n content = 'Epigraph Poetry';\n\n get run() {\n return (state, dispatch) => {\n Commands.setBlockType(state.config.schema.nodes.epigraphPoetry, {\n class: 'epigraph-poetry',\n })(state, dispatch);\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return Commands.setBlockType(state.config.schema.nodes.epigraphPoetry)(\n state,\n );\n };\n }\n}\n\nexport default EpigraphPoetry;\n","import { epigraphPoetryNode } from 'wax-prosemirror-schema';\nimport EpigraphPoetry from './EpigraphPoetry';\nimport Service from '../../Service';\n\nclass EpigraphPoetryService extends Service {\n // boot() {}\n\n register() {\n this.container.bind('EpigraphPoetry').to(EpigraphPoetry);\n const createNode = this.container.get('CreateNode');\n createNode(\n {\n epigraphPoetry: epigraphPoetryNode,\n },\n { toWaxSchema: true },\n );\n }\n}\n\nexport default EpigraphPoetryService;\n","import { injectable } from 'inversify';\nimport { Commands } from 'wax-prosemirror-utilities';\nimport Tools from '../../lib/Tools';\n\nexport default\n@injectable()\nclass EpigraphProse extends Tools {\n title = 'Change to Epigraph Prose';\n content = 'Epigraph Prose';\n\n get run() {\n return (state, dispatch) => {\n Commands.setBlockType(state.config.schema.nodes.epigraphProse, {\n class: 'epigraph-prose',\n })(state, dispatch);\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return Commands.setBlockType(state.config.schema.nodes.epigraphProse)(\n state,\n );\n };\n }\n}\n","import { epigraphProseNode } from 'wax-prosemirror-schema';\nimport EpigraphProse from './EpigraphProse';\nimport Service from '../../Service';\n\nclass EpigraphProseService extends Service {\n boot() {}\n\n register() {\n this.container.bind('EpigraphProse').to(EpigraphProse);\n const createNode = this.container.get('CreateNode');\n createNode(\n {\n epigraphProse: epigraphProseNode,\n },\n { toWaxSchema: true },\n );\n }\n}\n\nexport default EpigraphProseService;\n","import { injectable } from 'inversify';\nimport { Commands } from 'wax-prosemirror-utilities';\nimport Tools from '../../lib/Tools';\n\nexport default\n@injectable()\nclass Heading1 extends Tools {\n title = 'Change to heading level 1';\n content = 'Heading 1';\n\n get run() {\n return (state, dispatch) => {\n Commands.setBlockType(state.config.schema.nodes.heading, { level: 1 })(\n state,\n dispatch,\n );\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return Commands.setBlockType(state.config.schema.nodes.heading, {\n level: 1,\n })(state);\n };\n }\n}\n","import { injectable } from 'inversify';\nimport { Commands } from 'wax-prosemirror-utilities';\nimport Tools from '../../lib/Tools';\n\nexport default\n@injectable()\nclass Heading2 extends Tools {\n title = 'Change to heading level 2';\n content = 'Heading 2';\n\n get run() {\n return (state, dispatch) => {\n Commands.setBlockType(state.config.schema.nodes.heading, { level: 2 })(\n state,\n dispatch,\n );\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return Commands.setBlockType(state.config.schema.nodes.heading, {\n level: 2,\n })(state);\n };\n }\n}\n","import { injectable } from 'inversify';\nimport { Commands } from 'wax-prosemirror-utilities';\nimport Tools from '../../lib/Tools';\n\nexport default\n@injectable()\nclass Heading3 extends Tools {\n title = 'Change to heading level 3';\n content = 'Heading 3';\n\n get run() {\n return (state, dispatch) => {\n Commands.setBlockType(state.config.schema.nodes.heading, { level: 3 })(\n state,\n dispatch,\n );\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return Commands.setBlockType(state.config.schema.nodes.heading, {\n level: 3,\n })(state);\n };\n }\n}\n","import { headingNode } from 'wax-prosemirror-schema';\nimport Heading1 from './Heading1';\nimport Heading2 from './Heading2';\nimport Heading3 from './Heading3';\nimport Service from '../../Service';\n\nclass HeadingService extends Service {\n // boot() {}\n\n register() {\n this.container.bind('Heading1').to(Heading1);\n this.container.bind('Heading2').to(Heading2);\n this.container.bind('Heading3').to(Heading3);\n const createNode = this.container.get('CreateNode');\n createNode(\n {\n heading: headingNode,\n },\n { toWaxSchema: true },\n );\n }\n}\n\nexport default HeadingService;\n","import Tools from '../../lib/Tools';\nimport { injectable } from 'inversify';\nimport { Commands } from 'wax-prosemirror-utilities';\n\n@injectable()\nexport default class SubTitle extends Tools {\n title = 'Change to Subtitle';\n content = 'Subtitle';\n\n get run() {\n return (state, dispatch) => {\n Commands.setBlockType(state.config.schema.nodes.subtitle, {\n class: 'cst',\n })(state, dispatch);\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return Commands.setBlockType(state.config.schema.nodes.subtitle)(state);\n };\n }\n}\n","import Service from \"../../Service\";\nimport { subTitleNode } from \"wax-prosemirror-schema\";\nimport SubTitle from \"./SubTitle\";\n\nclass SubTitleService extends Service {\n boot() {}\n\n register() {\n this.container.bind(\"SubTitle\").to(SubTitle);\n const createNode = this.container.get(\"CreateNode\");\n createNode(\n {\n subtitle: subTitleNode\n },\n { toWaxSchema: true }\n );\n }\n}\n\nexport default SubTitleService;\n","import Tools from '../../lib/Tools';\nimport { injectable } from 'inversify';\nimport { Commands } from 'wax-prosemirror-utilities';\n\n@injectable()\nexport default class Title extends Tools {\n title = 'Change to Title';\n content = 'Title';\n\n get run() {\n return (state, dispatch) => {\n Commands.setBlockType(state.config.schema.nodes.title, {\n class: 'title',\n })(state, dispatch);\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return Commands.setBlockType(state.config.schema.nodes.title)(state);\n };\n }\n}\n","import Service from \"../../Service\";\nimport { titleNode } from \"wax-prosemirror-schema\";\nimport Title from \"./Title\";\n\nclass TitleService extends Service {\n boot() {}\n\n register() {\n this.container.bind(\"Title\").to(Title);\n const createNode = this.container.get(\"CreateNode\");\n createNode(\n {\n title: titleNode\n },\n { toWaxSchema: true }\n );\n }\n}\n\nexport default TitleService;\n","import AuthorService from \"./AuthorService/AuthorService\";\nimport EpigraphPoetryService from \"./EpigraphPoetryService/EpigraphPoetryService\";\nimport EpigraphProseService from \"./EpigraphProseService/EpigraphProseService\";\nimport HeadingService from \"./HeadingService/HeadingService\";\nimport SubTitleService from \"./SubTitleService/SubTitleService\";\nimport TitleService from \"./TitleService/TitleService\";\n\nexport default [\n new AuthorService(),\n new EpigraphProseService(),\n new EpigraphPoetryService(),\n new HeadingService(),\n new SubTitleService(),\n new TitleService()\n];\n","import Service from \"../Service\";\nimport DisplayServices from \"./index\";\n\nclass DisplayBlockLevelService extends Service {\n // register() {\n // this.config.pushToArray(\"services\", DisplayServices);\n // }\n dependencies = DisplayServices;\n}\n\nexport default DisplayBlockLevelService;\n","import Tools from '../lib/Tools';\nimport { injectable } from 'inversify';\nimport { icons } from 'wax-prosemirror-components';\nimport { Fragment } from 'prosemirror-model';\nimport { v4 as uuidv4 } from 'uuid';\n\n@injectable()\nexport default class Note extends Tools {\n title = 'Insert Note';\n content = icons.footnote;\n\n get run() {\n return (state, dispatch) => {\n let { empty, $from, $to } = state.selection,\n content = Fragment.empty;\n if (!empty && $from.sameParent($to) && $from.parent.inlineContent)\n content = $from.parent.content.cut(\n $from.parentOffset,\n $to.parentOffset,\n );\n const footnote = state.config.schema.nodes.footnote.create(\n { id: uuidv4() },\n content,\n );\n dispatch(state.tr.replaceSelectionWith(footnote));\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return true;\n };\n }\n}\n","import { forEach } from \"lodash\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { DocumentHelpers } from \"wax-prosemirror-utilities\";\n\nconst transformPasted = (slice, view) => {\n const { content } = slice;\n const commentNodes = DocumentHelpers.findChildrenByMark(\n content,\n view.state.schema.marks.comment,\n true\n );\n\n const allComments = [];\n\n commentNodes.map(node => {\n node.node.marks.map(comment => {\n if (comment.type.name === \"comment\") {\n allComments.push(comment);\n }\n });\n });\n\n let groupedCommentsById = allComments.reduce((obj, mark) => {\n obj[mark.attrs.id] = [...(obj[mark.attrs.id] || []), mark];\n return obj;\n }, {});\n\n forEach(Object.keys(groupedCommentsById), key => {\n let id = uuidv4();\n forEach(groupedCommentsById[key], comment => {\n comment.attrs.id = id;\n });\n });\n\n return slice;\n};\n\nexport default transformPasted;\n","/* eslint react/prop-types: 0 */\nimport React, { useEffect, useRef, useContext } from 'react';\nimport { filter } from 'lodash';\nimport { EditorView } from 'prosemirror-view';\nimport { EditorState } from 'prosemirror-state';\nimport { StepMap } from 'prosemirror-transform';\nimport { baseKeymap } from 'prosemirror-commands';\nimport { keymap } from 'prosemirror-keymap';\nimport { undo, redo } from 'prosemirror-history';\nimport { WaxContext } from 'wax-prosemirror-core';\nimport { NoteEditorContainer } from 'wax-prosemirror-components';\nimport { DocumentHelpers } from 'wax-prosemirror-utilities';\nimport trackedTransaction from '../TrackChangeService/track-changes/trackedTransaction';\nimport transformPasted from './helpers/TransformPasted';\n\nexport default ({ node, view }) => {\n const editorRef = useRef();\n const context = useContext(WaxContext);\n const noteId = node.attrs.id;\n let noteView;\n useEffect(() => {\n noteView = new EditorView(\n { mount: editorRef.current },\n {\n state: EditorState.create({\n doc: node,\n plugins: [keymap(createKeyBindings()), ...context.app.getPlugins()],\n }),\n // This is the magic part\n dispatchTransaction,\n handleDOMEvents: {\n mousedown: () => {\n context.updateView({}, noteId);\n\n // Kludge to prevent issues due to the fact that the whole\n // footnote is node-selected (and thus DOM-selected) when\n // the parent editor is focused.\n if (noteView.hasFocus()) noteView.focus();\n },\n },\n transformPasted: slice => {\n return transformPasted(slice, noteView);\n },\n },\n );\n\n // Set Each note into Wax's Context\n context.updateView(\n {\n [noteId]: noteView,\n },\n noteId,\n );\n if (context.view[noteId]) {\n context.view[noteId].focus();\n }\n }, []);\n\n const dispatchTransaction = transaction => {\n // const tr = TrackChange.enabled\n // ? trackedTransaction(transaction, view.state, user)\n // : transaction;\n\n const { state, transactions } = noteView.state.applyTransaction(\n transaction,\n );\n noteView.updateState(state);\n\n const allNotes = DocumentHelpers.findChildrenByType(\n view.state.doc,\n view.state.schema.nodes.footnote,\n true,\n );\n\n const noteFound = filter(allNotes, {\n node: { attrs: { id: noteId } },\n });\n\n // TODO Remove timeout and use state to check if noteView has changed\n setTimeout(() => {\n context.updateView({}, noteId);\n }, 20);\n\n if (!transaction.getMeta('fromOutside')) {\n const outerTr = view.state.tr;\n const offsetMap = StepMap.offset(noteFound[0].pos + 1);\n for (let i = 0; i < transactions.length; i + 1) {\n const { steps } = transactions[i];\n for (let j = 0; j < steps.length; j + 1)\n outerTr.step(steps[j].map(offsetMap));\n }\n\n if (outerTr.docChanged)\n view.dispatch(outerTr.setMeta('outsideView', 'notes'));\n }\n };\n\n const createKeyBindings = () => {\n const keys = getKeys();\n Object.keys(baseKeymap).forEach(key => {\n keys[key] = baseKeymap[key];\n });\n return keys;\n };\n\n const getKeys = () => {\n return {\n 'Mod-z': () => undo(view.state, view.dispatch),\n 'Mod-y': () => redo(view.state, view.dispatch),\n // 'Mod-u': () => Commands.markActive(noteView.state.config.schema.marks.underline)(noteView.state),\n };\n };\n\n if (context.view[noteId]) {\n const { state } = context.view[noteId];\n const start = node.content.findDiffStart(state.doc.content);\n if (start != null) {\n let { a: endA, b: endB } = node.content.findDiffEnd(state.doc.content);\n const overlap = start - Math.min(endA, endB);\n if (overlap > 0) {\n endA += overlap;\n endB += overlap;\n }\n context.view[noteId].dispatch(\n state.tr\n .replace(start, endB, node.slice(start, endA))\n .setMeta('fromOutside', true),\n );\n }\n }\n\n return <NoteEditorContainer ref={editorRef} />;\n};\n","import React, { Fragment } from \"react\";\nimport Editor from \"./Editor\";\n\nexport default ({ notes, view }) => {\n return (\n <Fragment>\n {notes.map(note => (\n <Editor key={note.node.attrs.id} node={note.node} view={view} />\n ))}\n </Fragment>\n );\n};\n","import React, {\n useContext,\n useState,\n useEffect,\n useMemo,\n Fragment\n} from \"react\";\nimport { WaxContext } from \"wax-prosemirror-core\";\nimport { DocumentHelpers } from \"wax-prosemirror-utilities\";\nimport NoteEditor from \"./NoteEditor\";\n\nexport default () => {\n const { view: { main } } = useContext(WaxContext);\n const [notes, setNotes] = useState([]);\n useEffect(\n () => {\n setNotes(updateNotes(main));\n },\n\n [JSON.stringify(updateNotes(main))]\n );\n\n const noteComponent = useMemo(\n () => <NoteEditor notes={notes} view={main} />,\n [notes]\n );\n return <Fragment>{noteComponent}</Fragment>;\n};\nconst updateNotes = view => {\n if (view) {\n return DocumentHelpers.findChildrenByType(\n view.state.doc,\n view.state.schema.nodes.footnote,\n true\n );\n }\n return [];\n};\n","import Service from \"../Service\";\nimport { footNoteNode } from \"wax-prosemirror-schema\";\nimport { CommentBubbleComponent } from \"wax-prosemirror-components\";\nimport Note from \"./Note\";\nimport NoteComponent from \"./NoteComponent\";\n\nclass NoteService extends Service {\n name = \"NoteService\";\n\n boot() {\n const layout = this.container.get(\"Layout\");\n const createOverlay = this.container.get(\"CreateOverlay\");\n layout.addComponent(\"notesArea\", NoteComponent);\n createOverlay(\n CommentBubbleComponent,\n {\n showComment: activeViewId => activeViewId !== \"main\",\n group: \"notes\"\n },\n {\n markType: \"\",\n followCursor: false,\n selection: true\n }\n );\n }\n\n register() {\n const createNode = this.container.get(\"CreateNode\");\n this.container.bind(\"Note\").to(Note);\n\n createNode({\n footnote: footNoteNode\n });\n }\n}\n\nexport default NoteService;\n","import { commentMark } from 'wax-prosemirror-schema';\nimport { RightArea, CommentBubbleComponent } from 'wax-prosemirror-components';\nimport { CommentPlugin } from 'wax-prosemirror-plugins';\nimport Service from '../Service';\n\nconst PLUGIN_KEY = 'commentPlugin';\n\nexport default class CommentsService extends Service {\n boot() {\n this.app.PmPlugins.add(PLUGIN_KEY, CommentPlugin(PLUGIN_KEY));\n const createOverlay = this.container.get('CreateOverlay');\n const layout = this.container.get('Layout');\n createOverlay(\n CommentBubbleComponent,\n {\n showComment: activeViewId => activeViewId === 'main',\n group: 'main',\n },\n {\n markType: '',\n followCursor: false,\n selection: true,\n },\n );\n layout.addComponent('rightArea', RightArea);\n }\n\n register() {\n const createMark = this.container.get('CreateMark');\n createMark(\n {\n comment: commentMark,\n },\n { toWaxSchema: true },\n );\n }\n}\n","import { injectable } from 'inversify';\nimport { icons } from 'wax-prosemirror-components';\nimport { setBlockType } from 'prosemirror-commands';\nimport Tools from '../lib/Tools';\n\n@injectable()\nclass CodeBlockTool extends Tools {\n title = 'Insert Code Block';\n content = icons.code_block;\n\n get run() {\n return (state, dispatch) => {\n setBlockType(state.config.schema.nodes.code_block)(state, dispatch);\n };\n }\n\n select = (state, activeViewId) => {\n if (activeViewId !== 'main') return false;\n return true;\n };\n\n get enable() {\n return state => {\n return setBlockType(state.config.schema.nodes.code_block)(state);\n };\n }\n}\n\nexport default CodeBlockTool;\n","import { highlightPlugin } from 'wax-prosemirror-plugins';\nimport 'highlight.js/styles/github.css';\n\nimport { codeBlockNode } from 'wax-prosemirror-schema';\nimport Service from '../Service';\nimport CodeBlockTool from './CodeBlockTool';\n\nexport default class CodeBlockService extends Service {\n boot() {\n this.app.PmPlugins.add('highlightPlugin', highlightPlugin());\n }\n\n register() {\n this.container.bind('CodeBlockTool').to(CodeBlockTool);\n const createNode = this.container.get('CreateNode');\n\n createNode({\n code_block: codeBlockNode,\n });\n }\n}\n","import { injectable, inject } from 'inversify';\nimport ToolGroup from '../../lib/ToolGroup';\n\n@injectable()\nclass Base extends ToolGroup {\n tools = [];\n constructor(@inject('Undo') undo, @inject('Redo') redo) {\n super();\n this.tools = [undo, redo];\n }\n}\n\nexport default Base;\n","import Service from '../../Service';\nimport Base from './Base';\n\nclass BaseToolGroupService extends Service {\n register() {\n this.container.bind('Base').to(Base);\n }\n}\n\nexport default BaseToolGroupService;\n","import { injectable, inject } from \"inversify\";\nimport ToolGroup from \"../../lib/ToolGroup\";\n\n@injectable()\nclass Annotations extends ToolGroup {\n tools = [];\n constructor(\n @inject(\"Code\") code,\n @inject(\"Emphasis\") emphasis,\n @inject(\"Link\") link,\n @inject(\"StrikeThrough\") strikethrough,\n @inject(\"Strong\") strong,\n @inject(\"Subscript\") subscript,\n @inject(\"Superscript\") superscript,\n @inject(\"Underline\") underline,\n @inject(\"SmallCaps\") smallcaps\n ) {\n super();\n this.tools = [\n strong,\n emphasis,\n code,\n link,\n strikethrough,\n underline,\n subscript,\n superscript,\n smallcaps\n ];\n }\n}\n\nexport default Annotations;\n","import Service from \"../../Service\";\nimport Annotations from \"./Annotations\";\n\nclass AnnotationToolGroupService extends Service {\n name = \"AnnotationToolGroupService\";\n\n register() {\n this.container.bind(\"Annotations\").to(Annotations);\n }\n}\n\nexport default AnnotationToolGroupService;\n","import { injectable, inject } from \"inversify\";\nimport ToolGroup from \"../../lib/ToolGroup\";\n\n@injectable()\nclass Lists extends ToolGroup {\n tools = [];\n constructor(\n @inject(\"OrderedList\") orderedlist,\n @inject(\"BulletList\") bulletlist,\n @inject(\"JoinUp\") joinup,\n @inject(\"Lift\") lift\n ) {\n super();\n this.tools = [orderedlist, bulletlist, joinup, lift];\n }\n}\n\nexport default Lists;\n","import Service from '../../Service';\nimport Lists from './Lists';\n\nclass ListToolGroupService extends Service {\n register() {\n this.container.bind('Lists').to(Lists);\n }\n}\n\nexport default ListToolGroupService;\n","import { injectable, inject } from \"inversify\";\nimport ToolGroup from \"../../lib/ToolGroup\";\n\n@injectable()\nclass Images extends ToolGroup {\n tools = [];\n constructor(@inject(\"Image\") image) {\n super();\n this.tools = [image];\n }\n}\n\nexport default Images;\n","import Service from '../../Service';\nimport Images from './Images';\n\nclass ImageToolGroupService extends Service {\n register() {\n this.container.bind('Images').to(Images);\n }\n}\n\nexport default ImageToolGroupService;\n","import { injectable, inject } from \"inversify\";\nimport ToolGroup from \"../../lib/ToolGroup\";\n\n@injectable()\nclass Tables extends ToolGroup {\n tools = [];\n constructor(\n @inject(\"Table\") table,\n @inject(\"TableDropDownOptions\") tableDropDownOptions\n ) {\n super();\n this.tools = [table, tableDropDownOptions];\n }\n}\n\nexport default Tables;\n","import Service from '../../Service';\nimport Tables from './Tables';\n\nclass TableToolGroupService extends Service {\n register() {\n this.container.bind('Tables').to(Tables);\n }\n}\n\nexport default TableToolGroupService;\n","import React from \"react\";\nimport { injectable, inject } from \"inversify\";\nimport { LeftMenuTitle } from \"wax-prosemirror-components\";\nimport ToolGroup from \"../../lib/ToolGroup\";\n\n@injectable()\nclass Display extends ToolGroup {\n tools = [];\n title = <LeftMenuTitle title=\"Display\" />;\n\n constructor(\n @inject(\"Author\") author,\n @inject(\"Title\") title,\n @inject(\"SubTitle\") subtitle,\n @inject(\"EpigraphProse\") epigraphprose,\n @inject(\"EpigraphPoetry\") epigraphpoetry,\n @inject(\"Heading1\") heading1,\n @inject(\"Heading2\") heading2,\n @inject(\"Heading3\") heading3\n ) {\n super();\n this.tools = [\n title,\n author,\n subtitle,\n epigraphprose,\n epigraphpoetry,\n heading1,\n heading2,\n heading3\n ];\n }\n}\n\nexport default Display;\n","import Service from '../../Service';\nimport Display from './Display';\n\nclass DisplayToolGroupService extends Service {\n register() {\n this.container.bind('Display').to(Display);\n }\n}\n\nexport default DisplayToolGroupService;\n","import React from \"react\";\nimport { injectable, inject } from \"inversify\";\nimport { LeftMenuTitle } from \"wax-prosemirror-components\";\nimport ToolGroup from \"../../lib/ToolGroup\";\n\n@injectable()\nclass Text extends ToolGroup {\n tools = [];\n title = <LeftMenuTitle title=\"Text\" />;\n\n constructor(\n @inject(\"Paragraph\") paragraph,\n @inject(\"ParagraphContinued\") paragraphContinued,\n @inject(\"ExtractProse\") extractProse,\n @inject(\"ExtractPoetry\") extractPoetry,\n @inject(\"SourceNote\") sourceNote,\n @inject(\"BlockQuote\") blockQuote\n ) {\n super();\n this.tools = [\n paragraph,\n paragraphContinued,\n extractProse,\n extractPoetry,\n sourceNote,\n blockQuote\n ];\n }\n}\n\nexport default Text;\n","import Service from '../../Service';\nimport Text from './Text';\n\nclass TextToolGroupService extends Service {\n register() {\n this.container.bind('Text').to(Text);\n }\n}\n\nexport default TextToolGroupService;\n","import { injectable, inject } from \"inversify\";\nimport ToolGroup from \"../../lib/ToolGroup\";\n\n@injectable()\nclass Notes extends ToolGroup {\n tools = [];\n constructor(@inject(\"Note\") note) {\n super();\n this.tools = [note];\n }\n}\n\nexport default Notes;\n","import Service from '../../Service';\nimport Notes from './Notes';\n\nclass NoteToolGroupService extends Service {\n register() {\n this.container.bind('Notes').to(Notes);\n }\n}\n\nexport default NoteToolGroupService;\n","import { injectable, inject } from 'inversify';\nimport ToolGroup from '../../lib/ToolGroup';\n\n@injectable()\nclass CodeBlock extends ToolGroup {\n tools = [];\n constructor(@inject('CodeBlockTool') codeblock) {\n super();\n this.tools = [codeblock];\n }\n}\n\nexport default CodeBlock;\n","import Service from '../../Service';\nimport CodeBlock from './CodeBlock';\n\nclass CodeBlockToolGroupService extends Service {\n register() {\n this.container.bind('CodeBlock').to(CodeBlock);\n }\n}\n\nexport default CodeBlockToolGroupService;\n","import { injectable, inject } from 'inversify';\nimport ToolGroup from '../../lib/ToolGroup';\n\n@injectable()\nclass TrackChange extends ToolGroup {\n tools = [];\n constructor(\n @inject('EnableTrackChange') enableTrackChange,\n @inject('AcceptTrackChange') acceptTrackChange,\n @inject('RejectTrackChange') rejectTrackChange,\n ) {\n super();\n this.tools = [enableTrackChange, acceptTrackChange, rejectTrackChange];\n }\n}\n\nexport default TrackChange;\n","import Service from '../../Service';\nimport TrackChange from './TrackChange';\n\nclass TrackChangeToolGroupService extends Service {\n register() {\n this.container.bind('TrackChange').to(TrackChange);\n }\n}\n\nexport default TrackChangeToolGroupService;\n"],"names":["_classCallCheck","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_createClass","protoProps","staticProps","prototype","Service","app","container","config","get","name","getSchema","_setPrototypeOf","o","p","setPrototypeOf","__proto__","_inherits","subClass","superClass","create","constructor","value","_getPrototypeOf","getPrototypeOf","_isNativeReflectConstruct","Reflect","construct","sham","Proxy","Date","toString","call","e","_typeof","obj","Symbol","iterator","_assertThisInitialized","self","ReferenceError","_possibleConstructorReturn","assertThisInitialized","_createSuper","Derived","Super","result","isNativeReflectConstruct","NewTarget","arguments","apply","possibleConstructorReturn","ComponentPlugin","renderArea","layoutProps","useInjection","components","render","map","Component","component","componentProps","React","DefaultLayout","editor","Layout","injectable","layoutComponent","LayoutFactory","createArea","size","set","getArray","area","Map","forEach","push","LayoutService","bind","to","inSingletonScope","ToolGroup","_config","title","_tools","exclude","include","tool","includes","displayTool","hideTool","more","hideInToolGroup","displayInToolGroup","view","ToolGroupComponent","uuidv4","tools","_taggedTemplateLiteral","strings","raw","slice","freeze","defineProperties","MainMenu","styled","div","MainMenuBar","items","item","renderTools","Menu","createTools","toolGroups","excludeIncludeTools","addToolIntoMore","toolGroup","useContext","WaxContext","main","activeView","Bar","useMemo","MenuWrapper","MenuCollection","menus","multiInject","find","menu","MenuService","layout","addComponent","templateArea","conf","toFactory","context","configTools","tl","isPlainObject","setGroupConfig","isFunction","error","Error","Tools","content","_isDisplayed","_isHiddenInToolGroup","onlyOnMain","pmplugins","inject","active","run","enable","select","isEmpty","Button","toJSON","LinkTool","icons","link","state","dispatch","Commands","markActive","schema","marks","toggleMark","createLink","isOnSameTextBlock","LinkService","createOverlay","LinkComponent","markType","followCursor","selection","createMark","linkMark","toWaxSchema","Plugin","PluginKey","init","DecorationSet","empty","tr","mapping","doc","action","getMeta","add","widget","document","createElement","deco","Decoration","pos","id","remove","spec","decorations","getState","PLUGIN_KEY","PlaceholderService","PmPlugins","placeholderPlugin","_arrayWithHoles","arr","Array","isArray","_iterableToArrayLimit","_arr","_n","_d","_e","undefined","_i","_s","next","done","err","_arrayLikeToArray","len","arr2","_unsupportedIterableToArray","minLen","arrayLikeToArray","n","from","test","_nonIterableRest","_slicedToArray","arrayWithHoles","iterableToArrayLimit","unsupportedIterableToArray","nonIterableRest","_defineProperty","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","_objectSpread2","source","getOwnPropertyDescriptors","defaultOverlay","left","top","mark","options","useState","position","setPosition","calculatePosition","WaxSurface","dom","getBoundingClientRect","start","coordsAtPos","end","displayOnSelection","displayOnMark","PMmark","DocumentHelpers","getSelectionMark","isObject","updatePosition","useCallback","useLayoutEffect","JSON","stringify","usePosition","visible","Overlay","OverlayService","OverlayComponent","findPlaceholder","decos","found","fileUpload","file","deleteSelection","setMeta","then","url","replaceWith","nodes","image","src","Image","activeViewId","upload","ImageUpload","canInsert","ImageService","createNode","imageNode","_arrayWithoutHoles","_iterableToArray","iter","_nonIterableSpread","_toConsumableArray","arrayWithoutHoles","iterableToArray","nonIterableSpread","Rules","plugins","extendedRules","allRules","rules","rulesCreated","inputRules","smartQuotes","wrappingInputRule","blockquote","orderedlist","match","order","node","childCount","attrs","bulletlist","textblockTypeInputRule","RegExp","heading","level","RulesService","configRules","addRule","createRules","toDynamicValue","text","group","hard_break","inline","selectable","parseDOM","tag","toDOM","paragraph","track","getAttrs","dataset","getAttribute","SchemaHelpers","parseTracks","blockLevelToDOM","Middleware","last","reduceOneRight","fn","go","stack","args","_next","ParseRule","style","exporter","defaultMiddleware","hook","addStack","use","rule","hooks","omit","parseSchema","Node","importer","atom","isolating","draggable","_attrs","_parseRules","combineRules","assign","parseDom","values","parseRule","Mark","inclusive","Schema","_nodes","_marks","prosemirrorSchema","schemaConfig","nd","has","fromJSON","addSchema","mr","type","DefaultSchema","index","PmPschema","SchemaService","schemaInstance","addNode","addProsemirrorSchema","addMark","backSpace","chainCommands","joinBackward","selectNodeBackward","backSpaceShortCut","undoShortCut","undo","redoShortCut","redo","ShortCuts","insertBreak","insertRule","getKeys","br","replaceSelectionWith","scrollIntoView","hr","horizontal_rule","shortCuts","keymap","createKeyBindings","shortcut","createShortCuts","baseKeymap","Backspace","Escape","selectParentNode","exitCode","liftListItem","list_item","sinkListItem","Enter","splitListItem","wrapInList","ShortCutsService","EnableTrackChange","TrackChangeEnable","enabled","EnableTrackChangeService","removeNode","nodePos","newNodePos","selectionBefore","Selection","findFrom","resolve","$anchor","delStep","replaceStep","step","stepMap","getMap","appendMap","AcceptTrackChange","Mapping","nodesBetween","deletionStep","ReplaceStep","Math","max","min","nodeSize","Slice","setNodeMarkup","insertionMark","RemoveMarkStep","formatChangeMark","blockChangeTrack","steps","AcceptTrackChangeService","RejectTrackChange","deletionMark","before","oldMark","AddMarkStep","after","newMark","RejectTrackChangeService","TrackChangeService","dependencies","TrackChangeServices","trackChangesMarks","trackChangesNodes","markDeletion","user","date","deletion","userId","username","deletionMap","isInline","removeStep","maybeStep","failed","trackAttr","isTextblock","TextSelection","counter","markInsertion","removeMark","insertion","newTr","cellDeleteTr","CellSelection","deletionMarkSchema","findMark","positionTo","newStep","structure","invert","trTemp","mappedNewStepTo","condensedStep","mirrorIndex","maps","eq","setSelection","markWrapping","oldNode","newNode","blockTrack","replaceAroundStep","gapFrom","gapTo","nodeAt","firstChild","console","log","addMarkStep","markName","concat","format_change","removeMarkStep","trackedTransaction","meta","every","metadata","floor","now","originalStep","ReplaceAroundStep","selectionSet","caretPos","$head","depth","storedMarksSet","setStoredMarks","storedMarks","scrolledIntoView","Undo","UndoService","Redo","RedoService","Save","save","BaseService","BaseServices","Code","code","CodeService","addShortCut","codeMark","Strong","strong","StrongService","strongMark","Emphasis","em","EmphasisService","emphasisMark","Subscript","subscript","SubscriptService","subscriptMark","Superscript","superscript","SuperscriptService","superscriptMark","StrikeThrough","strikethrough","StrikeThroughService","strikethroughMark","Underline","underline","UnderlineService","underlineMark","SmallCaps","small_caps","smallcaps","SmallCapsService","smallcapsMark","InlineAnnotationsService","InlineServices","BulletList","bullet_list","blockActive","BulletListService","bulletListNode","OrderedList","ordered_list","OrderedListService","orderedListNode","JoinUp","join_up","joinUp","JoinUpService","Lift","lift","LiftService","ListItemService","listItemNode","ListsService","ListsServices","Table","table","createTable","InsertTableService","Tab","goToNextCell","tableNodes","tableGroup","cellContent","table_row","table_cell","table_header","TableDropDownOptions","addColumnBefore","TableDropDown","EditTableService","TablesService","TablesServices","ExtractPoetry","setBlockType","extractPoetry","ExtractPoetryService","extractPoetryNode","ExtractProse","extractProse","ExtractProseService","extractProseNode","ParagraphContinued","paragraphCont","ParagraphContinuedService","paragraphContNode","Paragraph","ParagraphService","SourceNote","sourceNote","SourceNoteService","sourceNoteNode","BlockQuote","wrapIn","BlockQuoteService","blockQuoteNode","TextBlockLevelService","TextServices","Author","author","AuthorService","authorNode","EpigraphPoetry","epigraphPoetry","EpigraphPoetryService","epigraphPoetryNode","EpigraphProse","epigraphProse","EpigraphProseService","epigraphProseNode","Heading1","Heading2","Heading3","HeadingService","headingNode","SubTitle","subtitle","SubTitleService","subTitleNode","Title","TitleService","titleNode","DisplayBlockLevelService","DisplayServices","Note","footnote","$from","$to","Fragment","sameParent","parent","inlineContent","cut","parentOffset","transformPasted","commentNodes","findChildrenByMark","comment","allComments","groupedCommentsById","reduce","editorRef","useRef","noteId","noteView","useEffect","EditorView","mount","current","EditorState","getPlugins","dispatchTransaction","handleDOMEvents","mousedown","updateView","hasFocus","focus","transaction","applyTransaction","transactions","updateState","allNotes","findChildrenByType","noteFound","setTimeout","outerTr","offsetMap","StepMap","offset","j","docChanged","findDiffStart","findDiffEnd","endA","a","endB","b","overlap","replace","NoteEditorContainer","notes","note","setNotes","updateNotes","noteComponent","NoteService","NoteComponent","CommentBubbleComponent","showComment","footNoteNode","CommentsService","CommentPlugin","RightArea","commentMark","CodeBlockTool","code_block","CodeBlockService","highlightPlugin","codeBlockNode","Base","BaseToolGroupService","Annotations","emphasis","AnnotationToolGroupService","Lists","joinup","ListToolGroupService","Images","ImageToolGroupService","Tables","tableDropDownOptions","TableToolGroupService","Display","LeftMenuTitle","epigraphprose","epigraphpoetry","heading1","heading2","heading3","DisplayToolGroupService","Text","paragraphContinued","blockQuote","TextToolGroupService","Notes","NoteToolGroupService","CodeBlock","codeblock","CodeBlockToolGroupService","TrackChange","enableTrackChange","acceptTrackChange","rejectTrackChange","TrackChangeToolGroupService"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAe,SAASA,eAAT,CAAyBC,QAAzB,EAAmCC,WAAnC,EAAgD;AAC7D,MAAI,EAAED,QAAQ,YAAYC,WAAtB,CAAJ,EAAwC;AACtC,UAAM,IAAIC,SAAJ,CAAc,mCAAd,CAAN;AACD;AACF;;ACJD,SAASC,iBAAT,CAA2BC,MAA3B,EAAmCC,KAAnC,EAA0C;AACxC,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,KAAK,CAACE,MAA1B,EAAkCD,CAAC,EAAnC,EAAuC;AACrC,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KACgD,GADxC,EACwC;AAE9C,UAAKA,KAAL,GAAa,CAACirB,SAAD,CAAb;AAF8C;AAG/C;;cAHY7nB,gBAAM,CAAC,eAAD;;EAFGpE;;ICDlBksB;;;;;;;;;;;;;+BACO;AACT,WAAK5wB,SAAL,CAAeuE,IAAf,CAAoB,WAApB,EAAiCC,EAAjC,CAAoCksB,SAApC;AACD;;;;EAHqC5wB;;;ICClC+wB,wBADLltB,oBAAU;;;;;AAGT,gFAIE;AAAA;;AAAA;;AACA;AADA,UALF+B,KAKE,GALM,EAKN;AAEA,UAAKA,KAAL,GAAa,CAACorB,iBAAD,EAAoBC,iBAApB,EAAuCC,iBAAvC,CAAb;AAFA;AAGD;;gBAJEloB,gBAAM,CAAC,mBAAD;gBADNA,gBAAM,CAAC,mBAAD;gBADNA,gBAAM,CAAC,mBAAD;;EAHepE;;ICDpBusB;;;;;;;;;;;;;+BACO;AACT,WAAKjxB,SAAL,CAAeuE,IAAf,CAAoB,aAApB,EAAmCC,EAAnC,CAAsCqsB,WAAtC;AACD;;;;EAHuC/wB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/wax-prosemirror-services/src/CodeBlockService/CodeBlockTool.js b/wax-prosemirror-services/src/CodeBlockService/CodeBlockTool.js index 6b2b9fca1..b533ca58d 100644 --- a/wax-prosemirror-services/src/CodeBlockService/CodeBlockTool.js +++ b/wax-prosemirror-services/src/CodeBlockService/CodeBlockTool.js @@ -14,6 +14,11 @@ class CodeBlockTool extends Tools { }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return setBlockType(state.config.schema.nodes.code_block)(state); diff --git a/wax-prosemirror-services/src/DisplayBlockLevel/AuthorService/Author.js b/wax-prosemirror-services/src/DisplayBlockLevel/AuthorService/Author.js index 6d68ff01d..a3ee0f83e 100644 --- a/wax-prosemirror-services/src/DisplayBlockLevel/AuthorService/Author.js +++ b/wax-prosemirror-services/src/DisplayBlockLevel/AuthorService/Author.js @@ -15,6 +15,11 @@ class Author extends Tools { }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return Commands.setBlockType(state.config.schema.nodes.author)(state); diff --git a/wax-prosemirror-services/src/DisplayBlockLevel/EpigraphPoetryService/EpigraphPoetry.js b/wax-prosemirror-services/src/DisplayBlockLevel/EpigraphPoetryService/EpigraphPoetry.js index 819a449b1..b0637041a 100644 --- a/wax-prosemirror-services/src/DisplayBlockLevel/EpigraphPoetryService/EpigraphPoetry.js +++ b/wax-prosemirror-services/src/DisplayBlockLevel/EpigraphPoetryService/EpigraphPoetry.js @@ -15,6 +15,11 @@ class EpigraphPoetry extends Tools { }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return Commands.setBlockType(state.config.schema.nodes.epigraphPoetry)( diff --git a/wax-prosemirror-services/src/DisplayBlockLevel/EpigraphProseService/EpigraphProse.js b/wax-prosemirror-services/src/DisplayBlockLevel/EpigraphProseService/EpigraphProse.js index d4a504b35..7ec1f1494 100644 --- a/wax-prosemirror-services/src/DisplayBlockLevel/EpigraphProseService/EpigraphProse.js +++ b/wax-prosemirror-services/src/DisplayBlockLevel/EpigraphProseService/EpigraphProse.js @@ -16,6 +16,11 @@ class EpigraphProse extends Tools { }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return Commands.setBlockType(state.config.schema.nodes.epigraphProse)( diff --git a/wax-prosemirror-services/src/DisplayBlockLevel/HeadingService/Heading1.js b/wax-prosemirror-services/src/DisplayBlockLevel/HeadingService/Heading1.js index d1724fc9d..ce22bd8b3 100644 --- a/wax-prosemirror-services/src/DisplayBlockLevel/HeadingService/Heading1.js +++ b/wax-prosemirror-services/src/DisplayBlockLevel/HeadingService/Heading1.js @@ -17,6 +17,11 @@ class Heading1 extends Tools { }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return Commands.setBlockType(state.config.schema.nodes.heading, { diff --git a/wax-prosemirror-services/src/DisplayBlockLevel/HeadingService/Heading2.js b/wax-prosemirror-services/src/DisplayBlockLevel/HeadingService/Heading2.js index 792d810b0..da4295986 100644 --- a/wax-prosemirror-services/src/DisplayBlockLevel/HeadingService/Heading2.js +++ b/wax-prosemirror-services/src/DisplayBlockLevel/HeadingService/Heading2.js @@ -17,6 +17,11 @@ class Heading2 extends Tools { }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return Commands.setBlockType(state.config.schema.nodes.heading, { diff --git a/wax-prosemirror-services/src/DisplayBlockLevel/HeadingService/Heading3.js b/wax-prosemirror-services/src/DisplayBlockLevel/HeadingService/Heading3.js index e1e133d52..1706b0c14 100644 --- a/wax-prosemirror-services/src/DisplayBlockLevel/HeadingService/Heading3.js +++ b/wax-prosemirror-services/src/DisplayBlockLevel/HeadingService/Heading3.js @@ -17,6 +17,11 @@ class Heading3 extends Tools { }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return Commands.setBlockType(state.config.schema.nodes.heading, { diff --git a/wax-prosemirror-services/src/DisplayBlockLevel/SubTitleService/SubTitle.js b/wax-prosemirror-services/src/DisplayBlockLevel/SubTitleService/SubTitle.js index 332d816d9..d8957703e 100644 --- a/wax-prosemirror-services/src/DisplayBlockLevel/SubTitleService/SubTitle.js +++ b/wax-prosemirror-services/src/DisplayBlockLevel/SubTitleService/SubTitle.js @@ -1,20 +1,25 @@ -import Tools from "../../lib/Tools"; -import { injectable } from "inversify"; -import { Commands } from "wax-prosemirror-utilities"; +import Tools from '../../lib/Tools'; +import { injectable } from 'inversify'; +import { Commands } from 'wax-prosemirror-utilities'; @injectable() export default class SubTitle extends Tools { - title = "Change to Subtitle"; - content = "Subtitle"; + title = 'Change to Subtitle'; + content = 'Subtitle'; get run() { return (state, dispatch) => { Commands.setBlockType(state.config.schema.nodes.subtitle, { - class: "cst" + class: 'cst', })(state, dispatch); }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return Commands.setBlockType(state.config.schema.nodes.subtitle)(state); diff --git a/wax-prosemirror-services/src/DisplayBlockLevel/TitleService/Title.js b/wax-prosemirror-services/src/DisplayBlockLevel/TitleService/Title.js index 469096c15..7548b7b70 100644 --- a/wax-prosemirror-services/src/DisplayBlockLevel/TitleService/Title.js +++ b/wax-prosemirror-services/src/DisplayBlockLevel/TitleService/Title.js @@ -1,20 +1,25 @@ -import Tools from "../../lib/Tools"; -import { injectable } from "inversify"; -import { Commands } from "wax-prosemirror-utilities"; +import Tools from '../../lib/Tools'; +import { injectable } from 'inversify'; +import { Commands } from 'wax-prosemirror-utilities'; @injectable() export default class Title extends Tools { - title = "Change to Title"; - content = "Title"; + title = 'Change to Title'; + content = 'Title'; get run() { return (state, dispatch) => { Commands.setBlockType(state.config.schema.nodes.title, { - class: "title" + class: 'title', })(state, dispatch); }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return Commands.setBlockType(state.config.schema.nodes.title)(state); diff --git a/wax-prosemirror-services/src/ImageService/Image.js b/wax-prosemirror-services/src/ImageService/Image.js index 7f0e6fea2..726284945 100644 --- a/wax-prosemirror-services/src/ImageService/Image.js +++ b/wax-prosemirror-services/src/ImageService/Image.js @@ -17,6 +17,11 @@ class Image extends Tools { return () => true; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return Commands.canInsert(state.config.schema.nodes.image)(state); @@ -31,7 +36,12 @@ class Image extends Tools { this.pmplugins.get('imagePlaceHolder'), ); return this._isDisplayed ? ( - <ImageUpload key={uuidv4()} item={this.toJSON()} fileUpload={upload} /> + <ImageUpload + key={uuidv4()} + item={this.toJSON()} + fileUpload={upload} + view={view} + /> ) : null; } } diff --git a/wax-prosemirror-services/src/ListsService/BulletListService/BulletList.js b/wax-prosemirror-services/src/ListsService/BulletListService/BulletList.js index 80ab99f14..eab23cb2a 100644 --- a/wax-prosemirror-services/src/ListsService/BulletListService/BulletList.js +++ b/wax-prosemirror-services/src/ListsService/BulletListService/BulletList.js @@ -1,12 +1,12 @@ -import Tools from "../../lib/Tools"; -import { injectable } from "inversify"; -import { icons } from "wax-prosemirror-components"; -import { wrapInList } from "prosemirror-schema-list"; -import { Commands } from "wax-prosemirror-utilities"; +import Tools from '../../lib/Tools'; +import { injectable } from 'inversify'; +import { icons } from 'wax-prosemirror-components'; +import { wrapInList } from 'prosemirror-schema-list'; +import { Commands } from 'wax-prosemirror-utilities'; @injectable() export default class BulletList extends Tools { - title = "Wrap in bullet list"; + title = 'Wrap in bullet list'; content = icons.bullet_list; get run() { @@ -21,6 +21,11 @@ export default class BulletList extends Tools { }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get active() { return state => { return Commands.blockActive(state.config.schema.nodes.bulletlist)(state); diff --git a/wax-prosemirror-services/src/ListsService/OrderedListService/OrderedList.js b/wax-prosemirror-services/src/ListsService/OrderedListService/OrderedList.js index 9f01a6b82..e421df095 100644 --- a/wax-prosemirror-services/src/ListsService/OrderedListService/OrderedList.js +++ b/wax-prosemirror-services/src/ListsService/OrderedListService/OrderedList.js @@ -1,12 +1,12 @@ -import Tools from "../../lib/Tools"; -import { injectable } from "inversify"; -import { icons } from "wax-prosemirror-components"; -import { wrapInList } from "prosemirror-schema-list"; -import { Commands } from "wax-prosemirror-utilities"; +import Tools from '../../lib/Tools'; +import { injectable } from 'inversify'; +import { icons } from 'wax-prosemirror-components'; +import { wrapInList } from 'prosemirror-schema-list'; +import { Commands } from 'wax-prosemirror-utilities'; @injectable() export default class OrderedList extends Tools { - title = "Wrap in ordered list"; + title = 'Wrap in ordered list'; content = icons.ordered_list; get run() { @@ -21,6 +21,11 @@ export default class OrderedList extends Tools { }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get active() { return state => { return Commands.blockActive(state.config.schema.nodes.orderedlist)(state); diff --git a/wax-prosemirror-services/src/NoteService/Note.js b/wax-prosemirror-services/src/NoteService/Note.js index a676d1cf0..75f04f45b 100644 --- a/wax-prosemirror-services/src/NoteService/Note.js +++ b/wax-prosemirror-services/src/NoteService/Note.js @@ -1,12 +1,12 @@ -import Tools from "../lib/Tools"; -import { injectable } from "inversify"; -import { icons } from "wax-prosemirror-components"; -import { Fragment } from "prosemirror-model"; -import { v4 as uuidv4 } from "uuid"; +import Tools from '../lib/Tools'; +import { injectable } from 'inversify'; +import { icons } from 'wax-prosemirror-components'; +import { Fragment } from 'prosemirror-model'; +import { v4 as uuidv4 } from 'uuid'; @injectable() export default class Note extends Tools { - title = "Insert Note"; + title = 'Insert Note'; content = icons.footnote; get run() { @@ -16,18 +16,22 @@ export default class Note extends Tools { if (!empty && $from.sameParent($to) && $from.parent.inlineContent) content = $from.parent.content.cut( $from.parentOffset, - $to.parentOffset + $to.parentOffset, ); const footnote = state.config.schema.nodes.footnote.create( { id: uuidv4() }, - content + content, ); dispatch(state.tr.replaceSelectionWith(footnote)); }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { - // // TODO disable on notes editor return state => { return true; }; diff --git a/wax-prosemirror-services/src/TablesService/InsertTableService/Table.js b/wax-prosemirror-services/src/TablesService/InsertTableService/Table.js index d475193db..0649aef3d 100644 --- a/wax-prosemirror-services/src/TablesService/InsertTableService/Table.js +++ b/wax-prosemirror-services/src/TablesService/InsertTableService/Table.js @@ -14,6 +14,11 @@ export default class Table extends Tools { }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return Commands.canInsert(state.config.schema.nodes.table)(state); diff --git a/wax-prosemirror-services/src/TextBlockLevel/BlockQuoteService/BlockQuote.js b/wax-prosemirror-services/src/TextBlockLevel/BlockQuoteService/BlockQuote.js index 77ac0af54..2c2e9ceb2 100644 --- a/wax-prosemirror-services/src/TextBlockLevel/BlockQuoteService/BlockQuote.js +++ b/wax-prosemirror-services/src/TextBlockLevel/BlockQuoteService/BlockQuote.js @@ -1,11 +1,11 @@ -import Tools from "../../lib/Tools"; -import { injectable } from "inversify"; -import { wrapIn } from "prosemirror-commands"; +import Tools from '../../lib/Tools'; +import { injectable } from 'inversify'; +import { wrapIn } from 'prosemirror-commands'; @injectable() class BlockQuote extends Tools { - title = "Change to Block Quote"; - content = "Block Quote"; + title = 'Change to Block Quote'; + content = 'Block Quote'; get run() { return (state, dispatch) => { @@ -13,6 +13,11 @@ class BlockQuote extends Tools { }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return wrapIn(state.config.schema.nodes.blockquote)(state); diff --git a/wax-prosemirror-services/src/TextBlockLevel/ExtractPoetryService/ExtractPoetry.js b/wax-prosemirror-services/src/TextBlockLevel/ExtractPoetryService/ExtractPoetry.js index d4c87d7f5..8ec0b529d 100644 --- a/wax-prosemirror-services/src/TextBlockLevel/ExtractPoetryService/ExtractPoetry.js +++ b/wax-prosemirror-services/src/TextBlockLevel/ExtractPoetryService/ExtractPoetry.js @@ -1,24 +1,29 @@ -import Tools from "../../lib/Tools"; -import { injectable } from "inversify"; -import { Commands } from "wax-prosemirror-utilities"; +import Tools from '../../lib/Tools'; +import { injectable } from 'inversify'; +import { Commands } from 'wax-prosemirror-utilities'; @injectable() class ExtractPoetry extends Tools { - title = "Change to Extract Poetry"; - content = "Extract Poetry"; + title = 'Change to Extract Poetry'; + content = 'Extract Poetry'; get run() { return (state, dispatch) => { Commands.setBlockType(state.config.schema.nodes.extractPoetry, { - class: "extract-poetry" + class: 'extract-poetry', })(state, dispatch); }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return Commands.setBlockType(state.config.schema.nodes.extractPoetry)( - state + state, ); }; } diff --git a/wax-prosemirror-services/src/TextBlockLevel/ExtractProseService/ExtractProse.js b/wax-prosemirror-services/src/TextBlockLevel/ExtractProseService/ExtractProse.js index e887b9054..c3acd93e4 100644 --- a/wax-prosemirror-services/src/TextBlockLevel/ExtractProseService/ExtractProse.js +++ b/wax-prosemirror-services/src/TextBlockLevel/ExtractProseService/ExtractProse.js @@ -1,24 +1,29 @@ -import Tools from "../../lib/Tools"; -import { injectable } from "inversify"; -import { Commands } from "wax-prosemirror-utilities"; +import Tools from '../../lib/Tools'; +import { injectable } from 'inversify'; +import { Commands } from 'wax-prosemirror-utilities'; @injectable() class ExtractProse extends Tools { - title = "Change to Extract Prose"; - content = "Extract Prose"; + title = 'Change to Extract Prose'; + content = 'Extract Prose'; get run() { return (state, dispatch) => { Commands.setBlockType(state.config.schema.nodes.extractProse, { - class: "extract-prose" + class: 'extract-prose', })(state, dispatch); }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return Commands.setBlockType(state.config.schema.nodes.extractProse)( - state + state, ); }; } diff --git a/wax-prosemirror-services/src/TextBlockLevel/ParagraphContinuedService/ParagraphContinued.js b/wax-prosemirror-services/src/TextBlockLevel/ParagraphContinuedService/ParagraphContinued.js index 0821ef32b..c3d9b03ed 100644 --- a/wax-prosemirror-services/src/TextBlockLevel/ParagraphContinuedService/ParagraphContinued.js +++ b/wax-prosemirror-services/src/TextBlockLevel/ParagraphContinuedService/ParagraphContinued.js @@ -1,24 +1,29 @@ -import Tools from "../../lib/Tools"; -import { injectable } from "inversify"; -import { Commands } from "wax-prosemirror-utilities"; +import Tools from '../../lib/Tools'; +import { injectable } from 'inversify'; +import { Commands } from 'wax-prosemirror-utilities'; @injectable() class ParagraphContinued extends Tools { - title = "Change to Paragraph Continued"; - content = "Paragraph Continued"; + title = 'Change to Paragraph Continued'; + content = 'Paragraph Continued'; get run() { return (state, dispatch) => { Commands.setBlockType(state.config.schema.nodes.paragraphCont, { - class: "paragraph-cont" + class: 'paragraph-cont', })(state, dispatch); }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return Commands.setBlockType(state.config.schema.nodes.paragraphCont)( - state + state, ); }; } diff --git a/wax-prosemirror-services/src/TextBlockLevel/ParagraphService/Paragraph.js b/wax-prosemirror-services/src/TextBlockLevel/ParagraphService/Paragraph.js index e3018a4e2..918ae7607 100644 --- a/wax-prosemirror-services/src/TextBlockLevel/ParagraphService/Paragraph.js +++ b/wax-prosemirror-services/src/TextBlockLevel/ParagraphService/Paragraph.js @@ -1,20 +1,25 @@ -import Tools from "../../lib/Tools"; -import { injectable } from "inversify"; -import { Commands } from "wax-prosemirror-utilities"; +import Tools from '../../lib/Tools'; +import { injectable } from 'inversify'; +import { Commands } from 'wax-prosemirror-utilities'; @injectable() export default class Paragraph extends Tools { - title = "Change to Paragraph"; - content = "Paragraph"; + title = 'Change to Paragraph'; + content = 'Paragraph'; get run() { return (state, dispatch) => { Commands.setBlockType(state.config.schema.nodes.paragraph, { - class: "paragraph" + class: 'paragraph', })(state, dispatch); }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return Commands.setBlockType(state.config.schema.nodes.paragraph)(state); diff --git a/wax-prosemirror-services/src/TextBlockLevel/SourceNoteService/SourceNote.js b/wax-prosemirror-services/src/TextBlockLevel/SourceNoteService/SourceNote.js index 3e333e8dd..b40a17d1d 100644 --- a/wax-prosemirror-services/src/TextBlockLevel/SourceNoteService/SourceNote.js +++ b/wax-prosemirror-services/src/TextBlockLevel/SourceNoteService/SourceNote.js @@ -1,20 +1,25 @@ -import Tools from "../../lib/Tools"; -import { injectable } from "inversify"; -import { Commands } from "wax-prosemirror-utilities"; +import Tools from '../../lib/Tools'; +import { injectable } from 'inversify'; +import { Commands } from 'wax-prosemirror-utilities'; @injectable() class SourceNote extends Tools { - title = "Change to Source Note"; - content = "Source Note"; + title = 'Change to Source Note'; + content = 'Source Note'; get run() { return (state, dispatch) => { Commands.setBlockType(state.config.schema.nodes.sourceNote, { - class: "source-note" + class: 'source-note', })(state, dispatch); }; } + select = (state, activeViewId) => { + if (activeViewId !== 'main') return false; + return true; + }; + get enable() { return state => { return Commands.setBlockType(state.config.schema.nodes.sourceNote)(state); diff --git a/wax-prosemirror-themes/dist/index.js b/wax-prosemirror-themes/dist/index.js new file mode 100644 index 000000000..dc339977b --- /dev/null +++ b/wax-prosemirror-themes/dist/index.js @@ -0,0 +1,99 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +require('typeface-fira-sans-condensed'); +require('typeface-vollkorn'); +var styledComponents = require('styled-components'); +var styledComponents__default = _interopDefault(styledComponents); + +var ButtonStyles = styledComponents.css` + background: #fff; + border: none; + font-size: inherit; + cursor: pointer; + border-radius: 0; + padding: 5px 10px; + &:disabled { + color: #ccc; + pointer-events: none; + } + &:hover { + background: #f6f6f6; + } +`; + +/* eslint-disable import/extensions */ +const cokoTheme = { + /* Colors */ + colorBackground: "white", + colorPrimary: "#0B65CB", + colorSecondary: "#E7E7E7", + colorFurniture: "#CCC", + colorBorder: "#AAA", + colorBackgroundHue: "#F1F1F1", + colorSuccess: "#008800", + colorError: "#FF2D1A", + colorText: "#111", + colorTextReverse: "#FFF", + colorTextPlaceholder: "#595959", + colorWarning: "#ffc107", + + /*Buttons*/ + colorButton: "#777", + + /* Text variables */ + // fonts + fontInterface: "'Fira Sans Condensed'", + fontHeading: "'Fira Sans Condensed'", + fontReading: "'Vollkorn'", + fontWriting: "'Cokourier Prime Sans'", + // font sizes + fontSizeBase: "16px", + fontSizeBaseSmall: "14px", + fontSizeHeading1: "40px", + fontSizeHeading2: "36px", + fontSizeHeading3: "28px", + fontSizeHeading4: "24px", + fontSizeHeading5: "20px", + fontSizeHeading6: "16px", + // line heights + lineHeightBase: "24px", + lineHeightBaseSmall: "16px", + lineHeightHeading1: "48px", + lineHeightHeading2: "40px", + lineHeightHeading3: "32px", + lineHeightHeading4: "32px", + lineHeightHeading5: "24px", + lineHeightHeading6: "24px", + + /* Spacing */ + gridUnit: "8px", + + /* Border */ + borderRadius: "0", + borderWidth: "1px", + borderStyle: "solid", + + /* Shadow (for tooltip) */ + boxShadow: "0 2px 4px 0 rgba(51, 51, 51, 0.3)", + + /* Transition */ + transitionDuration: "0.2s", + transitionTimingFunction: "ease", + transitionDelay: "0", + + /* Breakpoints */ + breakpoints: [480, 768, 1000, 1272], + cssOverrides: { + ui: { + ButtonStyles + } + } +}; + +exports.ButtonStyles = ButtonStyles; +exports.cokoTheme = cokoTheme; +//# sourceMappingURL=index.js.map diff --git a/wax-prosemirror-themes/dist/index.js.map b/wax-prosemirror-themes/dist/index.js.map new file mode 100644 index 000000000..edcc6f3a5 --- /dev/null +++ b/wax-prosemirror-themes/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../src/coko-theme/elements/ButtonStyles.js","../src/coko-theme/index.js"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nexport default css`\n background: #fff;\n border: none;\n font-size: inherit;\n cursor: pointer;\n border-radius: 0;\n padding: 5px 10px;\n &:disabled {\n color: #ccc;\n pointer-events: none;\n }\n &:hover {\n background: #f6f6f6;\n }\n`;\n","/* eslint-disable import/extensions */\nimport \"typeface-fira-sans-condensed\";\nimport \"typeface-vollkorn\";\n\nimport { ButtonStyles } from \"./elements\";\n\nconst cokoTheme = {\n /* Colors */\n colorBackground: \"white\",\n colorPrimary: \"#0B65CB\",\n colorSecondary: \"#E7E7E7\",\n colorFurniture: \"#CCC\",\n colorBorder: \"#AAA\",\n colorBackgroundHue: \"#F1F1F1\",\n colorSuccess: \"#008800\",\n colorError: \"#FF2D1A\",\n colorText: \"#111\",\n colorTextReverse: \"#FFF\",\n colorTextPlaceholder: \"#595959\",\n colorWarning: \"#ffc107\",\n\n /*Buttons*/\n colorButton: \"#777\",\n /* Text variables */\n\n // fonts\n fontInterface: \"'Fira Sans Condensed'\",\n fontHeading: \"'Fira Sans Condensed'\",\n fontReading: \"'Vollkorn'\",\n fontWriting: \"'Cokourier Prime Sans'\",\n\n // font sizes\n fontSizeBase: \"16px\",\n fontSizeBaseSmall: \"14px\",\n fontSizeHeading1: \"40px\",\n fontSizeHeading2: \"36px\",\n fontSizeHeading3: \"28px\",\n fontSizeHeading4: \"24px\",\n fontSizeHeading5: \"20px\",\n fontSizeHeading6: \"16px\",\n\n // line heights\n lineHeightBase: \"24px\",\n lineHeightBaseSmall: \"16px\",\n lineHeightHeading1: \"48px\",\n lineHeightHeading2: \"40px\",\n lineHeightHeading3: \"32px\",\n lineHeightHeading4: \"32px\",\n lineHeightHeading5: \"24px\",\n lineHeightHeading6: \"24px\",\n\n /* Spacing */\n gridUnit: \"8px\",\n\n /* Border */\n borderRadius: \"0\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n\n /* Shadow (for tooltip) */\n boxShadow: \"0 2px 4px 0 rgba(51, 51, 51, 0.3)\",\n\n /* Transition */\n transitionDuration: \"0.2s\",\n transitionTimingFunction: \"ease\",\n transitionDelay: \"0\",\n /* Breakpoints */\n breakpoints: [480, 768, 1000, 1272],\n\n cssOverrides: {\n ui: {\n ButtonStyles\n }\n }\n};\n\nexport default cokoTheme;\n"],"names":["css","cokoTheme","colorBackground","colorPrimary","colorSecondary","colorFurniture","colorBorder","colorBackgroundHue","colorSuccess","colorError","colorText","colorTextReverse","colorTextPlaceholder","colorWarning","colorButton","fontInterface","fontHeading","fontReading","fontWriting","fontSizeBase","fontSizeBaseSmall","fontSizeHeading1","fontSizeHeading2","fontSizeHeading3","fontSizeHeading4","fontSizeHeading5","fontSizeHeading6","lineHeightBase","lineHeightBaseSmall","lineHeightHeading1","lineHeightHeading2","lineHeightHeading3","lineHeightHeading4","lineHeightHeading5","lineHeightHeading6","gridUnit","borderRadius","borderWidth","borderStyle","boxShadow","transitionDuration","transitionTimingFunction","transitionDelay","breakpoints","cssOverrides","ui","ButtonStyles"],"mappings":";;;;;;;;;;;AAEA,mBAAeA,oBAAI;;;;;;;;;;;;;;CAAnB;;ACFA;AAMA,MAA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3CJ;;AA6ChB;AACAC,EAAAA,QAAQ,EAAE,KA9CM;;AAgDhB;AACAC,EAAAA,YAAY,EAAE,GAjDE;AAkDhBC,EAAAA,WAAW,EAAE,KAlDG;AAmDhBC,EAAAA,WAAW,EAAE,OAnDG;;AAqDhB;AACAC,EAAAA,SAAS,EAAE,mCAtDK;;AAwDhB;AACAC,EAAAA,kBAAkB,EAAE,MAzDJ;AA0DhBC,EAAAA,wBAAwB,EAAE,MA1DV;AA2DhBC,EAAAA,eAAe,EAAE,GA3DD;;AA4DhB;AACAC,EAAAA,WAAW,EAAE,CAAC,GAAD,EAAM,GAAN,EAAW,IAAX,EAAiB,IAAjB,CA7DG;AA+DhBC,EAAAA,YAAY,EAAE;AACZC,IAAAA,EAAE,EAAE;AACFC,MAAAA;AADE;AADQ;AA/DE,CAAlB;;;;;"} \ No newline at end of file diff --git a/wax-prosemirror-utilities/dist/index.js b/wax-prosemirror-utilities/dist/index.js new file mode 100644 index 000000000..09c22e5e8 --- /dev/null +++ b/wax-prosemirror-utilities/dist/index.js @@ -0,0 +1,404 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var uuid = require('uuid'); +var prosemirrorCommands = require('prosemirror-commands'); + +const parseFormatList = str => { + if (!str) { + return []; + } + + let formatList; + + try { + formatList = JSON.parse(str); + } catch (error) { + return []; + } + + if (!Array.isArray(formatList)) { + return []; + } + + return formatList.filter(format => typeof format === "string"); +}; + +const parseTracks = str => { + if (!str) { + return []; + } + + let tracks; + + try { + tracks = JSON.parse(str); + } catch (error) { + return []; + } + + if (!Array.isArray(tracks)) { + return []; + } + + return tracks.filter((track // ensure required fields are present + ) => track.hasOwnProperty("user") && track.hasOwnProperty("username") && track.hasOwnProperty("date")); +}; + +const blockLevelToDOM = node => { + const attrs = node.attrs.track && node.attrs.track.length ? { + "data-id": node.attrs.id, + class: node.attrs.class, + "data-track": JSON.stringify(node.attrs.track), + "data-group": node.attrs.group + } : { + class: node.attrs.class + }; + return attrs; +}; + +var SchemaHelpers = { + parseFormatList, + parseTracks, + blockLevelToDOM +}; + +const findMark = (state, PMmark, toArr = false) => { + const { + selection: { + $from, + $to + }, + doc + } = state; + const fromMark = $from.marks().find(mark => mark.type === PMmark); + const toMark = $to.marks().find(mark => mark.type === PMmark); + let markFound; + const marksFound = []; + doc.nodesBetween($from.pos, $to.pos, (node, from) => { + if (node.marks) { + const actualMark = node.marks.find(mark => mark.type === PMmark); + + if (actualMark) { + markFound = { + from, + to: from + node.nodeSize, + attrs: actualMark.attrs, + contained: !fromMark || !toMark || fromMark === toMark + }; + marksFound.push(markFound); + } + } + }); + if (toArr) return marksFound; + return markFound; +}; + +const getSelectionMark = (state, PMmark) => { + const { + selection: { + $from, + $to + }, + doc + } = state; + let markFound; + doc.nodesBetween($from.pos, $to.pos, (node, from) => { + if (node.marks) { + const actualMark = node.marks.find(mark => mark.type === PMmark); + + if (actualMark) { + markFound = { + from: $from.pos, + to: $to.pos, + attrs: actualMark.attrs + }; + } + } + }); + return markFound; +}; +/* this is a workaround for now to find marks + that are pm will break them. +*/ + + +const findFragmentedMark = (state, PMmark) => { + const { + selection: { + $from, + $to + }, + doc + } = state; + const fromPos = [$from.pos - 1, $from.pos]; + const toPos = [$to.pos - 1, $to.pos]; + let markFound; + + for (let i = 0; i < fromPos.length; i++) { + doc.nodesBetween(fromPos[i], toPos[i], (node, from) => { + if (node.marks) { + const actualMark = node.marks.find(mark => mark.type === PMmark); + + if (actualMark) { + markFound = { + from, + to: from + node.nodeSize, + attrs: actualMark.attrs + }; + } + } + }); + + if (markFound) { + return markFound; + } + } + + return markFound; +}; + +const findAllMarksWithSameId = (state, mark) => { + const type = mark.type.name; + const markType = state.schema.marks[type]; + const allNodes = findChildrenByMark(state.doc, markType, true); + const allMarksWithSameId = []; + allNodes.map(node => { + node.node.marks.filter(value => { + if (mark.type.name === type && mark.attrs.id === value.attrs.id) { + allMarksWithSameId.push(node); + } + }); + }); + return allMarksWithSameId; +}; + +const findMarkPosition = (activeView, initialPos, markType) => { + const $pos = activeView.state.tr.doc.resolve(initialPos); + const { + parent + } = $pos; + const start = parent.childAfter($pos.parentOffset); + if (!start.node) return null; + const actualMark = start.node.marks.find(mark => mark.type.name === markType); + let startIndex = $pos.index(); + let startPos = $pos.start() + start.offset; + + while (startIndex > 0 && actualMark.isInSet(parent.child(startIndex - 1).marks)) startPos -= parent.child(--startIndex).nodeSize; + + let endIndex = $pos.indexAfter(); + let endPos = startPos + start.node.nodeSize; + + while (endPos < parent.childCount && actualMark.isInSet(parent.child(endIndex).marks)) endPos += parent.child(endIndex++).nodeSize; + + return { + from: startPos, + to: endPos + }; +}; + +const flatten = (node, descend = true) => { + if (!node) { + throw new Error('Invalid "node" parameter'); + } + + const result = []; + node.descendants((child, pos) => { + result.push({ + node: child, + pos + }); + + if (!descend) { + return false; + } + }); + return result; +}; + +const findBlockNodes = (node, descend) => { + return findChildren(node, child => child.isBlock, descend); +}; + +const findChildrenByType = (node, nodeType, descend) => { + return findChildren(node, child => child.type === nodeType, descend); +}; + +const findChildren = (node, predicate, descend) => { + if (!node) { + throw new Error('Invalid "node" parameter'); + } else if (!predicate) { + throw new Error('Invalid "predicate" parameter'); + } + + return flatten(node, descend).filter(child => predicate(child.node)); +}; + +const findInlineNodes = (node, descend) => { + return findChildren(node, child => child.isInline, descend); +}; + +const findChildrenByMark = (node, markType, descend) => { + return findChildren(node, child => markType.isInSet(child.marks), descend); +}; + +const findChildrenByAttr = (node, predicate, descend) => { + return findChildren(node, child => !!predicate(child.attrs), descend); +}; +var DocumentHelpers = { + findMark, + findBlockNodes, + findChildrenByType, + findInlineNodes, + findChildrenByMark, + findChildrenByAttr, + getSelectionMark, + findFragmentedMark, + findAllMarksWithSameId, + findMarkPosition +}; + +const setBlockType = (nodeType, attrs = {}) => { + return (state, dispatch) => { + const { + tr + } = state; + const { + from, + to + } = state.selection; + state.doc.nodesBetween(from, to, (node, pos) => { + if (!node.isTextblock || node.hasMarkup(nodeType, attrs)) return; + let applicable = false; + + if (node.type === nodeType) { + applicable = true; + } else { + const $pos = state.doc.resolve(pos); + const index = $pos.index(); + applicable = $pos.parent.canReplaceWith(index, index + 1, nodeType); + } + + if (applicable) { + tr.setBlockType(from, to, nodeType, Object.assign({}, node.attrs, attrs)); + } + }); + if (!tr.steps.length) return false; + if (dispatch) dispatch(tr.scrollIntoView()); + return true; + }; +}; + +const markActive = type => state => { + const { + from, + $from, + to, + empty + } = state.selection; + return empty ? type.isInSet(state.storedMarks || $from.marks()) : state.doc.rangeHasMark(from, to, type); +}; + +const blockActive = (type, attrs = {}) => state => { + const { + $from, + to, + node + } = state.selection; + + if (node) { + return node.hasMarkup(type, attrs); + } + + return to <= $from.end() && $from.parent.hasMarkup(type, attrs); +}; + +const canInsert = type => state => { + const { + $from + } = state.selection; + + for (let d = $from.depth; d >= 0; d--) { + const index = $from.index(d); + + if ($from.node(d).canReplaceWith(index, index, type)) { + return true; + } + } + + return false; +}; + +const createTable = (state, dispatch) => { + let rowCount = window && window.prompt('How many rows?', 2); + let colCount = window && window.prompt('How many columns?', 2); + const cells = []; + + while (colCount--) { + cells.push(state.config.schema.nodes.table_cell.createAndFill()); + } + + const rows = []; + + while (rowCount--) { + rows.push(state.config.schema.nodes.table_row.createAndFill(null, cells)); + } + + const table = state.config.schema.nodes.table.createAndFill(null, rows); + dispatch(state.tr.replaceSelectionWith(table)); +}; + +const createLink = (state, dispatch) => { + const { + selection: { + $from, + $to + } + } = state; + dispatch(state.tr.setMeta('addToHistory', false).addMark($from.pos, $to.pos, state.schema.marks.link.create({ + href: '' + }))); +}; + +const isOnSameTextBlock = state => { + const { + selection: { + $from, + $to, + from, + to + } + } = state; + + if (from !== to && $from.parent === $to.parent && $from.parent.isTextblock) { + return true; + } + + return false; +}; + +const createComment = (state, dispatch, group, viewid) => { + prosemirrorCommands.toggleMark(state.config.schema.marks.comment, { + id: uuid.v4(), + group, + conversation: [], + viewid + })(state, dispatch); +}; + +var Commands = { + setBlockType, + blockActive, + canInsert, + createComment, + createLink, + createTable, + markActive, + isOnSameTextBlock +}; + +exports.Commands = Commands; +exports.DocumentHelpers = DocumentHelpers; +exports.SchemaHelpers = SchemaHelpers; +//# sourceMappingURL=index.js.map diff --git a/wax-prosemirror-utilities/dist/index.js.map b/wax-prosemirror-utilities/dist/index.js.map new file mode 100644 index 000000000..26e7427f3 --- /dev/null +++ b/wax-prosemirror-utilities/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../src/schema/SchemaHelpers.js","../src/document/DocumentHelpers.js","../src/commands/Commands.js"],"sourcesContent":["const parseFormatList = str => {\n if (!str) {\n return [];\n }\n let formatList;\n try {\n formatList = JSON.parse(str);\n } catch (error) {\n return [];\n }\n if (!Array.isArray(formatList)) {\n return [];\n }\n return formatList.filter(format => typeof format === \"string\");\n};\n\nconst parseTracks = str => {\n if (!str) {\n return [];\n }\n let tracks;\n try {\n tracks = JSON.parse(str);\n } catch (error) {\n return [];\n }\n if (!Array.isArray(tracks)) {\n return [];\n }\n return tracks.filter(\n (\n track // ensure required fields are present\n ) =>\n track.hasOwnProperty(\"user\") &&\n track.hasOwnProperty(\"username\") &&\n track.hasOwnProperty(\"date\")\n );\n};\n\nconst blockLevelToDOM = node => {\n const attrs =\n node.attrs.track && node.attrs.track.length\n ? {\n \"data-id\": node.attrs.id,\n class: node.attrs.class,\n \"data-track\": JSON.stringify(node.attrs.track),\n \"data-group\": node.attrs.group\n }\n : { class: node.attrs.class };\n return attrs;\n};\n\nexport default { parseFormatList, parseTracks, blockLevelToDOM };\n","const findMark = (state, PMmark, toArr = false) => {\n const {\n selection: { $from, $to },\n doc,\n } = state;\n const fromMark = $from.marks().find(mark => mark.type === PMmark);\n const toMark = $to.marks().find(mark => mark.type === PMmark);\n let markFound;\n const marksFound = [];\n doc.nodesBetween($from.pos, $to.pos, (node, from) => {\n if (node.marks) {\n const actualMark = node.marks.find(mark => mark.type === PMmark);\n if (actualMark) {\n markFound = {\n from,\n to: from + node.nodeSize,\n attrs: actualMark.attrs,\n contained: !fromMark || !toMark || fromMark === toMark,\n };\n marksFound.push(markFound);\n }\n }\n });\n if (toArr) return marksFound;\n return markFound;\n};\n\nconst getSelectionMark = (state, PMmark) => {\n const {\n selection: { $from, $to },\n doc,\n } = state;\n let markFound;\n doc.nodesBetween($from.pos, $to.pos, (node, from) => {\n if (node.marks) {\n const actualMark = node.marks.find(mark => mark.type === PMmark);\n if (actualMark) {\n markFound = {\n from: $from.pos,\n to: $to.pos,\n attrs: actualMark.attrs,\n };\n }\n }\n });\n\n return markFound;\n};\n\n/* this is a workaround for now to find marks\n that are pm will break them.\n*/\nconst findFragmentedMark = (state, PMmark) => {\n const {\n selection: { $from, $to },\n doc,\n } = state;\n const fromPos = [$from.pos - 1, $from.pos];\n const toPos = [$to.pos - 1, $to.pos];\n let markFound;\n\n for (let i = 0; i < fromPos.length; i++) {\n doc.nodesBetween(fromPos[i], toPos[i], (node, from) => {\n if (node.marks) {\n const actualMark = node.marks.find(mark => mark.type === PMmark);\n if (actualMark) {\n markFound = {\n from,\n to: from + node.nodeSize,\n attrs: actualMark.attrs,\n };\n }\n }\n });\n if (markFound) {\n return markFound;\n }\n }\n return markFound;\n};\n\nconst findAllMarksWithSameId = (state, mark) => {\n const type = mark.type.name;\n const markType = state.schema.marks[type];\n\n const allNodes = findChildrenByMark(state.doc, markType, true);\n\n const allMarksWithSameId = [];\n allNodes.map(node => {\n node.node.marks.filter(value => {\n if (mark.type.name === type && mark.attrs.id === value.attrs.id) {\n allMarksWithSameId.push(node);\n }\n });\n });\n return allMarksWithSameId;\n};\n\nconst findMarkPosition = (activeView, initialPos, markType) => {\n const $pos = activeView.state.tr.doc.resolve(initialPos);\n const { parent } = $pos;\n const start = parent.childAfter($pos.parentOffset);\n if (!start.node) return null;\n const actualMark = start.node.marks.find(mark => mark.type.name === markType);\n let startIndex = $pos.index();\n let startPos = $pos.start() + start.offset;\n while (startIndex > 0 && actualMark.isInSet(parent.child(startIndex - 1).marks))\n startPos -= parent.child(--startIndex).nodeSize;\n let endIndex = $pos.indexAfter();\n let endPos = startPos + start.node.nodeSize;\n while (endPos < parent.childCount && actualMark.isInSet(parent.child(endIndex).marks))\n endPos += parent.child(endIndex++).nodeSize;\n return { from: startPos, to: endPos };\n};\n\nexport const flatten = (node, descend = true) => {\n if (!node) {\n throw new Error('Invalid \"node\" parameter');\n }\n const result = [];\n node.descendants((child, pos) => {\n result.push({ node: child, pos });\n if (!descend) {\n return false;\n }\n });\n return result;\n};\n\nconst findBlockNodes = (node, descend) => {\n return findChildren(node, child => child.isBlock, descend);\n};\n\nconst findChildrenByType = (node, nodeType, descend) => {\n return findChildren(node, child => child.type === nodeType, descend);\n};\n\nconst findChildren = (node, predicate, descend) => {\n if (!node) {\n throw new Error('Invalid \"node\" parameter');\n } else if (!predicate) {\n throw new Error('Invalid \"predicate\" parameter');\n }\n return flatten(node, descend).filter(child => predicate(child.node));\n};\n\nconst findInlineNodes = (node, descend) => {\n return findChildren(node, child => child.isInline, descend);\n};\n\nconst findChildrenByMark = (node, markType, descend) => {\n return findChildren(node, child => markType.isInSet(child.marks), descend);\n};\n\nexport const findChildrenByAttr = (node, predicate, descend) => {\n return findChildren(node, child => !!predicate(child.attrs), descend);\n};\n\nexport default {\n findMark,\n findBlockNodes,\n findChildrenByType,\n findInlineNodes,\n findChildrenByMark,\n findChildrenByAttr,\n getSelectionMark,\n findFragmentedMark,\n findAllMarksWithSameId,\n findMarkPosition,\n};\n","import { v4 as uuidv4 } from 'uuid';\nimport { toggleMark } from 'prosemirror-commands';\n\nconst setBlockType = (nodeType, attrs = {}) => {\n return (state, dispatch) => {\n const { tr } = state;\n const { from, to } = state.selection;\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (!node.isTextblock || node.hasMarkup(nodeType, attrs)) return;\n let applicable = false;\n if (node.type === nodeType) {\n applicable = true;\n } else {\n const $pos = state.doc.resolve(pos);\n const index = $pos.index();\n applicable = $pos.parent.canReplaceWith(index, index + 1, nodeType);\n }\n if (applicable) {\n tr.setBlockType(\n from,\n to,\n nodeType,\n Object.assign({}, node.attrs, attrs),\n );\n }\n });\n if (!tr.steps.length) return false;\n if (dispatch) dispatch(tr.scrollIntoView());\n return true;\n };\n};\n\nconst markActive = type => state => {\n const { from, $from, to, empty } = state.selection;\n\n return empty\n ? type.isInSet(state.storedMarks || $from.marks())\n : state.doc.rangeHasMark(from, to, type);\n};\n\nconst blockActive = (type, attrs = {}) => state => {\n const { $from, to, node } = state.selection;\n\n if (node) {\n return node.hasMarkup(type, attrs);\n }\n\n return to <= $from.end() && $from.parent.hasMarkup(type, attrs);\n};\n\nconst canInsert = type => state => {\n const { $from } = state.selection;\n\n for (let d = $from.depth; d >= 0; d--) {\n const index = $from.index(d);\n\n if ($from.node(d).canReplaceWith(index, index, type)) {\n return true;\n }\n }\n\n return false;\n};\n\nconst createTable = (state, dispatch) => {\n let rowCount = window && window.prompt('How many rows?', 2);\n let colCount = window && window.prompt('How many columns?', 2);\n\n const cells = [];\n while (colCount--) {\n cells.push(state.config.schema.nodes.table_cell.createAndFill());\n }\n\n const rows = [];\n while (rowCount--) {\n rows.push(state.config.schema.nodes.table_row.createAndFill(null, cells));\n }\n\n const table = state.config.schema.nodes.table.createAndFill(null, rows);\n dispatch(state.tr.replaceSelectionWith(table));\n};\n\nconst createLink = (state, dispatch) => {\n const {\n selection: { $from, $to },\n } = state;\n dispatch(\n state.tr\n .setMeta('addToHistory', false)\n .addMark(\n $from.pos,\n $to.pos,\n state.schema.marks.link.create({ href: '' }),\n ),\n );\n};\n\nconst isOnSameTextBlock = state => {\n const {\n selection: { $from, $to, from, to },\n } = state;\n if (from !== to && $from.parent === $to.parent && $from.parent.isTextblock) {\n return true;\n }\n return false;\n};\n\nconst createComment = (state, dispatch, group, viewid) => {\n toggleMark(state.config.schema.marks.comment, {\n id: uuidv4(),\n group,\n conversation: [],\n viewid,\n })(state, dispatch);\n};\n\nexport default {\n setBlockType,\n blockActive,\n canInsert,\n createComment,\n createLink,\n createTable,\n markActive,\n isOnSameTextBlock,\n};\n"],"names":["parseFormatList","str","formatList","JSON","parse","error","Array","isArray","filter","format","parseTracks","tracks","track","hasOwnProperty","blockLevelToDOM","node","attrs","length","id","class","stringify","group","findMark","state","PMmark","toArr","selection","$from","$to","doc","fromMark","marks","find","mark","type","toMark","markFound","marksFound","nodesBetween","pos","from","actualMark","to","nodeSize","contained","push","getSelectionMark","findFragmentedMark","fromPos","toPos","i","findAllMarksWithSameId","name","markType","schema","allNodes","findChildrenByMark","allMarksWithSameId","map","value","findMarkPosition","activeView","initialPos","$pos","tr","resolve","parent","start","childAfter","parentOffset","startIndex","index","startPos","offset","isInSet","child","endIndex","indexAfter","endPos","childCount","flatten","descend","Error","result","descendants","findBlockNodes","findChildren","isBlock","findChildrenByType","nodeType","predicate","findInlineNodes","isInline","findChildrenByAttr","setBlockType","dispatch","isTextblock","hasMarkup","applicable","canReplaceWith","Object","assign","steps","scrollIntoView","markActive","empty","storedMarks","rangeHasMark","blockActive","end","canInsert","d","depth","createTable","rowCount","window","prompt","colCount","cells","config","nodes","table_cell","createAndFill","rows","table_row","table","replaceSelectionWith","createLink","setMeta","addMark","link","create","href","isOnSameTextBlock","createComment","viewid","toggleMark","comment","uuidv4","conversation"],"mappings":";;;;;;;AAAA,MAAMA,eAAe,GAAGC,GAAG,IAAI;AAC7B,MAAI,CAACA,GAAL,EAAU;AACR,WAAO,EAAP;AACD;;AACD,MAAIC,UAAJ;;AACA,MAAI;AACFA,IAAAA,UAAU,GAAGC,IAAI,CAACC,KAAL,CAAWH,GAAX,CAAb;AACD,GAFD,CAEE,OAAOI,KAAP,EAAc;AACd,WAAO,EAAP;AACD;;AACD,MAAI,CAACC,KAAK,CAACC,OAAN,CAAcL,UAAd,CAAL,EAAgC;AAC9B,WAAO,EAAP;AACD;;AACD,SAAOA,UAAU,CAACM,MAAX,CAAkBC,MAAM,IAAI,OAAOA,MAAP,KAAkB,QAA9C,CAAP;AACD,CAdD;;AAgBA,MAAMC,WAAW,G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