mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 03:06:31 -05:00
Fixed importFromUrl should parse by the file extension, and move to-markdown dependency to bower
This commit is contained in:
parent
2ecec3b59a
commit
473212676a
4 changed files with 19 additions and 701 deletions
|
@ -30,6 +30,7 @@
|
|||
"js-url": "~2.0.2",
|
||||
"socket.io-client": "~1.3.7",
|
||||
"viz.js": "~1.3.0",
|
||||
"js-yaml": "~3.4.6"
|
||||
"js-yaml": "~3.4.6",
|
||||
"to-markdown": "~1.3.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -985,7 +985,11 @@ $('#refreshModalRefresh').click(function () {
|
|||
function parseToEditor(data) {
|
||||
var parsed = toMarkdown(data);
|
||||
if (parsed)
|
||||
editor.replaceRange(parsed, {
|
||||
replaceAll(parsed);
|
||||
}
|
||||
|
||||
function replaceAll(data) {
|
||||
editor.replaceRange(data, {
|
||||
line: 0,
|
||||
ch: 0
|
||||
}, {
|
||||
|
@ -1005,7 +1009,11 @@ function importFromUrl(url) {
|
|||
method: "GET",
|
||||
url: url,
|
||||
success: function (data) {
|
||||
var extension = url.split('.').pop();
|
||||
if (extension == 'html')
|
||||
parseToEditor(data);
|
||||
else
|
||||
replaceAll(data);
|
||||
},
|
||||
error: function () {
|
||||
alert('Import failed :(');
|
||||
|
|
691
public/vendor/to-markdown.js
vendored
691
public/vendor/to-markdown.js
vendored
File diff suppressed because one or more lines are too long
|
@ -35,7 +35,7 @@
|
|||
<script src="/vendor/moment/min/moment-with-locales.js" defer></script>
|
||||
<script src="/vendor/handlebars/handlebars.min.js" defer></script>
|
||||
<script src="/vendor/emojify/js/emojify.js" defer></script>
|
||||
<script src="/vendor/to-markdown.js" defer></script>
|
||||
<script src="/vendor/to-markdown/dist/to-markdown.js" defer></script>
|
||||
<script src="/vendor/raphael-min.js" defer></script>
|
||||
<script src="/vendor/lodash.min.js" defer></script>
|
||||
<script src="/vendor/sequence-diagrams/sequence-diagram-min.js" defer></script>
|
||||
|
|
Loading…
Reference in a new issue