From 2270ac06c9a1f17f30844f7d5c6fdfc95fbe0da3 Mon Sep 17 00:00:00 2001 From: Pete Boysen Date: Fri, 22 Apr 2016 12:29:12 -0500 Subject: [PATCH] fixed deletion of question before paragraph --- widgets-built-min.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/widgets-built-min.js b/widgets-built-min.js index e80f591..087dce6 100644 --- a/widgets-built-min.js +++ b/widgets-built-min.js @@ -9,6 +9,6 @@ return _map.MapResult}}),Object.defineProperty(exports,"Remapping",{enumerable:! "use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function windowRect(){return{left:0,right:window.innerWidth,top:0,bottom:window.innerHeight}}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 _this2=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,_this2.onEvent)})}return _createClass(UpdateScheduler,[{key:"detach",value:function(){var _this3=this;unscheduleDOMUpdate(this.pm,this.start),this.events.forEach(function(event){return _this3.pm.off(event,_this3.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 ProseMirrorError(message){Error.call(this,message),this.message!=message&&(this.message=message,Error.captureStackTrace?Error.captureStackTrace(this,this.name):this.stack=new Error(message).stack)}function functionName(f){var match=/^function (\w+)/.exec(f.toString());return match&&match[1]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProseMirrorError=ProseMirrorError,ProseMirrorError.prototype=Object.create(Error.prototype),ProseMirrorError.prototype.constructor=ProseMirrorError,Object.defineProperty(ProseMirrorError.prototype,"name",{get:function(){return this.constructor.name||functionName(this.constructor)||"ProseMirrorError"}})},{}],53:[function(require,module,exports){"use strict";function getHandlers(obj,type){return obj._handlers&&obj._handlers[type]||noHandlers}function eventMixin(ctor){var proto=ctor.prototype;for(var prop in methods)methods.hasOwnProperty(prop)&&(proto[prop]=methods[prop])}Object.defineProperty(exports,"__esModule",{value:!0}),exports.eventMixin=eventMixin;var noHandlers=[],methods={on:function(type,handler){var map=this._handlers||(this._handlers=Object.create(null));map[type]=type in map?map[type].concat(handler):[handler]},off:function(type,handler){var map=this._handlers,arr=map&&map[type];if(arr)for(var i=0;i1?_len-1:0),_key=1;_len>_key;_key++)args[_key-1]=arguments[_key];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){module.exports=function(element,fn){function resizeListener(e){var win=e.target||e.srcElement;win.__resizeRAF__&&cancelFrame(win.__resizeRAF__),win.__resizeRAF__=requestFrame(function(){var trigger=win.__resizeTrigger__;trigger.__resizeListeners__.forEach(function(fn){fn.call(trigger,e)})})}function objectLoad(e){this.contentDocument.defaultView.__resizeTrigger__=this.__resizeElement__,this.contentDocument.defaultView.addEventListener("resize",resizeListener)}var window=this,document=window.document,attachEvent=document.attachEvent;if("undefined"!=typeof navigator)var isIE=navigator.userAgent.match(/Trident/);var requestFrame=function(){var raf=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(fn){return window.setTimeout(fn,20)};return function(fn){return raf(fn)}}(),cancelFrame=function(){var cancel=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout;return function(id){return cancel(id)}}();if(!element.__resizeListeners__)if(element.__resizeListeners__=[],attachEvent)element.__resizeTrigger__=element,element.attachEvent("onresize",resizeListener);else{"static"==getComputedStyle(element).position&&(element.style.position="relative");var obj=element.__resizeTrigger__=document.createElement("object");obj.setAttribute("style","display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;"),obj.setAttribute("class","resize-sensor"),obj.__resizeElement__=element,obj.onload=objectLoad,obj.type="text/html",isIE&&element.appendChild(obj),obj.data="about:blank",isIE||element.appendChild(obj)}element.__resizeListeners__.push(fn)}},{}],59:[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},{}],60:[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},{}],61:[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}},{}],62:[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)}}},{}],63:[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 _dom=require("prosemirror/dist/dom"),_utils=require("./utils"),_schema=require("./schema");window.pm=new _edit.ProseMirror({place:document.querySelector("#editor"),menuBar:_schema.mainMenuBar,schema:_schema.widgetSchema,commands:_schema.commands,autoInput:!0,doc:document.querySelector("#content"),docFormat:"dom"});(0,_utils.defineFileHandler)(function(files){console.log(files)}),(0,_dom.insertCSS)("\n#editor {\n width: 800px;\n}\n\n")},{"./schema":64,"./utils":65,"prosemirror/dist/dom":1,"prosemirror/dist/edit":11,"prosemirror/dist/inputrules/autoinput":25,"prosemirror/dist/menu/menubar":29,"prosemirror/dist/menu/tooltipmenu":30}],64:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.grammarCommands=exports.commentOnlyCommands=exports.noCommands=exports.commentCommands=exports.commands=exports.commentMenuBar=exports.grammarMenuBar=exports.mainMenuBar=exports.widgetSchema=void 0;var _edit=require("prosemirror/dist/edit"),_dom=require("prosemirror/dist/dom"),_menu=require("prosemirror/dist/menu/menu"),_model=require("prosemirror/dist/model"),_questions=require("./widgets/questions"),_input=require("./widgets/input"),_content=require("./widgets/content"),_widgets=require("./widgets"),_tool=require("./widgets/tool"),widgetSpec=new _model.SchemaSpec({doc:_model.Doc,blockquote:_model.BlockQuote,ordered_list:_model.OrderedList,bullet_list:_model.BulletList,list_item:_model.ListItem,paragraph:_model.Paragraph,heading:_model.Heading,text:_model.Text,hard_break:_model.HardBreak,input:_input.Input,checkbox:_input.CheckBox,radiobutton:_input.RadioButton,select:_input.Select,textfield:_input.TextField,textarea:_input.TextArea,question:_questions.Question,textbox:_questions.TextBox,choice:_questions.Choice,multiplechoice:_questions.MultipleChoice,scaledisplay:_questions.ScaleDisplay,scale:_questions.Scale,checkitem:_questions.CheckItem,checklist:_questions.CheckList,shortanswer:_questions.ShortAnswer,essay:_questions.Essay,selection:_questions.Selection,horizontal_rule:_model.HorizontalRule,image:_content.Image,inlinemath:_content.InlineMath,blockmath:_content.BlockMath,website:_content.Website,carryforward:_content.CarryForward,spreadsheet:_content.SpreadSheet,graph:_content.Graph,leftalign:_widgets.LeftAlign,centeralign:_widgets.CenterAlign,rightalign:_widgets.RightAlign},{em:_model.EmMark,strong:_model.StrongMark,link:_model.LinkMark,code:_model.CodeMark,underline:_widgets.UnderlineMark,strikethrough:_widgets.StrikeThroughMark});exports.widgetSchema=new _model.Schema(widgetSpec),exports.mainMenuBar={"float":!0,content:[[_menu.inlineGroup,_menu.insertMenu],[_menu.blockGroup,_menu.textblockMenu],_widgets.alignGroup,[_widgets.contentInsertMenu,_widgets.questionInsertMenu],_widgets.toolGroup,_menu.historyGroup]},exports.grammarMenuBar={"float":!0,content:[[_menu.inlineGroup,_menu.insertMenu],[_menu.blockGroup,_menu.textblockMenu],_widgets.alignGroup,[_widgets.contentInsertMenu,_widgets.questionInsertMenu],_widgets.toolGroup,_menu.historyGroup]},exports.commentMenuBar={"float":!0,content:[_widgets.toolGroup]};_menu.textblockMenu.options.label="Format";var strongIcon={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"},emIcon={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"},noCommands=(exports.commands=_edit.CommandSet["default"].update({selectParentNode:{menu:null},lift:{menu:null},"code:toggle":{menu:{group:"textblock",rank:99,select:"disable",display:{type:"label",label:"Code"}}},"strong:toggle":{menu:{group:"inline",rank:20,select:"disable",display:strongIcon}},"em:toggle":{menu:{group:"inline",rank:21,select:"disable",display:emIcon}}}),exports.commentCommands=_edit.CommandSet["default"].update({selectParentNode:{menu:null},lift:{menu:null},"code:toggle":{menu:{group:"textblock",rank:99,select:"disable",display:{type:"label",label:"Code"}}},"strong:toggle":{menu:{group:"inline",rank:20,select:"disable",display:strongIcon}},"em:toggle":{menu:{group:"inline",rank:21,select:"disable",display:emIcon}},comment:_tool.commentCmdSpec}),exports.noCommands=new _edit.CommandSet(null,function(){return null}));exports.commentOnlyCommands=noCommands.update({comment:_tool.commentCmdSpec}),exports.grammarCommands=_edit.CommandSet["default"].update({selectParentNode:{menu:null},lift:{menu:null},"code:toggle":{menu:{group:"textblock",rank:99,select:"disable",display:{type:"label",label:"Code"}}},"strong:toggle":{menu:{group:"inline",rank:20,select:"disable",display:strongIcon}},"em:toggle":{menu:{group:"inline",rank:21,select:"disable",display:emIcon}},analyze:_tool.analyzeCmdSpec});(0,_dom.insertCSS)('\n \n.ProseMirror {\n}\n\n.ProseMirror-menu {\n background: white;\n color: black;\n}\n\ndiv.ProseMirror-dropdown-menu {\n position: absolute;\n background: white;\n color: black;\n border-radius: 6px;\n border: 1px solid silver;\n padding: 2px 2px;\n z-index: 15;\n}\n\ndiv.ProseMirror-dropdown-menu {\n cursor: pointer;\n padding: 0 1em 0 2px;\n}\n\ndiv.ProseMirror-menubar-inner {\n background: linear-gradient(to bottom, white, #0191C8);\n}\n\ndiv.ProseMirror-menu form {\n background: linear-gradient(to bottom, white, #0191C8);\n width: 300px;\n}\n\ndiv.ProseMirror-menu form select {\n width: 100px;\n background: white;\n}\n\ndiv.ProseMirror-menu input[type = "text"] {\n background: white;\n}\n\n')},{"./widgets":78,"./widgets/content":71,"./widgets/input":80,"./widgets/questions":88,"./widgets/tool":97,"prosemirror/dist/dom":1,"prosemirror/dist/edit":11,"prosemirror/dist/menu/menu":28,"prosemirror/dist/model":34}],65:[function(require,module,exports){"use strict";function defParser(type,tag,cls){type.register("parseDOM",tag,{parse:function(dom,state){if(!dom.classList.contains(cls))return!1;var attrs=Object.create(null);for(var name in this.attrs)attrs[name]=dom.getAttribute(name);state.wrapIn(dom,this,attrs)}})}function getID(){return Math.floor(4294967295*Math.random())}function addDropListeners(pm){pm.content.addEventListener("drop",function(e){return!1})}Object.defineProperty(exports,"__esModule",{value:!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.getID=getID,exports.addDropListeners=addDropListeners;exports.onResize=require("prosemirror/node_modules/element-resize-event/index.js")},{"./params":66,"prosemirror/node_modules/element-resize-event/index.js":58}],66:[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 defParamsClick(type,cmdname){var spots=arguments.length<=2||void 0===arguments[2]?["topright"]:arguments[2];type.prototype.handleClick=function(pm,e,pos,node){e.preventDefault(),pm.setNodeSelection(pos),pm.focus(),lastClicked=e.target;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;i--)if($pos.node(i).type instanceof _model.Block)return $pos.end(i);return $pos.end(0)}function insertWidget(pm,pos,w){var $pos=pm.doc.resolve(pos);return pm.tr.insert(getBlockPos(pm,$pos),w).apply(pm.apply.scroll)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Graph=exports.CarryForward=exports.SpreadSheet=exports.Image=exports.InlineMath=exports.Website=exports.BlockMath=void 0;var _blockmath=require("./blockmath");Object.defineProperty(exports,"BlockMath",{enumerable:!0,get:function(){return _blockmath.BlockMath}});var _website=require("./website");Object.defineProperty(exports,"Website",{enumerable:!0,get:function(){return _website.Website}});var _inlinemath=require("./inlinemath");Object.defineProperty(exports,"InlineMath",{enumerable:!0,get:function(){return _inlinemath.InlineMath}});var _image=require("./image");Object.defineProperty(exports,"Image",{enumerable:!0,get:function(){return _image.Image}});var _spreadsheet=require("./spreadsheet");Object.defineProperty(exports,"SpreadSheet",{enumerable:!0,get:function(){return _spreadsheet.SpreadSheet}});var _carryforward=require("./carryforward");Object.defineProperty(exports,"CarryForward",{enumerable:!0,get:function(){return _carryforward.CarryForward}});var _graph=require("./graph");Object.defineProperty(exports,"Graph",{enumerable:!0,get:function(){return _graph.Graph}}),exports.insertWidget=insertWidget;var _model=require("prosemirror/dist/model");window.MathJax&&MathJax.Hub.Queue(function(){MathJax.Hub.Config({tex2jax:{displayMath:[["\\[","\\]"]],inlineMath:[["\\(","\\)"]],processEscapes:!0},displayAlign:"left"})})},{"./blockmath":67,"./carryforward":68,"./graph":69,"./image":70,"./inlinemath":72,"./spreadsheet":73,"./website":74,"prosemirror/dist/model":34}],72:[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;i--)if($pos.node(i).type instanceof _model.Textblock)return i;return 0}function findAlignWrapper(pm,align){var _pm$selection=pm.selection,from=_pm$selection.from,to=_pm$selection.to,$from=(_pm$selection.node,pm.doc.resolve(from)),$to=pm.doc.resolve(to),isLeft="leftalign"==align.name,depth=getTextblockDepth(pm,$from);if(depth>0&&$from.node(depth-1).type instanceof Align){var tr=pm.tr.lift($from.start(depth),$from.end(depth)).apply(pm.apply.scroll);return isLeft||(tr=pm.tr.wrap($from.start(depth),$from.end(depth),align,{"class":align.style}).apply(pm.apply.scroll)),tr}if(isLeft)return!1;var $end=from==to?$from:$to;return pm.tr.wrap($from.start(depth),$end.end(depth),align,{"class":align.style}).apply(pm.apply.scroll)}function alignApplies(pm,type){var _pm$selection2=pm.selection,from=_pm$selection2.from,$from=(_pm$selection2.to,_pm$selection2.node,pm.doc.resolve(from)),isLeft="leftalign"==type.name,index=getTextblockDepth(pm,$from);return isLeft&&0==index?!0:$from.parent.type.name==type.name}function defAlign(type,label,path){type.register("command","align",{run:function(pm){return findAlignWrapper(pm,this)},active:function(pm){return alignApplies(pm,this)},label:label,menu:{group:"align",rank:51,display:{type:"icon",width:8,height:8,path:path}}})}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0)return pm.tr["delete"](from,to).apply(pm.apply.scroll);var cl=$from.node($from.depth-2);if(2==cl.childCount||ci.lastChild.content.size>0)return!0;var before=$from.before($from.depth-1),after=$from.after($from.depth-1),tr=pm.tr["delete"](before,after).apply(pm.apply.scroll);if($from=pm.doc.resolve(from),$from.nodeAfter){var $pos=pm.doc.resolve(after);renumber(pm,$from.node($from.depth-2),$from.start($from.depth-2)),pm.setTextSelection($pos.end($pos.depth)-1)}else{var $pos=pm.doc.resolve(before);pm.setTextSelection($pos.after($pos.depth)+1)}return tr},keys:["Backspace(9)","Mod-Backspace(9)"]}),CheckList.register("command","insert",{label:"Check List",run:function(pm,name,title){var _pm$selection3=pm.selection,from=_pm$selection3.from,node=_pm$selection3.node,$from=pm.doc.resolve(from),attrs={name:name,title:title,value:1};if(node&&node.type==this){var tr=pm.tr.setNodeType(from,this,attrs).apply();return $from=pm.doc.resolve(from),renumber(pm,$from.nodeAfter,from+1),tr}return(0,_question.insertQuestion)(pm,from,this.create(attrs))},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}},{name:"Title",attr:"title",label:"(optional)",type:"text","default":"",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"title")},options:{required:""}}]}),(0,_utils.defParamsClick)(CheckList,"checklist:insert"),(0,_dom.insertCSS)("\n\n.ProseMirror ."+cssi+" {\n cursor: text;\n}\n\n.ProseMirror ."+cssi+" input {\n float: left;\n}\n\n\n")},{"../../utils":65,"./question":90,"./textbox":94,"prosemirror/dist/dom":1,"prosemirror/dist/model":34}],87:[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 mc=$from.node($from.depth-2);if(2==mc.childCount||chc.lastChild.content.size>0)return!0;var before=$from.before($from.depth-1),after=$from.after($from.depth-1),tr=pm.tr["delete"](before,after).apply(pm.apply.scroll);if($from=pm.doc.resolve(from),$from.nodeAfter){var $pos=pm.doc.resolve(after);renumber(pm,$from.node($from.depth-2),$from.start($from.depth-2)),pm.setTextSelection($pos.end($pos.depth)-1)}else{var $pos=pm.doc.resolve(before);pm.setTextSelection($pos.after($pos.depth)+1)}return tr},keys:["Backspace(9)","Mod-Backspace(9)"]}),MultipleChoice.register("command","insert",{label:"MultipleChoice",run:function(pm,name,title){var _pm$selection3=pm.selection,from=_pm$selection3.from,node=_pm$selection3.node,$from=pm.doc.resolve(from),attrs={name:name,title:title,value:1};if(node&&node.type==this){var tr=pm.tr.setNodeType(from,this,attrs).apply(pm.apply.scroll);return $from=pm.doc.resolve(from),renumber(pm,$from.nodeAfter,from+1),tr}return(0,_question.insertQuestion)(pm,from,this.create(attrs))},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}},{name:"Title",attr:"title",label:"(optional)",type:"text","default":"",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"title")},options:{required:""}}]}),(0,_utils.defParamsClick)(MultipleChoice,"multiplechoice:insert"),(0,_dom.insertCSS)("\n\n."+cssc+" input {\n float: left;\n}\n\n.ProseMirror ."+cssc+":hover {\n cursor: text;\n}\n\n")},{"../../utils":65,"./question":90,"prosemirror/dist/dom":1,"prosemirror/dist/model":34}],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)}function setChildAttrs(pm,parent,parentpos,type,attrs){var pa=parent.attrs;for(var key in pa)if(pa[key]!=attrs[key])return;return parent.forEach(function(node,start){return node.type.name==type?pm.tr.setNodeType(parentpos+start,node.type,attrs).apply():void 0}),!1}function insertQuestion(pm,pos,q){var $pos=pm.doc.resolve(pos),p=$pos.end(1);return pm.tr.insert(p,q).apply(pm.apply.scroll),q.firstChild&&q.firstChild.isTextblock&&pm.setTextSelection(p+3),!0}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0||!($from.parent.type instanceof _textbox.TextBox))return!1;var parent=$from.node($from.depth-2);return parent.type instanceof Question},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,$from=pm.doc.resolve(from);if(node&&node.type instanceof Question){var _parent=$from.parent;if(_parent.lastChild==node||!_parent.child(from.offset+1).isTextblock){var side=$from.end($from.depth);pm.tr.insert(side,pm.schema.defaultTextblockType().create()).apply(pm.apply.scroll),pm.setTextSelection(side+3)}return!0}if($from.parentOffset>0||$from.depth<3||!($from.parent.type instanceof _model.Textblock))return!1;var parent=$from.node($from.depth-2);return parent.type instanceof Question},keys:["Enter(10)","Mod-Enter(10)"]}),(0,_dom.insertCSS)("\n \n."+css+" {\n counter-increment: qcnt;\n border: 1px solid #DDD;\n border-radius: 4px;\n padding: 8px;\n margin-top: 1em;\n}\n\n."+css+':before {\n content: counter(qcnt)"." attr(title);\n font-size: 80%;\n font-weight: bold;\n cursor: grabbing;\n}\n\n.ProseMirror .'+css+" p:hover {\n cursor: text;\n}\n\n")},{"../../utils":65,"./textbox":94,"prosemirror/dist/dom":1,"prosemirror/dist/model":34,"prosemirror/dist/transform":41}],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 _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;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:"defaultContent",value:function(attrs){return _model.Fragment.from([this.schema.nodes.paragraph.create(null,""),this.schema.nodes.scaledisplay.create(attrs)])}},{key:"create",value:function(attrs,content,marks){return content||(content=this.defaultContent(attrs)),_get(Object.getPrototypeOf(Scale.prototype),"create",this).call(this,attrs,content,marks)}},{key:"attrs",get:function(){return{name:new _model.Attribute,title:new _model.Attribute({"default":""}),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})}}}]),Scale}(_question.Question);(0,_utils.defParser)(Scale,"div",cssd),(0,_utils.defParser)(Scale,"div",csss),Scale.register("command","insert",{label:"Scale",run:function(pm,name,title,startvalue,startlabel,endvalue,endlabel){var _pm$selection=pm.selection,from=_pm$selection.from,node=(_pm$selection.to,_pm$selection.node),attrs={name:name,title:title,startvalue:startvalue,startlabel:startlabel,endvalue:endvalue,endlabel:endlabel};if(node&&node.type==this){pm.tr.setNodeType(from,this,attrs).apply(pm.apply.scroll);var $from=pm.doc.resolve(from);return(0,_question.setChildAttrs)(pm,$from.nodeAfter,from+1,"scaledisplay",attrs)}return(0,_question.insertQuestion)(pm,from,this.create(attrs))},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}},{name:"Title",attr:"title",label:"(optional)",type:"text","default":"",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"title")},options:{required:""}},{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."+cssd+" {\n display: inline-block;\n text-align: center;\n font-size: 80%;\n}\n\n."+csss+" input {\n vertical-align: middle;\n display: inline;\n}\n\n."+csss+" input[readonly] {\n vertical-align: middle;\n border-radius: 4px;\n text-align: right;\n width: 20px;\n height: 20px;\n border: 1px solid #AAA;\n display: inline;\n padding: 2px;\n margin: 4px;\n background: white;\n}\n\n."+csss+" span {\n vertical-align: middle;\n font-weight: normal;\n display: inline;\n}\n\n."+csss+" div {\n display: inline-block;\n padding: 4px;\n}\n\n."+csss+" input[type=range] {\n -webkit-appearance: none;\n border: 1px solid white;\n width: 200px;\n cursor: pointer;\n}\n."+csss+" 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."+csss+" 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."+csss+" input[type=range]:focus {\n outline: none;\n}\n."+csss+" input[type=range]:focus::-webkit-slider-runnable-track {\n background: #ccc;\n}\n\n."+csss+" input[type=range]::-moz-range-track {\n width: 200px;\n height: 5px;\n background: skyblue;\n border: none;\n border-radius: 3px;\n}\n."+csss+" 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."+csss+" input[type=range]:-moz-focusring{\n outline: 1px solid white;\n outline-offset: -1px;\n}\n\n."+csss+" input[type=range]::-ms-track {\n width: 200px;\n height: 5px;\n background: transparent;\n border-color: transparent;\n border-width: 6px 0;\n\n /*remove default tick marks*/\n color: transparent;\n}\n."+csss+" input[type=range]::-ms-fill-lower {\n background: ;\n border-radius: 10px;\n}\n."+csss+" input[type=range]::-ms-fill-upper {\n background: #ddd;\n border-radius: 10px;\n}\n."+csss+" input[type=range]::-ms-thumb {\n border: none;\n height: 16px;\n width: 16px;\n border-radius: 50%;\n background: navy;\n}\n."+csss+" input[type=range]:focus::-ms-fill-lower {\n background: #888;\n}\n."+csss+" input[type=range]:focus::-ms-fill-upper {\n background: #ccc;\n}\n")},{"../../utils":65,"./question":90,"prosemirror/dist/dom":1,"prosemirror/dist/model":34}],92:[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;ir.right-16&&e.clientYtop&&(top=bottom),r.dom.style.top=top+"px",bottom=top+r.h+1})}},{key:"highlightComment",value:function(id){var c=comments[id];if(c){this.clearHighlight(),c.dom.className+=" select",this.highlight=c;var _c$range=c.range,from=_c$range.from,to=_c$range.to;pm.removeRange(c.range),c.range=pm.markRange(from,to,{className:c.getRangeClass(!0)})}}},{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:c.getRangeClass(!1)})}this.highlight=null}}},{key:"getSelectionTop",value:function(){var from=pm.selection.from,r=pm.coordsAtPos(from),rect=pm.content.getBoundingClientRect();return Math.round(r.top-rect.top)}}]),CommentStore}();(0,_dom.insertCSS)('\n.comments {\n display: block;\n margin: 0 auto;\n width: 100%;\n height: 400px;\n}\n\n.comments .peer .ProseMirror-menubar {\n text-align: right;\n}\n\n.comments #editor {\n float: left;\n width: 70%;\n height: 100%;\n}\n\n.comments #comments {\n border: 1px solid #AAA;\n margin-left: 1px;\n padding: 0;\n height: 100%;\n width: 300px;\n display: inline-block;\n overflow-y: 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 border-radius: 6px;\n border: 1px solid #AAA;\n width: 92%;\n font-size: 90%;\n padding: 4px;\n min-height: 30px;\n position: absolute; \n left: 8px;\n}\n\n.comments .comment:after {\n content: \' \';\n height: 0;\n position: absolute;\n width: 0;\n border: 8px solid transparent;\n border-right-color: skyblue;\n left: -16px;\n top: 5px;\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.mode-comment {\n background: skyblue;\n}\n\n\n.mode-comment-select {\n background: dodgerblue;\n color: white;\n}\n\n.mode-delete {\n text-decoration: line-through;\n}\n\n.mode-delete-select {\n text-decoration: line-through;\n background: tomato;\n}\n\n.mode-insert:before {\n content: "^";\n font-width: bold;\n}\n\n.mode-insert-select:before {\n content: "^";\n background: turquoise;\n}\n\n.mode-replace {\n text-decoration: overline;\n}\n\n.mode-replace-select {\n text-decoration: overline;\n background: violet;\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, .approval, .mode {\n display: none;\n}\n\n.show {\n display: block;\n}\n\n.approval, .mode {\n display: block;\n font-size: 85%;\n margin: 4px;\n}\n\n.approval span:first-child:after {\n content: "?";\n display: inline-block;\n font-weight: bold;\n}\n\n')},{"../../utils":65,"prosemirror/dist/dom":1,"prosemirror/dist/model":34,"prosemirror/dist/util/event":53}],96:[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); +var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.TextArea=void 0;var _model=require("prosemirror/dist/model"),_dom=require("prosemirror/dist/dom"),_utils=(require("./input"),require("../../utils")),css="widgets-textarea",TextArea=exports.TextArea=function(_Block){function TextArea(){return _classCallCheck(this,TextArea),_possibleConstructorReturn(this,Object.getPrototypeOf(TextArea).apply(this,arguments))}return _inherits(TextArea,_Block),_createClass(TextArea,[{key:"attrs",get:function(){return{name:new _model.Attribute,rows:new _model.Attribute,cols:new _model.Attribute,"class":new _model.Attribute({"default":css})}}},{key:"canBeEmpty",get:function(){return!0}},{key:"contains",get:function(){return _model.NodeKind.text}}]),TextArea}(_model.Block);(0,_utils.defParser)(TextArea,"textarea",css),TextArea.prototype.serializeDOM=function(node,s){return(0,_dom.elt)("textarea",node.attrs)},TextArea.register("command","delete",{run:function(pm){var _pm$selection=pm.selection,node=(_pm$selection.from,_pm$selection.node);return node&&node.type==this?!0:!1},keys:["Backspace(10)","Mod-Backspace(10)"]}),TextArea.register("command","insert",{label:"TextArea",run:function(pm,name,rows,cols){return pm.tr.replaceSelection(this.create({name:name,rows:rows,cols:cols})).apply(pm.apply.scroll)},params:[{name:"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}},{name:"Rows",label:"In lines",type:"number","default":"4",options:{min:2,max:24},prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"rows")}},{name:"Columns",label:"In characters",type:"number","default":"40",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"cols")},options:{min:2,max:80}}]}),(0,_dom.insertCSS)("\n\n.ProseMirror ."+css+":hover {\n cursor: pointer;\n}\n\n")},{"../../utils":65,"./input":81,"prosemirror/dist/dom":1,"prosemirror/dist/model":34}],85:[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 cl=$from.node($from.depth-2);if(2==cl.childCount||ci.lastChild.content.size>0)return!0;var before=$from.before($from.depth-1),after=$from.after($from.depth-1),tr=pm.tr["delete"](before,after).apply(pm.apply.scroll);if($from=pm.doc.resolve(from),$from.nodeAfter){var $pos=pm.doc.resolve(after);renumber(pm,$from.node($from.depth-2),$from.start($from.depth-2)),pm.setTextSelection($pos.end($pos.depth)-1)}else{var $pos=pm.doc.resolve(before);pm.setTextSelection($pos.after($pos.depth)+1)}return tr},keys:["Backspace(9)","Mod-Backspace(9)"]}),CheckList.register("command","insert",{label:"Check List",run:function(pm,name,title){var _pm$selection3=pm.selection,from=_pm$selection3.from,node=_pm$selection3.node,$from=pm.doc.resolve(from),attrs={name:name,title:title,value:1};if(node&&node.type==this){var tr=pm.tr.setNodeType(from,this,attrs).apply();return $from=pm.doc.resolve(from),renumber(pm,$from.nodeAfter,from+1),tr}return(0,_question.insertQuestion)(pm,from,this.create(attrs))},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}},{name:"Title",attr:"title",label:"(optional)",type:"text","default":"",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"title")},options:{required:""}}]}),(0,_utils.defParamsClick)(CheckList,"checklist:insert"),(0,_dom.insertCSS)("\n\n.ProseMirror ."+cssi+" {\n cursor: text;\n}\n\n.ProseMirror ."+cssi+" input {\n float: left;\n}\n\n\n")},{"../../utils":65,"./question":90,"./textbox":94,"prosemirror/dist/dom":1,"prosemirror/dist/model":34}],87:[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 mc=$from.node($from.depth-2);if(2==mc.childCount||chc.lastChild.content.size>0)return!0;var before=$from.before($from.depth-1),after=$from.after($from.depth-1),tr=pm.tr["delete"](before,after).apply(pm.apply.scroll);if($from=pm.doc.resolve(from),$from.nodeAfter){var $pos=pm.doc.resolve(after);renumber(pm,$from.node($from.depth-2),$from.start($from.depth-2)),pm.setTextSelection($pos.end($pos.depth)-1)}else{var $pos=pm.doc.resolve(before);pm.setTextSelection($pos.after($pos.depth)+1)}return tr},keys:["Backspace(9)","Mod-Backspace(9)"]}),MultipleChoice.register("command","insert",{label:"MultipleChoice",run:function(pm,name,title){var _pm$selection3=pm.selection,from=_pm$selection3.from,node=_pm$selection3.node,$from=pm.doc.resolve(from),attrs={name:name,title:title,value:1};if(node&&node.type==this){var tr=pm.tr.setNodeType(from,this,attrs).apply(pm.apply.scroll);return $from=pm.doc.resolve(from),renumber(pm,$from.nodeAfter,from+1),tr}return(0,_question.insertQuestion)(pm,from,this.create(attrs))},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}},{name:"Title",attr:"title",label:"(optional)",type:"text","default":"",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"title")},options:{required:""}}]}),(0,_utils.defParamsClick)(MultipleChoice,"multiplechoice:insert"),(0,_dom.insertCSS)("\n\n."+cssc+" input {\n float: left;\n}\n\n.ProseMirror ."+cssc+":hover {\n cursor: text;\n}\n\n")},{"../../utils":65,"./question":90,"prosemirror/dist/dom":1,"prosemirror/dist/model":34}],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)}function setChildAttrs(pm,parent,parentpos,type,attrs){var pa=parent.attrs;for(var key in pa)if(pa[key]!=attrs[key])return;return parent.forEach(function(node,start){return node.type.name==type?pm.tr.setNodeType(parentpos+start,node.type,attrs).apply():void 0}),!1}function insertQuestion(pm,pos,q){var $pos=pm.doc.resolve(pos),p=$pos.end(1);return pm.tr.insert(p,q).apply(pm.apply.scroll),q.firstChild&&q.firstChild.isTextblock&&pm.setTextSelection(p+3),!0}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0||2>from)return!1;var $prev=pm.doc.resolve(from-2);if($prev.parent.type instanceof Question)return pm.tr["delete"]($prev.before($prev.depth),$prev.after($prev.depth)).apply(pm.apply.scroll);if(!($from.parent.type instanceof _textbox.TextBox))return!1;var parent=$from.node($from.depth-2);return parent.type instanceof Question},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,$from=pm.doc.resolve(from);if(node&&node.type instanceof Question){var _parent=$from.parent;if(_parent.lastChild==node||!_parent.child(from.offset+1).isTextblock){var side=$from.end($from.depth);pm.tr.insert(side,pm.schema.defaultTextblockType().create()).apply(pm.apply.scroll),pm.setTextSelection(side+3)}return!0}if($from.parentOffset>0||$from.depth<3||!($from.parent.type instanceof _model.Textblock))return!1;var parent=$from.node($from.depth-2);return parent.type instanceof Question},keys:["Enter(10)","Mod-Enter(10)"]}),(0,_dom.insertCSS)("\n \n."+css+" {\n counter-increment: qcnt;\n border: 1px solid #DDD;\n border-radius: 4px;\n padding: 8px;\n margin-top: 1em;\n}\n\n."+css+':before {\n content: counter(qcnt)"." attr(title);\n font-size: 80%;\n font-weight: bold;\n cursor: grabbing;\n}\n\n.ProseMirror .'+css+" p:hover {\n cursor: text;\n}\n\n")},{"../../utils":65,"./textbox":94,"prosemirror/dist/dom":1,"prosemirror/dist/model":34,"prosemirror/dist/transform":41}],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 _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;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:"defaultContent",value:function(attrs){return _model.Fragment.from([this.schema.nodes.paragraph.create(null,""),this.schema.nodes.scaledisplay.create(attrs)])}},{key:"create",value:function(attrs,content,marks){return content||(content=this.defaultContent(attrs)),_get(Object.getPrototypeOf(Scale.prototype),"create",this).call(this,attrs,content,marks)}},{key:"attrs",get:function(){return{name:new _model.Attribute,title:new _model.Attribute({"default":""}),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})}}}]),Scale}(_question.Question);(0,_utils.defParser)(Scale,"div",cssd),(0,_utils.defParser)(Scale,"div",csss),Scale.register("command","insert",{label:"Scale",run:function(pm,name,title,startvalue,startlabel,endvalue,endlabel){var _pm$selection=pm.selection,from=_pm$selection.from,node=(_pm$selection.to,_pm$selection.node),attrs={name:name,title:title,startvalue:startvalue,startlabel:startlabel,endvalue:endvalue,endlabel:endlabel};if(node&&node.type==this){pm.tr.setNodeType(from,this,attrs).apply(pm.apply.scroll);var $from=pm.doc.resolve(from);return(0,_question.setChildAttrs)(pm,$from.nodeAfter,from+1,"scaledisplay",attrs)}return(0,_question.insertQuestion)(pm,from,this.create(attrs))},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}},{name:"Title",attr:"title",label:"(optional)",type:"text","default":"",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"title")},options:{required:""}},{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."+cssd+" {\n display: inline-block;\n text-align: center;\n font-size: 80%;\n}\n\n."+csss+" input {\n vertical-align: middle;\n display: inline;\n}\n\n."+csss+" input[readonly] {\n vertical-align: middle;\n border-radius: 4px;\n text-align: right;\n width: 20px;\n height: 20px;\n border: 1px solid #AAA;\n display: inline;\n padding: 2px;\n margin: 4px;\n background: white;\n}\n\n."+csss+" span {\n vertical-align: middle;\n font-weight: normal;\n display: inline;\n}\n\n."+csss+" div {\n display: inline-block;\n padding: 4px;\n}\n\n."+csss+" input[type=range] {\n -webkit-appearance: none;\n border: 1px solid white;\n width: 200px;\n cursor: pointer;\n}\n."+csss+" 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."+csss+" 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."+csss+" input[type=range]:focus {\n outline: none;\n}\n."+csss+" input[type=range]:focus::-webkit-slider-runnable-track {\n background: #ccc;\n}\n\n."+csss+" input[type=range]::-moz-range-track {\n width: 200px;\n height: 5px;\n background: skyblue;\n border: none;\n border-radius: 3px;\n}\n."+csss+" 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."+csss+" input[type=range]:-moz-focusring{\n outline: 1px solid white;\n outline-offset: -1px;\n}\n\n."+csss+" input[type=range]::-ms-track {\n width: 200px;\n height: 5px;\n background: transparent;\n border-color: transparent;\n border-width: 6px 0;\n\n /*remove default tick marks*/\n color: transparent;\n}\n."+csss+" input[type=range]::-ms-fill-lower {\n background: ;\n border-radius: 10px;\n}\n."+csss+" input[type=range]::-ms-fill-upper {\n background: #ddd;\n border-radius: 10px;\n}\n."+csss+" input[type=range]::-ms-thumb {\n border: none;\n height: 16px;\n width: 16px;\n border-radius: 50%;\n background: navy;\n}\n."+csss+" input[type=range]:focus::-ms-fill-lower {\n background: #888;\n}\n."+csss+" input[type=range]:focus::-ms-fill-upper {\n background: #ccc;\n}\n")},{"../../utils":65,"./question":90,"prosemirror/dist/dom":1,"prosemirror/dist/model":34}],92:[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;ir.right-16&&e.clientYtop&&(top=bottom),r.dom.style.top=top+"px",bottom=top+r.h+1})}},{key:"highlightComment",value:function(id){var c=comments[id];if(c){this.clearHighlight(),c.dom.className+=" select",this.highlight=c;var _c$range=c.range,from=_c$range.from,to=_c$range.to;pm.removeRange(c.range),c.range=pm.markRange(from,to,{className:c.getRangeClass(!0)})}}},{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:c.getRangeClass(!1)})}this.highlight=null}}},{key:"getSelectionTop",value:function(){var from=pm.selection.from,r=pm.coordsAtPos(from),rect=pm.content.getBoundingClientRect();return Math.round(r.top-rect.top)}}]),CommentStore}();(0,_dom.insertCSS)('\n.comments {\n display: block;\n margin: 0 auto;\n width: 100%;\n height: 400px;\n}\n\n.comments .peer .ProseMirror-menubar {\n text-align: right;\n}\n\n.comments #editor {\n float: left;\n width: 70%;\n height: 100%;\n}\n\n.comments #comments {\n border: 1px solid #AAA;\n margin-left: 1px;\n padding: 0;\n height: 100%;\n width: 300px;\n display: inline-block;\n overflow-y: 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 border-radius: 6px;\n border: 1px solid #AAA;\n width: 92%;\n font-size: 90%;\n padding: 4px;\n min-height: 30px;\n position: absolute; \n left: 8px;\n}\n\n.comments .comment:after {\n content: \' \';\n height: 0;\n position: absolute;\n width: 0;\n border: 8px solid transparent;\n border-right-color: skyblue;\n left: -16px;\n top: 5px;\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.mode-comment {\n background: skyblue;\n}\n\n\n.mode-comment-select {\n background: dodgerblue;\n color: white;\n}\n\n.mode-delete {\n text-decoration: line-through;\n}\n\n.mode-delete-select {\n text-decoration: line-through;\n background: tomato;\n}\n\n.mode-insert:before {\n content: "^";\n font-width: bold;\n}\n\n.mode-insert-select:before {\n content: "^";\n background: turquoise;\n}\n\n.mode-replace {\n text-decoration: overline;\n}\n\n.mode-replace-select {\n text-decoration: overline;\n background: violet;\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, .approval, .mode {\n display: none;\n}\n\n.show {\n display: block;\n}\n\n.approval, .mode {\n display: block;\n font-size: 85%;\n margin: 4px;\n}\n\n.approval span:first-child:after {\n content: "?";\n display: inline-block;\n font-weight: bold;\n}\n\n')},{"../../utils":65,"prosemirror/dist/dom":1,"prosemirror/dist/model":34,"prosemirror/dist/util/event":53}],96:[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