RCP: X.X, add an Edition to Concordance hyperlink
Allow user to link a sequence of words from an edition page to its concordance.
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) {"+
"container.appendChild(sel.getRangeAt(i).cloneContents());"+
"}"+
"html = container.innerHTML;"+
"}"+
"} else if (typeof document.selection != \"undefined\") {"+
"if (document.selection.type == \"Text\") {"+
"html = document.selection.createRange().htmlText;"+
"}" +
"}" +
"return html";
Solution 1 bis
Do the same thing with the SynopticEditionEditor.
implemented for TXM 0.7.8
(from redmine: issue id 1355, created on 2015/05/21 by Matthieu Decorde)
- Relations:
- relates #1843 (closed)