Skip to content

Commit

Permalink
fix: abort autocomplete if inline create dialog was started
Browse files Browse the repository at this point in the history
Refs #11
  • Loading branch information
simontaurus committed May 27, 2024
1 parent 75f1ee7 commit 92939c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion extension.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version":2,
"name":"MwJson",
"version":"0.37.2",
"version":"0.37.3",
"author":[
"[https://github.com/simontaurus Simon Stier]"
],
Expand Down
6 changes: 5 additions & 1 deletion modules/ext.MwJson.editor/MwJson_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ mwjson.editor = class {
}).bind(this, subeditor));
$create_inline_button.find(".inline-edit-btn").on("click", (function (subeditor, e) {
//console.log("Click ", subeditor);
subeditor.unhandled_input = false;
var categories = subeditor.schema?.range ? subeditor.schema?.range : subeditor.schema?.options?.autocomplete?.category;
if (categories && !Array.isArray(categories)) categories = [categories];
var super_categories = subeditor.schema?.subclassof_range;
Expand Down Expand Up @@ -1106,6 +1107,10 @@ mwjson.editor = class {
jseditor_editor.unhandled_input = false;
console.warn("Error while fetching autocomplete data: ", data.error)
}
else if (jseditor_editor.unhandled_input === false) {
//aborted in the meantime
//console.log("Autocomplete request aborted in the meantime")
}
else {
resultList = Object.values(data.query.results); //use subjects as results
if (result_property) { //use objects as results
Expand Down Expand Up @@ -1173,7 +1178,6 @@ mwjson.editor = class {
if (labelTemplate.type.shift() === 'handlebars') {
label = Handlebars.compile(labelTemplate.value)({ result: result });
}
jseditor_editor.input.value_label = label;
return label;
},
//... but store the fulltext / id
Expand Down

0 comments on commit 92939c3

Please sign in to comment.