Feature #1355

Updated by Matthieu Decorde about 5 years ago

Allow user to link a sequence of words from an edition page to its concordance.

MD: If the user select text in the edition, send it to concordance.

h3. Solution 1 - implemented in TXM 0.7.7 beta2

- get the words sequence string from the browser selection
- build a CQP query with that sequence
- call concordance

Use the "evaluate" SWT browser Javascript API method with the following Javascript code:
static String SCRIPT01 = "var html = \"\";"+
"if (typeof window.getSelection != \"undefined\") {"+
"var sel = window.getSelection();"+
"if (sel.rangeCount) {"+
"var container = document.createElement(\"div\");"+
"for (var i = 0, len = sel.rangeCount; i < len; ++i) {"+
"html = container.innerHTML;"+
"} else if (typeof document.selection != \"undefined\") {"+
"if (document.selection.type == \"Text\") {"+
"html = document.selection.createRange().htmlText;"+
"}" +
"}" +
"return html";

h3. Solution 2

Get the word forms from the selected SPAN contents. By manipulating DOM using Javascript.

h3. Solution 3

Über and ultimate solution that allow the user to select the word properties involved (word, pos, lemma, etc.).

h3. Solution 4

Solution 3 and makes coffee.