From 3b680da6bc1027f3e7488d9870fcc0c5faf49b94 Mon Sep 17 00:00:00 2001 From: Giulia Cacioli Date: Fri, 7 May 2021 09:26:29 +0200 Subject: [PATCH 1/4] Fix diplomatic/interpretative search Handle search when there is a with the same line number --- .../search/diplomaticLbHandler.service.js | 51 +++++++++---------- app/styles/_searchBoxInternal.scss | 4 ++ app/styles/_variables.scss | 1 + 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/app/src/dataHandler/search/diplomaticLbHandler.service.js b/app/src/dataHandler/search/diplomaticLbHandler.service.js index 2377b1a02..85923a0a0 100644 --- a/app/src/dataHandler/search/diplomaticLbHandler.service.js +++ b/app/src/dataHandler/search/diplomaticLbHandler.service.js @@ -1,7 +1,7 @@ angular.module('evtviewer.dataHandler') - .service('evtSearchDiplomaticLbHandler', ['evtSearchDocument', 'evtDiplomaticEditionHandler', 'evtInterpretativeEditionHandler', - function DiplomaticLbHandler(evtSearchDocument, evtDiplomaticEditionHandler, evtInterpretativeEditionHandler){ - + .service('evtSearchDiplomaticLbHandler', ['evtSearchDocument', 'evtDiplomaticEditionHandler', 'evtInterpretativeEditionHandler', 'evtParser', + function DiplomaticLbHandler(evtSearchDocument, evtDiplomaticEditionHandler, evtInterpretativeEditionHandler, evtParser){ + var countAllDocsLine = 0; DiplomaticLbHandler.prototype.getLineInfo = function(xmlDocDom, xmlDocBody, lbNodes, prevDocsLbNumber, ns, nsResolver) { var currentXmlDoc = evtSearchDocument.getCurrentXmlDoc(xmlDocDom, xmlDocBody, ns, nsResolver), @@ -54,42 +54,39 @@ angular.module('evtviewer.dataHandler') } line.xmlDocTitle = currentXmlDoc.title; line.xmlDocId = currentXmlDoc.id; - line.docId = line.xmlDocId + '-' + line.pageId + '-' + line.line; + line.docId = line.xmlDocId + '-' + line.pageId + '-' + line.line + '-line' + countLine; line.lbId = node.getAttribute('xml:id'); - - do { - if (editionIsDipl) { - lineNodes.diplomatic = evtSearchDocument.getLineNodes(xmlDocDom, diplomaticNodes, prevDocsLbNumber, countLine, ns, nsResolver); - cleanedDiplomaticNodes = evtSearchDocument.removeEmptyTextNodes(lineNodes.diplomatic); - } else { - lineNodes.diplomatic = []; - cleanedDiplomaticNodes = []; - } - - if (editionIsInterp) { - lineNodes.interpretative = evtSearchDocument.getLineNodes(xmlDocDom, interpretativeNodes, prevDocsLbNumber, countLine, ns, nsResolver); - cleanedInterpretativeNodes = evtSearchDocument.removeEmptyTextNodes(lineNodes.interpretative); - } else { - lineNodes.interpretative = []; - cleanedInterpretativeNodes = []; - } - } while (cleanedDiplomaticNodes.length === 0 && cleanedInterpretativeNodes.length === 0 && - lineNodes.diplomatic.length !== 0 && lineNodes.interpretative.length !== 0); - + + if (editionIsDipl) { + lineNodes.diplomatic = evtSearchDocument.getLineNodes(xmlDocDom, diplomaticNodes, prevDocsLbNumber, countLine, ns, nsResolver); + cleanedDiplomaticNodes = evtSearchDocument.removeEmptyTextNodes(lineNodes.diplomatic); + } else { + lineNodes.diplomatic = []; + cleanedDiplomaticNodes = []; + } + + if (editionIsInterp) { + lineNodes.interpretative = evtSearchDocument.getLineNodes(xmlDocDom, interpretativeNodes, prevDocsLbNumber, countLine, ns, nsResolver); + cleanedInterpretativeNodes = evtSearchDocument.removeEmptyTextNodes(lineNodes.interpretative); + } else { + lineNodes.interpretative = []; + cleanedInterpretativeNodes = []; + } + line.content = {}; if (editionIsDipl) { line.content.diplomatic = evtSearchDocument.getContent(lineNodes.diplomatic, 'diplomatic'); } - + if (editionIsInterp) { line.content.interpretative = evtSearchDocument.getContent(lineNodes.interpretative, 'interpretative'); } - + lineId++; countLine++; countAllDocsLine++; prevLine = line.line; - + lines[line.docId] = line; lineNodes = []; } diff --git a/app/styles/_searchBoxInternal.scss b/app/styles/_searchBoxInternal.scss index f76fcf454..2137ad5f5 100644 --- a/app/styles/_searchBoxInternal.scss +++ b/app/styles/_searchBoxInternal.scss @@ -131,6 +131,7 @@ .result-token { font-weight: bold; + color: $search-result-item; } .results-number { @@ -145,6 +146,9 @@ .original-text { display: block; font-style: italic; + strong { + color: $search-result-item; + } } .resultInfo { diff --git a/app/styles/_variables.scss b/app/styles/_variables.scss index 180400652..d8e927c29 100644 --- a/app/styles/_variables.scss +++ b/app/styles/_variables.scss @@ -35,6 +35,7 @@ $box-witness-text-color: $box-text-color; $search-box-height: 30px; $search-input-height: 27px; $search-result-info: $base-color-light; +$search-result-item: #ad0808; $search-options-background: $box-background-color; $search-buttons-background: $box-background-color; $virtual-keyboard-width: 325px; From 11b9958393eb6eba63615073b5ac195f2b59fe63 Mon Sep 17 00:00:00 2001 From: ChiaraDipi Date: Mon, 25 Jan 2021 17:30:48 +0100 Subject: [PATCH 2/4] Fix transformation of content when @n missing. Fix #112 --- app/src/dataHandler/parser.service.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/dataHandler/parser.service.js b/app/src/dataHandler/parser.service.js index 34d26e8ff..b7b367113 100644 --- a/app/src/dataHandler/parser.service.js +++ b/app/src/dataHandler/parser.service.js @@ -703,8 +703,10 @@ angular.module('evtviewer.dataHandler') //newElement.insertBefore(lineNumElem, newElement.childNodes[0]); } else if (parsedData.getEncodingDetail('lineNums')) { newElement.className += ' l-indent'; + var parsedElement = parser.parseXMLElement(doc, newElement, options); + newElement.innerHTML = '' + parsedElement.outerHTML + ''; } - + return newElement; }; /** From 9b25915a239412b33faa315bbe8c0b377917617c Mon Sep 17 00:00:00 2001 From: ChiaraDipi Date: Mon, 25 Jan 2021 17:47:15 +0100 Subject: [PATCH 3/4] Fix transformation for generic element Class name generated from tag was always uppercase, now is smallcase. --- app/src/dataHandler/criticalElementsParser.service.js | 4 ++-- app/src/dataHandler/parser.service.js | 4 ++-- app/styles/_tei.scss | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/dataHandler/criticalElementsParser.service.js b/app/src/dataHandler/criticalElementsParser.service.js index b6951ee12..d09c29e47 100644 --- a/app/src/dataHandler/criticalElementsParser.service.js +++ b/app/src/dataHandler/criticalElementsParser.service.js @@ -1858,7 +1858,7 @@ angular.module('evtviewer.dataHandler') spanElement = evtParser.parseXMLElement(doc, e, {skip: ''}); } else { spanElement = document.createElement('span'); - spanElement.className = elem.tagName; + spanElement.className = elem.tagName ? elem.tagName.toLowerCase() : ''; var attribKeys = Object.keys(elem.attributes); for (var key in attribKeys) { @@ -2496,7 +2496,7 @@ angular.module('evtviewer.dataHandler') spanElement = evtParser.parseXMLElement(doc, e, {skip: ''}); } else { spanElement = document.createElement('span'); - spanElement.className = elem.tagName; + spanElement.className = elem.tagName ? elem.tagName.toLowerCase() : '';; var attribKeys = Object.keys(elem.attributes); for (var key in attribKeys) { diff --git a/app/src/dataHandler/parser.service.js b/app/src/dataHandler/parser.service.js index b7b367113..501f279cc 100644 --- a/app/src/dataHandler/parser.service.js +++ b/app/src/dataHandler/parser.service.js @@ -202,7 +202,7 @@ angular.module('evtviewer.dataHandler') newElement = parser.parseNote(element); } else if (tagName === 'date' && (!element.childNodes || element.childNodes.length <= 0)) { //TEMP => TODO: create new directive newElement = document.createElement('span'); - newElement.className = element.tagName; + newElement.className = element.tagName ? element.tagName.toLowerCase() : '';; var textContent = ''; for (var i = 0; i < element.attributes.length; i++) { var attrib = element.attributes[i]; @@ -226,7 +226,7 @@ angular.module('evtviewer.dataHandler') } else { newElement = document.createElement('span'); } - newElement.className = element.tagName !== undefined ? element.tagName : ''; + newElement.className = element.tagName !== undefined ? element.tagName.toLowerCase() : ''; if (element.attributes) { for (var k = 0; k < element.attributes.length; k++) { var attribK = element.attributes[k]; diff --git a/app/styles/_tei.scss b/app/styles/_tei.scss index 32892fa21..d85553c80 100644 --- a/app/styles/_tei.scss +++ b/app/styles/_tei.scss @@ -41,7 +41,7 @@ text-decoration: none; } -.div { +div.div { display: block; margin: 15px 0; background: inherit; From 1caa5f914fdf29add50a2bd6b869b58acf2d0562 Mon Sep 17 00:00:00 2001 From: ChiaraDipi Date: Thu, 22 Jul 2021 00:09:23 +0200 Subject: [PATCH 4/4] Fix pin button style --- app/styles/_buttonSwitch.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/app/styles/_buttonSwitch.scss b/app/styles/_buttonSwitch.scss index 9763b63bc..e23bf1971 100644 --- a/app/styles/_buttonSwitch.scss +++ b/app/styles/_buttonSwitch.scss @@ -196,6 +196,7 @@ button-switch { top: 54px; z-index: 20; left: 75%; + transform: none !important; &.centered { left: 75%; }