summaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
authorWu Cheng-Han2016-01-12 08:03:56 -0600
committerWu Cheng-Han2016-01-12 08:03:56 -0600
commit473212676ade788b6603a7a3c2bec726c6ca1579 (patch)
tree2929e414745edff86a50abd2cd79244430ec956c /public/js
parent2ecec3b59aabe2fd6156338cd4cbab7672d4f9b1 (diff)
Fixed importFromUrl should parse by the file extension, and move to-markdown dependency to bower
Diffstat (limited to 'public/js')
-rw-r--r--public/js/index.js24
1 files changed, 16 insertions, 8 deletions
diff --git a/public/js/index.js b/public/js/index.js
index 34cca1f8..1dfadc9a 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -985,13 +985,17 @@ $('#refreshModalRefresh').click(function () {
function parseToEditor(data) {
var parsed = toMarkdown(data);
if (parsed)
- editor.replaceRange(parsed, {
- line: 0,
- ch: 0
- }, {
- line: editor.lastLine(),
- ch: editor.lastLine().length
- }, '+input');
+ replaceAll(parsed);
+}
+
+function replaceAll(data) {
+ editor.replaceRange(data, {
+ line: 0,
+ ch: 0
+ }, {
+ line: editor.lastLine(),
+ ch: editor.lastLine().length
+ }, '+input');
}
function importFromUrl(url) {
@@ -1005,7 +1009,11 @@ function importFromUrl(url) {
method: "GET",
url: url,
success: function (data) {
- parseToEditor(data);
+ var extension = url.split('.').pop();
+ if (extension == 'html')
+ parseToEditor(data);
+ else
+ replaceAll(data);
},
error: function () {
alert('Import failed :(');