(command, value)
| 2894 | } |
| 2895 | |
| 2896 | function applyReportAnnotation(command, value) { |
| 2897 | const body = $("reportViewerBody"); |
| 2898 | const range = selectedReportAnnotationRange(); |
| 2899 | if (!body || !range || range.collapsed || !body.contains(range.commonAncestorContainer)) return; |
| 2900 | const wrapper = document.createElement("span"); |
| 2901 | wrapper.dataset.paperflowAnnotation = command; |
| 2902 | if (command === "foreColor") wrapper.style.color = value; |
| 2903 | else if (command === "bold") wrapper.style.fontWeight = "700"; |
| 2904 | else if (command === "italic") wrapper.style.fontStyle = "italic"; |
| 2905 | else wrapper.style.backgroundColor = value; |
| 2906 | wrapper.appendChild(range.extractContents()); |
| 2907 | range.insertNode(wrapper); |
| 2908 | saveReportAnnotation(); |
| 2909 | const selection = window.getSelection(); |
| 2910 | selection?.removeAllRanges(); |
| 2911 | state.reportAnnotationRange = null; |
| 2912 | hideReportAnnotationToolbar(); |
| 2913 | } |
| 2914 | |
| 2915 | function clearReportAnnotations() { |
| 2916 | if (!state.currentReport?.report_id) return; |
no test coverage detected