From eb908b8c7f16845c2a0bd85d7be92f86f141b9ad Mon Sep 17 00:00:00 2001 From: Pete Boysen Date: Sun, 6 Mar 2016 17:14:17 -0600 Subject: [PATCH] added peer review (commenting) --- comments-built-min.js | 13 +++++++++++ comments.html | 50 ++++++++++++++++++++++++++++++++++++++++++ grammar.html | 2 +- icons/menu.png | Bin 0 -> 173 bytes 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 comments-built-min.js create mode 100644 comments.html create mode 100644 icons/menu.png diff --git a/comments-built-min.js b/comments-built-min.js new file mode 100644 index 0000000..c804742 --- /dev/null +++ b/comments-built-min.js @@ -0,0 +1,13 @@ +!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o2?_len-2:0),_key=2;_len>_key;_key++)args[_key-2]=arguments[_key];for(var i=0;i0;i--){if(!(0,_char.isExtendingChar)(node.text.charAt(i-1)))return offset-1;offset--}else if("word"==by)for(var i=offset-start;i>0;i--){var nextCharCat=(0,_char.charCategory)(node.text.charAt(i-1));if(null==cat||1==counted&&"space"==cat)cat=nextCharCat;else if(cat!=nextCharCat)return offset;offset--,counted++}}}function deleteBarrier(pm,cut){var around=pm.doc.path(cut.path),before=around.child(cut.offset-1),after=around.child(cut.offset);if(!before.type.canContainContent(after.type)||pm.tr.join(cut).apply(pm.apply.scroll)===!1){var conn=void 0;if(after.isTextblock&&(conn=before.type.findConnection(after.type))){var tr=pm.tr,end=cut.move(1);if(tr.step("ancestor",cut,end,null,{types:[before.type].concat(_toConsumableArray(conn)),attrs:[before.attrs].concat(_toConsumableArray(conn.map(function(){return null})))}),tr.join(end),tr.join(cut),tr.apply(pm.apply.scroll)!==!1)return}var selAfter=(0,_selection.findSelectionFrom)(pm.doc,cut,1);return pm.tr.lift(selAfter.from,selAfter.to).apply(pm.apply.scroll)}}function moveForward(parent,offset,by){if("char"!=by&&"word"!=by)throw new _error.AssertionError("Unknown motion unit: "+by);for(var cat=null,counted=0;;){if(offset==parent.size)return offset;var _parent$chunkAfter=parent.chunkAfter(offset),start=_parent$chunkAfter.start,node=_parent$chunkAfter.node;if(!node.isText)return cat?offset:offset+1;if("char"==by)for(var i=offset-start;i0?to:from;return(0,_selection.findSelectionFrom)(pm.doc,node&&node.isBlock?side:side.shorten(null,dir>0?1:0),dir)}function selectNodeHorizontally(pm,dir){var _pm$selection16=pm.selection,empty=_pm$selection16.empty,node=_pm$selection16.node,from=_pm$selection16.from,to=_pm$selection16.to;if(!empty&&!node)return!1;if(node&&node.isInline)return pm.setTextSelection(dir>0?to:from),!0;var parent=void 0;if(!node&&(parent=pm.doc.path(from.path))&&(dir>0?from.offset0?parent.chunkAfter(from.offset):parent.chunkBefore(from.offset),nextNode=_ref.node,start=_ref.start;return nextNode.type.selectable&&start==from.offset-(dir>0?0:1)?(pm.setNodeSelection(0>dir?from.move(-1):from),!0):!1}var next=moveSelectionBlock(pm,dir);return next&&(next instanceof _selection.NodeSelection||node)?(pm.setSelectionDirect(next),!0):!1}function selectNodeVertically(pm,dir){var _pm$selection17=pm.selection,empty=_pm$selection17.empty,node=_pm$selection17.node,from=_pm$selection17.from,to=_pm$selection17.to;if(!empty&&!node)return!1;var leavingTextblock=!0;if((!node||node.isInline)&&(leavingTextblock=(0,_selection.verticalMotionLeavesTextblock)(pm,dir>0?to:from,dir)),leavingTextblock){var next=moveSelectionBlock(pm,dir);if(next&&next instanceof _selection.NodeSelection)return pm.setSelectionDirect(next),node||(pm.sel.lastNonNodePos=from),!0}if(!node)return!1;if(node.isInline)return(0,_dompos.setDOMSelectionToPos)(pm,from),!1;var last=pm.sel.lastNonNodePos,beyond=(0,_selection.findSelectionFrom)(pm.doc,0>dir?from:to,dir);return last&&beyond&&_model.Pos.samePath(last.path,beyond.from.path)?((0,_dompos.setDOMSelectionToPos)(pm,last),!1):(beyond&&pm.setSelectionDirect(beyond),!0)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.baseCommands=void 0;var _model=require("../model"),_transform=require("../transform"),_error=require("../util/error"),_char=require("./char"),_selection=require("./selection"),_dompos=require("./dompos"),baseCommands=exports.baseCommands=Object.create(null);baseCommands.deleteSelection={label:"Delete the selection",run:function(pm){return pm.tr.replaceSelection().apply(pm.apply.scroll)},keys:{all:["Backspace(10)","Delete(10)","Mod-Backspace(10)","Mod-Delete(10)"],mac:["Ctrl-H(10)","Alt-Backspace(10)","Ctrl-D(10)","Ctrl-Alt-Backspace(10)","Alt-Delete(10)","Alt-D(10)"]}},baseCommands.joinBackward={label:"Join with the block above",run:function(pm){var _pm$selection=pm.selection,head=_pm$selection.head,empty=_pm$selection.empty;if(!empty||head.offset>0)return!1;for(var before=void 0,cut=void 0,i=head.path.length-1;!before&&i>=0;i--)head.path[i]>0&&(cut=head.shorten(i),before=pm.doc.path(cut.path).child(cut.offset-1));return before?null==before.type.contains?pm.tr["delete"](cut.move(-1),cut).apply(pm.apply.scroll):deleteBarrier(pm,cut):pm.tr.lift(head).apply(pm.apply.scroll)},keys:["Backspace(30)","Mod-Backspace(30)"]},baseCommands.deleteCharBefore={label:"Delete a character before the cursor",run:function(pm){var _pm$selection2=pm.selection,head=_pm$selection2.head,empty=_pm$selection2.empty;if(!empty||0==head.offset)return!1;var from=moveBackward(pm.doc.path(head.path),head.offset,"char");return pm.tr["delete"](new _model.Pos(head.path,from),head).apply(pm.apply.scroll)},keys:{all:["Backspace(60)"],mac:["Ctrl-H(40)"]}},baseCommands.deleteWordBefore={label:"Delete the word before the cursor",run:function(pm){var _pm$selection3=pm.selection,head=_pm$selection3.head,empty=_pm$selection3.empty;if(!empty||0==head.offset)return!1;var from=moveBackward(pm.doc.path(head.path),head.offset,"word");return pm.tr["delete"](new _model.Pos(head.path,from),head).apply(pm.apply.scroll)},keys:{all:["Mod-Backspace(40)"],mac:["Alt-Backspace(40)"]}},baseCommands.joinForward={label:"Join with the block below",run:function(pm){var _pm$selection4=pm.selection,head=_pm$selection4.head,empty=_pm$selection4.empty;if(!empty||head.offset=0;i--){cut=head.shorten(i,1);var parent=pm.doc.path(cut.path);cut.offset0||pm.doc.path(head.path).size)return!1;if(head.depth>1){var shorter=head.shorten();if(shorter.offset>0&&shorter.offset0},menu:{group:"history",rank:10,display:{type:"icon",width:1024,height:1024,path:"M761 1024c113-206 132-520-313-509v253l-384-384 384-384v248c534-13 594 472 313 775z"}},keys:["Mod-Z"]},baseCommands.redo={label:"Redo last undone change",run:function(pm){return pm.scrollIntoView(),pm.history.redo()},select:function(pm){return pm.history.redoDepth>0},menu:{group:"history",rank:20,display:{type:"icon",width:1024,height:1024,path:"M576 248v-248l384 384-384 384v-253c-446-10-427 303-313 509-280-303-221-789 313-775z"}},keys:["Mod-Y","Shift-Mod-Z"]}},{"../model":34,"../transform":40,"../util/error":52,"./char":4,"./dompos":8,"./selection":17}],3:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function nothing(){}function ensureSelection(pm){if(pm.selection.node){var found=(0,_selection.findSelectionNear)(pm.doc,pm.selection.from,1,!0);found&&(0,_dompos.setDOMSelectionToPos)(pm,found.head)}return!1}Object.defineProperty(exports,"__esModule",{value:!0}),exports.captureKeys=void 0;var _browserkeymap=require("browserkeymap"),_browserkeymap2=_interopRequireDefault(_browserkeymap),_selection=require("./selection"),_dompos=require("./dompos"),_dom=require("../dom"),keys={Esc:nothing,Enter:nothing,"Mod-Enter":nothing,"Shift-Enter":nothing,Backspace:nothing,Delete:nothing,"Mod-B":nothing,"Mod-I":nothing,"Mod-Backspace":nothing,"Mod-Delete":nothing,"Shift-Backspace":nothing,"Shift-Delete":nothing,"Shift-Mod-Backspace":nothing,"Shift-Mod-Delete":nothing,"Mod-Z":nothing,"Mod-Y":nothing,"Shift-Mod-Z":nothing,"Ctrl-D":nothing,"Ctrl-H":nothing,"Ctrl-Alt-Backspace":nothing,"Alt-D":nothing,"Alt-Delete":nothing,"Alt-Backspace":nothing,"Mod-A":ensureSelection};["Left","Right","Up","Down","Home","End","PageUp","PageDown"].forEach(function(key){keys[key]=keys["Shift-"+key]=keys["Mod-"+key]=keys["Shift-Mod-"+key]=keys["Alt-"+key]=keys["Shift-Alt-"+key]=ensureSelection}),["Left","Mod-Left","Right","Mod-Right","Up","Down"].forEach(function(key){return delete keys[key]}),_dom.browser.mac&&(keys["Ctrl-F"]=keys["Ctrl-B"]=keys["Ctrl-P"]=keys["Ctrl-N"]=keys["Alt-F"]=keys["Alt-B"]=keys["Ctrl-A"]=keys["Ctrl-E"]=keys["Ctrl-V"]=keys.goPageUp=ensureSelection);exports.captureKeys=new _browserkeymap2["default"](keys)},{"../dom":1,"./dompos":8,"./selection":17,browserkeymap:57}],4:[function(require,module,exports){"use strict";function isWordChar(ch){return/\w/.test(ch)||isExtendingChar(ch)||ch>"€"&&(ch.toUpperCase()!=ch.toLowerCase()||nonASCIISingleCaseWordChar.test(ch))}function charCategory(ch){return/\s/.test(ch)?"space":isWordChar(ch)?"word":"other"}function isExtendingChar(ch){return ch.charCodeAt(0)>=768&&extendingChar.test(ch)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isWordChar=isWordChar,exports.charCategory=charCategory,exports.isExtendingChar=isExtendingChar;var nonASCIISingleCaseWordChar=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,extendingChar=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/},{}],5:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);ifrom.offset&&startParent.chunkAfter(from.offset);start=startChunk?type.isInSet(startChunk.node.marks):null,end=type.isInSet(pm.doc.marksAt(to))}return start&&end&&start.attrs[attr]==end.attrs[attr]?start.attrs[attr]:void 0}function selectedNodeAttr(pm,type,name){var node=pm.selection.node;return node&&node.type==type?node.attrs[name]:void 0}function deriveParams(type,params){return params&¶ms.map(function(param){var attr=type.attrs[param.attr],obj={type:"text","default":attr["default"],prefill:type instanceof _model.NodeType?function(pm){return selectedNodeAttr(pm,this,param.attr)}:function(pm){return selectedMarkAttr(pm,this,param.attr)}};for(var prop in param)obj[prop]=param[prop];return obj})}function fillAttrs(conf,givenParams){var attrs=conf.attrs;return conf.params&&!function(){var filled=Object.create(null);if(attrs)for(var name in attrs)filled[name]=attrs[name];conf.params.forEach(function(param,i){return filled[param.attr]=givenParams[i]}),attrs=filled}(),attrs}function isAtTopOfListItem(doc,from,to,listType){return _model.Pos.samePath(from.path,to.path)&&from.path.length>=2&&0==from.path[from.path.length-1]&&listType.canContain(doc.path(from.path.slice(0,from.path.length-1)))}function alreadyHasBlockType(doc,from,to,type,attrs){var found=!1;return attrs||(attrs={}),doc.nodesBetween(from,to||from,function(node){return node.isTextblock?(node.hasMarkup(type,attrs)&&(found=!0),!1):void 0}),found}function activeTextblockIs(pm,type,attrs){var _pm$selection6=pm.selection,from=_pm$selection6.from,to=_pm$selection6.to,node=_pm$selection6.node;if(!node||node.isInline){if(!_model.Pos.samePath(from.path,to.path))return!1;node=pm.doc.path(from.path)}else if(!node.isTextblock)return!1;return node.hasMarkup(type,attrs)}var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=arr[Symbol.iterator]();!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{!_n&&_i["return"]&&_i["return"]()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr))return arr;if(Symbol.iterator in Object(arr))return sliceIterator(arr,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},_createClass=function(){function defineProperties(target,props){for(var i=0;i1?_len-1:0),_key=1;_len>_key;_key++)params[_key-1]=arguments[_key];pm.setMark(this,!0,fillAttrs(conf,params))},select:function(pm){return conf.inverseSelect?markApplies(pm,this)&&!markActive(pm,this):canAddInline(pm,this)},params:deriveParams(this,conf.params)}},_model.MarkType.derivableCommands.unset=function(){return{run:function(pm){pm.setMark(this,!1)},select:function(pm){return markActive(pm,this)}}},_model.MarkType.derivableCommands.toggle=function(){return{run:function(pm){pm.setMark(this,null)},active:function(pm){return markActive(pm,this)},select:function(pm){return markApplies(pm,this)}}},_model.NodeType.derivableCommands.wrap=function(conf){return{run:function(pm){var _pm$selection4=pm.selection,from=_pm$selection4.from,to=_pm$selection4.to,head=_pm$selection4.head,doJoin=!1;if(conf.list&&head&&isAtTopOfListItem(pm.doc,from,to,this)){if(0==from.path[from.path.length-2])return!1;doJoin=!0}for(var _len2=arguments.length,params=Array(_len2>1?_len2-1:0),_key2=1;_len2>_key2;_key2++)params[_key2-1]=arguments[_key2];var tr=pm.tr.wrap(from,to,this,fillAttrs(conf,params));return doJoin&&tr.join(from.shorten(from.depth-2)),tr.apply(pm.apply.scroll)},select:function(pm){var _pm$selection5=pm.selection,from=_pm$selection5.from,to=_pm$selection5.to,head=_pm$selection5.head;return conf.list&&head&&isAtTopOfListItem(pm.doc,from,to,this)&&0==from.path[from.path.length-2]?!1:(0,_transform.canWrap)(pm.doc,from,to,this,conf.attrs)},params:deriveParams(this,conf.params)}},_model.NodeType.derivableCommands.make=function(conf){return{run:function(pm){var _pm$selection7=pm.selection,from=_pm$selection7.from,to=_pm$selection7.to;return pm.tr.setBlockType(from,to,this,conf.attrs).apply(pm.apply.scroll)},select:function(pm){var _pm$selection8=pm.selection,from=_pm$selection8.from,to=_pm$selection8.to,node=_pm$selection8.node;return node?node.isTextblock&&!node.hasMarkup(this,conf.attrs):!alreadyHasBlockType(pm.doc,from,to,this,conf.attrs)},active:function(pm){return activeTextblockIs(pm,this,conf.attrs)}}},_model.NodeType.derivableCommands.insert=function(conf){return{run:function(pm){for(var _len3=arguments.length,params=Array(_len3>1?_len3-1:0),_key3=1;_len3>_key3;_key3++)params[_key3-1]=arguments[_key3];return pm.tr.replaceSelection(this.create(fillAttrs(conf,params))).apply(pm.apply.scroll)},select:this.isInline?function(pm){return pm.doc.path(pm.selection.from.path).type.canContainType(this)}:null,params:deriveParams(this,conf.params)}}},{"../dom":1,"../model":34,"../transform":40,"../util/error":52,"../util/obj":55,"../util/sortedinsert":56,"./base_commands":2,browserkeymap:57}],6:[function(require,module,exports){"use strict";var _dom=require("../dom");(0,_dom.insertCSS)('\n\n.ProseMirror {\n border: 1px solid silver;\n position: relative;\n}\n\n.ProseMirror-content {\n padding: 4px 8px 4px 14px;\n white-space: pre-wrap;\n line-height: 1.2;\n}\n\n.ProseMirror-drop-target {\n position: absolute;\n width: 1px;\n background: #666;\n display: none;\n}\n\n.ProseMirror-content ul.tight p, .ProseMirror-content ol.tight p {\n margin: 0;\n}\n\n.ProseMirror-content ul, .ProseMirror-content ol {\n padding-left: 30px;\n cursor: default;\n}\n\n.ProseMirror-content blockquote {\n padding-left: 1em;\n border-left: 3px solid #eee;\n margin-left: 0; margin-right: 0;\n}\n\n.ProseMirror-content pre {\n white-space: pre-wrap;\n}\n\n.ProseMirror-selectednode {\n outline: 2px solid #8cf;\n}\n\n.ProseMirror-nodeselection *::selection { background: transparent; }\n.ProseMirror-nodeselection *::-moz-selection { background: transparent; }\n\n.ProseMirror-content p:first-child,\n.ProseMirror-content h1:first-child,\n.ProseMirror-content h2:first-child,\n.ProseMirror-content h3:first-child,\n.ProseMirror-content h4:first-child,\n.ProseMirror-content h5:first-child,\n.ProseMirror-content h6:first-child {\n margin-top: .3em;\n}\n\n/* Add space around the hr to make clicking it easier */\n\n.ProseMirror-content hr {\n position: relative;\n height: 6px;\n border: none;\n}\n\n.ProseMirror-content hr:after {\n content: "";\n position: absolute;\n left: 10px;\n right: 10px;\n top: 2px;\n border-top: 2px solid silver;\n}\n\n.ProseMirror-content img {\n cursor: default;\n}\n\n/* Make sure li selections wrap around markers */\n\n.ProseMirror-content li {\n position: relative;\n pointer-events: none; /* Don\'t do weird stuff with marker clicks */\n}\n.ProseMirror-content li > * {\n pointer-events: auto;\n}\n\nli.ProseMirror-selectednode {\n outline: none;\n}\n\nli.ProseMirror-selectednode:after {\n content: "";\n position: absolute;\n left: -32px;\n right: -2px; top: -2px; bottom: -2px;\n border: 2px solid #8cf;\n pointer-events: none;\n}\n\n'); +},{"../dom":1}],7:[function(require,module,exports){"use strict";function isAtEnd(node,pos,depth){for(var i=depth||0;i0)return!1;for(var i=depth||0;i0)return!1;return!0}function parseNearSelection(pm){for(var dom=pm.content,node=pm.doc,_pm$selection=pm.selection,from=_pm$selection.from,to=_pm$selection.to,depth=0;;depth++){var toNode=node.child(to.path[depth]),fromStart=isAtStart(from,depth+1),toEnd=isAtEnd(toNode,to,depth+1);if(fromStart||toEnd||from.path[depth]!=to.path[depth]||toNode.isTextblock){var startOffset=depth==from.depth?from.offset:from.path[depth];fromStart&&startOffset>0&&startOffset--;var endOffset=depth==to.depth?to.offset:to.path[depth]+1;toEnd&&endOffset=0;i--){var wrap=pm.doc.path(from.path.slice(0,i));parsed=wrap.replace(from.path[i],parsed)}return parsed}node=toNode,dom=(0,_dompos.findByPath)(dom,from.path[depth],!1)}}function applyDOMChange(pm){var updated=parseNearSelection(pm),changeStart=(0,_model.findDiffStart)(pm.doc.content,updated.content);if(changeStart){var changeEnd=findDiffEndConstrained(pm.doc.content,updated.content,changeStart);return markDirtyFor(pm,changeStart,changeEnd),pm.tr.replace(changeStart,changeEnd.a,updated,changeStart,changeEnd.b).apply(),!0}return!1}function offsetBy(first,second,pos){var same=(0,_tree.samePathDepth)(first,second),firstEnd=same==first.depth,secondEnd=same==second.depth,off=(secondEnd?second.offset:second.path[same])-(firstEnd?first.offset:first.path[same]),shorter=firstEnd?pos.move(off):pos.shorten(same,off);return secondEnd?shorter:shorter.extend(new _model.Pos(second.path.slice(same),second.offset))}function findDiffEndConstrained(a,b,start){var end=(0,_model.findDiffEnd)(a,b);return end?end.a.cmp(start)<0?{a:start,b:offsetBy(end.a,start,end.b)}:end.b.cmp(start)<0?{a:offsetBy(end.b,start,end.a),b:start}:end:end}function sameDepth(a,b){for(var max=Math.min(a.depth,b.depth),i=0;max>i;i++)if(a.path[i]!=b.path[i])return i;return max}function markDirtyFor(pm,start,end){var depth=Math.min(sameDepth(start,end.a),sameDepth(start,end.b));if(0==depth)pm.markAllDirty();else{var pos=_model.Pos.from(start.path.slice(0,depth));pm.markRangeDirty({from:pos,to:pos.move(1)})}}function textContext(data){var range=window.getSelection().getRangeAt(0),start=range.startContainer,end=range.endContainer;if(start==end&&3==start.nodeType){var value=start.nodeValue,lead=range.startOffset,_end=range.endOffset;return data&&_end>=data.length&&value.slice(_end-data.length,_end)==data&&(lead=_end-data.length),{inside:start,lead:lead,trail:value.length-_end}}for(var sizeBefore=null,sizeAfter=null,before=start.childNodes[range.startOffset-1]||nodeBefore(start);before.lastChild;)before=before.lastChild;if(before&&3==before.nodeType){var value=before.nodeValue;sizeBefore=value.length,data&&value.slice(value.length-data.length)==data&&(sizeBefore-=data.length)}for(var after=end.childNodes[range.endOffset]||nodeAfter(end);after.firstChild;)after=after.firstChild;return after&&3==after.nodeType&&(sizeAfter=after.nodeValue.length),{before:before,sizeBefore:sizeBefore,after:after,sizeAfter:sizeAfter}}function textInContext(context,deflt){if(context.inside){var _val=context.inside.nodeValue;return _val.slice(context.lead,_val.length-context.trail)}var before=context.before,after=context.after,val="";if(!before)return deflt;3==before.nodeType&&(val=before.nodeValue.slice(context.sizeBefore));var scan=scanText(before,after);if(null==scan)return deflt;if(val+=scan,after&&3==after.nodeType){var valAfter=after.nodeValue;val+=valAfter.slice(0,valAfter.length-context.sizeAfter)}return val}function nodeAfter(node){for(;;){var next=node.nextSibling;if(next){for(;next.firstChild;)next=next.firstChild;return next}if(!(node=node.parentElement))return null}}function nodeBefore(node){for(;;){var prev=node.previousSibling;if(prev){for(;prev.lastChild;)prev=prev.lastChild;return prev}if(!(node=node.parentElement))return null}}function scanText(start,end){for(var text="",cur=nodeAfter(start);;){if(cur==end)return text;if(!cur)return null;3==cur.nodeType&&(text+=cur.nodeValue),cur=cur.firstChild||nodeAfter(cur)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.applyDOMChange=applyDOMChange,exports.textContext=textContext,exports.textInContext=textInContext;var _model=require("../model"),_format=require("../format"),_tree=require("../transform/tree"),_dompos=require("./dompos")},{"../format":20,"../model":34,"../transform/tree":48,"./dompos":8}],8:[function(require,module,exports){"use strict";function pathFromDOM(pm,node){for(var path=[];node!=pm.content;){var attr=node.getAttribute("pm-offset");attr&&path.unshift(+attr),node=node.parentNode}return path}function widthFromDOM(dom){var attr=dom.getAttribute("pm-leaf");return attr&&"true"!=attr?+attr:1}function posFromDOM(pm,dom,domOffset,loose){if(!loose&&pm.operation&&pm.doc!=pm.operation.doc)throw new _error.AssertionError("Fetching a position from an outdated DOM structure");null==domOffset&&(domOffset=Array.prototype.indexOf.call(dom.parentNode.childNodes,dom),dom=dom.parentNode);for(var extraOffset=0,tag=void 0;;){var adjust=0;if(3==dom.nodeType)extraOffset+=domOffset;else{if(dom.hasAttribute("pm-container"))break;(tag=dom.getAttribute("pm-inner-offset"))?(extraOffset+=+tag,adjust=-1):domOffset&&domOffset==dom.childNodes.length&&(adjust=1)}var parent=dom.parentNode;domOffset=0>adjust?0:Array.prototype.indexOf.call(parent.childNodes,dom)+adjust,dom=parent}var path=pathFromDOM(pm,dom);if(dom.hasAttribute("pm-leaf"))return _model.Pos.from(path,extraOffset+(domOffset?1:0));for(var offset=0,i=domOffset-1;i>=0;i--){var child=dom.childNodes[i];if(3==child.nodeType)loose&&(extraOffset+=child.nodeValue.length);else{if(tag=child.getAttribute("pm-offset")){offset=+tag+widthFromDOM(child);break}loose&&!child.hasAttribute("pm-ignore")&&(extraOffset+=child.textContent.length)}}return new _model.Pos(path,offset+extraOffset)}function findByPath(node,n,fromEnd){for(var container=childContainer(node),ch=fromEnd?container.lastChild:container.firstChild;ch;ch=fromEnd?ch.previousSibling:ch.nextSibling)if(1==ch.nodeType){var offset=ch.getAttribute("pm-offset");if(offset&&+offset==n)return ch}}function pathToDOM(parent,path){for(var node=parent,i=0;i=0&&(after?width>=diff:width>diff))return{node:ch,offset:i,innerOffset:diff}}}function leafAt(node,offset){for(;;){var child=node.firstChild;if(!child)return{node:node,offset:offset};if(1!=child.nodeType)return{node:child,offset:offset};if(child.hasAttribute("pm-inner-offset")){for(var nodeOffset=0;;){var nextSib=child.nextSibling,nextOffset=void 0;if(!nextSib||(nextOffset=+nextSib.getAttribute("pm-inner-offset"))>=offset)break;child=nextSib,nodeOffset=nextOffset}offset-=nodeOffset}node=child}}function DOMFromPos(parent,pos){var dom=childContainer(pathToDOM(parent,pos.path)),found=findByOffset(dom,pos.offset,!0),inner=void 0;return found?"true"!=found.node.getAttribute("pm-leaf")&&(inner=leafAt(found.node,found.innerOffset))?inner:{node:found.node.parentNode,offset:found.offset+(found.innerOffset?1:0)}:{node:dom,offset:0}}function windowRect(){return{left:0,right:window.innerWidth,top:0,bottom:window.innerHeight}}function scrollIntoView(pm,pos){pos||(pos=pm.sel.range.head||pm.sel.range.from);for(var coords=coordsAtPos(pm,pos),parent=pm.content;;parent=parent.parentNode){var atBody=parent==document.body,rect=atBody?windowRect():parent.getBoundingClientRect(),moveX=0,moveY=0;if(coords.toprect.bottom&&(moveY=coords.bottom-rect.bottom+scrollMargin),coords.leftrect.right&&(moveX=coords.right-rect.right+scrollMargin),(moveX||moveY)&&(atBody?window.scrollBy(moveX,moveY):(moveY&&(parent.scrollTop+=moveY),moveX&&(parent.scrollLeft+=moveX))),atBody)break}}function findOffsetInNode(node,coords){for(var closest=void 0,dyClosest=1e8,coordsClosest=void 0,offset=0,child=node.firstChild;child;child=child.nextSibling){var rects=void 0;if(1==child.nodeType)rects=child.getClientRects();else{if(3!=child.nodeType)continue;rects=textRects(child)}for(var i=0;i=coords.left){var dy=rect.top>coords.top?rect.top-coords.top:rect.bottomdy){closest=child,dyClosest=dy,coordsClosest=dy?{left:coords.left,top:rect.top}:coords,1!=child.nodeType||child.firstChild||(offset=i+(coords.left>=(rect.left+rect.right)/2?1:0));continue}}!closest&&(coords.top>=rect.bottom||coords.top>=rect.top&&coords.left>=rect.right)&&(offset=i+1)}}return closest?3==closest.nodeType?findOffsetInText(closest,coordsClosest):closest.firstChild?findOffsetInNode(closest,coordsClosest):{node:node,offset:offset}:{node:node,offset:offset}}function findOffsetInText(node,coords){for(var len=node.nodeValue.length,range=document.createRange(),i=0;len>i;i++){range.setEnd(node,i+1),range.setStart(node,i);var rect=range.getBoundingClientRect();if(rect.top!=rect.bottom&&rect.left<=coords.left&&rect.right>=coords.left&&rect.top<=coords.top&&rect.bottom>=coords.top)return{node:node,offset:i+(coords.left>=(rect.left+rect.right)/2?1:0)}}return{node:node,offset:0}}function posAtCoords(pm,coords){var elt=document.elementFromPoint(coords.left,coords.top+1);if(!(0,_dom.contains)(pm.content,elt))return null;elt.firstChild||(elt=elt.parentNode);var _findOffsetInNode=findOffsetInNode(elt,coords),node=_findOffsetInNode.node,offset=_findOffsetInNode.offset;return posFromDOM(pm,node,offset)}function textRect(node,from,to){var range=document.createRange();return range.setEnd(node,to),range.setStart(node,from),range.getBoundingClientRect()}function textRects(node){var range=document.createRange();return range.setEnd(node,node.nodeValue.length),range.setStart(node,0),range.getClientRects()}function coordsAtPos(pm,pos){var _DOMFromPos=DOMFromPos(pm.content,pos),node=_DOMFromPos.node,offset=_DOMFromPos.offset,side=void 0,rect=void 0;if(3==node.nodeType)offsetversion;)this.addNextMap()}},{key:"addNextMap",value:function(){var found=this.branch.mirror[this.version],mapOffset=this.branch.maps.length-(this.branch.version-this.version)-1,id=this.remap.addToFront(this.branch.maps[mapOffset],this.mirrorBuffer[this.version]);return--this.version,null!=found&&(this.mirrorBuffer[found]=id),id}},{key:"movePastStep",value:function(result){var id=this.addNextMap();result&&this.remap.addToBack(result.map,id)}}]),BranchRemapping}(),workTime=100,pauseTime=150,CompressionWorker=function(){function CompressionWorker(doc,branch,callback){_classCallCheck(this,CompressionWorker),this.branch=branch,this.callback=callback,this.remap=new BranchRemapping(branch),this.doc=doc,this.events=[],this.maps=[],this.version=this.startVersion=branch.version,this.i=branch.events.length,this.timeout=null,this.aborted=!1}return _createClass(CompressionWorker,[{key:"work",value:function(){var _this=this;if(!this.aborted)for(var endTime=Date.now()+workTime;;){if(0==this.i)return this.finish();for(var event=this.branch.events[--this.i],outEvent=[],j=event.length-1;j>=0;j--){var _event$j=event[j],step=_event$j.step,stepVersion=_event$j.version,stepID=_event$j.id;this.remap.moveToVersion(stepVersion);var mappedStep=step.map(this.remap.remap);if(mappedStep&&isDelStep(step)){for(var extra=0,start=step.from;j>0;){var next=event[j-1];if(next.version!=stepVersion-1||!isDelStep(next.step)||start.cmp(next.step.to))break;extra+=next.step.to.offset-next.step.from.offset,start=next.step.from,stepVersion--,j--,this.remap.addNextMap()}if(extra>0){var _start=mappedStep.from.move(-extra);mappedStep=new _transform.Step("replace",_start,mappedStep.to,_start)}}var result=mappedStep&&mappedStep.apply(this.doc);result&&(this.doc=result.doc,this.maps.push(result.map.invert()),outEvent.push(new InvertedStep(mappedStep,this.version,stepID)),this.version--),this.remap.movePastStep(result)}if(outEvent.length&&(outEvent.reverse(),this.events.push(outEvent)),Date.now()>endTime)return void(this.timeout=window.setTimeout(function(){return _this.work()},pauseTime))}}},{key:"finish",value:function(){this.aborted||(this.events.reverse(),this.maps.reverse(),this.callback(this.maps.concat(this.branch.maps.slice(this.branch.maps.length-(this.branch.version-this.startVersion))),this.events))}},{key:"abort",value:function(){this.aborted=!0,window.clearTimeout(this.timeout)}}]),CompressionWorker}(),compressStepCount=150,Branch=function(){function Branch(maxDepth){_classCallCheck(this,Branch),this.maxDepth=maxDepth,this.version=0,this.nextStepID=1,this.maps=[],this.mirror=Object.create(null),this.events=[],this.stepsSinceCompress=0,this.compressing=null,this.compressTimeout=null}return _createClass(Branch,[{key:"clear",value:function(force){(force||!this.empty())&&(this.maps.length=this.events.length=this.stepsSinceCompress=0,this.mirror=Object.create(null),this.abortCompression())}},{key:"newEvent",value:function(){for(this.abortCompression(),this.events.push([]);this.events.length>this.maxDepth;)this.events.shift()}},{key:"addMap",value:function(map){return this.empty()?void 0:(this.maps.push(map),this.version++,this.stepsSinceCompress++,!0)}},{key:"empty",value:function(){return 0==this.events.length}},{key:"addStep",value:function(step,map,id){this.addMap(map),null==id&&(id=this.nextStepID++),this.events[this.events.length-1].push(new InvertedStep(step,this.version,id))}},{key:"addTransform",value:function(transform,ids){this.abortCompression();for(var i=0;i=0;i--){var invertedStep=event[i],step=invertedStep.step;if(collapsing&&invertedStep.version==remap.version)this.version--,delete this.mirror[this.version],this.maps.pop(),tr.step(step),ids.push(invertedStep.id),--remap.version;else{collapsing=!1,remap.moveToVersion(invertedStep.version),step=step.map(remap.remap);var result=step&&tr.step(step);result&&(ids.push(invertedStep.id),this.addMap(result.map)&&(this.mirror[this.version]=invertedStep.version)),i>0&&remap.movePastStep(result)}}return this.empty()&&this.clear(!0),{transform:tr,ids:ids}}},{key:"lastStep",value:function(){for(var i=this.events.length-1;i>=0;i--){var event=this.events[i];if(event.length)return event[event.length-1]}}},{key:"getVersion",value:function(){var step=this.lastStep();return{lastID:step&&step.id,version:this.version}}},{key:"isAtVersion",value:function(version){var step=this.lastStep();return this.version==version.version&&(step&&step.id)==version.lastID}},{key:"findVersion",value:function(version){for(var i=this.events.length-1;i>=0;i--)for(var event=this.events[i],j=event.length-1;j>=0;j--)if(event[j].id<=version.lastID)return{event:i,step:j+1}}},{key:"rebased",value:function(newMaps,rebasedTransform,positions){if(!this.empty()){this.abortCompression();var startVersion=this.version-positions.length;out:for(var i=this.events.length-1;i>=0;i--)for(var event=this.events[i],j=event.length-1;j>=0;j--){var step=event[j];if(step.version<=startVersion)break out;var off=positions[step.version-startVersion-1];if(-1==off)event.splice(j--,1);else{var inv=rebasedTransform.steps[off].invert(rebasedTransform.docs[off],rebasedTransform.maps[off]);event[j]=new InvertedStep(inv,startVersion+newMaps.length+off+1,step.id)}}this.maps.length>positions.length?this.maps=this.maps.slice(0,this.maps.length-positions.length).concat(newMaps).concat(rebasedTransform.maps):this.maps=rebasedTransform.maps.slice(),this.version=startVersion+newMaps.length+rebasedTransform.maps.length,this.stepsSinceCompress+=newMaps.length+rebasedTransform.steps.length-positions.length}}},{key:"abortCompression",value:function(){this.compressing&&(this.compressing.abort(),this.compressing=null)}},{key:"needsCompression",value:function(){return this.stepsSinceCompress>compressStepCount&&!this.compressing}},{key:"startCompression",value:function(doc){var _this2=this;this.compressing=new CompressionWorker(doc,this,function(maps,events){_this2.maps=maps,_this2.events=events,_this2.mirror=Object.create(null),_this2.compressing=null,_this2.stepsSinceCompress=0}),this.compressing.work()}}]),Branch}(),compressDelay=750;exports.History=function(){function History(pm){var _this3=this;_classCallCheck(this,History),this.pm=pm,this.done=new Branch(pm.options.historyDepth),this.undone=new Branch(pm.options.historyDepth),this.lastAddedAt=0,this.ignoreTransform=!1,this.allowCollapsing=!0,pm.on("transform",function(transform,options){return _this3.recordTransform(transform,options)})}return _createClass(History,[{key:"recordTransform",value:function(transform,options){if(!this.ignoreTransform){if(0==options.addToHistory)for(var i=0;ithis.lastAddedAt+this.pm.options.historyEventDelay&&this.done.newEvent(),this.done.addTransform(transform),this.lastAddedAt=now}this.maybeScheduleCompression()}}},{key:"undo",value:function(){return this.shift(this.done,this.undone)}},{key:"redo",value:function(){return this.shift(this.undone,this.done)}},{key:"shift",value:function(from,to){var event=from.popEvent(this.pm.doc,this.allowCollapsing);if(!event)return!1;var transform=event.transform,ids=event.ids;return this.ignoreTransform=!0,this.pm.apply(transform),this.ignoreTransform=!1,transform.steps.length?(to&&(to.newEvent(),to.addTransform(transform,ids)),this.lastAddedAt=0,!0):this.shift(from,to)}},{key:"getVersion",value:function(){return this.done.getVersion()}},{key:"isAtVersion",value:function(version){return this.done.isAtVersion(version)}},{key:"backToVersion",value:function(version){var found=this.done.findVersion(version);if(!found)return!1;var event=this.done.events[found.event];if(found.event==this.done.events.length-1&&found.step==event.length)return!0;var combined=this.done.events.slice(found.event+1).reduce(function(comb,arr){return comb.concat(arr)},event.slice(found.step));return this.done.events.length=found.event+((event.length=found.step)?1:0),this.done.events.push(combined),this.shift(this.done),!0}},{key:"rebased",value:function(newMaps,rebasedTransform,positions){this.done.rebased(newMaps,rebasedTransform,positions),this.undone.rebased(newMaps,rebasedTransform,positions),this.maybeScheduleCompression()}},{key:"maybeScheduleCompression",value:function(){this.maybeScheduleCompressionForBranch(this.done),this.maybeScheduleCompressionForBranch(this.undone)}},{key:"maybeScheduleCompressionForBranch",value:function(branch){var _this4=this;window.clearTimeout(branch.compressTimeout),branch.needsCompression()&&(branch.compressTimeout=window.setTimeout(function(){branch.needsCompression()&&branch.startCompression(_this4.pm.doc)},compressDelay))}},{key:"undoDepth",get:function(){return this.done.events.length}},{key:"redoDepth",get:function(){return this.undone.events.length}}]),History}()},{"../model":34,"../transform":40}],11:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Keymap=exports.baseCommands=exports.Command=exports.CommandSet=exports.MarkedRange=exports.NodeSelection=exports.TextSelection=exports.Selection=exports.SelectionError=exports.defineOption=exports.ProseMirror=void 0;var _main=require("./main");Object.defineProperty(exports,"ProseMirror",{enumerable:!0,get:function(){return _main.ProseMirror}});var _options=require("./options");Object.defineProperty(exports,"defineOption",{enumerable:!0,get:function(){return _options.defineOption}});var _selection=require("./selection");Object.defineProperty(exports,"SelectionError",{enumerable:!0,get:function(){return _selection.SelectionError}}),Object.defineProperty(exports,"Selection",{enumerable:!0,get:function(){return _selection.Selection}}),Object.defineProperty(exports,"TextSelection",{enumerable:!0,get:function(){return _selection.TextSelection}}),Object.defineProperty(exports,"NodeSelection",{enumerable:!0,get:function(){return _selection.NodeSelection}});var _range=require("./range");Object.defineProperty(exports,"MarkedRange",{enumerable:!0,get:function(){return _range.MarkedRange}});var _command=require("./command");Object.defineProperty(exports,"CommandSet",{enumerable:!0,get:function(){return _command.CommandSet}}),Object.defineProperty(exports,"Command",{enumerable:!0,get:function(){return _command.Command}});var _base_commands=require("./base_commands");Object.defineProperty(exports,"baseCommands",{enumerable:!0,get:function(){return _base_commands.baseCommands}}),require("./schema_commands");var _browserkeymap=require("browserkeymap"),_browserkeymap2=_interopRequireDefault(_browserkeymap);exports.Keymap=_browserkeymap2["default"]},{"./base_commands":2,"./command":5,"./main":13,"./options":14,"./range":15,"./schema_commands":16,"./selection":17,browserkeymap:57}],12:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function dispatchKey(pm,name,e){var seq=pm.input.keySeq;if(seq){if(_browserkeymap2["default"].isModifierKey(name))return!0;clearTimeout(stopSeq),stopSeq=setTimeout(function(){pm.input.keySeq==seq&&(pm.input.keySeq=null)},50),name=seq+" "+name}for(var handle=function handle(bound){if(bound===!1)return"nothing";if("..."==bound)return"multi";if(null==bound)return!1;var result=!1;if(Array.isArray(bound))for(var i=0;result===!1&&i=from.depth&&0==pos.shorten(from.depth).cmp(from)){if(0==from.depth)return pm.sel.fastPoll();pos=from.shorten()}pm.setNodeSelection(pos), +pm.focus(),e.preventDefault()}function handleTripleClick(pm,e){e.preventDefault();var pos=(0,_dompos.selectableNodeAbove)(pm,e.target,{left:e.clientX,top:e.clientY},!0);if(pos){var node=pm.doc.nodeAfter(pos);if(node.isBlock&&!node.isTextblock)pm.setNodeSelection(pos);else{var path=node.isInline?pos.path:pos.toPath();node.isInline&&(node=pm.doc.path(path)),pm.setTextSelection(new _model.Pos(path,0),new _model.Pos(path,node.size))}pm.focus()}}function finishComposing(pm){var info=pm.input.composing,text=(0,_domchange.textInContext)(info.context,info.endData),range=(0,_selection.rangeFromDOMLoose)(pm);pm.ensureOperation(),pm.input.composing=null,text!=info.data&&inputText(pm,info.range,text),range&&!range.eq(pm.sel.range)&&pm.setSelectionDirect(range)}function toClipboard(doc,from,to,dataTransfer){for(var found=void 0,max=Math.min(from.depth,to.depth),depth=0,node=doc.sliceBetween(from,to);max>=depth&&(node.type.defaultAttrs&&(found={depth:depth,node:node}),!(node.size>1));depth++)node=node.firstChild;var attr=found.node.type.name+" "+(from.depth-found.depth)+" "+(to.depth-found.depth),html='
'+(0,_format.toHTML)(found.node)+"
";dataTransfer.clearData(),dataTransfer.setData("text/html",html),dataTransfer.setData("text/plain",(0,_format.toText)(found.node))}function fromClipboard(pm,dataTransfer,plainText){var txt=dataTransfer.getData("text/plain"),html=dataTransfer.getData("text/html");if(!html&&!txt)return null;var doc=void 0,from=void 0,to=void 0;if(!plainText&&html||!txt){var dom=document.createElement("div");dom.innerHTML=pm.signalPipelined("transformPastedHTML",html);var wrap=dom.querySelector("[pm-context]"),context=void 0,contextNode=void 0,found=void 0;if(wrap&&(context=/^(\w+) (\d+) (\d+)$/.exec(wrap.getAttribute("pm-context")))&&(contextNode=pm.schema.nodes[context[1]])&&contextNode.defaultAttrs&&(found=parseFromContext(wrap,contextNode,+context[2],+context[3]))){var _found=found;doc=_found.doc,from=_found.from,to=_found.to}else doc=(0,_format.fromDOM)(pm.schema,dom)}else doc=(0,_format.parseFrom)(pm.schema,pm.signalPipelined("transformPastedText",txt),"text");return{doc:doc,from:from||(0,_selection.findSelectionAtStart)(doc).from,to:to||(0,_selection.findSelectionAtEnd)(doc).to}}function posAtLeft(doc,depth){for(var path=[],i=0,node=doc;depth>i&&(node=node.firstChild);i++)path.push(0);return new _model.Pos(path,0)}function posAtRight(doc,depth){for(var path=[],node=doc,i=0;depth>i&&node.size;i++)path.push(node.size-1),node=node.lastChild;return new _model.Pos(path,node.size)}function parseFromContext(dom,contextNode,openLeft,openRight){var schema=contextNode.schema,top=schema.nodes.doc,doc=(0,_format.fromDOM)(schema,dom,{topNode:contextNode.create(),preserveWhitespace:!0});if(contextNode!=top){var path=top.findConnection(contextNode);if(!path)return null;for(var i=path.length-1;i>=-1;i--)doc=(0>i?top:path[i]).create(null,doc),++openLeft,++openRight}return{doc:doc,from:posAtLeft(doc,openLeft),to:posAtRight(doc,openRight)}}var _createClass=function(){function defineProperties(target,props){for(var i=0;inow-lastClick,tripleClick=600>now-oneButLastClick;oneButLastClick=lastClick,lastClick=now,tripleClick?handleTripleClick(pm,e):pm.input.mouseDown=new MouseDown(pm,e,doubleClick)};var MouseDown=function(){function MouseDown(pm,event,doubleClick){_classCallCheck(this,MouseDown),this.pm=pm,this.event=event,this.leaveToBrowser=pm.input.shiftKey||doubleClick;var path=(0,_dompos.pathFromDOM)(pm,event.target),node=pm.doc.path(path);this.mightDrag=node.type.draggable||node==pm.sel.range.node?path:null,this.mightDrag&&(event.target.draggable=!0,_dom.browser.gecko&&(this.setContentEditable=!event.target.hasAttribute("contentEditable"))&&event.target.setAttribute("contentEditable","false")),this.x=event.clientX,this.y=event.clientY,window.addEventListener("mouseup",this.up=this.up.bind(this)),window.addEventListener("mousemove",this.move=this.move.bind(this)),pm.sel.fastPoll()}return _createClass(MouseDown,[{key:"done",value:function(){window.removeEventListener("mouseup",this.up),window.removeEventListener("mousemove",this.move),this.mightDrag&&(this.event.target.draggable=!1,_dom.browser.gecko&&this.setContentEditable&&this.event.target.removeAttribute("contentEditable"))}},{key:"up",value:function(){if(this.done(),this.leaveToBrowser)this.pm.sel.fastPoll();else if(this.event.ctrlKey)selectClickedNode(this.pm,this.event);else if(!(0,_dompos.handleNodeClick)(this.pm,"handleClick",this.event,!0)){var pos=(0,_dompos.selectableNodeAbove)(this.pm,this.event.target,{left:this.x,top:this.y});pos?(this.pm.setNodeSelection(pos),this.pm.focus()):this.pm.sel.fastPoll()}}},{key:"move",value:function(event){!this.leaveToBrowser&&(Math.abs(this.x-event.clientX)>4||Math.abs(this.y-event.clientY)>4)&&(this.leaveToBrowser=!0),this.pm.sel.fastPoll()}}]),MouseDown}();handlers.touchdown=function(pm){pm.sel.fastPoll()},handlers.contextmenu=function(pm,e){(0,_dompos.handleNodeClick)(pm,"handleContextMenu",e,!1)};var Composing=function Composing(pm,data){_classCallCheck(this,Composing),this.finished=!1,this.context=(0,_domchange.textContext)(data),this.data=data,this.endData=null;var range=pm.selection;if(data){var path=range.head.path,line=pm.doc.path(path).textContent,found=line.indexOf(data,range.head.offset-data.length);found>-1&&found<=range.head.offset+data.length&&(range=new _selection.TextSelection(new _model.Pos(path,found),new _model.Pos(path,found+data.length)))}this.range=range};handlers.compositionstart=function(pm,e){if(!pm.input.maybeAbortComposition()){pm.flush(),pm.input.composing=new Composing(pm,e.data);var above=pm.selection.head.shorten();pm.markRangeDirty({from:above,to:above.move(1)})}},handlers.compositionupdate=function(pm,e){var info=pm.input.composing;info&&info.data!=e.data&&(info.data=e.data,pm.input.updatingComposition=!0,inputText(pm,info.range,info.data),pm.input.updatingComposition=!1,info.range=new _selection.TextSelection(info.range.from,info.range.from.move(info.data.length)))},handlers.compositionend=function(pm,e){var info=pm.input.composing;info&&(pm.input.composing.finished=!0,pm.input.composing.endData=e.data,setTimeout(function(){pm.input.composing==info&&finishComposing(pm)},20))},handlers.input=function(pm){return pm.input.skipInput?--pm.input.skipInput:pm.input.composing?void(pm.input.composing.finished&&finishComposing(pm)):(pm.startOperation({readSelection:!1}),(0,_domchange.applyDOMChange)(pm),void pm.scrollIntoView())},handlers.copy=handlers.cut=function(pm,e){var _pm$selection2=pm.selection,from=_pm$selection2.from,to=_pm$selection2.to,empty=_pm$selection2.empty;!empty&&e.clipboardData&&(toClipboard(pm.doc,from,to,e.clipboardData),e.preventDefault(),"cut"!=e.type||empty||pm.tr["delete"](from,to).apply())},handlers.paste=function(pm,e){if(e.clipboardData){var sel=pm.selection,fragment=fromClipboard(pm,e.clipboardData,pm.input.shiftKey);fragment&&(e.preventDefault(),pm.tr.replace(sel.from,sel.to,fragment.doc,fragment.from,fragment.to).apply(),pm.scrollIntoView())}},handlers.dragstart=function(pm,e){var mouseDown=pm.input.mouseDown;if(mouseDown&&mouseDown.done(),e.dataTransfer){var _pm$selection3=pm.selection,from=_pm$selection3.from,to=_pm$selection3.to,empty=_pm$selection3.empty,fragment=void 0,pos=!empty&&pm.posAtCoords({left:e.clientX,top:e.clientY});if(pos&&pos.cmp(from)>=0&&pos.cmp(to)<=0)fragment={from:from,to:to};else if(mouseDown&&mouseDown.mightDrag){var _pos=_model.Pos.from(mouseDown.mightDrag);fragment={from:_pos,to:_pos.move(1)}}fragment&&(pm.input.draggingFrom=fragment,toClipboard(pm.doc,fragment.from,fragment.to,e.dataTransfer))}},handlers.dragend=function(pm){return window.setTimeout(function(){return pm.input.draggingFrom=!1},50)},handlers.dragover=handlers.dragenter=function(pm,e){e.preventDefault();var cursorPos=pm.posAtCoords({left:e.clientX,top:e.clientY});if(cursorPos){var coords=(0,_dompos.coordsAtPos)(pm,cursorPos),rect=pm.wrapper.getBoundingClientRect();coords.top-=rect.top,coords.right-=rect.left,coords.bottom-=rect.top,coords.left-=rect.left;var target=pm.input.dropTarget;target.style.display="block",target.style.left=coords.left-1+"px",target.style.top=coords.top+"px",target.style.height=coords.bottom-coords.top+"px"}},handlers.dragleave=function(pm){return pm.input.dropTarget.style.display=""},handlers.drop=function(pm,e){if(pm.input.dropTarget.style.display="",e.dataTransfer&&!pm.signalDOM(e)){var fragment=fromClipboard(pm,e.dataTransfer);if(fragment){e.preventDefault();var insertPos=pm.posAtCoords({left:e.clientX,top:e.clientY}),origPos=insertPos;if(!insertPos)return;var tr=pm.tr;pm.input.draggingFrom&&!e.ctrlKey&&(tr["delete"](pm.input.draggingFrom.from,pm.input.draggingFrom.to),insertPos=tr.map(insertPos).pos),tr.replace(insertPos,insertPos,fragment.doc,fragment.from,fragment.to).apply();var posAfter=tr.map(origPos).pos;_model.Pos.samePath(insertPos.path,posAfter.path)&&posAfter.offset==insertPos.offset+1&&pm.doc.nodeAfter(insertPos).type.selectable?pm.setNodeSelection(insertPos):pm.setTextSelection(insertPos,posAfter),pm.focus()}}},handlers.focus=function(pm){pm.wrapper.classList.add("ProseMirror-focused"),pm.signal("focus")},handlers.blur=function(pm){pm.wrapper.classList.remove("ProseMirror-focused"),pm.signal("blur")}},{"../dom":1,"../format":20,"../model":34,"./capturekeys":3,"./domchange":7,"./dompos":8,"./selection":17,browserkeymap:57}],13:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;i=parent.size)throw new _selection2.SelectionError("Trying to set a node selection at the end of a node");var node=parent.child(pos.offset);if(!node.type.selectable)throw new _selection2.SelectionError("Trying to select a non-selectable node");this.input.maybeAbortComposition(),this.sel.setAndSignal(new _selection2.NodeSelection(pos,pos.move(1),node))}},{key:"setSelection",value:function(selection){selection instanceof _selection2.TextSelection?(this.checkPos(selection.head,!0),selection.empty||this.checkPos(selection.anchor,!0)):this.checkPos(selection.to,!1),this.setSelectionDirect(selection)}},{key:"setSelectionDirect",value:function(selection){this.ensureOperation(),this.input.maybeAbortComposition(),selection.eq(this.sel.range)||this.sel.setAndSignal(selection)}},{key:"setContent",value:function(value,format){format&&(value=(0,_format.parseFrom)(this.schema,value,format)),this.setDoc(value)}},{key:"getContent",value:function(format){return format?(0,_format.serializeTo)(this.doc,format):this.doc}},{key:"setDocInner",value:function(doc){if(doc.type!=this.schema.nodes.doc)throw new _error.AssertionError("Trying to set a document with a different schema");this.doc=doc,this.ranges=new _range.RangeStore(this),this.history=new _history.History(this)}},{key:"setDoc",value:function(doc,sel){sel||(sel=(0,_selection2.findSelectionAtStart)(doc)),this.signal("beforeSetDoc",doc,sel),this.ensureOperation(),this.setDocInner(doc),this.sel.set(sel,!0),this.signal("setDoc",doc,sel)}},{key:"updateDoc",value:function(doc,mapping,selection){this.ensureOperation(),this.input.maybeAbortComposition(),this.ranges.transform(mapping),this.doc=doc,this.sel.setAndSignal(selection||this.sel.range.map(doc,mapping)),this.signal("change")}},{key:"apply",value:function(transform){var options=arguments.length<=1||void 0===arguments[1]?nullOptions:arguments[1];if(transform.doc==this.doc)return!1;if(transform.docs[0]!=this.doc&&(0,_model.findDiffStart)(transform.docs[0],this.doc))throw new _error.AssertionError("Applying a transform that does not start with the current document");return this.signal("beforeTransform",transform,options),this.updateDoc(transform.doc,transform,options.selection),this.signal("transform",transform,options),options.scrollIntoView&&this.scrollIntoView(),transform}},{key:"checkPos",value:function(pos,textblock){if(!pos.isValid(this.doc,textblock))throw new _error.AssertionError("Position "+pos+" is not valid in current document")}},{key:"ensureOperation",value:function(options){return this.operation||this.startOperation(options)}},{key:"startOperation",value:function(options){var _this=this;return this.operation=new Operation(this),options&&options.readSelection===!1||!this.sel.readFromDOM()||(this.operation.sel=this.sel.range),this.flushScheduled||((0,_dom.requestAnimationFrame)(function(){_this.flushScheduled=!1,_this.flush()}),this.flushScheduled=!0),this.operation}},{key:"flush",value:function(){if(document.body.contains(this.wrapper)&&this.operation){this.signal("flushing");var op=this.operation;if(op){this.operation=null,this.accurateSelection=!0;var docChanged=op.doc!=this.doc||this.dirtyNodes.size,redrawn=!1;this.input.composing||!docChanged&&!op.composingAtStart||((0,_draw.redraw)(this,this.dirtyNodes,this.doc,op.doc),this.dirtyNodes.clear(),redrawn=!0),((redrawn||!op.sel.eq(this.sel.range))&&!this.input.composing||op.focus)&&this.sel.toDOM(op.focus),op.scrollIntoView!==!1&&(0,_dompos.scrollIntoView)(this,op.scrollIntoView),docChanged&&this.signal("draw"),this.signal("flush"),this.accurateSelection=!1}}}},{key:"addKeymap",value:function(map){var rank=arguments.length<=1||void 0===arguments[1]?50:arguments[1];(0,_sortedinsert2["default"])(this.input.keymaps,{map:map,rank:rank},function(a,b){return a.rank-b.rank})}},{key:"removeKeymap",value:function(map){for(var maps=this.input.keymaps,i=0;i-1:deflt==name)return this.commandKeys[name]=key}for(var _key in keymap.bindings){var bound=keymap.bindings[_key];if(Array.isArray(bound)?bound.indexOf(name)>-1:bound==name)return this.commandKeys[name]=_key}return this.commandKeys[name]=null}},{key:"markRangeDirty",value:function(range){this.ensureOperation();for(var dirty=this.dirtyNodes,from=range.from,to=range.to,depth=0,node=this.doc;;depth++){var fromEnd=depth==from.depth,toEnd=depth==to.depth;if(fromEnd||toEnd||from.path[depth]!=to.path[depth]){var _ret=function(){var start=fromEnd?from.offset:from.path[depth],end=toEnd?to.offset:to.path[depth]+1;if(node.isTextblock)node.forEach(function(child,cStart,cEnd){end>cStart&&cEnd>start&&dirty.set(child,DIRTY_REDRAW)});else for(var child,i=node.iter(start,end);child=i.next().value;)dirty.set(child,DIRTY_REDRAW);return"break"}();if("break"===_ret)break}else{var child=node.child(from.path[depth]);dirty.has(child)||dirty.set(child,DIRTY_RESCAN),node=child}}}},{key:"markAllDirty",value:function(){this.dirtyNodes.set(this.doc,DIRTY_REDRAW)}},{key:"selection",get:function(){return this.accurateSelection||this.ensureOperation(),this.sel.range}},{key:"tr",get:function(){return new EditorTransform(this)}}]),ProseMirror}();ProseMirror.prototype.apply.scroll={scrollIntoView:!0};var DIRTY_RESCAN=exports.DIRTY_RESCAN=1,DIRTY_REDRAW=exports.DIRTY_REDRAW=2,nullOptions={};(0,_event.eventMixin)(ProseMirror);var Operation=function Operation(pm){_classCallCheck(this,Operation),this.doc=pm.doc,this.sel=pm.sel.range,this.scrollIntoView=!1,this.focus=!1,this.composingAtStart=!!pm.input.composing},EditorTransform=function(_Transform){function EditorTransform(pm){_classCallCheck(this,EditorTransform);var _this2=_possibleConstructorReturn(this,Object.getPrototypeOf(EditorTransform).call(this,pm.doc));return _this2.pm=pm,_this2}return _inherits(EditorTransform,_Transform),_createClass(EditorTransform,[{key:"apply",value:function(options){return this.pm.apply(this,options)}},{key:"replaceSelection",value:function(node,inheritMarks){var _selection=this.selection,empty=_selection.empty,from=_selection.from,to=_selection.to,selNode=_selection.node,parent=void 0;if(node&&node.isInline&&inheritMarks!==!1){var marks=empty?this.pm.input.storedMarks:this.doc.marksAt(from);node=node.type.create(node.attrs,node.text,marks)}if(selNode&&selNode.isTextblock&&node&&node.isInline)from=new _model.Pos(from.toPath(),0),to=new _model.Pos(from.path,selNode.size);else if(selNode)for(;from.depth&&0==from.offset&&(parent=this.doc.path(from.path))&&from.offset==parent.size-1&&!parent.type.canBeEmpty&&(!node||!parent.type.canContain(node));)from=from.shorten(),to=to.shorten(null,1);else if(node&&node.isBlock&&this.doc.path(from.path.slice(0,from.depth-1)).type.canContain(node)){this["delete"](from,to);var _parent=this.doc.path(from.path);return from.offset&&from.offset!=_parent.size&&this.split(from),this.insert(from.shorten(null,from.offset?1:0),node)}return node?this.replaceWith(from,to,node):this["delete"](from,to)}},{key:"deleteSelection",value:function(){return this.replaceSelection()}},{key:"typeText",value:function(text){return this.replaceSelection(this.pm.schema.text(text),!0)}},{key:"selection",get:function(){return this.steps.length?this.pm.selection.map(this):this.pm.selection}}]),EditorTransform}(_transform.Transform)},{"../dom":1,"../format":20,"../model":34,"../transform":40,"../util/error":52,"../util/event":53,"../util/map":54,"../util/sortedinsert":56,"./css":6,"./dompos":8,"./draw":9,"./history":10,"./input":12,"./options":14,"./range":15,"./selection":17,browserkeymap:57}],14:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function defineOption(name,defaultValue,update,updateOnInit){options[name]=new Option(defaultValue,update,updateOnInit)}function parseOptions(obj){var result=Object.create(null),given=obj?[obj].concat(obj.use||[]):[];outer:for(var opt in options){for(var i=0;imax){for(var i=min;max>i;i++)if(this.sorted[i].at.cmp(at)>=0)return i;return max}var mid=min+max>>1;this.sorted[mid].at.cmp(at)>0?max=mid:min=mid}}},{key:"insert",value:function(obj){this.sorted.splice(this.find(obj.at),0,obj)}},{key:"remove",value:function(at,range){for(var pos=this.find(at),dist=0;;dist++){var leftPos=pos-dist-1,rightPos=pos+dist;if(leftPos>=0&&this.sorted[leftPos].range==range)return void this.sorted.splice(leftPos,1);if(rightPos0&&this.sorted[pos-1].at.cmp(at)>0;)this.sorted[pos]=this.sorted[pos-1],this.sorted[--pos]=cur}}]),RangeSorter}(),RangeTracker=(exports.RangeStore=function(){function RangeStore(pm){_classCallCheck(this,RangeStore),this.pm=pm,this.ranges=[],this.sorted=new RangeSorter}return _createClass(RangeStore,[{key:"addRange",value:function(range){this.ranges.push(range),this.sorted.insert({type:"open",at:range.from,range:range}),this.sorted.insert({type:"close",at:range.to,range:range}),this.pm.markRangeDirty(range)}},{key:"removeRange",value:function(range){var found=this.ranges.indexOf(range);found>-1&&(this.ranges.splice(found,1),this.sorted.remove(range.from,range),this.sorted.remove(range.to,range),this.pm.markRangeDirty(range),range.remove())}},{key:"transform",value:function(mapping){for(var i=0;i=0?(this.removeRange(range),i--):diff>0&&(range.to=range.from)}this.sorted.resort()}},{key:"activeRangeTracker",value:function(){return new RangeTracker(this.sorted.sorted)}}]),RangeStore}(),function(){function RangeTracker(sorted){_classCallCheck(this,RangeTracker),this.sorted=sorted,this.pos=0,this.current=[]}return _createClass(RangeTracker,[{key:"advanceTo",value:function(pos){for(var next=void 0;this.pos=0?null:next.at.offset;this.pos++}}}]),RangeTracker}())},{"../util/event":53}],16:[function(require,module,exports){"use strict";var _model=require("../model"),_command=require("./command"),_format=require("../format");_model.StrongMark.register("command","set",{derive:!0,label:"Set strong"}),_model.StrongMark.register("command","unset",{derive:!0,label:"Unset strong"}),_model.StrongMark.register("command","toggle",{derive:!0,label:"Toggle strong", +menu:{group:"inline",rank:20,display:{type:"icon",width:805,height:1024,path:"M317 869q42 18 80 18 214 0 214-191 0-65-23-102-15-25-35-42t-38-26-46-14-48-6-54-1q-41 0-57 5 0 30-0 90t-0 90q0 4-0 38t-0 55 2 47 6 38zM309 442q24 4 62 4 46 0 81-7t62-25 42-51 14-81q0-40-16-70t-45-46-61-24-70-8q-28 0-74 7 0 28 2 86t2 86q0 15-0 45t-0 45q0 26 0 39zM0 950l1-53q8-2 48-9t60-15q4-6 7-15t4-19 3-18 1-21 0-19v-37q0-561-12-585-2-4-12-8t-25-6-28-4-27-2-17-1l-2-47q56-1 194-6t213-5q13 0 39 0t38 0q40 0 78 7t73 24 61 40 42 59 16 78q0 29-9 54t-22 41-36 32-41 25-48 22q88 20 146 76t58 141q0 57-20 102t-53 74-78 48-93 27-100 8q-25 0-75-1t-75-1q-60 0-175 6t-132 6z"}},keys:["Mod-B"]}),_model.EmMark.register("command","set",{derive:!0,label:"Add emphasis"}),_model.EmMark.register("command","unset",{derive:!0,label:"Remove emphasis"}),_model.EmMark.register("command","toggle",{derive:!0,label:"Toggle emphasis",menu:{group:"inline",rank:21,display:{type:"icon",width:585,height:1024,path:"M0 949l9-48q3-1 46-12t63-21q16-20 23-57 0-4 35-165t65-310 29-169v-14q-13-7-31-10t-39-4-33-3l10-58q18 1 68 3t85 4 68 1q27 0 56-1t69-4 56-3q-2 22-10 50-17 5-58 16t-62 19q-4 10-8 24t-5 22-4 26-3 24q-15 84-50 239t-44 203q-1 5-7 33t-11 51-9 47-3 32l0 10q9 2 105 17-1 25-9 56-6 0-18 0t-18 0q-16 0-49-5t-49-5q-78-1-117-1-29 0-81 5t-69 6z"}},keys:["Mod-I"]}),_model.CodeMark.register("command","set",{derive:!0,label:"Set code style"}),_model.CodeMark.register("command","unset",{derive:!0,label:"Remove code style"}),_model.CodeMark.register("command","toggle",{derive:!0,label:"Toggle code style",menu:{group:"inline",rank:22,display:{type:"icon",width:896,height:1024,path:"M608 192l-96 96 224 224-224 224 96 96 288-320-288-320zM288 192l-288 320 288 320 96-96-224-224 224-224-96-96z"}},keys:["Mod-`"]});var linkIcon={type:"icon",width:951,height:1024,path:"M832 694q0-22-16-38l-118-118q-16-16-38-16-24 0-41 18 1 1 10 10t12 12 8 10 7 14 2 15q0 22-16 38t-38 16q-8 0-15-2t-14-7-10-8-12-12-10-10q-18 17-18 41 0 22 16 38l117 118q15 15 38 15 22 0 38-14l84-83q16-16 16-38zM430 292q0-22-16-38l-117-118q-16-16-38-16-22 0-38 15l-84 83q-16 16-16 38 0 22 16 38l118 118q15 15 38 15 24 0 41-17-1-1-10-10t-12-12-8-10-7-14-2-15q0-22 16-38t38-16q8 0 15 2t14 7 10 8 12 12 10 10q18-17 18-41zM941 694q0 68-48 116l-84 83q-47 47-116 47-69 0-116-48l-117-118q-47-47-47-116 0-70 50-119l-50-50q-49 50-118 50-68 0-116-48l-118-118q-48-48-48-116t48-116l84-83q47-47 116-47 69 0 116 48l117 118q47 47 47 116 0 70-50 119l50 50q49-50 118-50 68 0 116 48l118 118q48 48 48 116z"};_model.LinkMark.register("command","unset",{derive:!0,label:"Unlink",menu:{group:"inline",rank:30,display:linkIcon},active:function(){return!0}}),_model.LinkMark.register("command","set",{derive:{inverseSelect:!0,params:[{label:"Target",attr:"href"},{label:"Title",attr:"title"}]},label:"Add link",menu:{group:"inline",rank:30,display:linkIcon}}),_model.Image.register("command","insert",{derive:{params:[{label:"Image URL",attr:"src"},{label:"Description / alternative text",attr:"alt",prefill:function(pm){return(0,_command.selectedNodeAttr)(pm,this,"alt")||(0,_format.toText)(pm.doc.sliceBetween(pm.selection.from,pm.selection.to))}},{label:"Title",attr:"title"}]},label:"Insert image",menu:{group:"insert",rank:20,display:{type:"label",label:"Image"}}}),_model.BulletList.register("command","wrap",{derive:{list:!0},label:"Wrap the selection in a bullet list",menu:{group:"block",rank:40,display:{type:"icon",width:768,height:896,path:"M0 512h128v-128h-128v128zM0 256h128v-128h-128v128zM0 768h128v-128h-128v128zM256 512h512v-128h-512v128zM256 256h512v-128h-512v128zM256 768h512v-128h-512v128z"}},keys:["Alt-Right '*'","Alt-Right '-'"]}),_model.OrderedList.register("command","wrap",{derive:{list:!0},label:"Wrap the selection in an ordered list",menu:{group:"block",rank:41,display:{type:"icon",width:768,height:896,path:"M320 512h448v-128h-448v128zM320 768h448v-128h-448v128zM320 128v128h448v-128h-448zM79 384h78v-256h-36l-85 23v50l43-2v185zM189 590c0-36-12-78-96-78-33 0-64 6-83 16l1 66c21-10 42-15 67-15s32 11 32 28c0 26-30 58-110 112v50h192v-67l-91 2c49-30 87-66 87-113l1-1z"}},keys:["Alt-Right '1'"]}),_model.BlockQuote.register("command","wrap",{derive:!0,label:"Wrap the selection in a block quote",menu:{group:"block",rank:45,display:{type:"icon",width:640,height:896,path:"M0 448v256h256v-256h-128c0 0 0-128 128-128v-128c0 0-256 0-256 256zM640 320v-128c0 0-256 0-256 256v256h256v-256h-128c0 0 0-128 128-128z"}},keys:["Alt-Right '>'","Alt-Right '\"'"]}),_model.HardBreak.register("command","insert",{label:"Insert hard break",run:function(pm){var _pm$selection=pm.selection,node=_pm$selection.node,from=_pm$selection.from;return node&&node.isBlock?!1:pm.doc.path(from.path).type.isCode?pm.tr.typeText("\n").apply(pm.apply.scroll):pm.tr.replaceSelection(this.create()).apply(pm.apply.scroll)},keys:["Mod-Enter","Shift-Enter"]}),_model.ListItem.register("command","split",{label:"Split the current list item",run:function(pm){var _pm$selection2=pm.selection,from=_pm$selection2.from,to=_pm$selection2.to,node=_pm$selection2.node;if(node&&node.isBlock||from.path.length<2||!_model.Pos.samePath(from.path,to.path))return!1;var toParent=from.shorten(),grandParent=pm.doc.path(toParent.path);if(grandParent.type!=this)return!1;var nextType=to.offset==grandParent.child(toParent.offset).size?pm.schema.defaultTextblockType():null;return pm.tr["delete"](from,to).split(from,2,nextType).apply(pm.apply.scroll)},keys:["Enter(50)"]});for(var _loop=function(i){_model.Heading.registerComputed("command","make"+i,function(type){return i<=type.maxLevel?{derive:{name:"make",attrs:{level:i}},label:"Change to heading "+i,keys:10>i&&["Mod-"+i],menu:{group:"textblockHeading",rank:30+i,display:{type:"label",label:"Level "+i},activeDisplay:"Head "+i}}:void 0})},i=1;10>=i;i++)_loop(i);_model.Paragraph.register("command","make",{derive:!0,label:"Change to paragraph",keys:["Mod-0"],menu:{group:"textblock",rank:10,display:{type:"label",label:"Plain"},activeDisplay:"Plain"}}),_model.CodeBlock.register("command","make",{derive:!0,label:"Change to code block",keys:["Mod-\\"],menu:{group:"textblock",rank:20,display:{type:"label",label:"Code"},activeDisplay:"Code"}}),_model.HorizontalRule.register("command","insert",{derive:!0,label:"Insert horizontal rule",keys:["Mod-Shift--"],menu:{group:"insert",rank:70,display:{type:"label",label:"Horizontal rule"}}})},{"../format":20,"../model":34,"./command":5}],17:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function rangeFromDOMLoose(pm){if(!hasFocus(pm))return null;var sel=window.getSelection();return new TextSelection((0,_dompos.posFromDOM)(pm,sel.anchorNode,sel.anchorOffset,!0),(0,_dompos.posFromDOM)(pm,sel.focusNode,sel.focusOffset,!0))}function hasFocus(pm){var sel=window.getSelection();return sel.rangeCount&&(0,_dom.contains)(pm.content,sel.anchorNode)}function findSelectionIn(doc,path,offset,dir,text){var node=doc.path(path);if(node.isTextblock)return new TextSelection(new _model.Pos(path,offset));for(var i=offset+(dir>0?0:-1);dir>0?i=0;i+=dir){var child=node.child(i);if(!text&&null==child.type.contains&&child.type.selectable)return new NodeSelection(new _model.Pos(path,i),new _model.Pos(path,i+1),child);path.push(i);var inside=findSelectionIn(doc,path,0>dir?child.size:0,dir,text);if(inside)return inside;path.pop()}}function findSelectionFrom(doc,pos,dir,text){for(var path=pos.path.slice(),offset=pos.offset;;){var found=findSelectionIn(doc,path,offset,dir,text);if(found)return found;if(!path.length)break;offset=path.pop()+(dir>0?1:0)}}function findSelectionNear(doc,pos){var bias=arguments.length<=2||void 0===arguments[2]?1:arguments[2],text=arguments[3],result=findSelectionFrom(doc,pos,bias,text)||findSelectionFrom(doc,pos,-bias,text);return result||SelectionError("Searching for selection in invalid document "+doc),result}function findSelectionAtStart(node){var path=arguments.length<=1||void 0===arguments[1]?[]:arguments[1],text=arguments[2];return findSelectionIn(node,path.slice(),0,1,text)}function findSelectionAtEnd(node){var path=arguments.length<=1||void 0===arguments[1]?[]:arguments[1],text=arguments[2];return findSelectionIn(node,path.slice(),node.size,-1,text)}function verticalMotionLeavesTextblock(pm,pos,dir){for(var dom=(0,_dompos.pathToDOM)(pm.content,pos.path),coords=(0,_dompos.coordsAtPos)(pm,pos),child=dom.firstChild;child;child=child.nextSibling)if(1==child.nodeType)for(var boxes=child.getClientRects(),i=0;idir?box.bottomcoords.bottom)return!1}return!0}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0){var tmp=anchor;anchor=head,head=tmp}range.setEnd(head.node,head.offset),range.setStart(anchor.node,anchor.offset)}sel.removeAllRanges(),sel.addRange(range),sel.extend&&sel.extend(head.node,head.offset),this.storeDOMState()}},{key:"clearNode",value:function(){return this.lastNode?(this.lastNode.classList.remove("ProseMirror-selectednode"),this.pm.content.classList.remove("ProseMirror-nodeselection"),this.lastNode=null,!0):void 0}},{key:"receivedFocus",value:function(){null==this.polling&&this.startPolling()}}]),SelectionState}(),exports.Selection=function Selection(){_classCallCheck(this,Selection)}),TextSelection=exports.TextSelection=function(_Selection){function TextSelection(anchor,head){_classCallCheck(this,TextSelection);var _this3=_possibleConstructorReturn(this,Object.getPrototypeOf(TextSelection).call(this));return _this3.anchor=anchor,_this3.head=head||anchor,_this3}return _inherits(TextSelection,_Selection),_createClass(TextSelection,[{key:"eq",value:function(other){return other instanceof TextSelection&&!other.head.cmp(this.head)&&!other.anchor.cmp(this.anchor)}},{key:"map",value:function(doc,mapping){var head=mapping.map(this.head).pos;if(!doc.path(head.path).isTextblock)return findSelectionNear(doc,head);var anchor=mapping.map(this.anchor).pos;return new TextSelection(doc.path(anchor.path).isTextblock?anchor:head,head)}},{key:"inverted",get:function(){return this.anchor.cmp(this.head)>0}},{key:"from",get:function(){return this.inverted?this.head:this.anchor}},{key:"to",get:function(){return this.inverted?this.anchor:this.head}},{key:"empty",get:function(){return 0==this.anchor.cmp(this.head)}}]),TextSelection}(Selection),NodeSelection=exports.NodeSelection=function(_Selection2){function NodeSelection(from,to,node){_classCallCheck(this,NodeSelection);var _this4=_possibleConstructorReturn(this,Object.getPrototypeOf(NodeSelection).call(this));return _this4.from=from,_this4.to=to,_this4.node=node,_this4}return _inherits(NodeSelection,_Selection2),_createClass(NodeSelection,[{key:"eq",value:function(other){return other instanceof NodeSelection&&!this.from.cmp(other.from)}},{key:"map",value:function(doc,mapping){var from=mapping.map(this.from,1).pos,to=mapping.map(this.to,-1).pos;if(_model.Pos.samePath(from.path,to.path)&&from.offset==to.offset-1){var node=doc.nodeAfter(from);if(node.type.selectable)return new NodeSelection(from,to,node)}return findSelectionNear(doc,from)}},{key:"empty",get:function(){return!1}}]),NodeSelection}(Selection)},{"../dom":1,"../model":34,"../util/error":52,"./dompos":8}],18:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function fromDOM(schema,dom,options){options||(options={});var context=new DOMParseState(schema,options.topNode||schema.node("doc"),options),start=options.from?dom.childNodes[options.from]:dom.firstChild,end=null!=options.to&&dom.childNodes[options.to]||null;context.addAll(start,end,!0);var doc=void 0;do doc=context.leave();while(context.stack.length);return doc}function fromHTML(schema,html,options){var wrap=(options&&options.document||window.document).createElement("div");return wrap.innerHTML=html,fromDOM(schema,wrap,options)}function matches(dom,selector){return(dom.matches||dom.msMatchesSelector||dom.webkitMatchesSelector||dom.mozMatchesSelector).call(dom,selector)}function parseStyles(style){for(var re=/\s*([\w-]+)\s*:\s*([^;]+)/g,m=void 0,result=[];m=re.exec(style);)result.push(m[1],m[2].trim());return result}function schemaInfo(schema){return schema.cached.parseDOMInfo||(schema.cached.parseDOMInfo=summarizeSchemaInfo(schema))}function summarizeSchemaInfo(schema){var tags=Object.create(null),styles=Object.create(null);return tags._=[],schema.registry("parseDOM",function(tag,info,type){var parse=info.parse;"block"==parse?parse=function(dom,state){state.wrapIn(dom,this)}:"mark"==parse&&(parse=function(dom,state){state.wrapMark(dom,this)}),(0,_sortedinsert2["default"])(tags[tag]||(tags[tag]=[]),{type:type,parse:parse,selector:info.selector,rank:null==info.rank?50:info.rank},function(a,b){return a.rank-b.rank})}),schema.registry("parseDOMStyle",function(style,info,type){(0,_sortedinsert2["default"])(styles[style]||(styles[style]=[]),{type:type,parse:info.parse,rank:null==info.rank?50:info.rank},function(a,b){return a.rank-b.rank})}),{tags:tags,styles:styles}}var _createClass=function(){function defineProperties(target,props){for(var i=0;i=0;i--){var route=this.stack[i].type.findConnection(node.type);if(route){if(i==this.stack.length-1)this.doClose();else for(;this.stack.length>i+1;)this.leave();found=route;break}}if(!found)return;for(var j=0;jstack.length;)this.leave();for(;;){var n=this.stack.length-1,one=this.stack[n],two=stack[n];if(one.type==two.type&&_model.Node.sameAttrs(one.attrs,two.attrs))break;this.leave()}for(;stack.length>this.stack.length;){var add=stack[this.stack.length];this.enter(add.type,add.attrs)}this.marks.length&&(this.marks=noMarks),this.closing=!1}},{key:"wrapIn",value:function(dom,type,attrs){this.enter(type,attrs),this.addAll(dom.firstChild,null,!0),this.leave()}},{key:"wrapMark",value:function(inner,mark){var old=this.marks;this.marks=(mark.instance||mark).addToSet(old),inner.call?inner():this.addAll(inner.firstChild,null),this.marks=old}},{key:"top",get:function(){return this.stack[this.stack.length-1]}}]),DOMParseState}();_model.Paragraph.register("parseDOM","p",{parse:"block"}),_model.BlockQuote.register("parseDOM","blockquote",{parse:"block"});for(var _loop=function(i){_model.Heading.registerComputed("parseDOM","h"+i,function(type){return i<=type.maxLevel?{parse:function(dom,state){state.wrapIn(dom,this,{level:i})}}:void 0})},i=1;6>=i;i++)_loop(i);_model.HorizontalRule.register("parseDOM","hr",{parse:"block"}),_model.CodeBlock.register("parseDOM","pre",{parse:function(dom,state){var params=dom.firstChild&&/^code$/i.test(dom.firstChild.nodeName)&&dom.firstChild.getAttribute("class");if(params&&/fence/.test(params)){for(var found=[],re=/(?:^|\s)lang-(\S+)/g,m=void 0;m=re.exec(params);)found.push(m[1]);params=found.join(" ")}else params=null;var text=dom.textContent;state.insert(this,{params:params},text?[state.schema.text(text)]:[])}}),_model.BulletList.register("parseDOM","ul",{parse:"block"}),_model.OrderedList.register("parseDOM","ol",{parse:function(dom,state){var attrs={order:dom.getAttribute("start")||1};state.wrapIn(dom,this,attrs)}}),_model.ListItem.register("parseDOM","li",{parse:"block"}),_model.HardBreak.register("parseDOM","br",{parse:function(_,state){state.insert(this)}}),_model.Image.register("parseDOM","img",{parse:function(dom,state){state.insert(this,{src:dom.getAttribute("src"),title:dom.getAttribute("title")||null,alt:dom.getAttribute("alt")||null})}}),_model.LinkMark.register("parseDOM","a",{parse:function(dom,state){state.wrapMark(dom,this.create({href:dom.getAttribute("href"),title:dom.getAttribute("title")}))},selector:"[href]"}),_model.EmMark.register("parseDOM","i",{parse:"mark"}),_model.EmMark.register("parseDOM","em",{parse:"mark"}),_model.EmMark.register("parseDOMStyle","font-style",{parse:function(value,state,inner){"italic"==value?state.wrapMark(inner,this):inner()}}),_model.StrongMark.register("parseDOM","b",{parse:"mark"}),_model.StrongMark.register("parseDOM","strong",{parse:"mark"}),_model.StrongMark.register("parseDOMStyle","font-weight",{parse:function(value,state,inner){"bold"==value||"bolder"==value||!/\D/.test(value)&&+value>=500?state.wrapMark(inner,this):inner()}}),_model.CodeMark.register("parseDOM","code",{parse:"mark"})},{"../model":34,"../util/sortedinsert":56,"./register":21}],19:[function(require,module,exports){"use strict";function fromText(schema,text){for(var blocks=text.trim().split(/\n{2,}/),nodes=[],i=0;i2?_len-2:0),_key=2;_len>_key;_key++)content[_key-2]=arguments[_key];for(var i=0;i=0;i--){var wrap=this.renderMark(marks[i]);wrap.appendChild(dom),dom=wrap}return dom}},{key:"renderAs",value:function(node,tagName,tagAttrs){var dom=this.renderContent(node,this.elt(tagName,tagAttrs));return this.options.onContainer&&this.options.onContainer(dom),dom}}]),DOMSerializer}();(0,_register.defineTarget)("dom",toDOM),(0,_register.defineTarget)("html",toHTML),def(_model.BlockQuote,function(node,s){return s.renderAs(node,"blockquote")}),_model.BlockQuote.prototype.countCoordsAsChild=function(_,path,dom,coords){var childBox=dom.firstChild.getBoundingClientRect();return coords.leftchildBox.left-2)return null;if(childBox.top<=coords.top&&childBox.bottom>=coords.top)return new _model.Pos(path,i)}}},def(_model.ListItem,function(node,s){return s.renderAs(node,"li")}),def(_model.HorizontalRule,function(_,s){return s.elt("hr")}),def(_model.Paragraph,function(node,s){return s.renderAs(node,"p")}),def(_model.Heading,function(node,s){return s.renderAs(node,"h"+node.attrs.level)}),def(_model.CodeBlock,function(node,s){var code=s.renderAs(node,"code");return null!=node.attrs.params&&(code.className="fence "+node.attrs.params.replace(/(^|\s+)/g,"$&lang-")),s.elt("pre",null,code)}),def(_model.Text,function(node,s){return s.doc.createTextNode(node.text)}),def(_model.Image,function(node,s){return s.elt("img",{src:node.attrs.src,alt:node.attrs.alt,title:node.attrs.title})}),def(_model.HardBreak,function(_,s){return s.elt("br")}),def(_model.EmMark,function(_,s){return s.elt("em")}),def(_model.StrongMark,function(_,s){return s.elt("strong")}),def(_model.CodeMark,function(_,s){return s.elt("code")}),def(_model.LinkMark,function(mark,s){return s.elt("a",{href:mark.attrs.href,title:mark.attrs.title})})},{"../model":34,"./register":21}],23:[function(require,module,exports){"use strict";function toText(doc){return doc.type.serializeText(doc).trim()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.toText=toText;var _model=require("../model"),_register=require("./register");_model.Block.prototype.serializeText=function(node){var accum="";return node.forEach(function(child){return accum+=child.type.serializeText(child)}),accum},_model.Textblock.prototype.serializeText=function(node){var text=_model.Block.prototype.serializeText(node);return text&&text+"\n\n"},_model.Inline.prototype.serializeText=function(){return""},_model.HardBreak.prototype.serializeText=function(){return"\n"},_model.Text.prototype.serializeText=function(node){return node.text},(0,_register.defineTarget)("text",toText)},{"../model":34,"./register":21}],24:[function(require,module,exports){"use strict";function wrapAndJoin(pm,pos,type){var attrs=arguments.length<=3||void 0===arguments[3]?null:arguments[3],predicate=arguments.length<=4||void 0===arguments[4]?null:arguments[4],before=pos.shorten(),sibling=before.offset>0&&pm.doc.path(before.path).child(before.offset-1),join=sibling&&sibling.type.name==type&&(!predicate||predicate(sibling)),tr=pm.tr.wrap(pos,pos,type,attrs),delPos=tr.map(pos).pos;tr["delete"](new _model.Pos(delPos.path,0),delPos),join&&tr.join(before),tr.apply()}function setAs(pm,pos,type,attrs){pm.tr.setBlockType(pos,pos,type,attrs)["delete"](new _model.Pos(pos.path,0),pos).apply()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.autoInputRules=void 0;var _model=require("../model"),_edit=require("../edit"),_inputrules=require("./inputrules"),autoInputRules=exports.autoInputRules=Object.create(null);(0,_edit.defineOption)("autoInput",!1,function(pm,val){pm.mod.autoInput&&(pm.mod.autoInput.forEach(function(rule){return(0,_inputrules.removeInputRule)(pm,rule)}),pm.mod.autoInput=null),val&&!function(){val===!0&&(val=["schema",autoInputRules]);var rules=Object.create(null),list=pm.mod.autoInput=[];val.forEach(function(spec){if("schema"===spec)pm.schema.registry("autoInput",function(name,rule,type,typeName){var rname=typeName+":"+name,handler=rule.handler;handler.bind&&(handler=handler.bind(type)),rules[rname]=new _inputrules.InputRule(rule.match,rule.filter,handler)});else for(var name in spec){var _val=spec[name];null==_val?delete rules[name]:rules[name]=_val}});for(var name in rules)(0,_inputrules.addInputRule)(pm,rules[name]),list.push(rules[name])}()}),autoInputRules.emDash=new _inputrules.InputRule(/--$/,"-","—"),autoInputRules.openDoubleQuote=new _inputrules.InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,'"',"“"),autoInputRules.closeDoubleQuote=new _inputrules.InputRule(/"$/,'"',"”"),autoInputRules.openSingleQuote=new _inputrules.InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"'","‘"),autoInputRules.closeSingleQuote=new _inputrules.InputRule(/'$/,"'","’"),_model.BlockQuote.register("autoInput","startBlockQuote",new _inputrules.InputRule(/^\s*> $/," ",function(pm,_,pos){wrapAndJoin(pm,pos,this)})),_model.OrderedList.register("autoInput","startOrderedList",new _inputrules.InputRule(/^(\d+)\. $/," ",function(pm,match,pos){var order=+match[1];wrapAndJoin(pm,pos,this,{order:order||null},function(node){return node.size+(node.attrs.order||1)==order})})),_model.BulletList.register("autoInput","startBulletList",new _inputrules.InputRule(/^\s*([-+*]) $/," ",function(pm,match,pos){var bullet=match[1];wrapAndJoin(pm,pos,this,null,function(node){return node.attrs.bullet==bullet})})),_model.CodeBlock.register("autoInput","startCodeBlock",new _inputrules.InputRule(/^```$/,"`",function(pm,_,pos){setAs(pm,pos,this,{params:""})})),_model.Heading.registerComputed("autoInput","startHeading",function(type){var re=new RegExp("^(#{1,"+type.maxLevel+"}) $");return new _inputrules.InputRule(re," ",function(pm,match,pos){setAs(pm,pos,this,{level:match[1].length})})})},{"../edit":11,"../model":34,"./inputrules":25}],25:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function addInputRule(pm,rule){pm.mod.interpretInput||(pm.mod.interpretInput=new InputRules(pm)),pm.mod.interpretInput.addRule(rule)}function removeInputRule(pm,rule){var ii=pm.mod.interpretInput;ii&&(ii.removeRule(rule),0==ii.rules.length&&(ii.unregister(),pm.mod.interpretInput=null))}function getContext(doc,pos){for(var child,parent=doc.path(pos.path),isCode=parent.type.isCode,textBefore="",i=parent.iter(0,pos.offset);child=i.next().value;)child.isText?textBefore+=child.text:textBefore="",i.atEnd()&&child.marks.some(function(st){return st.type.isCode})&&(isCode=!0);return{textBefore:textBefore,isCode:isCode}}var _createClass=function(){function defineProperties(target,props){for(var i=0;i-1?(this.rules.splice(found,1),!0):void 0}},{key:"onTextInput",value:function(text){var pos=this.pm.selection.head;if(pos)for(var textBefore=void 0,isCode=void 0,lastCh=text[text.length-1],i=0;icur.clientHeight)return cur}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},_createClass=function(){function defineProperties(target,props){for(var i=0;i_this2.maxHeight?(_this2.maxHeight=_this2.wrapper.offsetHeight,function(){_this2.wrapper.style.minHeight=_this2.maxHeight+"px"}):void 0}}},{key:"updateFloat",value:function(){var editorRect=this.pm.wrapper.getBoundingClientRect();if(this.floating)if(editorRect.top>=0||editorRect.bottomwindow.innerHeight?"none":""}else if(editorRect.top<0&&editorRect.bottom>=this.wrapper.offsetHeight+10){this.floating=!0;var menuRect=this.wrapper.getBoundingClientRect();this.wrapper.style.left=menuRect.left+"px",this.wrapper.style.width=menuRect.width+"px",this.wrapper.style.position="fixed",this.spacer=(0,_dom.elt)("div",{"class":prefix+"-spacer",style:"height: "+menuRect.height+"px"}),this.pm.wrapper.insertBefore(this.spacer,this.wrapper)}}},{key:"updateScrollCursor",value:function(){var _this3=this;if(!this.floating)return null;var head=this.pm.selection.head;return head?function(){var cursorPos=_this3.pm.coordsAtPos(head),menuRect=_this3.wrapper.getBoundingClientRect();if(cursorPos.topmenuRect.top){var _ret=function(){var scrollable=findWrappingScrollable(_this3.pm.wrapper);return scrollable?{v:function(){scrollable.scrollTop-=menuRect.bottom-cursorPos.top}}:void 0}();if("object"===("undefined"==typeof _ret?"undefined":_typeof(_ret)))return _ret.v}}:null}}]),MenuBar}();(0,_dom.insertCSS)("\n."+prefix+" {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n position: relative;\n min-height: 1em;\n color: #666;\n padding: 1px 6px;\n top: 0; left: 0; right: 0;\n border-bottom: 1px solid silver;\n background: white;\n z-index: 10;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n overflow: visible;\n}\n")},{"../dom":1,"../edit":11,"../ui/update":51,"./menu":27}],29:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function topCenterOfSelection(){var range=window.getSelection().getRangeAt(0),rects=range.getClientRects();if(!rects.length)return range.getBoundingClientRect();for(var _rects$=rects[0],left=_rects$.left,right=_rects$.right,top=_rects$.top,i=1;left==right&&rects.length>i;){var _rects=rects[i++];left=_rects.left,right=_rects.right,top=_rects.top}for(;i1)&&(left=Math.min(left,rects[i].left),right=Math.max(right,rects[i].right),top=Math.min(top,rects[i].top));return{top:top,left:(left+right)/2}}function topOfNodeSelection(pm){var selected=pm.content.querySelector(".ProseMirror-selectednode");if(!selected)return{left:0,top:0};var box=selected.getBoundingClientRect();return{left:Math.min((box.left+box.right)/2,box.left+20),top:box.top}}var _createClass=function(){function defineProperties(target,props){for(var i=0;isame&&childA.text[childA.text.length-same-1]==childB.text[childB.text.length-same-1];)same++,offA--,offB--;break}if(offA-=childA.width,offB-=childB.width,childA.size||childB.size){pathA.push(offA),pathB.push(offB);var inner=findDiffEnd(childA.content,childB.content,pathA,pathB);if(inner)return inner;pathA.pop(),pathB.pop()}}else offA-=childA.width,offB-=childB.width}return{a:new _pos.Pos(pathA,offA),b:new _pos.Pos(pathB,offB)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.findDiffStart=findDiffStart,exports.findDiffEnd=findDiffEnd;var _pos=require("./pos")},{"./pos":37}],32:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ModelError=void 0;var _error=require("../util/error");exports.ModelError=function(_ProseMirrorError){function ModelError(){return _classCallCheck(this,ModelError),_possibleConstructorReturn(this,Object.getPrototypeOf(ModelError).apply(this,arguments))}return _inherits(ModelError,_ProseMirrorError),ModelError}(_error.ProseMirrorError)},{"../util/error":52}],33:[function(require,module,exports){"use strict";function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;ipath.length,moreTo=to&&to.depth>path.length,start=moreFrom?from.path[path.length]:from?from.offset:0,end=moreTo?to.path[path.length]+1:to?to.offset:this.size,iter=this.iter(start,end);node=iter.next().value;){var startOffset=iter.offset-node.width;path.push(startOffset),node.nodesBetween(moreFrom&&startOffset==start?from:null,moreTo&&iter.offset==end?to:null,f,path,parent),path.pop()}}},{key:"sliceBetween",value:function(from,to){for(var node,depth=arguments.length<=2||void 0===arguments[2]?0:arguments[2],moreFrom=from&&from.depth>depth,moreTo=to&&to.depth>depth,start=moreFrom?from.path[depth]:from?from.offset:0,end=moreTo?to.path[depth]+1:to?to.offset:this.size,nodes=[],iter=this.iter(start,end);node=iter.next().value;){var passFrom=moreFrom&&iter.offset-node.width==start?from:null,passTo=moreTo&&iter.offset==end?to:null;(passFrom||passTo)&&(node=node.sliceBetween(passFrom,passTo,depth+1)),nodes.push(node)}return new this.constructor(nodes)}},{key:"textContent",get:function(){var text="";return this.forEach(function(n){return text+=n.textContent}),text}}],[{key:"fromJSON",value:function(schema,value){return value?this.fromArray(value.map(schema.nodeFromJSON)):emptyFragment}},{key:"fromArray",value:function(array){if(!array.length)return emptyFragment;for(var hasText=!1,joined=void 0,size=0,i=0;ioff||off>=this.content.length)throw new _error.ModelError("Offset "+off+" out of range");return this.content[off]}},{key:"forEach",value:function(f){for(var i=0;i0&&joinRight>0&&before.sameMarkup(after)?content.push(before.append(after.content,joinLeft-1,joinRight-1)):content.push(before.close(joinLeft-1,"end"),after.close(joinRight-1,"start")),Fragment.fromArray(content.concat(other.toArray(after.width)))}},{key:"toJSON",value:function(){return this.content.map(function(n){return n.toJSON()})}},{key:"size",get:function(){return this.content.length}},{key:"firstChild",get:function(){return this.content.length?this.content[0]:null}},{key:"lastChild",get:function(){return this.content.length?this.content[this.content.length-1]:null}}]),FlatFragment}(Fragment),emptyFragment=exports.emptyFragment=new FlatFragment([]),TextIterator=function(){function TextIterator(fragment,startOffset,endOffset){var pos=arguments.length<=3||void 0===arguments[3]?-1:arguments[3];_classCallCheck(this,TextIterator),this.frag=fragment,this.offset=startOffset,this.pos=pos,this.endOffset=endOffset}return _createClass(TextIterator,[{key:"copy",value:function(){return new this.constructor(this.frag,this.offset,this.endOffset,this.pos)}},{key:"atEnd",value:function(){return this.offset==this.endOffset}},{key:"next",value:function(){if(-1==this.pos){var start=this.init();if(start)return start}return this.offset==this.endOffset?iterEnd:this.advance()}},{key:"advance",value:function(){var node=this.frag.content[this.pos++],end=this.offset+node.width;return end>this.endOffset?(node=node.copy(node.text.slice(0,this.endOffset-this.offset)),this.offset=this.endOffset,node):(this.offset=end,node)}},{key:"init",value:function(){this.pos=0;for(var offset=0;offsetthis.offset){var sliceEnd=node.width;return end>this.endOffset&&(sliceEnd=this.endOffset-offset,end=this.endOffset),node=node.copy(node.text.slice(this.offset-offset,sliceEnd)),this.offset=end,node}offset=end}}}]),TextIterator}(),ReverseTextIterator=function(_TextIterator){function ReverseTextIterator(){return _classCallCheck(this,ReverseTextIterator),_possibleConstructorReturn(this,Object.getPrototypeOf(ReverseTextIterator).apply(this,arguments))}return _inherits(ReverseTextIterator,_TextIterator),_createClass(ReverseTextIterator,[{key:"advance",value:function(){var node=this.frag.content[--this.pos],end=this.offset-node.width;return endthis.offset;){var node=this.frag.content[--this.pos],end=offset-node.width;if(end==this.offset)break;if(endoff||off>=this.size)throw new _error.ModelError("Offset "+off+" out of range");for(var i=0,curOff=0;ioff)return child}}},{key:"forEach",value:function(f){for(var i=0,off=0;i=off)return{node:child,start:curOff};curOff=end}}},{key:"chunkAfter",value:function(off){if(off==this.size)throw new _error.ModelError("No chunk after end of node");for(var i=0,curOff=0;ioff)return{node:child,start:curOff};curOff=end}}},{key:"slice",value:function(){var from=arguments.length<=0||void 0===arguments[0]?0:arguments[0],to=arguments.length<=1||void 0===arguments[1]?this.size:arguments[1];return from==to?emptyFragment:new TextFragment(this.toArray(from,to),to-from)}},{key:"replace",value:function(off,node){if(node.isText)throw new _error.ModelError("Argument to replace should be a non-text node");for(var curNode=void 0,index=void 0,curOff=0;off>curOff;index++)curNode=this.content[index],curOff+=curNode.width;if(curNode.isText)throw new _error.ModelError("Can not replace text content with replace method");var copy=this.content.slice();return copy[index]=node,new TextFragment(copy,this.size)}},{key:"appendInner",value:function(other,joinLeft,joinRight){var last=this.content.length-1,content=this.content.slice(0,last),before=this.content[last],after=other.firstChild,same=before.sameMarkup(after);return same&&before.isText?content.push(before.copy(before.text+after.text)):same&&joinLeft>0&&joinRight>0?content.push(before.append(after.content,joinLeft-1,joinRight-1)):content.push(before.close(joinLeft-1,"end"),after.close(joinRight-1,"start")),Fragment.fromArray(content.concat(other.toArray(after.width)))}},{key:"toJSON",value:function(){return this.content.map(function(n){return n.toJSON()})}},{key:"firstChild",get:function(){return this.size?this.content[0]:null}},{key:"lastChild",get:function(){return this.size?this.content[this.content.length-1]:null}}]),TextFragment}(Fragment);"undefined"!=typeof Symbol&&(Fragment.prototype[Symbol.iterator]=function(){return this.iter()},FlatIterator.prototype[Symbol.iterator]=TextIterator.prototype[Symbol.iterator]=function(){return this})},{"./error":32}],34:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _node=require("./node");Object.defineProperty(exports,"Node",{enumerable:!0,get:function(){return _node.Node}});var _fragment=require("./fragment");Object.defineProperty(exports,"Fragment",{enumerable:!0,get:function(){return _fragment.Fragment}}),Object.defineProperty(exports,"emptyFragment",{enumerable:!0,get:function(){return _fragment.emptyFragment}});var _mark=require("./mark");Object.defineProperty(exports,"Mark",{enumerable:!0,get:function(){return _mark.Mark}});var _schema=require("./schema");Object.defineProperty(exports,"SchemaSpec",{enumerable:!0,get:function(){return _schema.SchemaSpec}}),Object.defineProperty(exports,"Schema",{enumerable:!0,get:function(){return _schema.Schema}}),Object.defineProperty(exports,"SchemaError",{enumerable:!0,get:function(){return _schema.SchemaError}}),Object.defineProperty(exports,"NodeType",{enumerable:!0,get:function(){return _schema.NodeType}}),Object.defineProperty(exports,"Block",{enumerable:!0,get:function(){return _schema.Block}}),Object.defineProperty(exports,"Textblock",{enumerable:!0,get:function(){return _schema.Textblock}}),Object.defineProperty(exports,"Inline",{enumerable:!0,get:function(){return _schema.Inline}}),Object.defineProperty(exports,"Text",{enumerable:!0,get:function(){return _schema.Text}}),Object.defineProperty(exports,"MarkType",{enumerable:!0,get:function(){return _schema.MarkType}}),Object.defineProperty(exports,"Attribute",{enumerable:!0,get:function(){return _schema.Attribute}}),Object.defineProperty(exports,"NodeKind",{enumerable:!0,get:function(){return _schema.NodeKind}});var _defaultschema=require("./defaultschema");Object.defineProperty(exports,"defaultSchema",{enumerable:!0,get:function(){return _defaultschema.defaultSchema}}),Object.defineProperty(exports,"Doc",{enumerable:!0,get:function(){return _defaultschema.Doc}}),Object.defineProperty(exports,"BlockQuote",{enumerable:!0,get:function(){return _defaultschema.BlockQuote}}),Object.defineProperty(exports,"OrderedList",{enumerable:!0,get:function(){return _defaultschema.OrderedList}}),Object.defineProperty(exports,"BulletList",{enumerable:!0,get:function(){return _defaultschema.BulletList}}),Object.defineProperty(exports,"ListItem",{enumerable:!0,get:function(){return _defaultschema.ListItem}}),Object.defineProperty(exports,"HorizontalRule",{enumerable:!0,get:function(){return _defaultschema.HorizontalRule}}),Object.defineProperty(exports,"Paragraph",{enumerable:!0,get:function(){return _defaultschema.Paragraph}}),Object.defineProperty(exports,"Heading",{enumerable:!0,get:function(){return _defaultschema.Heading}}),Object.defineProperty(exports,"CodeBlock",{enumerable:!0,get:function(){return _defaultschema.CodeBlock}}),Object.defineProperty(exports,"Image",{enumerable:!0,get:function(){return _defaultschema.Image}}),Object.defineProperty(exports,"HardBreak",{enumerable:!0,get:function(){return _defaultschema.HardBreak}}),Object.defineProperty(exports,"CodeMark",{enumerable:!0,get:function(){return _defaultschema.CodeMark}}),Object.defineProperty(exports,"EmMark",{enumerable:!0,get:function(){return _defaultschema.EmMark}}),Object.defineProperty(exports,"StrongMark",{enumerable:!0,get:function(){return _defaultschema.StrongMark}}),Object.defineProperty(exports,"LinkMark",{enumerable:!0,get:function(){return _defaultschema.LinkMark}});var _pos=require("./pos");Object.defineProperty(exports,"Pos",{enumerable:!0,get:function(){return _pos.Pos}});var _diff=require("./diff");Object.defineProperty(exports,"findDiffStart",{enumerable:!0,get:function(){return _diff.findDiffStart}}),Object.defineProperty(exports,"findDiffEnd",{enumerable:!0,get:function(){return _diff.findDiffEnd}});var _error=require("./error");Object.defineProperty(exports,"ModelError",{enumerable:!0,get:function(){return _error.ModelError}})},{"./defaultschema":30,"./diff":31,"./error":32,"./fragment":33,"./mark":35,"./node":36,"./pos":37,"./schema":38}],35:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;ithis.type.rank)return set.slice(0,i).concat(this).concat(set.slice(i))}return set.concat(this)}},{key:"removeFromSet",value:function(set){for(var i=0;i=0;i--)str=marks[i].type.name+"("+str+")";return str}var _get=function get(object,property,receiver){null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0===desc){var parent=Object.getPrototypeOf(object);return null===parent?void 0:get(parent,property,receiver)}if("value"in desc)return desc.value;var getter=desc.get;if(void 0!==getter)return getter.call(receiver)},_createClass=function(){function defineProperties(target,props){for(var i=0;i0&&(closedContent=this.content.close(depth-1,side))!=this.content?this.copy(closedContent):this}},{key:"path",value:function(_path){for(var i=0,node=this;i<_path.length;node=node.child(_path[i]),i++);return node}},{key:"nodeAfter",value:function(pos){var parent=this.path(pos.path);return pos.offset0?this:other}},{key:"min",value:function(other){return this.cmp(other)<0?this:other}},{key:"cmp",value:function(other){return other==this?0:Pos.cmp(this.path,this.offset,other.path,other.offset)}},{key:"shorten",value:function(){var to=arguments.length<=0||void 0===arguments[0]?null:arguments[0],offset=arguments.length<=1||void 0===arguments[1]?0:arguments[1];if(to>=this.depth){if(to!=this.depth||offset)throw new _error.ModelError("Invalid shorten depth "+to+" for "+this);return new Pos(this.path,this.offset+offset)}return Pos.shorten(this.path,to,offset)}},{key:"move",value:function(by){return new Pos(this.path,this.offset+by)}},{key:"toPath",value:function(){var move=arguments.length<=0||void 0===arguments[0]?0:arguments[0];return this.path.concat(this.offset+move)}},{key:"extend",value:function(pos){for(var path=this.path.slice(),add=this.offset,i=0;i=node.size)return!1;node=node.child(n)}}},{key:"toJSON",value:function(){return this}},{key:"depth",get:function(){return this.path.length}}],[{key:"cmp",value:function(pathA,offsetA,pathB,offsetB){for(var lenA=pathA.length,lenB=pathB.length,i=0,end=Math.min(lenA,lenB);end>i;i++){var diff=pathA[i]-pathB[i];if(0!=diff)return diff}return lenA>lenB?offsetB<=pathA[i]?1:-1:lenB>lenA?offsetA<=pathB[i]?-1:1:offsetA-offsetB}},{key:"samePath",value:function(pathA,pathB){if(pathA.length!=pathB.length)return!1;for(var i=0;i=0;i--)inner=conn[i].create(null,inner);return _fragment.Fragment.from(inner)}},{key:"contains",get:function(){return NodeKind.block}},{key:"kind",get:function(){return NodeKind.block}},{key:"isBlock",get:function(){return!0}},{key:"canBeEmpty",get:function(){return null==this.contains}}]),Block}(NodeType),Inline=(exports.Textblock=function(_Block){function Textblock(){return _classCallCheck(this,Textblock),_possibleConstructorReturn(this,Object.getPrototypeOf(Textblock).apply(this,arguments))}return _inherits(Textblock,_Block),_createClass(Textblock,[{key:"contains",get:function(){return NodeKind.inline}},{key:"containsMarks",get:function(){return!0}},{key:"isTextblock",get:function(){return!0}},{key:"canBeEmpty",get:function(){return!0}}]),Textblock}(Block),exports.Inline=function(_NodeType2){function Inline(){return _classCallCheck(this,Inline),_possibleConstructorReturn(this,Object.getPrototypeOf(Inline).apply(this,arguments))}return _inherits(Inline,_NodeType2),_createClass(Inline,[{key:"kind",get:function(){return NodeKind.inline}},{key:"isInline",get:function(){return!0}}]),Inline}(NodeType)),MarkType=(exports.Text=function(_Inline){function Text(){return _classCallCheck(this,Text),_possibleConstructorReturn(this,Object.getPrototypeOf(Text).apply(this,arguments))}return _inherits(Text,_Inline),_createClass(Text,[{key:"create",value:function(attrs,content,marks){return new _node.TextNode(this,this.computeAttrs(attrs,content),content,marks)}},{key:"selectable",get:function(){return!1}},{key:"isText",get:function(){return!0}},{key:"kind",get:function(){return NodeKind.text}}]),Text}(Inline),exports.Attribute=function Attribute(){var options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];_classCallCheck(this,Attribute),this["default"]=options["default"],this.compute=options.compute,this.label=options.label},exports.MarkType=function(_SchemaItem2){function MarkType(name,rank,schema){_classCallCheck(this,MarkType);var _this10=_possibleConstructorReturn(this,Object.getPrototypeOf(MarkType).call(this));_this10.name=name,_this10.freezeAttrs(),_this10.rank=rank,_this10.schema=schema;var defaults=_this10.getDefaultAttrs();return _this10.instance=defaults&&new _mark.Mark(_this10,defaults),_this10}return _inherits(MarkType,_SchemaItem2),_createClass(MarkType,[{key:"create",value:function(attrs){return!attrs&&this.instance?this.instance:new _mark.Mark(this,this.computeAttrs(attrs))}},{key:"removeFromSet",value:function(set){for(var i=0;ii;i++){var obj=i?this.marks:this.nodes;for(var tname in obj){var type=obj[tname],registry=type.registry,ns=registry&®istry[namespace];if(ns)for(var prop in ns){var value=ns[prop](type);null!=value&&f(prop,value,type,tname)}}}}}]),Schema}());exports.Schema=Schema},{"../util/error":52,"../util/obj":55,"./fragment":33,"./mark":35,"./node":36}],39:[function(require,module,exports){"use strict";function canBeLifted(doc,range){for(var content=[doc.path(range.from.path)],unwrap=!1;;){for(var parentDepth=-1,_loop=function(_node,i){content.some(function(inner){return!_node.type.canContainContent(inner.type)})||(parentDepth=i),_node=_node.child(range.from.path[i]),node=_node},node=doc,i=0;i-1)return{path:range.from.path.slice(0,parentDepth),unwrap:unwrap};if(unwrap||!content[0].isBlock)return null;content=content[0].content.slice(range.from.offset,range.to.offset),unwrap=!0}}function canLift(doc,from,to){var range=doc.siblingRange(from,to||from),found=canBeLifted(doc,range);return found?{found:found,range:range}:void 0}function canWrap(doc,from,to,type){var range=doc.siblingRange(from,to||from);if(range.from.offset==range.to.offset)return null;var parent=doc.path(range.from.path),around=parent.type.findConnection(type),inside=type.findConnection(parent.child(range.from.offset).type);return around&&inside?{range:range,around:around,inside:inside}:void 0}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:!0}),exports.canLift=canLift,exports.canWrap=canWrap;var _model=require("../model"),_transform=require("./transform"),_step=require("./step"),_tree=require("./tree"),_map=require("./map");_step.Step.define("ancestor",{apply:function(doc,step){var from=step.from,to=step.to;if(!(0,_tree.isFlatRange)(from,to))return null;for(var toParent=from.path,start=from.offset,end=to.offset,_step$param=step.param,_step$param$depth=_step$param.depth,depth=void 0===_step$param$depth?0:_step$param$depth,_step$param$types=_step$param.types,types=void 0===_step$param$types?[]:_step$param$types,_step$param$attrs=_step$param.attrs,attrs=void 0===_step$param$attrs?[]:_step$param$attrs,inner=doc.path(from.path),i=0;depth>i;i++){if(start>0||end=0;i--)node=types[i].create(attrs[i],node||content);newParent=parent.splice(start,end,_model.Fragment.from(node))}();if("object"===("undefined"==typeof _ret?"undefined":_typeof(_ret)))return _ret.v}else{if(!parent.type.canContainFragment(inner.content)||!inner.size&&0==start&&end==parent.size&&!parent.type.canBeEmpty)return null;newParent=parent.splice(start,end,inner.content)}for(var copy=doc.replaceDeep(toParent,newParent),toInner=toParent.slice(),i=0;i1||types.length>1){var posBefore=new _model.Pos(toParent,start),posAfter1=new _model.Pos(toParent,end),posAfter2=new _model.Pos(toParent,start+insertedSize),endOfInner=new _model.Pos(toInner,startOfInner.offset+(to.offset-from.offset));replaced=[new _map.ReplacedRange(posBefore,from,posBefore,startOfInner),new _map.ReplacedRange(to,posAfter1,endOfInner,posAfter2,posAfter1,posAfter2)]}var moved=[new _map.MovedRange(from,to.offset-from.offset,startOfInner)];return end-start!=insertedSize&&moved.push(new _map.MovedRange(new _model.Pos(toParent,end),parentSize-end,new _model.Pos(toParent,start+insertedSize))),new _step.StepResult(copy,new _map.PosMap(moved,replaced))},invert:function(step,oldDoc,map){var types=[],attrs=[];if(step.param.depth)for(var i=0;i0){this.split(pos,depth-d);for(var cut=range.from.path.length-depth,path=pos.path.slice(0,cut).concat(pos.path[cut]+1);path.lengthrange.from.offset;i--)this.join(new _model.Pos(range.from.path,i));for(var child,size=0,i=rangeNode.iter(range.from.offset,range.to.offset);child=i.next().value;)size+=child.size;var path=range.from.path.concat(range.from.offset);range={from:new _model.Pos(path,0),to:new _model.Pos(path,size)},++depth}return this.step("ancestor",range.from,range.to,null,{depth:depth}),this},_transform.Transform.prototype.wrap=function(from,to,type,wrapAttrs){ +var can=canWrap(this.doc,from,to,type);if(!can)return this;var range=can.range,around=can.around,inside=can.inside,types=around.concat(type).concat(inside),attrs=around.map(function(){return null}).concat(wrapAttrs).concat(inside.map(function(){return null}));if(this.step("ancestor",range.from,range.to,null,{types:types,attrs:attrs}),inside.length){for(var toInner=range.from.path.slice(),i=0;i0;i--)this.split(new _model.Pos(toInner,i),inside.length)}return this},_transform.Transform.prototype.setBlockType=function(from,to,type,attrs){var _this=this;return this.doc.nodesBetween(from,to||from,function(node,path){return node.isTextblock&&!node.hasMarkup(type,attrs)?(path=path.slice(),_this.clearMarkup(new _model.Pos(path,0),new _model.Pos(path,node.size),type),_this.step("ancestor",new _model.Pos(path,0),new _model.Pos(path,_this.doc.path(path).size),null,{depth:1,types:[type],attrs:[attrs]}),!1):void 0}),this},_transform.Transform.prototype.setNodeType=function(pos,type,attrs){var node=this.doc.nodeAfter(pos),path=pos.toPath();return this.step("ancestor",new _model.Pos(path,0),new _model.Pos(path,node.size),null,{depth:1,types:[type],attrs:[attrs]}),this}},{"../model":34,"./map":42,"./step":46,"./transform":47,"./tree":48}],40:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Remapping=exports.MapResult=exports.PosMap=exports.joinableBlocks=exports.joinPoint=exports.canWrap=exports.canLift=exports.StepResult=exports.Step=exports.Transform=void 0;var _transform=require("./transform");Object.defineProperty(exports,"Transform",{enumerable:!0,get:function(){return _transform.Transform}});var _step=require("./step");Object.defineProperty(exports,"Step",{enumerable:!0,get:function(){return _step.Step}}),Object.defineProperty(exports,"StepResult",{enumerable:!0,get:function(){return _step.StepResult}});var _ancestor=require("./ancestor");Object.defineProperty(exports,"canLift",{enumerable:!0,get:function(){return _ancestor.canLift}}),Object.defineProperty(exports,"canWrap",{enumerable:!0,get:function(){return _ancestor.canWrap}});var _join=require("./join");Object.defineProperty(exports,"joinPoint",{enumerable:!0,get:function(){return _join.joinPoint}}),Object.defineProperty(exports,"joinableBlocks",{enumerable:!0,get:function(){return _join.joinableBlocks}});var _map=require("./map");Object.defineProperty(exports,"PosMap",{enumerable:!0,get:function(){return _map.PosMap}}),Object.defineProperty(exports,"MapResult",{enumerable:!0,get:function(){return _map.MapResult}}),Object.defineProperty(exports,"Remapping",{enumerable:!0,get:function(){return _map.Remapping}}),require("./mark"),require("./split"),require("./replace")},{"./ancestor":39,"./join":41,"./map":42,"./mark":43,"./replace":44,"./split":45,"./step":46,"./transform":47}],41:[function(require,module,exports){"use strict";function joinableBlocks(doc,pos){if(0==pos.offset)return!1;var parent=doc.path(pos.path);if(parent.isTextblock||pos.offset==parent.size)return!1;var type=parent.child(pos.offset-1).type;return!type.isTextblock&&type.contains&&type==parent.child(pos.offset).type}function joinPoint(doc,pos){for(var dir=arguments.length<=2||void 0===arguments[2]?-1:arguments[2];;){if(joinableBlocks(doc,pos))return pos;if(0==pos.depth)return null;pos=pos.shorten(null,0>dir?0:1)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.joinableBlocks=joinableBlocks,exports.joinPoint=joinPoint;var _model=require("../model"),_transform=require("./transform"),_step=require("./step"),_map=require("./map");_step.Step.define("join",{apply:function(doc,step){var before=doc.path(step.from.path),after=doc.path(step.to.path);if(step.from.offset0||!before.type.canContainFragment(after.content))return null;var pFrom=step.from.path,pTo=step.to.path,last=pFrom.length-1,offset=pFrom[last]+1;if(pFrom.length!=pTo.length||0==pFrom.length||offset!=pTo[last])return null;for(var i=0;last>i;i++)if(pFrom[i]!=pTo[i])return null;var targetPath=pFrom.slice(0,last),target=doc.path(targetPath),oldSize=target.size;if(target.type.locked)return null;var joined=before.append(after.content),copy=doc.replaceDeep(targetPath,target.splice(offset-1,offset+1,_model.Fragment.from(joined))),map=new _map.PosMap([new _map.MovedRange(step.to,after.size,step.from),new _map.MovedRange(new _model.Pos(targetPath,offset+1),oldSize-offset-1,new _model.Pos(targetPath,offset))],[new _map.ReplacedRange(step.from,step.to,step.from,step.from,step.to.shorten())]);return new _step.StepResult(copy,map)},invert:function(step,oldDoc){return new _step.Step("split",null,null,step.from,oldDoc.path(step.to.path).copy())}}),_transform.Transform.prototype.join=function(at){var parent=this.doc.path(at.path);return 0==at.offset||at.offset==parent.size||parent.isTextblock?this:(this.step("join",new _model.Pos(at.path.concat(at.offset-1),parent.child(at.offset-1).size),new _model.Pos(at.path.concat(at.offset),0)),this)}},{"../model":34,"./map":42,"./step":46,"./transform":47}],42:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function offsetFrom(base,pos){if(pos.path.length>base.path.length){for(var path=[pos.path[base.path.length]-base.offset],i=base.path.length+1;i=0&&(right=pos.cmp(side.to))<=0){var other=back?range.before:range.after;return new MapResult(0>bias?other.from:other.to,!(!left||!right),{rangeID:i,offset:offsetFrom(side.ref,pos)})}}for(var i=0;i=0&&_model.Pos.cmp(pos.path,pos.offset,start.path,start.offset+range.size)<=0){var dest=back?range.start:range.dest,depth=start.depth;if(pos.depth>depth){var offset=dest.offset+(pos.path[depth]-start.offset);return new MapResult(new _model.Pos(dest.path.concat(offset).concat(pos.path.slice(depth+1)),pos.offset))}return new MapResult(new _model.Pos(dest.path,dest.offset+(pos.offset-start.offset)))}}return new MapResult(pos)}var _createClass=function(){function defineProperties(target,props){for(var i=0;iid?this.head[-id-1]:this.tail[id]}},{key:"map",value:function map(pos,bias){for(var deleted=!1,i=-this.head.length;i=0;i--)this.step(delSteps[i]);return this}},{"../model":34,"./step":46,"./transform":47,"./tree":48}],44:[function(require,module,exports){"use strict";function findMovedChunks(oldNode,oldPath,newNode,startDepth){for(var moved=[],newPath=oldPath.path.slice(0,startDepth),depth=startDepth;;depth++){var joined=depth==oldPath.depth?0:1,cut=depth==oldPath.depth?oldPath.offset:oldPath.path[depth],afterCut=oldNode.size-cut,newOffset=newNode.size-afterCut,from=oldPath.shorten(depth,joined),to=new _model.Pos(newPath,newOffset+joined);if(from.cmp(to)&&moved.push(new _map.MovedRange(from,afterCut-joined,to)),!joined)return moved;oldNode=oldNode.child(cut),newNode=newNode.child(newOffset),newPath=newPath.concat(newOffset)}}function replace(node,from,to,root,repl){var depth=arguments.length<=5||void 0===arguments[5]?0:arguments[5];if(depth==root.length){var before=node.sliceBetween(null,from,depth),after=node.sliceBetween(to,null,depth),result=void 0;return before.type.canContainFragment(repl.content)?(result=repl.content.size?before.append(repl.content,from.depth-depth,repl.openLeft).append(after.content,repl.openRight,to.depth-depth):before.append(after.content,from.depth-depth,to.depth-depth),result.size||result.type.canBeEmpty||(result=result.copy(result.type.defaultContent())),{doc:result,moved:findMovedChunks(node,to,result,depth)}):null}var pos=root[depth],result=replace(node.child(pos),from,to,root,repl,depth+1);return result?{doc:node.replace(pos,result.doc),moved:result.moved}:null}function shiftFromStack(stack,depth){for(var shifted=stack[depth]=stack[depth].slice(1),i=depth-1;i>=0;i--)shifted=stack[i]=stack[i].replace(0,shifted)}function buildInserted(nodesLeft,source,start,end){for(var sliced=source.sliceBetween(start,end),nodesRight=[],node=sliced,i=0;i<=start.path.length;i++,node=node.firstChild)nodesRight.push(node);var same=(0,_tree.samePathDepth)(start,end),searchLeft=nodesLeft.length-1,searchRight=nodesRight.length-1,result=null,dLeft=start.depth,dRight=end.depth,inner=nodesRight[searchRight];for(inner.isTextblock&&inner.size&&nodesLeft[searchLeft].isTextblock&&(result=nodesLeft[searchLeft--].copy(inner.content),--searchRight,shiftFromStack(nodesRight,searchRight));;searchRight--){for(var node=nodesRight[searchRight],type=node.type,matched=null,outside=same>=searchRight,i=searchLeft;i>=0;i--){var left=nodesLeft[i];if(outside?left.type.canContainContent(node.type):left.type==type){matched=i;break}}if(null!=matched){if(result)for(;searchLeft>=matched;){var wrap=nodesLeft[searchLeft],content=_model.Fragment.from(result);result=wrap.copy(searchLeft==matched?content.append(node.content):content),searchLeft--}else result=nodesLeft[matched].copy(node.content),searchLeft=matched-1;if(outside)break}else--dLeft;(null!=matched||0==node.size)&&(outside&&null==matched&&--dRight,shiftFromStack(nodesRight,searchRight-1))}var repl={content:result?result.content:_model.emptyFragment,openLeft:dLeft-searchRight,openRight:dRight-searchRight};return{repl:repl,depth:searchLeft+1}}function moveText(tr,doc,before,after){for(var root=(0,_tree.samePathDepth)(before,after),cutAt=after.shorten(null,1);cutAt.path.length>root&&1==doc.path(cutAt.path).size;)cutAt=cutAt.shorten(null,1);tr.split(cutAt,cutAt.path.length-root);for(var start=after,end=new _model.Pos(start.path,doc.path(start.path).size),parent=doc.path(start.path.slice(0,root)),wanted=parent.pathNodes(before.path.slice(root)),existing=parent.pathNodes(start.path.slice(root));wanted.length&&existing.length&&wanted[0].sameMarkup(existing[0]);)wanted.shift(),existing.shift();(existing.length||wanted.length)&&tr.step("ancestor",start,end,null,{depth:existing.length,types:wanted.map(function(n){return n.type}),attrs:wanted.map(function(n){return n.attrs})});for(var i=root;imaxDepth;)repl.content.size&&(repl={content:_model.Fragment.from(doc.path(from.path.slice(0,depth)).copy(repl.content)),openLeft:repl.openLeft+1,openRight:repl.openRight+1}),depth--}else repl=nullRepl,depth=maxDepth;var root=from.shorten(depth),docAfter=doc,after=to;if(repl.content.size||(0,_tree.replaceHasEffect)(doc,from,to)){var result=this.step("replace",from,to,root,repl);docAfter=result.doc,after=result.map.map(to).pos}if(!doc.path(to.path).isTextblock)return this;if(!(repl.content.size?source.path(end.path).isTextblock:doc.path(from.path).isTextblock))return this;var nodesAfter=doc.path(root.path).pathNodes(to.path.slice(depth)).slice(1),nodesBefore=void 0;if(repl.content.size){var inserted=repl.content;nodesBefore=[];for(var i=0;ioff;off++){var here=pos.shorten(pos.depth-off);here.offset&&here.offset0)return!0}return gapStart!=gapEnd?!0:canBeJoined(node,gapStart,Math.min(from.depth,to.depth)-depth)}node=node.child(from.path[depth])}}function samePathDepth(a,b){for(var i=0;;i++)if(i==a.path.length||i==b.path.length||a.path[i]!=b.path[i])return i}Object.defineProperty(exports,"__esModule",{value:!0}),exports.copyStructure=copyStructure,exports.copyInline=copyInline,exports.isFlatRange=isFlatRange,exports.replaceHasEffect=replaceHasEffect,exports.samePathDepth=samePathDepth;var _model=require("../model")},{"../model":34}],49:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function openPrompt(pm,content,options){var button=(0,_dom.elt)("button",{"class":"ProseMirror-prompt-close"}),wrapper=(0,_dom.elt)("div",{"class":"ProseMirror-prompt"},content,button),outerBox=pm.wrapper.getBoundingClientRect();if(pm.wrapper.appendChild(wrapper),options&&options.pos)wrapper.style.left=options.pos.left-outerBox.left+"px",wrapper.style.pos=options.pos.top-outerBox.top+"px";else{var blockBox=wrapper.getBoundingClientRect(),cX=Math.max(0,outerBox.left)+Math.min(window.innerWidth,outerBox.right)-blockBox.width,cY=Math.max(0,outerBox.top)+Math.min(window.innerHeight,outerBox.bottom)-blockBox.height; +wrapper.style.left=cX/2-outerBox.left+"px",wrapper.style.top=cY/2-outerBox.top+"px"}var close=function close(){pm.off("interaction",close),wrapper.parentNode&&(wrapper.parentNode.removeChild(wrapper),options&&options.onClose&&options.onClose())};return button.addEventListener("click",close),pm.on("interaction",close),{close:close}}var _createClass=function(){function defineProperties(target,props){for(var i=0;i-1&&this.waiting.splice(index,1)}},{key:"force",value:function(){for(clearTimeout(this.timeout),this.lastForce=Date.now();this.waiting.length;)for(var i=0;iMIN_FLUSH_DELAY&&this.force()}}],[{key:"get",value:function(pm){return pm.mod.centralScheduler||(pm.mod.centralScheduler=new this(pm))}}]),CentralScheduler}();exports.UpdateScheduler=function(){function UpdateScheduler(pm,events,start){var _this=this;_classCallCheck(this,UpdateScheduler),this.pm=pm,this.start=start,this.events=events.split(" "),this.onEvent=this.onEvent.bind(this),this.events.forEach(function(event){return pm.on(event,_this.onEvent)})}return _createClass(UpdateScheduler,[{key:"detach",value:function(){var _this2=this;unscheduleDOMUpdate(this.pm,this.start),this.events.forEach(function(event){return _this2.pm.off(event,_this2.onEvent)})}},{key:"onEvent",value:function(){scheduleDOMUpdate(this.pm,this.start)}},{key:"force",value:function(){if(this.pm.operation)this.onEvent();else{unscheduleDOMUpdate(this.pm,this.start);for(var run=this.start;run;run=run());}}}]),UpdateScheduler}()},{}],52:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function functionName(f){var match=/^function (\w+)/.exec(f.toString());return match&&match[1]}var _createClass=function(){function defineProperties(target,props){for(var i=0;i1?_len-1:0),_key=1;_len>_key;_key++)args[_key-1]=arguments[_key];if(arr)for(var i=0;i1?_len2-1:0),_key2=1;_len2>_key2;_key2++)args[_key2-1]=arguments[_key2];for(var i=0;i0}}},{}],54:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;i-1?this.content[found+1]=value:this.content.push(key,value)}},{key:"get",value:function(key){var found=this.find(key);return-1==found?void 0:this.content[found+1]}},{key:"has",value:function(key){return this.find(key)>-1}},{key:"find",value:function(key){for(var i=0;i0);i++);array.splice(i,0,elt)}Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=sortedInsert},{}],57:[function(require,module,exports){!function(mod){if("object"==typeof exports&&"object"==typeof module)module.exports=mod();else{if("function"==typeof define&&define.amd)return define([],mod);(this||window).browserKeymap=mod()}}(function(){"use strict";function keyName(event){if("keypress"==event.type)return"'"+String.fromCharCode(event.charCode)+"'";var base=keyNames[event.keyCode],name=base;return null==name||event.altGraphKey?null:(event.altKey&&"Alt"!=base&&(name="Alt-"+name),event.ctrlKey&&"Ctrl"!=base&&(name="Ctrl-"+name),event.metaKey&&"Cmd"!=base&&(name="Cmd-"+name),event.shiftKey&&"Shift"!=base&&(name="Shift-"+name),name)}function isModifierKey(name){return name=/[^-]*$/.exec(name)[0],"Ctrl"==name||"Alt"==name||"Shift"==name||"Mod"==name}function normalizeKeyName(name){for(var alt,ctrl,shift,cmd,parts=name.split(/-(?!'?$)/),result=parts[parts.length-1],i=0;ii;i++)keyNames[i+48]=keyNames[i+96]=String(i);for(var i=65;90>=i;i++)keyNames[i]=String.fromCharCode(i);for(var i=1;12>=i;i++)keyNames[i+111]=keyNames[i+63235]="F"+i;return Keymap.prototype={normalize:function(name){return this.options.multi!==!1?name.split(/ +(?!\'$)/).map(normalizeKeyName):[normalizeKeyName(name)]},addBinding:function(keyname,value){for(var keys=this.normalize(keyname),i=0;i=0;i--){var name=keys.slice(0,i).join(" "),val=this.bindings[name];if("..."==val&&!this.unusedMulti(name))break;val&&delete this.bindings[name]}},unusedMulti:function(name){for(var binding in this.bindings)if(binding.length>name&&0==binding.indexOf(name)&&" "==binding.charAt(name.length))return!1;return!0},lookup:function(key,context){return this.options.call?this.options.call(key,context):this.bindings[key]},constructor:Keymap},Keymap.keyName=keyName,Keymap.isModifierKey=isModifierKey,Keymap.normalizeKeyName=normalizeKeyName,Keymap})},{}],58:[function(require,module,exports){"use strict";function fleschKincaid(counts){return counts&&counts.sentence&&counts.word&&counts.syllable?SENTENCE_WEIGHT*(counts.word/counts.sentence)+WORD_WEIGHT*(counts.syllable/counts.word)-ADJUSTMENT:NaN}var SENTENCE_WEIGHT,WORD_WEIGHT,ADJUSTMENT;SENTENCE_WEIGHT=.39,WORD_WEIGHT=11.8,ADJUSTMENT=15.59,module.exports=fleschKincaid},{}],59:[function(require,module,exports){"use strict";function flesch(counts){return counts&&counts.sentence&&counts.word&&counts.syllable?BASE-SENTENCE_WEIGHT*(counts.word/counts.sentence)-WORD_WEIGHT*(counts.syllable/counts.word):NaN}var SENTENCE_WEIGHT,WORD_WEIGHT,BASE;SENTENCE_WEIGHT=1.015,WORD_WEIGHT=84.6,BASE=206.835,module.exports=flesch},{}],60:[function(require,module,exports){function constructByRe(){return byRe=new RegExp(re.toString().slice(1,-3)+"\\s*by\\b","gi")}var byRe,irregulars=["awoken","been","born","beat","become","begun","bent","beset","bet","bid","bidden","bound","bitten","bled","blown","broken","bred","brought","broadcast","built","burnt","burst","bought","cast","caught","chosen","clung","come","cost","crept","cut","dealt","dug","dived","done","drawn","dreamt","driven","drunk","eaten","fallen","fed","felt","fought","found","fit","fled","flung","flown","forbidden","forgotten","foregone","forgiven","forsaken","frozen","gotten","given","gone","ground","grown","hung","heard","hidden","hit","held","hurt","kept","knelt","knit","known","laid","led","leapt","learnt","left","lent","let","lain","lighted","lost","made","meant","met","misspelt","mistaken","mown","overcome","overdone","overtaken","overthrown","paid","pled","proven","put","quit","read","rid","ridden","rung","risen","run","sawn","said","seen","sought","sold","sent","set","sewn","shaken","shaven","shorn","shed","shone","shod","shot","shown","shrunk","shut","sung","sunk","sat","slept","slain","slid","slung","slit","smitten","sown","spoken","sped","spent","spilt","spun","spit","split","spread","sprung","stood","stolen","stuck","stung","stunk","stridden","struck","strung","striven","sworn","swept","swollen","swum","swung","taken","taught","torn","told","thought","thrived","thrown","thrust","trodden","understood","upheld","upset","woken","worn","woven","wed","wept","wound","won","withheld","withstood","wrung","written"],exceptions=["indeed"],re=new RegExp("\\b(am|are|were|being|is|been|was|be)\\b\\s*([\\w]+ed|"+irregulars.join("|")+")\\b","gi");module.exports=function(text,options){for(var r=options&&options.by?byRe||constructByRe():re,suggestions=[];match=r.exec(text);)-1===exceptions.indexOf(match[2].toLowerCase())&&suggestions.push({index:match.index,offset:match[0].length});return suggestions}},{}],61:[function(require,module,exports){module.exports={stats:function(text){var data;return text.length&&(data={sentences:this.sentences(text),words:this.words(text),syllables:this.syllables(text),characters:this.characters(text),carpar:this.charactersWords(text),gulpease:this.gulpease(text),gunningFog:this.gunningFog(text)}),data},findSentences:function(text){var sentence,sentences,result,_i,_len;for(sentences=text.split("."),result=[],_i=0,_len=sentences.length;_len>_i;_i++)sentence=sentences[_i],""!==sentence.trim()&&result.push(sentence);return result},sentences:function(text){return this.findSentences(text).length},findWords:function(sentence){return sentence.match(/[A-z\u00E0-\u00FC]+/g)},words:function(sentence){return this.findWords(sentence).length},findSyllables:function(word){return word=word.toLowerCase(),word.length<=3?1:(word=word.replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,""),word=word.replace(/^y/,""),word.match(/[aeiouy]{1,2}/g))},syllables:function(word){return this.findSyllables(word).length},characters:function(sentence){var word,tot,_i,_len;for(sentence=this.findWords(sentence),tot=0,_i=0,_len=sentence.length;_len>_i;_i++)word=sentence[_i],null!==word&&(tot+=word.length);return tot},charactersWords:function(sentence){var result,tot;return tot=this.characters(sentence),result=tot/this.words(sentence),result.toFixed(1)},gulpease:function(text){var _characters,_sentences,_words,_result;return _sentences=this.sentences(text),_characters=this.characters(text),_words=this.words(text),_result=89+(300*_sentences-10*_characters)/_words,parseInt(_result,10)},gunningFog:function(text){var word,_sentences,_i,_len,_words,_wordsComplesse,_result;for(_sentences=this.sentences(text),_words=this.words(text),_wordsComplesse=0,_i=0,_len=_words.length;_len>_i;_i++)word=_words[_i],this.syllables(word)>2&&(_wordsComplesse+=1);return _result=.4*(_words/_sentences+100*(_wordsComplesse/_words)),parseInt(_result,10)}}},{}],62:[function(require,module,exports){"use strict";var _edit=require("prosemirror/dist/edit");require("prosemirror/dist/menu/tooltipmenu"),require("prosemirror/dist/menu/menubar"),require("prosemirror/dist/inputrules/autoinput");var _schema=require("./schema"),_transform=require("prosemirror/dist/transform/transform"),_tool=require("./widgets/tool"),pm=window.pm=new _edit.ProseMirror({place:document.querySelector("#editor"),menuBar:{"float":!1,content:null},schema:_schema.widgetSchema,commands:_schema.readonlyCommands,autoInput:!0,doc:document.querySelector("#content"),docFormat:"dom"});(0,_transform.setReadOnly)(function(step){return!0}),(0,_tool.initComments)(pm)},{"./schema":63,"./widgets/tool":96,"prosemirror/dist/edit":11,"prosemirror/dist/inputrules/autoinput":24,"prosemirror/dist/menu/menubar":28,"prosemirror/dist/menu/tooltipmenu":29,"prosemirror/dist/transform/transform":47}],63:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var _createClass=function(){function defineProperties(target,props){for(var i=0;i=0;i--)pos.path[i]>0&&(cut=pos.shorten(i),before=pm.doc.path(cut.path).child(cut.offset-1));return{before:before,at:new _model.Pos(cut.path,cut.offset-1)}}function getID(){return Math.floor(4294967295*Math.random())}function insertWidget(pm,pos,w){for(;;){if(0==pos.depth)return pm.tr.insert(pos,w).apply(pm.apply.scroll),w.firstChild&&w.firstChild.isTextblock&&pm.on("change",function(){var side=getPosInParent(pm,pos,w),p=new _model.Pos(side.toPath(),0);pm.setTextSelection(new _model.Pos(p.toPath(),0))}),!0;pos=pos.shorten(null,1)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.selectedNodeAttr=exports.defParamsClick=exports.nameTitle=exports.namePattern=exports.defineFileHandler=exports.widgetParamHandler=void 0;var _params=require("./params");Object.defineProperty(exports,"widgetParamHandler",{enumerable:!0,get:function(){return _params.widgetParamHandler}}),Object.defineProperty(exports,"defineFileHandler",{enumerable:!0,get:function(){return _params.defineFileHandler}}),Object.defineProperty(exports,"namePattern",{enumerable:!0,get:function(){return _params.namePattern}}),Object.defineProperty(exports,"nameTitle",{enumerable:!0,get:function(){return _params.nameTitle}}),Object.defineProperty(exports,"defParamsClick",{enumerable:!0,get:function(){return _params.defParamsClick}}),Object.defineProperty(exports,"selectedNodeAttr",{enumerable:!0,get:function(){return _params.selectedNodeAttr}}),exports.defParser=defParser,exports.getPosInParent=getPosInParent,exports.nodeBefore=nodeBefore,exports.getID=getID,exports.insertWidget=insertWidget;var _model=require("prosemirror/dist/model");require("prosemirror/dist/edit/selection")},{"./params":65,"prosemirror/dist/edit/selection":17,"prosemirror/dist/model":34}],65:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function defineFileHandler(handler){fhandler=handler}function getLastClicked(){return lastClicked}function openWidgetPrompt(wpp,options){var close=function close(){wpp.pm.off("interaction",close),dialog.parentNode&&(dialog.parentNode.removeChild(dialog),options&&options.onClose&&options.onClose())},submit=function(){var params=wpp.values();params&&(wpp.command.exec(wpp.pm,params),close())};wpp.pm.on("interaction",close);var save=(0,_dom.elt)("input",{name:"save",type:"button",value:"Save"});save.addEventListener("mousedown",function(e){submit()});var cancel=(0,_dom.elt)("input",{name:"cancel",type:"button",value:"Cancel"});cancel.addEventListener("mousedown",function(e){e.preventDefault(),e.stopPropagation(),close()});var buttons=(0,_dom.elt)("div",{"class":"widgetButtons"},save,cancel);wpp.form=(0,_dom.elt)("form",{"class":"widgetForm"},(0,_dom.elt)("h4",null,wpp.command.label+" Settings"),wpp.fields.map(function(f){return(0,_dom.elt)("div",null,f)}),buttons),wpp.form.addEventListener("keypress",function(e){13==e.keyCode&&(e.preventDefault(),e.stopPropagation(),save.click())});var dialog=(0,_dom.elt)("div",null,(0,_dom.elt)("div",{"class":"widgetDialog"}),wpp.form);return wpp.pm.wrapper.appendChild(dialog),{close:close}}function selectClickedNode(pm,e){var pos=(0,_dompos.selectableNodeAbove)(pm,e.target,{left:e.clientX,top:e.clientY},!0);if(!pos)return pm.sel.fastPoll();var _pm$selection=pm.selection,node=_pm$selection.node,from=_pm$selection.from;if(node&&pos.depth>=from.depth&&0==pos.shorten(from.depth).cmp(from)){if(0==from.depth)return pm.sel.fastPoll();pos=from.shorten()}pm.setNodeSelection(pos),lastClicked=e.target}function defParamsClick(type,cmdname){var spots=arguments.length<=2||void 0===arguments[2]?["topright"]:arguments[2];type.prototype.handleClick=function(pm,e,path,node){selectClickedNode(pm,e);var spotClicked=!1;if(spots.forEach(function(loc){var r=e.target.getBoundingClientRect();"all"==loc?spotClicked=!0:"topright"==loc?spotClicked=spotClicked||e.clientX>r.right-16&&e.clientYr.right-32&&e.clientY>r.bottom-32)}),spotClicked){var cmd=pm.commands[cmdname];return cmd?(cmd.exec(pm),!0):!1}}}function selectedNodeAttr(pm,type,name){var node=pm.selection.node;return node&&node.type==type?node.attrs[name]:void 0}function FileDragHover(e){e.stopPropagation(),e.preventDefault(),e.target.className="dragover"==e.type?"hover":""}function buildUploadForm(pm,field){var legend=(0,_dom.elt)("h4",null,"File Upload"),label=((0,_dom.elt)("input",{type:"hidden",id:"MAX_FILE_SIZE",name:"MAX_FILE_SIZE",value:"300000"}),(0,_dom.elt)("label",{"for":"fileselect"},"File to upload:")),fileselect=(0,_dom.elt)("input",{id:"fileselect",type:"file",name:"fileselect[]",multiple:"multiple"}),filedrag=(0,_dom.elt)("div",{id:"filedrag"},"or drop files here"),cancel=(0,_dom.elt)("input",{type:"button",value:"Cancel"});cancel.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),pm.wrapper.removeChild(form)});var saveFile=function(e){e.preventDefault(),e.stopPropagation(),FileDragHover(e);var files=e.target.files||e.dataTransfer.files;files&&(field.value=files[0].name),fhandler&&fhandler(files),pm.wrapper.removeChild(form)};fileselect.addEventListener("change",saveFile);var xhr=new XMLHttpRequest;xhr.upload&&(filedrag.addEventListener("dragover",FileDragHover),filedrag.addEventListener("dragleave",FileDragHover),filedrag.addEventListener("drop",saveFile),filedrag.style.display="block");var form=(0,_dom.elt)("form",{id:"upload",enctype:"multipart/form-data"},legend,(0,_dom.elt)("div",null,label,fileselect,filedrag),(0,_dom.elt)("div",null,cancel));pm.wrapper.appendChild(form)}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0)return pm.tr["delete"](from,to).apply(pm.apply.scroll);var toCL=toCH.shorten(),cl=pm.doc.path(toCL.path),_nodeBefore=(0,_utils.nodeBefore)(pm,toCH),before=_nodeBefore.before;_nodeBefore.at;if(2==cl.size||before.type!=this||ch.lastChild.size>0)return!0;var tr=pm.tr["delete"](toCL,toCL.move(1)).apply();return renumber(pm,toCL),tr},keys:["Backspace(10)","Mod-Backspace(10)"]}),CheckList.register("command","insert",{label:"Check List",run:function(pm,name){var _pm$selection3=pm.selection,from=_pm$selection3.from,node=(_pm$selection3.to,_pm$selection3.node);if(node&&node.type==this){var tr=pm.tr.setNodeType(from,this,{name:name}).apply();return renumber(pm,_model.Pos.from(from.toPath().concat(from.offset),0)),tr}var choice_content=_model.Fragment.from([this.schema.nodes.checkbox.create({name:name,value:1}),this.schema.nodes.textbox.create()]),content=_model.Fragment.from([this.schema.nodes.paragraph.create(null,""),this.schema.nodes.checkitem.create({name:name,value:1},choice_content)]);return(0,_utils.insertWidget)(pm,from,this.create({name:name},content))},select:function(pm){return!0},menu:{group:"question",rank:70,display:{type:"label",label:"CheckList"}},params:[{name:"Name",attr:"name",label:"Short ID",type:"text",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"name")},options:{pattern:_utils.namePattern,size:10,title:_utils.nameTitle}}]}),(0,_utils.defParamsClick)(CheckList,"checklist:insert"),(0,_dom.insertCSS)("\n\n.ProseMirror .widgets-checkitem input {\n float: left;\n}\n\n.ProseMirror .widgets-checkitem {\n cursor: text;\n}\n\n\n")},{"../../utils":64,"./question":89,"./textbox":93,"prosemirror/dist/dom":1,"prosemirror/dist/model":34}],86:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0)return pm.tr["delete"](from,to).apply(pm.apply.scroll);var toMC=toCH.shorten(),mc=pm.doc.path(toMC.path),_nodeBefore=(0,_utils.nodeBefore)(pm,toCH),before=_nodeBefore.before;_nodeBefore.at;if(2==mc.size||before.type!=this||ch.lastChild.size>0)return!0;var tr=pm.tr["delete"](toMC,toMC.move(1)).apply();return renumber(pm,toMC),tr},keys:["Backspace(10)","Mod-Backspace(10)"]}),MultipleChoice.register("command","insert",{label:"MultipleChoice",run:function(pm,name){var _pm$selection3=pm.selection,from=_pm$selection3.from,node=(_pm$selection3.to,_pm$selection3.node);if(node&&node.type==this){var tr=pm.tr.setNodeType(from,this,{name:name}).apply();return renumber(pm,_model.Pos.from(from.toPath().concat(from.offset),0)),tr}var choice_content=_model.Fragment.from([this.schema.nodes.radiobutton.create({name:name,value:1}),this.schema.nodes.textbox.create()]),content=_model.Fragment.from([this.schema.nodes.paragraph.create(null,""),this.schema.nodes.choice.create({name:name,value:1},choice_content)]);return(0,_utils.insertWidget)(pm,from,this.create({name:name},content))},select:function(pm){return!0},menu:{group:"question",rank:70,display:{type:"label",label:"MultipleChoice"}},params:[{name:"Name",attr:"name",label:"Short ID",type:"text",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"name")},options:{pattern:_utils.namePattern,size:10,title:_utils.nameTitle}}]}),(0,_utils.defParamsClick)(MultipleChoice,"multiplechoice:insert"),(0,_dom.insertCSS)("\n\n.widgets-choice input {\n float: left;\n}\n\n.ProseMirror .widgets-choice:hover {\n cursor: text;\n}\n\n")},{"../../utils":64,"./question":89,"prosemirror/dist/dom":1,"prosemirror/dist/model":34}],89:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0||"paragraph"!=para.type.name)return!1;from=from.shorten();var parent=pm.doc.path(from.path);return parent.type instanceof Question?parent.firstChild==para:!1},keys:["Backspace(10)","Mod-Backspace(10)"]}),Question.register("command","enter",{label:"process enter",run:function(pm){var _pm$selection2=pm.selection,from=_pm$selection2.from,node=_pm$selection2.node,para=pm.doc.path(from.path);if(node&&node.type instanceof Question){var _parent=pm.doc.path(from.path);if(_parent.lastChild==node||!_parent.child(from.offset+1).isTextblock){var side=from.move(1);pm.tr.insert(side,pm.schema.defaultTextblockType().create()).apply(pm.apply.scroll),pm.setTextSelection(new _model.Pos(side.toPath(),0))}return!0}if(from.offset>0||"paragraph"!=para.type.name)return!1;var parent=pm.doc.path(from.shorten().path);return parent.type instanceof Question},keys:["Enter(10)","Mod-Enter(10)"]}),(0,_dom.insertCSS)('\n \n.widgets-question {\n counter-increment: qcnt;\n border: 1px solid #DDD;\n border-radius: 4px;\n padding: 8px;\n margin-top: 1em;\n}\n\n.widgets-question:before {\n content: "Question " counter(qcnt) ".";\n font-size: 80%;\n font-weight: bold;\n// cursor: move;\n}\n\n.ProseMirror .widgets-question p:hover {\n cursor: text;\n}\n\n')},{"../../schema":63,"../../utils":64,"prosemirror/dist/dom":1,"prosemirror/dist/model":34,"prosemirror/dist/transform":40}],90:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var _createClass=function(){ +function defineProperties(target,props){for(var i=0;istartVal?setOutputValue=function(val){out.value=val}:!function(){var max=startVal;setOutputValue=function(val){out.value=max-val},endVal=startVal-endVal,startVal=0}();var range=(0,_dom.elt)("input",{"class":"widgets-input",value:mid,name:node.attrs.name,id:node.attrs.name,type:"range",min:startVal,max:endVal,contenteditable:!1});return range.addEventListener("input",function(e){e.stopPropagation(),setOutputValue(e.originalTarget.valueAsNumber)}),(0,_dom.elt)("div",node.attrs,(0,_dom.elt)("span",null,node.attrs.startlabel),range,(0,_dom.elt)("span",null,node.attrs.endlabel),out)};var Scale=exports.Scale=function(_Question){function Scale(){return _classCallCheck(this,Scale),_possibleConstructorReturn(this,Object.getPrototypeOf(Scale).apply(this,arguments))}return _inherits(Scale,_Question),_createClass(Scale,[{key:"attrs",get:function(){return{name:new _model.Attribute,startvalue:new _model.Attribute({"default":"1"}),startlabel:new _model.Attribute({"default":"low"}),endvalue:new _model.Attribute({"default":"10"}),endlabel:new _model.Attribute({"default":"high"}),"class":new _model.Attribute({"default":"widgets-scale "+_question.qclass})}}}],[{key:"contains",get:function(){return"text"}}]),Scale}(_question.Question);(0,_utils.defParser)(Scale,"div","widgets-scaledisplay"),(0,_utils.defParser)(Scale,"div","widgets-scale"),Scale.register("command","insert",{label:"Scale",run:function(pm,name,startvalue,startlabel,endvalue,endlabel){var _pm$selection=pm.selection,from=_pm$selection.from,node=(_pm$selection.to,_pm$selection.node);if(node&&node.type==this)return pm.tr.setNodeType(from,this,{name:name,startvalue:startvalue,startlabel:startlabel,endvalue:endvalue,endlabel:endlabel}).apply(pm.apply.scroll);var content=_model.Fragment.from([this.schema.nodes.paragraph.create(null,""),this.schema.nodes.scaledisplay.create({name:name,startvalue:startvalue,startlabel:startlabel,endvalue:endvalue,endlabel:endlabel})]);return(0,_utils.insertWidget)(pm,from,this.create({name:name,startvalue:startvalue,startlabel:startlabel,endvalue:endvalue,endlabel:endlabel},content))},menu:{group:"question",rank:74,display:{type:"label",label:"Scale"}},params:[{name:"Name",attr:"name",label:"Short ID",type:"text",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"name")},options:{pattern:_utils.namePattern,size:10,title:_utils.nameTitle}},{label:"Start value",attr:"startvalue",type:"number","default":1,prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"startvalue")}},{name:"Start Label",attr:"startlabel",label:"Text on left",type:"text","default":"low",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"startlabel")}},{label:"End value",attr:"endvalue",type:"number","default":10,prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"endvalue")}},{name:"End Label",attr:"endlabel",label:"Text on right",type:"text","default":"high",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"endlabel")}}]}),(0,_utils.defParamsClick)(Scale,"scale:insert"),(0,_dom.insertCSS)("\n\n.widgets-scaledisplay {\n display: inline-block;\n text-align: center;\n font-size: 80%;\n}\n\n.widgets-scale input {\n vertical-align: middle;\n display: inline;\n}\n\n.widgets-scale output {\n vertical-align: middle;\n border-radius: 4px;\n text-align: right;\n height: 20px;\n border: 1px solid #AAA;\n display: inline;\n padding: 2px;\n margin: 4px;\n background: white;\n}\n\n.widgets-scale span {\n vertical-align: middle;\n font-weight: normal;\n display: inline;\n}\n\n.widgets-scale div {\n display: inline-block;\n padding: 4px;\n}\n\n.widgets-scale input[type=range] {\n /*removes default webkit styles*/\n -webkit-appearance: none;\n \n /*fix for FF unable to apply focus style bug */\n border: 1px solid white;\n \n /*required for proper track sizing in FF*/\n width: 200px;\n}\n.widgets-scale input[type=range]::-webkit-slider-runnable-track {\n width: 200px;\n height: 5px;\n background: skyblue;\n border: none;\n border-radius: 3px;\n}\n.widgets-scale input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n border: none;\n height: 16px;\n width: 16px;\n border-radius: 50%;\n background: navy;\n margin-top: -4px;\n}\n.widgets-scale input[type=range]:focus {\n outline: none;\n}\n.widgets-scale input[type=range]:focus::-webkit-slider-runnable-track {\n background: #ccc;\n}\n\n.widgets-scale input[type=range]::-moz-range-track {\n width: 200px;\n height: 5px;\n background: skyblue;\n border: none;\n border-radius: 3px;\n}\n.widgets-scale input[type=range]::-moz-range-thumb {\n border: none;\n height: 16px;\n width: 16px;\n border-radius: 50%;\n background: navy;\n}\n\n/*hide the outline behind the border*/\n.widgets-scale input[type=range]:-moz-focusring{\n outline: 1px solid white;\n outline-offset: -1px;\n}\n\n.widgets-scale input[type=range]::-ms-track {\n width: 200px;\n height: 5px;\n \n /*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */\n background: transparent;\n \n /*leave room for the larger thumb to overflow with a transparent border */\n border-color: transparent;\n border-width: 6px 0;\n\n /*remove default tick marks*/\n color: transparent;\n}\n.widgets-scale input[type=range]::-ms-fill-lower {\n background: ;\n border-radius: 10px;\n}\n.widgets-scale input[type=range]::-ms-fill-upper {\n background: #ddd;\n border-radius: 10px;\n}\n.widgets-scale input[type=range]::-ms-thumb {\n border: none;\n height: 16px;\n width: 16px;\n border-radius: 50%;\n background: navy;\n}\n.widgets-scale input[type=range]:focus::-ms-fill-lower {\n background: #888;\n}\n.widgets-scale input[type=range]:focus::-ms-fill-upper {\n background: #ccc;\n}\n")},{"../../utils":64,"./question":89,"prosemirror/dist/dom":1,"prosemirror/dist/model":34}],91:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&commentStore.createComment(textArea.value,addComment.style.top)}),commentMenu=getCommentMenu(),commentsNode.appendChild(commentHeader),commentsNode.appendChild(addComment),commentsNode.appendChild(commentMenu)}var _createClass=function(){function defineProperties(target,props){for(var i=0;ir.right-16&&e.clientYtop&&(top=bottom),r.dom.style.top=top+"px",bottom=top+r.h+1})}},{key:"highlightComment",value:function(id){var comment=comments[id];this.clearHighlight(),comment.dom.className+=" select",this.highlight=comment;var _comment$range=comment.range,from=_comment$range.from,to=_comment$range.to;pm.removeRange(comment.range),comment.range=pm.markRange(from,to,{className:"range-select"})}},{key:"clearHighlight",value:function(){if(this.highlight){var c=this.highlight;if(c.dom.className="comment",c.range){var r=c.range,from=r.from,to=r.to;pm.removeRange(r),c.range=pm.markRange(from,to,{className:"range"})}this.highlight=null}}}]),CommentStore}();(0,_dom.insertCSS)("\n.comments {\n display: block;\n margin: 0 auto;\n width: 100%;\n}\n \n.comments #editor {\n float: left;\n width: 60%;\n display: inline-block;\n}\n\n.comments #comments {\n border: 1px solid #AAA;\n margin-left: 1px;\n padding: 0;\n height: 500px;\n width: 250px;\n display: inline-block;\n overflow: auto;\n position:relative;\n }\n\n\n.comments .comment-header {\n font-weight: bold;\n font-size: 80%;\n width: 100%;\n background: skyblue;\n color: white;\n margin: 0;\n padding: 2px 2px 0px 2px;\n border-bottom: 1px solid #AAA;\n display: inline-block;\n}\n \n.comments .newcomment {\n margin-left: 10px;\n display: inline-block;\n}\n\n.comments .newcomment a {\n padding: 0 4px 0 4px;\n background: skyblue;\n color: white;\n text-decoration: none;\n}\n\n.comments .newcomment a:hover {\n padding: 0 4px 0 4px;\n background: white;\n color: skyblue;\n cursor: pointer;\n}\n\n.comments .comment {\n background: white;\n margin: 4px;\n border-radius: 6px;\n border: 1px solid #AAA;\n font-size: 90%;\n padding: 4px;\n display: inline-block;\n width: 93%;\n left: 0;\n position: absolute;\n min-height: 30px;\n}\n\n.comments .comment:hover {\n background-image: url('icons/menu.png');\n background-repeat: no-repeat;\n background-position: top right;\n cursor: pointer;\n}\n\n.comments .select {\n border: 1px solid skyblue;\n}\n\n.comment-button {\n margin: 4px;\n padding: 2px;\n border-radius: 4px;\n border: 1px solid #AAA;\n background: skyblue;\n color: white;\n cursor: pointer;\n}\n\n.addComment {\n background: white;\n margin: 2px;\n border-radius: 6px;\n border: 1px solid #AAA;\n visibility: visible;\n font-size: 80%;\n padding: 4px;\n display: inline-block;\n position: absolute;\n left: 0;\n width: 93%;\n z-index: 100;\n}\n\n.addComment textarea {\n width: 95%;\n resize: none;\n margin: 4px;\n}\n\n.range {\n background: skyblue;\n}\n\n\n.range-select {\n background: dodgerblue;\n color: white;\n}\n\n.commentMenu {\n font-size: 90%;\n border: 1px solid #AAA;\n display: none;\n position:relative;\n left: 180px;\n width: 60px;\n z-index: 100;\n cursor: pointer;\n}\n\n.commentMenu ul {\n display: block;\n list-style-type: none;\n margin: 0;\n padding: 0;\n overflow: hidden;\n background-color: white;\n}\n\n.commentMenu li {\n}\n\n.commentMenu li span {\n display: inline-block;\n color: black;\n padding: 1px;\n text-decoration: none;\n}\n\n.commentMenu li span:hover {\n background: skyblue;\n color: white;\n}\n\n.hide {\n display: none;\n}\n\n.show {\n display: block;\n}\n")},{"../../utils":64,"prosemirror/dist/dom":1,"prosemirror/dist/model":34,"prosemirror/dist/util/event":53}],95:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function clearRanges(){granges&&(granges.forEach(function(r){return pm.removeRange(r)}),granges=null)}function clearComments(){for(;comments.lastChild;)comments.removeChild(comments.lastChild);comments.appendChild((0,_dom.elt)("div",{"class":"comment-header"},"Comments"))}function clearPositions(){grammar.forEach(function(g){return g.clear()})}function getGrammar(f){grammar&&f(),grammar=[];var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=function(){4==xmlhttp.readyState&&200==xmlhttp.status&&(JSON.parse(xmlhttp.responseText).forEach(function(g){grammar.push(new GrammarItem(g[0],g[1]))}),f())},xmlhttp.open("GET","grammar.json",!0),xmlhttp.send()}function scanGrammar(doc){function scan(node,offset){var updatePath=node.isBlock&&null!=offset;updatePath&&path.push(offset),node.isText&&grammar.forEach(function(g){for(var m=void 0;m=g.regexp.exec(node.text);)g.recordLoc(offset+m.index,offset+m.index+m[0].length,path)}),node.forEach(scan),updatePath&&path.pop()}clearComments(),clearRanges(),clearPositions();var result=[],path=[],text=doc.textContent,psv=getPassive(text);return psv&&grammar.push(psv),scan(doc),grammar.forEach(function(g){g.loc.length>0&&result.push(g)}),result.push(getStats(text)),psv&&grammar.pop(),result}function getStats(text){var stats=analyzer.stats(text),tstats={sentence:stats.sentences,word:stats.words,syllable:stats.syllables},fstat=flesch(tstats).toFixed(1),fkstat=fleschkincaid(tstats).toFixed(1),msg="There were "+stats.sentences+" sentences, "+stats.words+" words, and "+stats.syllables+" syllables. Flesch:"+fstat+", FleschKincaid:"+fkstat;return new GrammarItem("Summary Statistics",msg)}function getPassive(text){var passive=passivevoice(text);if(passive.length>0){var s="";return passive.forEach(function(loc){s+=text.substr(loc.index,loc.offset)+","}),s=s.slice(0,-1),new GrammarItem(s,"Passive voice can be hard to read. Can you make it active?")}return null}var _createClass=function(){function defineProperties(target,props){for(var i=0;i + +ProseMirror Peer Review Examples + + + + + + + + + + + + + + +

ProseMirror Peer Review Example

+

+In a peer review you can comment but not change the text. +Swipe a section of the text and add a comment. +

+ +
+
+
+
+ + + + diff --git a/grammar.html b/grammar.html index 818fef3..74ed672 100644 --- a/grammar.html +++ b/grammar.html @@ -1,6 +1,6 @@ -ProseMirror Widgets Examples +ProseMirror Grammar Examples diff --git a/icons/menu.png b/icons/menu.png new file mode 100644 index 0000000000000000000000000000000000000000..827db276eac843d266f2c60cc3864e7546f113cd GIT binary patch literal 173 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?- zSP*6mP0*VHWJs2{MwA5SrERHWtU;uvDl zoBZehe|u)thEAosJUl!-K+Mbhx`~m$`J#giuM1n-L4gj2xl+7+FPp?ffVvnwUHx3v IIVCg!09S1-KL7v# literal 0 HcmV?d00001