MCPcopy Index your code
hub / github.com/mailvelope/mailvelope / getEmailText

Method getEmailText

src/content-scripts/encryptFrame.js:148–167  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

146 }
147
148 getEmailText(type) {
149 let text;
150 let html;
151 if (this.emailTextElement.tagName.toLowerCase() === 'textarea') {
152 text = this.emailTextElement.value;
153 } else { // html element
154 if (type === 'text') {
155 this.emailTextElement.focus();
156 const sel = this.emailTextElement.ownerDocument.defaultView.getSelection();
157 sel.selectAllChildren(this.emailTextElement);
158 text = sel.toString();
159 sel.removeAllRanges();
160 } else {
161 html = this.emailTextElement.innerHTML;
162 html = html.replace(/\n/g, ''); // remove new lines
163 text = html;
164 }
165 }
166 return text;
167 }
168
169 /**
170 * Is called after encryption and injects ciphertext and recipient

Callers 2

showMailEditorMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected