Revision f901d8b7
Added by Katja Luther almost 7 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/LanguageRichTextWithLabel.java | ||
---|---|---|
78 | 78 |
intextRefernces.setEntity(getLanguageString()); |
79 | 79 |
} |
80 | 80 |
|
81 |
//getLanguageString().setText(getText());
|
|
81 |
getLanguageString().setText(getText()); |
|
82 | 82 |
|
83 | 83 |
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e)); |
84 | 84 |
} |
... | ... | |
107 | 107 |
if (StringUtils.isBlank(text.getText())){ |
108 | 108 |
return null; |
109 | 109 |
} |
110 |
|
|
110 | 111 |
String test = text.getText(); |
112 |
String test2 = getLanguageString().getText(); |
|
111 | 113 |
String selectedText = text.getSelectedText(); |
114 |
String selectedhtml =(String) text.evaluateJavascript(SCRIPT01); |
|
115 |
|
|
112 | 116 |
|
113 | 117 |
int posStart = getLanguageString().getText().indexOf(selectedText); |
114 | 118 |
Point point = new Point (posStart, posStart+ selectedText.length()); |
115 | 119 |
return point; |
116 | 120 |
} |
121 |
|
|
122 |
static String SCRIPT01 = "var html = \"\";"+ |
|
123 |
"if (typeof window.getSelection != \"undefined\") {"+ |
|
124 |
"var sel = window.getSelection();"+ |
|
125 |
"if (sel.rangeCount) {"+ |
|
126 |
"var container = document.createElement(\"div\");"+ |
|
127 |
"for (var i = 0, len = sel.rangeCount; i < len; ++i) {"+ |
|
128 |
"container.appendChild(sel.getRangeAt(i).cloneContents());"+ |
|
129 |
"}"+ |
|
130 |
"html = container.innerHTML;"+ |
|
131 |
"}"+ |
|
132 |
"} else if (typeof document.selection != \"undefined\") {"+ |
|
133 |
"if (document.selection.type == \"Text\") {"+ |
|
134 |
"html = document.selection.createRange().htmlText;"+ |
|
135 |
"}" + |
|
136 |
"}" + |
|
137 |
"return html"; |
|
138 |
|
|
139 |
static String SCRIPT02 = "var html = \"\";"+ |
|
140 |
"if (typeof window.getSelection != \"undefined\") {"+ |
|
141 |
"var sel = window.getSelection();"+ |
|
142 |
|
|
143 |
"return sel"; |
|
144 |
|
|
145 |
|
|
146 |
static String SCRIPT03 = "var html = \"\";"+ |
|
147 |
"if (typeof window.getSelection != \"undefined\") {"+ |
|
148 |
"var sel = window.getSelection();"+ |
|
149 |
"if (sel.rangeCount) {"+ |
|
150 |
"var container = document.createElement(\"div\");"+ |
|
151 |
"for (var i = 0, len = sel.rangeCount; i < len; ++i) {"+ |
|
152 |
"container.appendChild(sel.getRangeAt(i).cloneContents());"+ |
|
153 |
"}"+ |
|
154 |
"html = container.innerHTML;"+ |
|
155 |
"}"+ |
|
156 |
"} else if (typeof document.selection != \"undefined\") {"+ |
|
157 |
"if (document.selection.type == \"Text\") {"+ |
|
158 |
"html = document.selection.createRange().htmlText;"+ |
|
159 |
"}" + |
|
160 |
"}" + |
|
161 |
"return html"; |
|
117 | 162 |
} |
118 | 163 |
|
119 | 164 |
|
Also available in: Unified diff
disable content filter in ckEditor to avoid deleting of html tags