Skip to content

Commit

Permalink
Strip tags when working with workflowy (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Perez committed Jun 22, 2016
1 parent d68ce2c commit 2a04e68
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/content-script-tools/custom-events/workflowy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ export default {
this.setValue = (value) => {
this.elem.innerHTML = string.htmlEscape(value);
};

this.extractTextFromUnknownElem = (elem, options) => {
return elem.innerText;
};
}
};
6 changes: 5 additions & 1 deletion src/handlers/content-editable.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ class ContentEditableHandler extends BaseHandler {
const noBreak = options.noLinebreak || i === this.elem.childNodes.length - 1;
return noBreak ? '' : '\n';
default:
return child.outerHTML;
return this.extractTextFromUnknownElem(child, options);
}
}).join('');
}

extractTextFromUnknownElem(elem, _options) {
return elem.outerHTML;
}

setValue(value) {
const htmlValue = value.split('\n').map((v) => {
if (v.trim().length === 0) {
Expand Down

0 comments on commit 2a04e68

Please sign in to comment.