-
Notifications
You must be signed in to change notification settings - Fork 1
/
converter.html
76 lines (69 loc) · 3.76 KB
/
converter.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html>
<head>
<title>Converter</title>
<script src="to-markdown/to-markdown.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous" defer></script>
<script src="ckeditor/ckeditor.js"></script>
<script src="resize/ResizeSensor.js"></script>
<script src="https://use.fontawesome.com/6146fe9152.js"></script>
<link href='https://fonts.googleapis.com/css?family=Fredoka+One' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Poiret+One' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'>
</head>
<body>
<nav class="navbar navbar-default" role="navigation" id="nav">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#"><span id="text">Text</span> to <span id="markdown">**Markdown**</span></a>
</div>
<ul class="nav navbar-nav navbar-right">
<li><a href="#about" id="github"><i class="fa fa-github" aria-hidden="true" style="padding-right: 3px;"></i>Github</a></li>
</ul>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-md-6 portfolio-item" id="source">
<textarea id="sourceTA" rows="25" name="editor1" placeholder="You can write over here..."></textarea>
</div>
<div class="col-md-6 portfolio-item" id="target">
<textarea id='targetDiv' style="width:100%; overflow: scroll; height: 100vh" readonly></textarea>
</div>
</div>
<script>
CKEDITOR.replace( 'editor1' );
CKEDITOR.config.width = '100%';
CKEDITOR.config.height = window.innerHeight - 170;
CKEDITOR.config.extraPlugins = 'confighelper';
var instance = CKEDITOR.instances.sourceTA;
instance.on( 'change', function() {
instance.updateElement()
try {
var data = instance.getData();
data = toMarkdown(data)
target = document.getElementById('targetDiv')
target.innerHTML = data;
}
catch (ex) { }
});
new ResizeSensor(jQuery('#source'), function() {
var height = document.getElementById('source').clientHeight;
console.log(height);
$('#targetDiv').css("height", height - 20);
});
$(window).resize(function() {
instance.resize(instance.config.width, window.innerHeight - 170, true, false);
});
</script>
</div>
<footer class="footer">
<div class="container">
<p class="text-muted">Made by <a href="http://arunabh98.github.io/" target="_blank">Arunabh Ghosh</a></p>
</div>
</footer>
</body>
</html>