@pie-element/extended-text-entry 15.1.1-next.11 → 15.1.2-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configure.js +2 -0
- package/controller.js +1 -0
- package/dist/author/defaults.d.ts +166 -0
- package/dist/author/defaults.js +209 -0
- package/dist/author/index.d.ts +52 -0
- package/dist/author/index.js +74 -0
- package/dist/author/main.d.ts +26 -0
- package/dist/author/main.js +166 -0
- package/dist/browser/author/index.js +495 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/browser-kkT1XVKw.js +210 -0
- package/dist/browser/browser-kkT1XVKw.js.map +1 -0
- package/dist/browser/controller/index.js +184 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +98 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/dist-D8VooYkz.js +49034 -0
- package/dist/browser/dist-D8VooYkz.js.map +1 -0
- package/dist/browser/extended-text-entry.css +2 -0
- package/dist/browser/main-C2oHx_V9.js +714 -0
- package/dist/browser/main-C2oHx_V9.js.map +1 -0
- package/dist/browser/print/index.js +53 -0
- package/dist/browser/print/index.js.map +1 -0
- package/dist/controller/defaults.d.ts +33 -0
- package/dist/controller/defaults.js +104 -0
- package/dist/controller/index.d.ts +59 -0
- package/dist/controller/index.js +72 -0
- package/dist/delivery/annotation/annotation-editor.d.ts +47 -0
- package/dist/delivery/annotation/annotation-editor.js +296 -0
- package/dist/delivery/annotation/annotation-menu.d.ts +25 -0
- package/dist/delivery/annotation/annotation-menu.js +113 -0
- package/dist/delivery/annotation/annotation-utils.d.ts +20 -0
- package/dist/delivery/annotation/annotation-utils.js +65 -0
- package/dist/delivery/annotation/freeform-editor.d.ts +30 -0
- package/dist/delivery/annotation/freeform-editor.js +143 -0
- package/dist/delivery/index.d.ts +23 -0
- package/dist/delivery/index.js +68 -0
- package/dist/delivery/main.d.ts +27 -0
- package/dist/delivery/main.js +134 -0
- package/dist/extended-text-entry.css +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +403 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +57 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +33 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/debounce.js +50 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js +19 -0
- package/dist/print/index.d.ts +15 -0
- package/dist/print/index.js +49 -0
- package/package.json +83 -21
- package/CHANGELOG.json +0 -1282
- package/CHANGELOG.md +0 -2260
- package/LICENSE.md +0 -5
- package/README.md +0 -1
- package/configure/CHANGELOG.json +0 -922
- package/configure/CHANGELOG.md +0 -1949
- package/configure/lib/defaults.js +0 -224
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/index.js +0 -125
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/main.js +0 -247
- package/configure/lib/main.js.map +0 -1
- package/configure/package.json +0 -23
- package/controller/CHANGELOG.json +0 -362
- package/controller/CHANGELOG.md +0 -1179
- package/controller/lib/defaults.js +0 -91
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -101
- package/controller/lib/index.js.map +0 -1
- package/controller/package.json +0 -16
- package/docs/config-schema.json +0 -1782
- package/docs/config-schema.json.md +0 -1333
- package/docs/demo/config.js +0 -7
- package/docs/demo/generate.js +0 -14
- package/docs/demo/index.html +0 -3
- package/docs/demo/session.js +0 -7
- package/docs/pie-schema.json +0 -954
- package/docs/pie-schema.json.md +0 -717
- package/lib/annotation/annotation-editor.js +0 -636
- package/lib/annotation/annotation-editor.js.map +0 -1
- package/lib/annotation/annotation-menu.js +0 -147
- package/lib/annotation/annotation-menu.js.map +0 -1
- package/lib/annotation/annotation-utils.js +0 -205
- package/lib/annotation/annotation-utils.js.map +0 -1
- package/lib/annotation/freeform-editor.js +0 -241
- package/lib/annotation/freeform-editor.js.map +0 -1
- package/lib/index.js +0 -108
- package/lib/index.js.map +0 -1
- package/lib/main.js +0 -205
- package/lib/main.js.map +0 -1
- package/lib/print.js +0 -86
- package/lib/print.js.map +0 -1
- package/module/configure.js +0 -1
- package/module/controller.js +0 -139
- package/module/demo.js +0 -38
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -22
- package/module/print-demo.js +0 -76
- package/module/print.html +0 -18
- package/module/print.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"annotation-editor.js","names":["_react","_interopRequireDefault","require","_styles","_propTypes","_annotationUtils","_freeformEditor","_annotationMenu","_editableHtmlTipTap","_configUi","TextContainer","styled","padding","backgroundColor","border","borderRadius","overflowY","lineHeight","whiteSpace","overflowWrap","margin","userSelect","LabelsContainer","width","Wrapper","position","overflowX","display","CommentContainer","InputContainer","theme","paddingTop","spacing","marginBottom","marginTop","globalStyles","document","getElementById","styleElement","createElement","id","textContent","head","appendChild","AnnotationEditor","React","Component","constructor","props","_defineProperty2","default","textRef","labelsRef","left","offsetLeft","offsetWidth","Array","from","children","forEach","label","spans","getAnnotationElements","dataset","annId","spanOffset","offsetTop","offsetParent","top","scrollTop","style","event","annotations","selectionDetails","state","target","annotationId","selectedElems","labelElem","getLabelElement","annotationIndex","findIndex","annotation","isSideLabel","hasAttribute","zIndex","setState","anchorEl","openedMenu","openedEditor","elem","classList","contains","setProperty","color","removeProperty","length","removeElemsWrapping","clearSelection","selection","window","getSelection","detail","rangeCount","selectedRange","getRangeAt","selectedText","toString","isSelectionInside","commonAncestorContainer","isCollapsed","getRangeDetails","wrapRange","onChange","parentRef","removeChild","splice","handleClose","elems","disabled","type","className","cursor","onclick","handleClick","onmouseover","handleHover","onmouseout","handleCancelHover","firstSpan","innerHTML","freeform","marginLeft","wordBreak","fontSize","fontStyle","fontWeight","webkitUserSelect","mozUserSelect","msUserSelect","start","end","Date","getTime","join","createDOMAnnotation","newAnnotation","text","updatedAnnotation","oldType","oldLabel","updateLabel","createNewAnnotation","push","remove","add","newLabel","span","componentDidMount","domStart","domEnd","getDOMNodes","range","createRange","setStart","node","offset","setEnd","adjustAnnotationsPosition","addEventListener","componentWillUnmount","removeEventListener","render","comment","customKeys","disabledMath","keypadMode","height","maxHeight","onCommentChange","predefinedAnnotations","anchorOffset","topOffset","minHeight","ref","r","onMouseDown","onMouseUp","handleSelection","dangerouslySetInnerHTML","__html","markup","pluginProps","math","controlledKeypadMode","video","audio","textAlign","h3","open","isNewAnnotation","onClose","onDelete","deleteAnnotation","onEdit","editAnnotation","onWrite","addAnnotation","onAnnotate","handleMenuClick","value","onSave","updateAnnotation","onTypeChange","changeAnnotationType","PropTypes","string","array","func","isRequired","number","bool","_default","exports"],"sources":["../../src/annotation/annotation-editor.jsx"],"sourcesContent":["import React from 'react';\nimport { styled } from '@mui/material/styles';\nimport PropTypes from 'prop-types';\n\nimport {\n clearSelection,\n isSideLabel,\n getAnnotationElements,\n getDOMNodes,\n getLabelElement,\n getRangeDetails,\n removeElemsWrapping,\n wrapRange,\n} from './annotation-utils';\nimport FreeformEditor from './freeform-editor';\nimport AnnotationMenu from './annotation-menu';\nimport EditableHtml from '@pie-lib/editable-html-tip-tap';\nimport { InputContainer } from '@pie-lib/config-ui';\n\nconst TextContainer = styled('div')({\n padding: '10px 120px 10px 16px',\n backgroundColor: 'rgba(0, 0, 0, 0.06)',\n border: '1px solid #ccc',\n borderRadius: '4px',\n overflowY: 'scroll',\n lineHeight: '36px',\n whiteSpace: 'pre-wrap',\n overflowWrap: 'break-word',\n '& p': {\n margin: 0,\n },\n '& span[data-latex]': {\n userSelect: 'none',\n '-webkit-user-select': 'none',\n '-moz-user-select': 'none',\n '-ms-user-select': 'none',\n },\n});\n\nconst LabelsContainer = styled('div')({\n width: '230px',\n});\n\nconst Wrapper = styled('div')({\n position: 'relative',\n overflowX: 'hidden',\n display: 'flex',\n});\n\nconst CommentContainer = styled(InputContainer)(({ theme }) => ({\n paddingTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n marginTop: theme.spacing(2),\n width: '100%',\n}));\n\n// Global styles for pseudo-elements that can't be applied inline\nconst globalStyles = `\n .sideAnnotation:before {\n position: absolute;\n right: var(--before-right, 100%);\n top: var(--before-top, 5px);\n border: solid transparent;\n content: \"\";\n height: 0;\n width: 0;\n pointer-events: none;\n border-width: var(--before-border-width, 7px);\n border-right-color: var(--before-border-color, rgb(153, 255, 153));\n }\n`;\n\n// Inject styles if not already injected\nif (!document.getElementById('annotation-editor-styles')) {\n const styleElement = document.createElement('style');\n styleElement.id = 'annotation-editor-styles';\n styleElement.textContent = globalStyles;\n document.head.appendChild(styleElement);\n}\n\nclass AnnotationEditor extends React.Component {\n static propTypes = {\n text: PropTypes.string,\n comment: PropTypes.string,\n annotations: PropTypes.array,\n predefinedAnnotations: PropTypes.array,\n onChange: PropTypes.func.isRequired,\n onCommentChange: PropTypes.func.isRequired,\n width: PropTypes.number,\n height: PropTypes.number,\n maxHeight: PropTypes.string,\n disabled: PropTypes.bool,\n disabledMath: PropTypes.bool,\n customKeys: PropTypes.array,\n keypadMode: PropTypes.string,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n anchorEl: null,\n openedMenu: false,\n openedEditor: false,\n selectedElems: [],\n labelElem: null,\n selectionDetails: null,\n annotation: null,\n annotationIndex: null,\n };\n }\n\n componentDidMount() {\n const { annotations, text } = this.props;\n\n if (text) {\n annotations.forEach((annotation) => {\n const [domStart, domEnd] = getDOMNodes(annotation.start, annotation.end, this.textRef);\n\n if (domStart && domEnd) {\n const range = document.createRange();\n\n range.setStart(domStart.node, domStart.offset);\n range.setEnd(domEnd.node, domEnd.offset);\n\n const spans = wrapRange(range);\n\n this.createDOMAnnotation(spans, annotation);\n }\n });\n }\n\n if (this.textRef) {\n this.adjustAnnotationsPosition();\n this.textRef.addEventListener('scroll', this.adjustAnnotationsPosition);\n }\n }\n\n adjustAnnotationsPosition = () => {\n if (this.textRef && this.labelsRef) {\n const left = this.textRef.offsetLeft + this.textRef.offsetWidth + 8;\n\n Array.from(this.labelsRef.children).forEach((label) => {\n const spans = getAnnotationElements(label.dataset.annId);\n const spanOffset = spans[0].offsetTop ? spans[0].offsetTop : spans[0].offsetParent.offsetTop;\n const top = spanOffset - this.textRef.scrollTop - 6;\n\n label.style.top = `${top}px`;\n label.style.left = `${left}px`;\n });\n }\n };\n\n handleClick = (event) => {\n const { annotations } = this.props;\n const { selectionDetails } = this.state;\n\n if (selectionDetails) {\n // new selection was made inside another annotation and should not update that annotation\n return;\n }\n\n const { id, annId } = event.target.dataset;\n const annotationId = id || annId;\n const selectedElems = getAnnotationElements(annotationId);\n const labelElem = getLabelElement(annotationId);\n const annotationIndex = annotations.findIndex((annotation) => annotation.id === annotationId);\n const isSideLabel = labelElem.hasAttribute('data-freeform');\n\n if (isSideLabel) {\n labelElem.style.zIndex = '10';\n }\n\n this.setState({\n anchorEl: selectedElems[0],\n openedMenu: !!id || (!!annId && !isSideLabel), // true if the annotation or the label was clicked\n openedEditor: !!annId && isSideLabel, // true if the side label was clicked\n selectedElems,\n labelElem,\n annotationIndex,\n annotation: annotations[annotationIndex],\n selectionDetails: null,\n });\n };\n\n handleHover = (event) => {\n const { id, annId } = event.target.dataset;\n const annotationId = id || annId;\n const selectedElems = getAnnotationElements(annotationId);\n const labelElem = getLabelElement(annotationId);\n const isSideLabel = labelElem.hasAttribute('data-freeform');\n\n selectedElems.forEach((elem) => {\n elem.style.zIndex = '20';\n if (elem.classList.contains('positive')) {\n elem.style.backgroundColor = 'rgb(51, 255, 51, 0.7)';\n } else if (elem.classList.contains('negative')) {\n elem.style.backgroundColor = 'rgba(255, 102, 204, 0.55)';\n }\n });\n\n if (isSideLabel) {\n labelElem.style.zIndex = '20';\n if (labelElem.classList.contains('positive')) {\n labelElem.style.backgroundColor = 'rgb(128, 255, 128)';\n labelElem.style.setProperty('--before-border-color', 'rgb(153, 255, 153)');\n } else if (labelElem.classList.contains('negative')) {\n labelElem.style.backgroundColor = 'rgb(255, 179, 230)';\n labelElem.style.setProperty('--before-border-color', 'rgb(255, 179, 230)');\n }\n } else {\n labelElem.style.zIndex = '20';\n if (labelElem.classList.contains('positive')) {\n labelElem.style.color = 'rgb(0, 77, 0)';\n } else if (labelElem.classList.contains('negative')) {\n labelElem.style.color = 'rgb(153, 0, 102)';\n }\n }\n };\n\n handleCancelHover = (event) => {\n const { id, annId } = event.target.dataset;\n const annotationId = id || annId;\n const selectedElems = getAnnotationElements(annotationId);\n const labelElem = getLabelElement(annotationId);\n const isSideLabel = labelElem.hasAttribute('data-freeform');\n\n selectedElems.forEach((elem) => {\n elem.style.zIndex = '';\n if (elem.classList.contains('positive')) {\n elem.style.backgroundColor = 'rgb(51, 255, 51, 0.5)';\n } else if (elem.classList.contains('negative')) {\n elem.style.backgroundColor = 'rgba(255, 102, 204, 0.4)';\n }\n });\n\n if (isSideLabel) {\n labelElem.style.zIndex = '';\n if (labelElem.classList.contains('positive')) {\n labelElem.style.backgroundColor = 'rgb(153, 255, 153)';\n labelElem.style.removeProperty('--before-border-color');\n } else if (labelElem.classList.contains('negative')) {\n labelElem.style.backgroundColor = 'rgb(255, 204, 238)';\n labelElem.style.removeProperty('--before-border-color');\n }\n } else {\n labelElem.style.zIndex = '';\n if (labelElem.classList.contains('positive')) {\n labelElem.style.color = 'rgb(0, 128, 0)';\n } else if (labelElem.classList.contains('negative')) {\n labelElem.style.color = 'rgb(204, 0, 136)';\n }\n }\n };\n\n handleClose = (event) => {\n const { selectedElems, labelElem } = this.state;\n\n if (selectedElems.length && !selectedElems[0].hasAttribute('data-id')) {\n removeElemsWrapping(selectedElems, this.textRef);\n }\n\n if (labelElem) {\n labelElem.style.zIndex = '';\n }\n\n this.setState({\n anchorEl: null,\n openedMenu: false,\n openedEditor: false,\n selectedElems: [],\n labelElem: null,\n selectionDetails: null,\n annotationIndex: null,\n annotation: null,\n });\n\n clearSelection();\n };\n\n handleSelection = (event) => {\n const selection = window.getSelection();\n\n // prevent unwanted selections\n if (event.detail > 2) {\n clearSelection();\n return;\n }\n\n if (selection && selection.rangeCount > 0) {\n const selectedRange = selection.getRangeAt(0);\n const selectedText = selectedRange.toString();\n const isSelectionInside = this.textRef.contains(selectedRange.commonAncestorContainer);\n\n if (!selection.isCollapsed && selectedText !== '' && isSelectionInside) {\n const selectionDetails = getRangeDetails(selectedRange, this.textRef);\n const selectedElems = wrapRange(selectedRange);\n\n this.setState({\n anchorEl: selectedElems[0],\n openedMenu: true,\n selectedElems,\n selectionDetails,\n });\n }\n }\n };\n\n deleteAnnotation = () => {\n const { annotations, onChange } = this.props;\n const { selectedElems, labelElem, annotationIndex, annotation } = this.state;\n const parentRef = isSideLabel(annotation.label) ? this.labelsRef : selectedElems[0];\n\n parentRef.removeChild(labelElem);\n removeElemsWrapping(selectedElems, this.textRef);\n annotations.splice(annotationIndex, 1);\n\n onChange(annotations);\n this.handleClose();\n };\n\n createDOMAnnotation = (elems, annotation) => {\n const { disabled } = this.props;\n const { id, label, type } = annotation;\n\n (elems || []).forEach((elem) => {\n elem.dataset.id = id;\n elem.className = `annotation ${type}`;\n // Apply annotation styles directly\n elem.style.position = 'relative';\n elem.style.cursor = 'pointer';\n if (type === 'positive') {\n elem.style.backgroundColor = 'rgb(51, 255, 51, 0.5)';\n } else if (type === 'negative') {\n elem.style.backgroundColor = 'rgba(255, 102, 204, 0.4)';\n }\n elem.onclick = !disabled && this.handleClick;\n elem.onmouseover = this.handleHover;\n elem.onmouseout = this.handleCancelHover;\n });\n\n const firstSpan = (elems && elems[0]) || {};\n const labelElem = document.createElement('SPAN');\n\n labelElem.dataset.annId = id;\n labelElem.innerHTML = label;\n labelElem.onclick = !disabled && this.handleClick;\n labelElem.onmouseover = this.handleHover;\n labelElem.onmouseout = this.handleCancelHover;\n\n if (isSideLabel(label)) {\n const spanOffset = firstSpan.offsetTop ? firstSpan.offsetTop : firstSpan.offsetParent.offsetTop;\n const top = spanOffset - this.textRef.scrollTop;\n const left = this.textRef.offsetLeft + this.textRef.offsetWidth + 8;\n\n labelElem.dataset.freeform = true;\n labelElem.className = `sideAnnotation ${type}`;\n \n // Apply side annotation styles directly\n labelElem.style.position = 'absolute';\n labelElem.style.padding = '4px';\n labelElem.style.borderRadius = '4px';\n labelElem.style.marginLeft = '8px';\n labelElem.style.width = '180px';\n labelElem.style.whiteSpace = 'pre-wrap';\n labelElem.style.wordBreak = 'break-word';\n labelElem.style.border = '2px solid #ffffff';\n labelElem.style.fontSize = '14px';\n labelElem.style.fontStyle = 'normal';\n labelElem.style.fontWeight = 'normal';\n labelElem.style.top = `${top}px`;\n labelElem.style.left = `${left}px`;\n \n if (type === 'negative') {\n labelElem.style.backgroundColor = 'rgb(255, 204, 238)';\n } else if (type === 'positive') {\n labelElem.style.backgroundColor = 'rgb(153, 255, 153)';\n }\n \n // Add pseudo-element styles via CSS\n labelElem.style.setProperty('--before-border-width', '7px');\n labelElem.style.setProperty('--before-top', '5px');\n labelElem.style.setProperty('--before-right', '100%');\n if (type === 'negative') {\n labelElem.style.setProperty('--before-border-color', 'rgb(255, 204, 238)');\n } else if (type === 'positive') {\n labelElem.style.setProperty('--before-border-color', 'rgb(153, 255, 153)');\n }\n\n this.labelsRef.appendChild(labelElem);\n } else {\n labelElem.className = `annotationLabel ${type}`;\n \n // Apply annotation label styles directly\n labelElem.style.backgroundColor = 'rgb(242, 242, 242)';\n labelElem.style.padding = '2px';\n labelElem.style.position = 'absolute';\n labelElem.style.userSelect = 'none';\n labelElem.style.whiteSpace = 'nowrap';\n labelElem.style.top = '-10px';\n labelElem.style.left = '-2px';\n labelElem.style.fontSize = '12px';\n labelElem.style.fontStyle = 'normal';\n labelElem.style.fontWeight = 'normal';\n labelElem.style.lineHeight = '6px';\n labelElem.style.webkitUserSelect = 'none';\n labelElem.style.mozUserSelect = 'none';\n labelElem.style.msUserSelect = 'none';\n \n if (type === 'positive') {\n labelElem.style.color = 'rgb(0, 128, 0)';\n } else if (type === 'negative') {\n labelElem.style.color = 'rgb(204, 0, 136)';\n }\n \n firstSpan.appendChild(labelElem);\n }\n };\n\n createNewAnnotation = (label, type) => {\n const { selectedElems, selectionDetails } = this.state;\n const annotation = {\n id: [selectionDetails.start, selectionDetails.end, new Date().getTime()].join('-'),\n label,\n type,\n ...selectionDetails,\n };\n\n this.createDOMAnnotation(selectedElems, annotation);\n\n return annotation;\n };\n\n handleMenuClick = (newAnnotation) => {\n const { annotations, onChange } = this.props;\n const { annotation, annotationIndex } = this.state;\n const { type, text: label } = newAnnotation;\n\n if (annotation) {\n const updatedAnnotation = { ...annotation, label, type };\n const { type: oldType, label: oldLabel } = annotation;\n\n this.updateLabel(oldLabel, updatedAnnotation, type !== oldType && oldType);\n annotations.splice(annotationIndex, 1, updatedAnnotation);\n } else {\n const newAnnotation = this.createNewAnnotation(label, type);\n\n annotations.push(newAnnotation);\n }\n\n onChange(annotations);\n this.handleClose();\n };\n\n editAnnotation = () => {\n this.setState({\n openedMenu: false,\n openedEditor: true,\n });\n };\n\n addAnnotation = (type) => {\n const { annotations, onChange } = this.props;\n const annotation = this.createNewAnnotation('', type);\n const labelElem = getLabelElement(annotation.id);\n\n annotations.push(annotation);\n\n this.setState({\n openedMenu: false,\n openedEditor: true,\n annotationIndex: annotations.length - 1,\n annotation,\n labelElem,\n });\n\n onChange(annotations);\n };\n\n updateLabel = (oldLabel, annotation, oldType) => {\n const { selectedElems, labelElem } = this.state;\n const { label, type } = annotation;\n\n if ((isSideLabel(label) && isSideLabel(oldLabel)) || (!isSideLabel(label) && !isSideLabel(oldLabel))) {\n labelElem.innerHTML = label;\n\n if (oldType) {\n labelElem.classList.remove(oldType);\n labelElem.classList.add(type);\n\n selectedElems.forEach((elem) => {\n elem.classList.remove(oldType);\n elem.classList.add(type);\n });\n }\n } else if (isSideLabel(label) && !isSideLabel(oldLabel)) {\n selectedElems[0].removeChild(labelElem);\n this.createDOMAnnotation(selectedElems, annotation);\n } else if (!isSideLabel(label) && isSideLabel(oldLabel)) {\n this.labelsRef.removeChild(labelElem);\n this.createDOMAnnotation(selectedElems, annotation);\n }\n };\n\n changeAnnotationType = (newLabel) => {\n const { annotations, onChange } = this.props;\n const { annotationIndex, selectedElems } = this.state;\n const { type: oldType, label: oldLabel } = annotations[annotationIndex];\n const type = oldType === 'positive' ? 'negative' : 'positive';\n const updatedAnnotation = { ...annotations[annotationIndex], type, label: newLabel };\n\n selectedElems.forEach((span) => {\n span.classList.remove(oldType);\n span.classList.add(type);\n });\n\n this.updateLabel(oldLabel, updatedAnnotation, oldType);\n annotations.splice(annotationIndex, 1, updatedAnnotation);\n\n onChange(annotations);\n this.handleClose();\n };\n\n updateAnnotation = (oldLabel, newLabel) => {\n const { annotations, onChange } = this.props;\n const { annotationIndex } = this.state;\n const updatedAnnotation = { ...annotations[annotationIndex], label: newLabel };\n\n this.updateLabel(oldLabel, updatedAnnotation);\n annotations.splice(annotationIndex, 1, updatedAnnotation);\n\n onChange(annotations);\n };\n\n componentWillUnmount() {\n this.textRef.removeEventListener('scroll', this.adjustAnnotationsPosition);\n }\n\n render() {\n const {\n comment,\n customKeys,\n disabled,\n disabledMath,\n keypadMode,\n height,\n width,\n maxHeight,\n onCommentChange,\n predefinedAnnotations,\n text,\n } = this.props;\n const { anchorEl, annotation, openedMenu, openedEditor, selectionDetails } = this.state;\n\n const anchorOffset = anchorEl && (anchorEl.offsetTop ? anchorEl.offsetTop : anchorEl.offsetParent.offsetTop);\n const topOffset = this.textRef && anchorOffset ? anchorOffset - this.textRef.scrollTop - 8 : 0;\n\n return (\n <div>\n <Wrapper>\n <TextContainer\n style={{ width: width - 34, minHeight: height, maxHeight: maxHeight }}\n ref={(r) => (this.textRef = r)}\n onMouseDown={!disabled ? clearSelection : () => {}}\n onMouseUp={!disabled ? this.handleSelection : () => {}}\n dangerouslySetInnerHTML={{ __html: text }}\n />\n <LabelsContainer ref={(r) => (this.labelsRef = r)} />\n </Wrapper>\n\n <CommentContainer label={'Comment'}>\n <EditableHtml\n className=\"prompt\"\n markup={comment || ''}\n onChange={onCommentChange}\n width={width && (width + 104).toString()}\n disabled={disabled}\n pluginProps={{\n math: {\n disabled: disabledMath,\n customKeys: customKeys,\n keypadMode: keypadMode,\n controlledKeypadMode: false,\n },\n video: {\n disabled: true,\n },\n audio: {\n disabled: true,\n },\n textAlign: {\n disabled: true,\n },\n h3: {\n disabled: true,\n },\n }}\n />\n </CommentContainer>\n\n <AnnotationMenu\n anchorEl={anchorEl}\n open={openedMenu && !disabled}\n annotations={predefinedAnnotations}\n isNewAnnotation={!!selectionDetails}\n onClose={this.handleClose}\n onDelete={this.deleteAnnotation}\n onEdit={this.editAnnotation}\n onWrite={this.addAnnotation}\n onAnnotate={this.handleMenuClick}\n />\n\n <FreeformEditor\n anchorEl={this.textRef}\n open={openedEditor && !disabled}\n offset={topOffset}\n value={(annotation && annotation.label) || ''}\n type={annotation && annotation.type}\n onClose={this.handleClose}\n onDelete={this.deleteAnnotation}\n onSave={this.updateAnnotation}\n onTypeChange={this.changeAnnotationType}\n />\n </div>\n );\n }\n}\n\nexport default AnnotationEditor;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,gBAAA,GAAAH,OAAA;AAUA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,eAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,mBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAEA,MAAMQ,aAAa,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC;EAClCC,OAAO,EAAE,sBAAsB;EAC/BC,eAAe,EAAE,qBAAqB;EACtCC,MAAM,EAAE,gBAAgB;EACxBC,YAAY,EAAE,KAAK;EACnBC,SAAS,EAAE,QAAQ;EACnBC,UAAU,EAAE,MAAM;EAClBC,UAAU,EAAE,UAAU;EACtBC,YAAY,EAAE,YAAY;EAC1B,KAAK,EAAE;IACLC,MAAM,EAAE;EACV,CAAC;EACD,oBAAoB,EAAE;IACpBC,UAAU,EAAE,MAAM;IAClB,qBAAqB,EAAE,MAAM;IAC7B,kBAAkB,EAAE,MAAM;IAC1B,iBAAiB,EAAE;EACrB;AACF,CAAC,CAAC;AAEF,MAAMC,eAAe,GAAG,IAAAX,cAAM,EAAC,KAAK,CAAC,CAAC;EACpCY,KAAK,EAAE;AACT,CAAC,CAAC;AAEF,MAAMC,OAAO,GAAG,IAAAb,cAAM,EAAC,KAAK,CAAC,CAAC;EAC5Bc,QAAQ,EAAE,UAAU;EACpBC,SAAS,EAAE,QAAQ;EACnBC,OAAO,EAAE;AACX,CAAC,CAAC;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|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
var _styles = require("@mui/material/styles");
|
|
12
|
-
var _material = require("@mui/material");
|
|
13
|
-
const StyledPopover = (0, _styles.styled)(_material.Popover)({
|
|
14
|
-
'& .MuiPaper-root': {
|
|
15
|
-
overflowX: 'unset',
|
|
16
|
-
overflowY: 'unset',
|
|
17
|
-
marginTop: '-16px',
|
|
18
|
-
'&::after': {
|
|
19
|
-
position: 'absolute',
|
|
20
|
-
left: 'calc(50% - 7px)',
|
|
21
|
-
border: 'solid transparent',
|
|
22
|
-
content: '""',
|
|
23
|
-
height: 0,
|
|
24
|
-
width: 0,
|
|
25
|
-
pointerEvents: 'none',
|
|
26
|
-
borderWidth: '7px',
|
|
27
|
-
borderTopColor: 'black'
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
const MainWrapper = (0, _styles.styled)('div')(({
|
|
32
|
-
theme
|
|
33
|
-
}) => ({
|
|
34
|
-
width: '300px',
|
|
35
|
-
overflow: 'hidden',
|
|
36
|
-
borderRadius: '4px',
|
|
37
|
-
backgroundColor: theme.palette.common.white,
|
|
38
|
-
border: `2px solid ${theme.palette.grey[100]}`
|
|
39
|
-
}));
|
|
40
|
-
const AnnotationsWrapper = (0, _styles.styled)('div')({
|
|
41
|
-
display: 'flex',
|
|
42
|
-
flexWrap: 'wrap'
|
|
43
|
-
});
|
|
44
|
-
const ControlsWrapper = (0, _styles.styled)('div')(({
|
|
45
|
-
theme
|
|
46
|
-
}) => ({
|
|
47
|
-
display: 'flex',
|
|
48
|
-
flexWrap: 'wrap',
|
|
49
|
-
borderTop: `2px solid ${theme.palette.grey[100]}`
|
|
50
|
-
}));
|
|
51
|
-
const Button = (0, _styles.styled)('div')(({
|
|
52
|
-
theme,
|
|
53
|
-
variant
|
|
54
|
-
}) => ({
|
|
55
|
-
width: '22%',
|
|
56
|
-
textAlign: 'center',
|
|
57
|
-
padding: '4px',
|
|
58
|
-
cursor: 'pointer',
|
|
59
|
-
borderBottom: `1px solid ${theme.palette.grey[100]}`,
|
|
60
|
-
'&:not(:nth-child(4n))': {
|
|
61
|
-
borderRight: `1px solid ${theme.palette.grey[100]}`
|
|
62
|
-
},
|
|
63
|
-
'&:nth-child(4n)': {
|
|
64
|
-
flexGrow: 1
|
|
65
|
-
},
|
|
66
|
-
'&:hover': {
|
|
67
|
-
backgroundColor: theme.palette.grey[100]
|
|
68
|
-
},
|
|
69
|
-
...(variant === 'positive' && {
|
|
70
|
-
backgroundColor: 'rgb(153, 255, 153) !important',
|
|
71
|
-
'&:hover': {
|
|
72
|
-
filter: 'brightness(85%)'
|
|
73
|
-
}
|
|
74
|
-
}),
|
|
75
|
-
...(variant === 'negative' && {
|
|
76
|
-
backgroundColor: 'rgb(255, 204, 238) !important',
|
|
77
|
-
'&:hover': {
|
|
78
|
-
filter: 'brightness(85%)'
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
}));
|
|
82
|
-
class AnnotationMenu extends _react.default.Component {
|
|
83
|
-
render() {
|
|
84
|
-
const {
|
|
85
|
-
anchorEl,
|
|
86
|
-
annotations,
|
|
87
|
-
isNewAnnotation,
|
|
88
|
-
onAnnotate,
|
|
89
|
-
onClose,
|
|
90
|
-
onEdit,
|
|
91
|
-
onDelete,
|
|
92
|
-
onWrite,
|
|
93
|
-
open
|
|
94
|
-
} = this.props;
|
|
95
|
-
return /*#__PURE__*/_react.default.createElement(StyledPopover, {
|
|
96
|
-
anchorEl: anchorEl,
|
|
97
|
-
open: open,
|
|
98
|
-
onClose: onClose,
|
|
99
|
-
elevation: 5,
|
|
100
|
-
transitionDuration: {
|
|
101
|
-
enter: 225,
|
|
102
|
-
exit: 195
|
|
103
|
-
},
|
|
104
|
-
anchorOrigin: {
|
|
105
|
-
vertical: 'top',
|
|
106
|
-
horizontal: 'center'
|
|
107
|
-
},
|
|
108
|
-
transformOrigin: {
|
|
109
|
-
vertical: 'bottom',
|
|
110
|
-
horizontal: 'center'
|
|
111
|
-
}
|
|
112
|
-
}, /*#__PURE__*/_react.default.createElement(MainWrapper, null, /*#__PURE__*/_react.default.createElement(AnnotationsWrapper, null, annotations.map((annotation, index) => /*#__PURE__*/_react.default.createElement(Button, {
|
|
113
|
-
key: `annotation-${index}`,
|
|
114
|
-
variant: annotation.type,
|
|
115
|
-
onClick: () => onAnnotate(annotation)
|
|
116
|
-
}, annotation.label))), /*#__PURE__*/_react.default.createElement(ControlsWrapper, null, /*#__PURE__*/_react.default.createElement(Button, {
|
|
117
|
-
onClick: onClose
|
|
118
|
-
}, "Cancel"), /*#__PURE__*/_react.default.createElement(Button, {
|
|
119
|
-
style: {
|
|
120
|
-
pointerEvents: 'none'
|
|
121
|
-
}
|
|
122
|
-
}), isNewAnnotation ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Button, {
|
|
123
|
-
variant: "positive",
|
|
124
|
-
onClick: () => onWrite('positive')
|
|
125
|
-
}, "Write"), /*#__PURE__*/_react.default.createElement(Button, {
|
|
126
|
-
variant: "negative",
|
|
127
|
-
onClick: () => onWrite('negative')
|
|
128
|
-
}, "Write")) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Button, {
|
|
129
|
-
onClick: onDelete
|
|
130
|
-
}, "Delete"), /*#__PURE__*/_react.default.createElement(Button, {
|
|
131
|
-
onClick: onEdit
|
|
132
|
-
}, "Edit")))));
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
(0, _defineProperty2.default)(AnnotationMenu, "propTypes", {
|
|
136
|
-
anchorEl: _propTypes.default.object,
|
|
137
|
-
open: _propTypes.default.bool,
|
|
138
|
-
annotations: _propTypes.default.array,
|
|
139
|
-
isNewAnnotation: _propTypes.default.bool,
|
|
140
|
-
onClose: _propTypes.default.func,
|
|
141
|
-
onDelete: _propTypes.default.func,
|
|
142
|
-
onEdit: _propTypes.default.func,
|
|
143
|
-
onWrite: _propTypes.default.func,
|
|
144
|
-
onAnnotate: _propTypes.default.func
|
|
145
|
-
});
|
|
146
|
-
var _default = exports.default = AnnotationMenu;
|
|
147
|
-
//# sourceMappingURL=annotation-menu.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"annotation-menu.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_material","StyledPopover","styled","Popover","overflowX","overflowY","marginTop","position","left","border","content","height","width","pointerEvents","borderWidth","borderTopColor","MainWrapper","theme","overflow","borderRadius","backgroundColor","palette","common","white","grey","AnnotationsWrapper","display","flexWrap","ControlsWrapper","borderTop","Button","variant","textAlign","padding","cursor","borderBottom","borderRight","flexGrow","filter","AnnotationMenu","React","Component","render","anchorEl","annotations","isNewAnnotation","onAnnotate","onClose","onEdit","onDelete","onWrite","open","props","default","createElement","elevation","transitionDuration","enter","exit","anchorOrigin","vertical","horizontal","transformOrigin","map","annotation","index","key","type","onClick","label","style","Fragment","_defineProperty2","PropTypes","object","bool","array","func","_default","exports"],"sources":["../../src/annotation/annotation-menu.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { Popover } from '@mui/material';\n\nconst StyledPopover = styled(Popover)({\n '& .MuiPaper-root': {\n overflowX: 'unset',\n overflowY: 'unset',\n marginTop: '-16px',\n '&::after': {\n position: 'absolute',\n left: 'calc(50% - 7px)',\n border: 'solid transparent',\n content: '\"\"',\n height: 0,\n width: 0,\n pointerEvents: 'none',\n borderWidth: '7px',\n borderTopColor: 'black',\n },\n },\n});\n\nconst MainWrapper = styled('div')(({ theme }) => ({\n width: '300px',\n overflow: 'hidden',\n borderRadius: '4px',\n backgroundColor: theme.palette.common.white,\n border: `2px solid ${theme.palette.grey[100]}`,\n}));\n\nconst AnnotationsWrapper = styled('div')({\n display: 'flex',\n flexWrap: 'wrap',\n});\n\nconst ControlsWrapper = styled('div')(({ theme }) => ({\n display: 'flex',\n flexWrap: 'wrap',\n borderTop: `2px solid ${theme.palette.grey[100]}`,\n}));\n\nconst Button = styled('div')(({ theme, variant }) => ({\n width: '22%',\n textAlign: 'center',\n padding: '4px',\n cursor: 'pointer',\n borderBottom: `1px solid ${theme.palette.grey[100]}`,\n '&:not(:nth-child(4n))': {\n borderRight: `1px solid ${theme.palette.grey[100]}`,\n },\n '&:nth-child(4n)': {\n flexGrow: 1,\n },\n '&:hover': {\n backgroundColor: theme.palette.grey[100],\n },\n ...(variant === 'positive' && {\n backgroundColor: 'rgb(153, 255, 153) !important',\n '&:hover': {\n filter: 'brightness(85%)',\n },\n }),\n ...(variant === 'negative' && {\n backgroundColor: 'rgb(255, 204, 238) !important',\n '&:hover': {\n filter: 'brightness(85%)',\n },\n }),\n}));\n\nclass AnnotationMenu extends React.Component {\n static propTypes = {\n anchorEl: PropTypes.object,\n open: PropTypes.bool,\n annotations: PropTypes.array,\n isNewAnnotation: PropTypes.bool,\n onClose: PropTypes.func,\n onDelete: PropTypes.func,\n onEdit: PropTypes.func,\n onWrite: PropTypes.func,\n onAnnotate: PropTypes.func,\n };\n\n render() {\n const { anchorEl, annotations, isNewAnnotation, onAnnotate, onClose, onEdit, onDelete, onWrite, open } =\n this.props;\n\n return (\n <StyledPopover\n anchorEl={anchorEl}\n open={open}\n onClose={onClose}\n elevation={5}\n transitionDuration={{ enter: 225, exit: 195 }}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'center',\n }}\n transformOrigin={{\n vertical: 'bottom',\n horizontal: 'center',\n }}\n >\n <MainWrapper>\n <AnnotationsWrapper>\n {annotations.map((annotation, index) => (\n <Button\n key={`annotation-${index}`}\n variant={annotation.type}\n onClick={() => onAnnotate(annotation)}\n >\n {annotation.label}\n </Button>\n ))}\n </AnnotationsWrapper>\n <ControlsWrapper>\n <Button onClick={onClose}>\n Cancel\n </Button>\n <Button style={{ pointerEvents: 'none' }} />\n {isNewAnnotation ? (\n <React.Fragment>\n <Button variant=\"positive\" onClick={() => onWrite('positive')}>\n Write\n </Button>\n <Button variant=\"negative\" onClick={() => onWrite('negative')}>\n Write\n </Button>\n </React.Fragment>\n ) : (\n <React.Fragment>\n <Button onClick={onDelete}>\n Delete\n </Button>\n <Button onClick={onEdit}>\n Edit\n </Button>\n </React.Fragment>\n )}\n </ControlsWrapper>\n </MainWrapper>\n </StyledPopover>\n );\n }\n}\n\nexport default AnnotationMenu;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEA,MAAMI,aAAa,GAAG,IAAAC,cAAM,EAACC,iBAAO,CAAC,CAAC;EACpC,kBAAkB,EAAE;IAClBC,SAAS,EAAE,OAAO;IAClBC,SAAS,EAAE,OAAO;IAClBC,SAAS,EAAE,OAAO;IAClB,UAAU,EAAE;MACVC,QAAQ,EAAE,UAAU;MACpBC,IAAI,EAAE,iBAAiB;MACvBC,MAAM,EAAE,mBAAmB;MAC3BC,OAAO,EAAE,IAAI;MACbC,MAAM,EAAE,CAAC;MACTC,KAAK,EAAE,CAAC;MACRC,aAAa,EAAE,MAAM;MACrBC,WAAW,EAAE,KAAK;MAClBC,cAAc,EAAE;IAClB;EACF;AACF,CAAC,CAAC;AAEF,MAAMC,WAAW,GAAG,IAAAd,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEe;AAAM,CAAC,MAAM;EAChDL,KAA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AS,CAACE,IAAI;EAC/B5B,OAAO,EAAE0B,kBAAS,CAACI,IAAI;EACvB5B,QAAQ,EAAEwB,kBAAS,CAACI,IAAI;EACxB7B,MAAM,EAAEyB,kBAAS,CAACI,IAAI;EACtB3B,OAAO,EAAEuB,kBAAS,CAACI,IAAI;EACvB/B,UAAU,EAAE2B,kBAAS,CAACI;AACxB,CAAC;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAA1B,OAAA,GAiEYd,cAAc","ignoreList":[]}
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.wrapRange = exports.removeElemsWrapping = exports.isSideLabel = exports.getRangeDetails = exports.getLabelElement = exports.getDOMNodes = exports.getAnnotationElements = exports.clearSelection = void 0;
|
|
7
|
-
// returns DOM Nodes before the stopOffset
|
|
8
|
-
const getAllTextNodesBeforePosition = (node, stopOffset, nodeArray) => {
|
|
9
|
-
const nodes = nodeArray ? nodeArray : [];
|
|
10
|
-
const offset = nodes.reduce((acc, node) => acc + node.textContent.length, 0);
|
|
11
|
-
let keepWalking = true;
|
|
12
|
-
if (offset > stopOffset) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
if (node) {
|
|
16
|
-
// 3 = HTML DOM node value for text nodes
|
|
17
|
-
if (node.nodeType === 3 && node.parentNode && !node.parentNode.hasAttribute('data-ann-id')) {
|
|
18
|
-
nodes.push(node);
|
|
19
|
-
}
|
|
20
|
-
node = node.firstChild;
|
|
21
|
-
}
|
|
22
|
-
while (node && keepWalking) {
|
|
23
|
-
keepWalking = getAllTextNodesBeforePosition(node, stopOffset, nodes);
|
|
24
|
-
node = node.nextSibling;
|
|
25
|
-
}
|
|
26
|
-
return nodes;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// returns DOM Nodes that overlap the start or end position
|
|
30
|
-
const getDOMNodes = (startOffset, endOffset, rootNode) => {
|
|
31
|
-
const textNodesToEnd = getAllTextNodesBeforePosition(rootNode, endOffset);
|
|
32
|
-
const domNodes = [];
|
|
33
|
-
let start = 0;
|
|
34
|
-
textNodesToEnd.forEach(node => {
|
|
35
|
-
const end = start + node.textContent.length;
|
|
36
|
-
[startOffset, endOffset].forEach(offset => {
|
|
37
|
-
if (start <= offset && offset < end) {
|
|
38
|
-
domNodes.push({
|
|
39
|
-
node,
|
|
40
|
-
offset: offset - start
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
start = end;
|
|
45
|
-
});
|
|
46
|
-
return domNodes;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// returns [ textNodes, text ]
|
|
50
|
-
// textNodes = DOM Text Nodes between start range and end range node
|
|
51
|
-
// text = plain text in range
|
|
52
|
-
exports.getDOMNodes = getDOMNodes;
|
|
53
|
-
const getTextNodesBetween = range => {
|
|
54
|
-
const {
|
|
55
|
-
commonAncestorContainer: rootNode,
|
|
56
|
-
startContainer: startNode,
|
|
57
|
-
endContainer: endNode,
|
|
58
|
-
startOffset,
|
|
59
|
-
endOffset
|
|
60
|
-
} = range;
|
|
61
|
-
const textNodes = [];
|
|
62
|
-
let pastStartNode = false;
|
|
63
|
-
let reachedEndNode = false;
|
|
64
|
-
let text = '';
|
|
65
|
-
const getTextNodes = node => {
|
|
66
|
-
const {
|
|
67
|
-
nodeValue: value,
|
|
68
|
-
childNodes
|
|
69
|
-
} = node;
|
|
70
|
-
if (node === startNode && node === endNode) {
|
|
71
|
-
if (value) {
|
|
72
|
-
text += value.substring(startOffset, endOffset);
|
|
73
|
-
}
|
|
74
|
-
pastStartNode = reachedEndNode = true;
|
|
75
|
-
} else if (node === startNode) {
|
|
76
|
-
if (value) {
|
|
77
|
-
text += value.substring(startOffset);
|
|
78
|
-
}
|
|
79
|
-
pastStartNode = true;
|
|
80
|
-
} else if (node === endNode) {
|
|
81
|
-
if (value) {
|
|
82
|
-
text += value.substring(0, endOffset);
|
|
83
|
-
}
|
|
84
|
-
reachedEndNode = true;
|
|
85
|
-
} else if (node && node.nodeType === 3 && node.parentNode && !node.parentNode.hasAttribute('data-ann-id')) {
|
|
86
|
-
// 3 = HTML DOM node value for text nodes
|
|
87
|
-
if (value && pastStartNode && !reachedEndNode) {
|
|
88
|
-
text += value;
|
|
89
|
-
textNodes.push(node);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
childNodes.forEach(childNode => {
|
|
93
|
-
if (!reachedEndNode) {
|
|
94
|
-
getTextNodes(childNode);
|
|
95
|
-
} else {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
getTextNodes(rootNode);
|
|
101
|
-
return [textNodes, text];
|
|
102
|
-
};
|
|
103
|
-
const surroundContent = range => {
|
|
104
|
-
const wrapper = document.createElement('SPAN');
|
|
105
|
-
range.surroundContents(wrapper);
|
|
106
|
-
return wrapper;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
// wrap each DOM Text Node in range into a span
|
|
110
|
-
const wrapRange = range => {
|
|
111
|
-
if (range.startContainer === range.endContainer) {
|
|
112
|
-
return [surroundContent(range)];
|
|
113
|
-
}
|
|
114
|
-
const [nodesBetween] = getTextNodesBetween(range);
|
|
115
|
-
|
|
116
|
-
// wrap the start node
|
|
117
|
-
const startRange = document.createRange();
|
|
118
|
-
startRange.selectNodeContents(range.startContainer);
|
|
119
|
-
startRange.setStart(range.startContainer, range.startOffset);
|
|
120
|
-
const startWrapper = surroundContent(startRange);
|
|
121
|
-
|
|
122
|
-
// wrap the end node
|
|
123
|
-
const endRange = document.createRange();
|
|
124
|
-
endRange.selectNode(range.endContainer);
|
|
125
|
-
endRange.setEnd(range.endContainer, range.endOffset);
|
|
126
|
-
const endWrapper = surroundContent(endRange);
|
|
127
|
-
|
|
128
|
-
// wrap the nodes between start and end nodes, if any
|
|
129
|
-
const centerWrappers = nodesBetween.map(node => {
|
|
130
|
-
const wrapper = document.createElement('SPAN');
|
|
131
|
-
node.parentNode.insertBefore(wrapper, node);
|
|
132
|
-
wrapper.appendChild(node);
|
|
133
|
-
return wrapper;
|
|
134
|
-
});
|
|
135
|
-
return [startWrapper, ...centerWrappers, endWrapper];
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// returns text in range with start and end position in rootNode
|
|
139
|
-
exports.wrapRange = wrapRange;
|
|
140
|
-
const getRangeDetails = (range, rootNode) => {
|
|
141
|
-
const rangeBefore = document.createRange();
|
|
142
|
-
rangeBefore.setStart(rootNode, 0);
|
|
143
|
-
rangeBefore.setEnd(range.startContainer, range.startOffset);
|
|
144
|
-
const [, text] = getTextNodesBetween(rangeBefore);
|
|
145
|
-
const [, textSelected] = getTextNodesBetween(range);
|
|
146
|
-
const start = text.length;
|
|
147
|
-
const end = start + textSelected.length;
|
|
148
|
-
return {
|
|
149
|
-
quote: textSelected,
|
|
150
|
-
start,
|
|
151
|
-
end
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
// removes the annotation spans without changing the content inside
|
|
156
|
-
exports.getRangeDetails = getRangeDetails;
|
|
157
|
-
const removeElemsWrapping = (elems, container) => {
|
|
158
|
-
(elems || []).forEach(elem => {
|
|
159
|
-
const parent = elem.parentNode;
|
|
160
|
-
const childNodes = elem.childNodes;
|
|
161
|
-
const childNodesLength = childNodes.length;
|
|
162
|
-
if (childNodesLength > 0) {
|
|
163
|
-
for (let i = 0; i < childNodesLength; i++) {
|
|
164
|
-
parent.insertBefore(childNodes[0], elem);
|
|
165
|
-
}
|
|
166
|
-
} else {
|
|
167
|
-
parent.insertBefore(document.createTextNode(elem.textContent), elem);
|
|
168
|
-
}
|
|
169
|
-
parent.removeChild(elem);
|
|
170
|
-
});
|
|
171
|
-
container.normalize();
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
// also used in select-text
|
|
175
|
-
exports.removeElemsWrapping = removeElemsWrapping;
|
|
176
|
-
const clearSelection = () => {
|
|
177
|
-
if (document.getSelection) {
|
|
178
|
-
// for all new browsers (IE9+, Chrome, Firefox)
|
|
179
|
-
document.getSelection().removeAllRanges();
|
|
180
|
-
document.getSelection().addRange(document.createRange());
|
|
181
|
-
} else if (window.getSelection) {
|
|
182
|
-
// equals with the document.getSelection (MSDN info)
|
|
183
|
-
if (window.getSelection().removeAllRanges) {
|
|
184
|
-
// for all new browsers (IE9+, Chrome, Firefox)
|
|
185
|
-
window.getSelection().removeAllRanges();
|
|
186
|
-
window.getSelection().addRange(document.createRange());
|
|
187
|
-
} else if (window.getSelection().empty) {
|
|
188
|
-
// Chrome supports this as well
|
|
189
|
-
window.getSelection().empty();
|
|
190
|
-
}
|
|
191
|
-
} else if (document.selection) {
|
|
192
|
-
// IE8-
|
|
193
|
-
document.selection.empty();
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
// check if annotation label contains line breaks or its length >= 20 characters
|
|
198
|
-
exports.clearSelection = clearSelection;
|
|
199
|
-
const isSideLabel = text => text.length >= 20 || text.search(/\n|\r|\r\n/) !== -1;
|
|
200
|
-
exports.isSideLabel = isSideLabel;
|
|
201
|
-
const getAnnotationElements = id => Array.from(document.querySelectorAll(`[data-id='${id}']`));
|
|
202
|
-
exports.getAnnotationElements = getAnnotationElements;
|
|
203
|
-
const getLabelElement = id => document.querySelector(`[data-ann-id='${id}']`);
|
|
204
|
-
exports.getLabelElement = getLabelElement;
|
|
205
|
-
//# sourceMappingURL=annotation-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"annotation-utils.js","names":["getAllTextNodesBeforePosition","node","stopOffset","nodeArray","nodes","offset","reduce","acc","textContent","length","keepWalking","nodeType","parentNode","hasAttribute","push","firstChild","nextSibling","getDOMNodes","startOffset","endOffset","rootNode","textNodesToEnd","domNodes","start","forEach","end","exports","getTextNodesBetween","range","commonAncestorContainer","startContainer","startNode","endContainer","endNode","textNodes","pastStartNode","reachedEndNode","text","getTextNodes","nodeValue","value","childNodes","substring","childNode","surroundContent","wrapper","document","createElement","surroundContents","wrapRange","nodesBetween","startRange","createRange","selectNodeContents","setStart","startWrapper","endRange","selectNode","setEnd","endWrapper","centerWrappers","map","insertBefore","appendChild","getRangeDetails","rangeBefore","textSelected","quote","removeElemsWrapping","elems","container","elem","parent","childNodesLength","i","createTextNode","removeChild","normalize","clearSelection","getSelection","removeAllRanges","addRange","window","empty","selection","isSideLabel","search","getAnnotationElements","id","Array","from","querySelectorAll","getLabelElement","querySelector"],"sources":["../../src/annotation/annotation-utils.js"],"sourcesContent":["// returns DOM Nodes before the stopOffset\nconst getAllTextNodesBeforePosition = (node, stopOffset, nodeArray) => {\n const nodes = nodeArray ? nodeArray : [];\n const offset = nodes.reduce((acc, node) => acc + node.textContent.length, 0);\n let keepWalking = true;\n\n if (offset > stopOffset) {\n return false;\n }\n\n if (node) {\n // 3 = HTML DOM node value for text nodes\n if (node.nodeType === 3 && node.parentNode && !node.parentNode.hasAttribute('data-ann-id')) {\n nodes.push(node);\n }\n\n node = node.firstChild;\n }\n\n while (node && keepWalking) {\n keepWalking = getAllTextNodesBeforePosition(node, stopOffset, nodes);\n node = node.nextSibling;\n }\n\n return nodes;\n};\n\n// returns DOM Nodes that overlap the start or end position\nexport const getDOMNodes = (startOffset, endOffset, rootNode) => {\n const textNodesToEnd = getAllTextNodesBeforePosition(rootNode, endOffset);\n const domNodes = [];\n let start = 0;\n\n textNodesToEnd.forEach((node) => {\n const end = start + node.textContent.length;\n\n [startOffset, endOffset].forEach((offset) => {\n if (start <= offset && offset < end) {\n domNodes.push({\n node,\n offset: offset - start,\n });\n }\n });\n\n start = end;\n });\n\n return domNodes;\n};\n\n// returns [ textNodes, text ]\n// textNodes = DOM Text Nodes between start range and end range node\n// text = plain text in range\nconst getTextNodesBetween = (range) => {\n const {\n commonAncestorContainer: rootNode,\n startContainer: startNode,\n endContainer: endNode,\n startOffset,\n endOffset,\n } = range;\n const textNodes = [];\n let pastStartNode = false;\n let reachedEndNode = false;\n let text = '';\n\n const getTextNodes = (node) => {\n const { nodeValue: value, childNodes } = node;\n\n if (node === startNode && node === endNode) {\n if (value) {\n text += value.substring(startOffset, endOffset);\n }\n\n pastStartNode = reachedEndNode = true;\n } else if (node === startNode) {\n if (value) {\n text += value.substring(startOffset);\n }\n\n pastStartNode = true;\n } else if (node === endNode) {\n if (value) {\n text += value.substring(0, endOffset);\n }\n\n reachedEndNode = true;\n } else if (node && node.nodeType === 3 && node.parentNode && !node.parentNode.hasAttribute('data-ann-id')) {\n // 3 = HTML DOM node value for text nodes\n if (value && pastStartNode && !reachedEndNode) {\n text += value;\n textNodes.push(node);\n }\n }\n\n childNodes.forEach((childNode) => {\n if (!reachedEndNode) {\n getTextNodes(childNode);\n } else {\n return;\n }\n });\n };\n\n getTextNodes(rootNode);\n\n return [textNodes, text];\n};\n\nconst surroundContent = (range) => {\n const wrapper = document.createElement('SPAN');\n\n range.surroundContents(wrapper);\n\n return wrapper;\n};\n\n// wrap each DOM Text Node in range into a span\nexport const wrapRange = (range) => {\n if (range.startContainer === range.endContainer) {\n return [surroundContent(range)];\n }\n\n const [nodesBetween] = getTextNodesBetween(range);\n\n // wrap the start node\n const startRange = document.createRange();\n\n startRange.selectNodeContents(range.startContainer);\n startRange.setStart(range.startContainer, range.startOffset);\n\n const startWrapper = surroundContent(startRange);\n\n // wrap the end node\n const endRange = document.createRange();\n\n endRange.selectNode(range.endContainer);\n endRange.setEnd(range.endContainer, range.endOffset);\n\n const endWrapper = surroundContent(endRange);\n\n // wrap the nodes between start and end nodes, if any\n const centerWrappers = nodesBetween.map((node) => {\n const wrapper = document.createElement('SPAN');\n\n node.parentNode.insertBefore(wrapper, node);\n wrapper.appendChild(node);\n\n return wrapper;\n });\n\n return [startWrapper, ...centerWrappers, endWrapper];\n};\n\n// returns text in range with start and end position in rootNode\nexport const getRangeDetails = (range, rootNode) => {\n const rangeBefore = document.createRange();\n\n rangeBefore.setStart(rootNode, 0);\n rangeBefore.setEnd(range.startContainer, range.startOffset);\n\n const [, text] = getTextNodesBetween(rangeBefore);\n const [, textSelected] = getTextNodesBetween(range);\n const start = text.length;\n const end = start + textSelected.length;\n\n return {\n quote: textSelected,\n start,\n end,\n };\n};\n\n// removes the annotation spans without changing the content inside\nexport const removeElemsWrapping = (elems, container) => {\n (elems || []).forEach((elem) => {\n const parent = elem.parentNode;\n const childNodes = elem.childNodes;\n const childNodesLength = childNodes.length;\n\n if (childNodesLength > 0) {\n for (let i = 0; i < childNodesLength; i++) {\n parent.insertBefore(childNodes[0], elem);\n }\n } else {\n parent.insertBefore(document.createTextNode(elem.textContent), elem);\n }\n\n parent.removeChild(elem);\n });\n\n container.normalize();\n};\n\n// also used in select-text\nexport const clearSelection = () => {\n if (document.getSelection) {\n // for all new browsers (IE9+, Chrome, Firefox)\n document.getSelection().removeAllRanges();\n document.getSelection().addRange(document.createRange());\n } else if (window.getSelection) {\n // equals with the document.getSelection (MSDN info)\n if (window.getSelection().removeAllRanges) {\n // for all new browsers (IE9+, Chrome, Firefox)\n window.getSelection().removeAllRanges();\n window.getSelection().addRange(document.createRange());\n } else if (window.getSelection().empty) {\n // Chrome supports this as well\n window.getSelection().empty();\n }\n } else if (document.selection) {\n // IE8-\n document.selection.empty();\n }\n};\n\n// check if annotation label contains line breaks or its length >= 20 characters\nexport const isSideLabel = (text) => text.length >= 20 || text.search(/\\n|\\r|\\r\\n/) !== -1;\n\nexport const getAnnotationElements = (id) => Array.from(document.querySelectorAll(`[data-id='${id}']`));\n\nexport const getLabelElement = (id) => document.querySelector(`[data-ann-id='${id}']`);\n"],"mappings":";;;;;;AAAA;AACA,MAAMA,6BAA6B,GAAGA,CAACC,IAAI,EAAEC,UAAU,EAAEC,SAAS,KAAK;EACrE,MAAMC,KAAK,GAAGD,SAAS,GAAGA,SAAS,GAAG,EAAE;EACxC,MAAME,MAAM,GAAGD,KAAK,CAACE,MAAM,CAAC,CAACC,GAAG,EAAEN,IAAI,KAAKM,GA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