mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 02:44:18 +00:00
Function renaming
This commit is contained in:
parent
ff1bcb40f3
commit
0882e085a3
@ -93,7 +93,7 @@ nopaque.corpus_analysis.query_builder.QueryBuilder = class QueryBuilder {
|
||||
</span>
|
||||
`
|
||||
);
|
||||
this.actionListeners(queryChipElement);
|
||||
this.addActionListeners(queryChipElement);
|
||||
queryChipElement.addEventListener('dragstart', this.handleDragStart.bind(this, queryChipElement));
|
||||
queryChipElement.addEventListener('dragend', this.handleDragEnd);
|
||||
|
||||
@ -119,7 +119,7 @@ nopaque.corpus_analysis.query_builder.QueryBuilder = class QueryBuilder {
|
||||
this.queryPreviewBuilder();
|
||||
}
|
||||
|
||||
actionListeners(queryChipElement) {
|
||||
addActionListeners(queryChipElement) {
|
||||
let notQuantifiableDataTypes = ['start-sentence', 'end-sentence', 'start-entity', 'start-empty-entity', 'end-entity', 'token-incidence-modifier'];
|
||||
queryChipElement.addEventListener('click', (event) => {
|
||||
if (event.target.classList.contains('chip')) {
|
||||
@ -129,8 +129,7 @@ nopaque.corpus_analysis.query_builder.QueryBuilder = class QueryBuilder {
|
||||
}
|
||||
});
|
||||
let chipActionButtons = queryChipElement.querySelectorAll('.chip-action-button');
|
||||
// chipActionButtons.forEach(button => {
|
||||
for (let button of chipActionButtons) {
|
||||
chipActionButtons.forEach(button => {
|
||||
button.addEventListener('click', (event) => {
|
||||
if (event.target.dataset.chipAction === 'delete') {
|
||||
this.deleteChipElement(queryChipElement);
|
||||
@ -140,8 +139,7 @@ nopaque.corpus_analysis.query_builder.QueryBuilder = class QueryBuilder {
|
||||
this.lockClosingChipElement(queryChipElement);
|
||||
}
|
||||
});
|
||||
}
|
||||
// });
|
||||
});
|
||||
}
|
||||
|
||||
editChipElement(queryChipElement) {
|
||||
@ -175,10 +173,10 @@ nopaque.corpus_analysis.query_builder.QueryBuilder = class QueryBuilder {
|
||||
let elementIndex = Array.from(this.elements.queryInputField.children).indexOf(attr);
|
||||
switch (attr.dataset.type) {
|
||||
case 'start-sentence':
|
||||
this.deletingClosingTagHandler(elementIndex, 'end-sentence');
|
||||
this.deleteClosingTagHandler(elementIndex, 'end-sentence');
|
||||
break;
|
||||
case 'start-entity':
|
||||
this.deletingClosingTagHandler(elementIndex, 'end-entity');
|
||||
this.deleteClosingTagHandler(elementIndex, 'end-entity');
|
||||
break;
|
||||
case 'token':
|
||||
let nextElement = Array.from(this.elements.queryInputField.children)[elementIndex+1];
|
||||
@ -196,7 +194,7 @@ nopaque.corpus_analysis.query_builder.QueryBuilder = class QueryBuilder {
|
||||
this.queryPreviewBuilder();
|
||||
}
|
||||
|
||||
deletingClosingTagHandler(elementIndex, closingTagType) {
|
||||
deleteClosingTagHandler(elementIndex, closingTagType) {
|
||||
let closingTags = this.elements.queryInputField.querySelectorAll(`[data-type="${closingTagType}"]`);
|
||||
for (let i = 0; i < closingTags.length; i++) {
|
||||
let closingTag = closingTags[i];
|
||||
@ -208,7 +206,7 @@ nopaque.corpus_analysis.query_builder.QueryBuilder = class QueryBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
handleDragStart(queryChipElement, event) {
|
||||
handleDragStart(queryChipElement) {
|
||||
// is called when a query chip is dragged. It creates a dropzone (in form of a chip) for the dragged chip and adds it to the query input field.
|
||||
let queryChips = this.elements.queryInputField.querySelectorAll('.query-component');
|
||||
if (queryChipElement.dataset.type === 'token-incidence-modifier') {
|
||||
@ -232,7 +230,7 @@ nopaque.corpus_analysis.query_builder.QueryBuilder = class QueryBuilder {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
handleDragEnd(event) {
|
||||
handleDragEnd() {
|
||||
document.querySelectorAll('.drop-target').forEach(target => target.remove());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user