diff --git a/inception/inception-brat-editor/src/main/ts/src/dispatcher/Dispatcher.ts b/inception/inception-brat-editor/src/main/ts/src/dispatcher/Dispatcher.ts index f527f420b59..5247d80e981 100644 --- a/inception/inception-brat-editor/src/main/ts/src/dispatcher/Dispatcher.ts +++ b/inception/inception-brat-editor/src/main/ts/src/dispatcher/Dispatcher.ts @@ -44,7 +44,7 @@ export type Message = 'dispatchAsynchError' | 'collectionLoaded' | 'requestRende | 'svgWidth' | 'configurationUpdated' | 'newSourceData' | 'init' | 'click' | 'contextmenu' | 'isReloadOkay' | 'spanAndAttributeTypesLoaded' | 'keydown' | 'dragstart' | 'mousedown' | 'mouseup' | 'mousemove' - | 'displaySpanComment' | 'displayArcComment' | 'displaySentComment' | 'hideComment' + | 'displaySpanComment' | 'displayArcComment' | 'displaySentComment' | 'resize' | 'displaySpanButtons' | 'configurationChanged' | 'mouseover' | 'mouseout' | 'dblclick' | 'keypress' | 'touchstart' | 'touchend' | 'collectionChanged' | 'renderData' | 'renderDataPatch' | 'triggerRender' diff --git a/inception/inception-brat-editor/src/main/ts/src/visualizer/Visualizer.ts b/inception/inception-brat-editor/src/main/ts/src/visualizer/Visualizer.ts index 2d1d419ff66..b955af01a58 100644 --- a/inception/inception-brat-editor/src/main/ts/src/visualizer/Visualizer.ts +++ b/inception/inception-brat-editor/src/main/ts/src/visualizer/Visualizer.ts @@ -3788,7 +3788,6 @@ export class Visualizer { const target = evt.target target.classList.remove('badTarget') - this.dispatcher.post('hideComment') if (this.highlight) { this.highlight.map(h => h.remove()) diff --git a/inception/inception-brat-editor/src/main/ts/src/visualizer_ui/VisualizerUI.ts b/inception/inception-brat-editor/src/main/ts/src/visualizer_ui/VisualizerUI.ts index c7f9b42e593..9d00be0b4de 100644 --- a/inception/inception-brat-editor/src/main/ts/src/visualizer_ui/VisualizerUI.ts +++ b/inception/inception-brat-editor/src/main/ts/src/visualizer_ui/VisualizerUI.ts @@ -55,25 +55,16 @@ export class VisualizerUI { private dispatcher: Dispatcher - private commentPopup: JQuery - private commentDisplayed = false - private displayCommentTimer: number | undefined = undefined - private ajax: DiamAjax constructor (dispatcher: Dispatcher, ajax: DiamAjax) { console.debug('Setting up brat visualizer-ui module...') this.ajax = ajax - this.commentPopup = $('#commentpopup') this.dispatcher = dispatcher this.dispatcher .on('init', this, this.init) .on('dataReady', this, this.rememberData) -// .on('displaySpanComment', this, this.displaySpanComment) -// .on('displayArcComment', this, this.displayArcComment) -// .on('displaySentComment', this, this.displaySentComment) - .on('hideComment', this, this.hideComment) .on('resize', this, this.onResize) .on('spanAndAttributeTypesLoaded', this, this.spanAndAttributeTypesLoaded) .on('doneRendering', this, this.onDoneRendering) @@ -167,137 +158,6 @@ export class VisualizerUI { return Util.cmp(a[2], b[2]) } - /** - * @deprecated To be replaced with the new Popover component - */ - displaySpanComment (evt, target, spanId, spanType, mods, spanText, hoverText, - commentText, commentType) { - const immediately = false - let comment = ('
' + - '' + Util.escapeHTML(Util.spanDisplayForm(this.spanTypes, spanType)) + '' + ' ' + - '' + 'ID:' + Util.escapeHTML(spanId) + '') - if (mods.length) { - comment += '
' + Util.escapeHTML(mods.join(', ')) + '
' - } - - comment += '
' - - if (hoverText != null) { - comment += ('
' + Util.escapeHTML(hoverText) + '
') - } else if (spanText) { - comment += ('
"' + Util.escapeHTML(spanText) + '"
') - } - - comment += '
' - - // display initial comment HTML - this.displayComment(evt, comment, commentText, commentType, immediately) - - // initiate AJAX calls for the normalization data to query - this.initiateNormalizationAjaxCall(spanId, spanType) - } - - /** - * @deprecated To be replaced with the new Popover component - */ - displayArcComment (evt, target, symmetric, arcId, originSpanId, originSpanType, - role, targetSpanId, targetSpanType, commentText, commentType) { - if (!this.data) return - const arcRole = target.attr('data-arc-role') - // in arrowStr, — == mdash, → == Unicode right arrow - const arrowStr = symmetric ? '—' : '→' - const arcDisplayForm = Util.arcDisplayForm(this.spanTypes, this.data.spans[originSpanId].type, arcRole, this.relationTypesHash) - let comment = '' - comment += ('' + - '' + Util.escapeHTML(Util.spanDisplayForm(this.spanTypes, originSpanType)) + ' ' + arrowStr + ' ' + Util.escapeHTML(arcDisplayForm) + ' ' + arrowStr + ' ' + Util.escapeHTML(Util.spanDisplayForm(this.spanTypes, targetSpanType)) + '' + - '' + (arcId ? 'ID:' + arcId : Util.escapeHTML(originSpanId) + arrowStr + Util.escapeHTML(targetSpanId)) + '' + - '') - comment += ('
' + Util.escapeHTML('"' + this.data.spans[originSpanId].text + '"') + arrowStr + Util.escapeHTML('"' + this.data.spans[targetSpanId].text + '"') + '
') - comment += '
' - - this.displayComment(evt, comment, commentText, commentType) - - // initiate AJAX calls for the normalization data to query - this.initiateNormalizationAjaxCall(arcId, arcRole) - } - - /** - * @deprecated To be replaced with the new Popover component - */ - initiateNormalizationAjaxCall (id: VID, type: number) { - this.ajax.loadLazyDetails(id, type).then(detailGroups => { - // extend comment popup with normalization data - let norminfo = '' - - for (const group of detailGroups) { - const details = group.details - // flatten outer (name, attr, info) array (idx for sort) - let infos: [string, string, number][] = [] - let idx = 0 - for (let j = 0; j < details.length; j++) { - infos.push([details[j].label, details[j].value, idx++]) - } - - // sort, prioritizing images (to get floats right) - infos = infos.sort(this.compareLazyDetails) - - // generate HTML - if (group.title) { - norminfo += `
- ${group.title} -
` - } - - for (let i = 0; i < infos.length; i++) { - const label = infos[i][0] as string - let value = infos[i][1] as string - if (label && value) { - // special treatment for some label values - if (label.toLowerCase() === '') { - norminfo += `` - } else { - // normal, as text max length restriction - if (value.length > 300) { - value = value.substr(0, 300) + ' ...' - } - - norminfo += `${Util.escapeHTML(label)} - : ${Util.escapeHTML(value)?.replace(/\n/g, '
')}
-
` - } - } - } - } - - const drop = $('#lazy_details_drop_point') - if (drop) { - drop.html(norminfo) - } else { - console.log('Lazy details drop point not found!') // TODO XXX - } - }) - } - - /** - * @deprecated To be replaced with the new Popover component - */ - hideComment () { - clearTimeout(this.displayCommentTimer) - if (this.commentDisplayed) { - // BEGIN WEBANNO EXTENSION - #1610 - Improve brat visualization interaction performance - // - Show/hide comments immediately instead of using an animation to avoid costly reflows - /* - commentPopup.stop(true, true).fadeOut(0, function() { - commentDisplayed = false; - }); - */ - this.commentPopup.hide() - this.commentDisplayed = false - // END WEBANNO EXTENSION - #1610 - Improve brat visualization interaction performance - } - clearTimeout(this.displayButtonsTimer) - } - /** * @deprecated To be replaced with the new Popover component */ @@ -370,8 +230,6 @@ export class VisualizerUI { width: acceptBtn.width() * 2 + spanWidth }) .mouseleave(this.hideSpanButtons) - // hide the buttons when comments are hidden (i.e. mouse left the span) - this.dispatcher.on('hideComment', this, this.hideSpanButtons) clearTimeout(this.displayButtonsTimer) this.displayButtonsTimer = setTimeout(() => {