Commit b9650cc4 authored by George Popoff's avatar George Popoff

add context to message

parent 20ac46e3
...@@ -26,6 +26,7 @@ ETYPOS.prototype = { ...@@ -26,6 +26,7 @@ ETYPOS.prototype = {
//язык по умочланияю //язык по умочланияю
default_language: 'ru', default_language: 'ru',
// Фраза или слово для исправления
selection: '', selection: '',
needConstructPanel: true, needConstructPanel: true,
...@@ -47,6 +48,7 @@ ETYPOS.prototype = { ...@@ -47,6 +48,7 @@ ETYPOS.prototype = {
'url': '', 'url': '',
'text': '', 'text': '',
'comment': '', 'comment': '',
'context': '',
'language': this.default_language, 'language': this.default_language,
'old_browser': 0, 'old_browser': 0,
}, },
...@@ -185,6 +187,9 @@ ETYPOS.prototype = { ...@@ -185,6 +187,9 @@ ETYPOS.prototype = {
text.innerHTML = selection; text.innerHTML = selection;
self.userdata['text'] = selection; self.userdata['text'] = selection;
self.userdata['context'] = self.getSelectionContext();
console.log("context: ", self.userdata['context']);
if ( !self.validateTextData() ) { if ( !self.validateTextData() ) {
self.printMessage('error', self.error); self.printMessage('error', self.error);
...@@ -275,6 +280,10 @@ ETYPOS.prototype = { ...@@ -275,6 +280,10 @@ ETYPOS.prototype = {
return (window.getSelection()) ? String(window.getSelection()) : this.selection; return (window.getSelection()) ? String(window.getSelection()) : this.selection;
}, },
getSelectionContext: function() {
return (window.getSelection()) ? window.getSelection().anchorNode : this.selection;
},
/*Скрытие/показ окна*/ /*Скрытие/показ окна*/
controlPanel: function () { controlPanel: function () {
(this.element.style.display === "block") ? this.closeWindow() : this.openWindow(); (this.element.style.display === "block") ? this.closeWindow() : this.openWindow();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment