You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
914 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{646:function(A,B,Q){var g,I,C,E;E=function(A,B){"use strict";function Q(A){return"inputType"in A}function g(A){return"clipboardData"in A}function I(A,B,Q,g){return g?g(A,B,Q):A}function C(A,B,C,E,D,w){var G,M;const i=I(A,{actions:E,content:()=>B.get_content_as_html()},D,w);if(i){if(g(i)){const A=null!=(M=null==(G=i.clipboardData)?void 0:G.getData("text/plain"))?M:"";return C(B.replace_text(A),"paste")}switch(i.inputType){case"clear":return C(B.clear(),"clear");case"deleteContentBackward":return C(B.backspace(),"backspace");case"deleteWordBackward":return C(B.backspace_word(),"backspace_word");case"deleteSoftLineBackward":{const A=document.getSelection();return A&&(A.modify("extend","backward","lineboundary"),document.dispatchEvent(new CustomEvent("selectionchange"))),C(B.delete(),"backspace_line")}case"deleteContentForward":case"deleteByCut":return C(B.delete(),"delete");case"deleteWordForward":return C(B.delete_word(),"delete_word");case"formatBold":return C(B.bold(),"bold");case"formatItalic":return C(B.italic(),"italic");case"formatStrikeThrough":return C(B.strike_through(),"strike_through");case"formatUnderline":return C(B.underline(),"underline");case"formatInlineCode":return C(B.inline_code(),"inline_code");case"historyRedo":return C(B.redo(),"redo");case"historyUndo":return C(B.undo(),"undo");case"insertCodeBlock":return C(B.code_block(),"code_block");case"insertQuote":return C(B.quote(),"quote");case"insertFromPaste":return;case"insertOrderedList":return C(B.ordered_list(),"ordered_list");case"insertLineBreak":case"insertParagraph":return C(B.enter(),"enter");case"insertReplacementText":{const A=D.innerHTML.slice(0,D.innerHTML.length-4);return C(B.set_content_from_html(A),"set_content_from_html",A)}case"insertCompositionText":case"insertFromComposition":case"insertText":if(i.data)return C(B.replace_text(i.data),"replace_text",i.data);break;case"insertUnorderedList":return C(B.unordered_list(),"unordered_list");case"insertLink":if(function(A){return Q(A)&&"insertLink"==A.inputType}(i)){const{text:A,link:Q}=i.data;return C(A?B.set_link_with_text(Q,A):B.set_link(Q),"insertLink")}break;case"removeLinks":return C(B.remove_links(),"remove_links");case"formatIndent":return C(B.indent(),"indent");case"formatOutdent":return C(B.unindent(),"unindent");case"sendMessage":return null;default:return console.error(`Unknown input type: ${i.inputType}`),console.error(A),null}}}function E(A,B,Q,g){A.innerHTML=B+"<br />",function(A,B,Q){const g=document.createRange();let I=D(A,B),C=D(A,Q);if(I.node&&C.node){const A=I.node.compareDocumentPosition(C.node)&Node.DOCUMENT_POSITION_PRECEDING,B=I.node===C.node&&C.offset<I.offset;if((A||B)&&([I,C]=[C,I],!I.node||!C.node))throw new Error;g.setStart(I.node,I.offset),g.setEnd(C.node,C.offset)}else g.selectNodeContents(A),g.collapse();const E=document.getSelection();E&&(E.removeAllRanges(),E.addRange(g))}(A,Q,g)}function D(A,B){var Q,g,I,C;const E="LI"===A.nodeName&&!A.hasChildNodes();if(A.nodeType===Node.TEXT_NODE){const I=o(A)?1:0;return Y(A)?0===B?{node:A,offset:B}:{node:null,offset:B-I}:B<=((null==(Q=A.textContent)?void 0:Q.length)||0)?{node:A,offset:B}:{node:null,offset:B-((null==(g=A.textContent)?void 0:g.length)||0)-I}}if(E)return B<=((null==(I=A.textContent)?void 0:I.length)||0)?{node:A,offset:B}:{node:null,offset:B-((null==(C=A.textContent)?void 0:C.length)||0)};if("BR"===A.nodeName)return 0===B?{node:A,offset:0}:{node:null,offset:B-1};if(function(A){var B;return F.includes(A.nodeName)&&0===(null==(B=A.textContent)?void 0:B.length)}(A)&&0===B)return{node:A,offset:B};for(const Q of A.childNodes){const A=D(Q,B);if(A.node)return{node:A.node,offset:A.offset};B=A.offset}return{node:null,offset:B}}function w(A,B){var Q;const g=1===A.childNodes.length&&"BR"===(null==(Q=A.firstChild)?void 0:Q.nodeName);return!B||g?[0,0]:[B.anchorNode&&i(A,B.anchorNode,B.anchorOffset)||0,B.focusNode&&i(A,B.focusNode,B.focusOffset)||0]}function G(A,B){var Q,g;if(A.nodeType===Node.TEXT_NODE){const B=o(A)?1:0;return(null!=(g=null==(Q=A.textContent)?void 0:
//# sourceMappingURL=0.js.map