Differences From Artifact [184dcb850a]:
- File gc_lang/fr/webext/content_scripts/api.js — part of check-in [2189e58b3b] at 2020-04-02 13:58:17 on branch trunk — [fx] fix web API for Chrome: use JSON.stringify() for dispatching events (user: olr, size: 4524) [annotate] [blame] [check-ins using]
To Artifact [4233cac483]:
- File gc_lang/fr/webext/content_scripts/api.js — part of check-in [cd626d33e6] at 2020-04-07 11:17:25 on branch trunk — [fx][doc] warning: the node must always have an identifier (user: olr, size: 4660) [annotate] [blame] [check-ins using]
| ︙ | |||
30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | + + + |
let sNodeId = "";
if (vNode instanceof HTMLElement && vNode.id) {
sNodeId = vNode.id;
}
else if (typeof(vNode) === "string" && document.getElementById(vNode)) {
sNodeId = vNode;
}
else {
console.log("[Grammalecte API] No node identifier. No event, no result will be sent.")
}
let xEvent = new CustomEvent("GrammalecteCall", { detail: JSON.stringify({sCommand: "openPanelForText", sText: sText, sNodeId: sNodeId}) });
document.dispatchEvent(xEvent);
} else {
console.log("[Grammalecte API] Error: parameter is not a text.");
}
},
|
| ︙ |