Skip to content

Commit 7b07305

Browse files
committed
version 1.0
1 parent 2e41b82 commit 7b07305

File tree

3 files changed

+31
-26
lines changed

3 files changed

+31
-26
lines changed

dist/codeparl-bootstrap-markdown-editor.min.js

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/codeparl-bootstrap-markdown-editor.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,9 @@
504504
},
505505

506506
markdownContent: function(markdown) {
507+
console.log(aceEditor);
507508
if (!markdown) {
508-
return aceEditor.session.getvalue();
509+
return aceEditor.getValue();
509510
} else {
510511
aceEditor.session.setValue(markdown);
511512
aceEditor.clearSelection();
@@ -518,23 +519,26 @@
518519
var html = converter.makeHtml(aceEditor.session.getValue());
519520
return html;
520521
},
521-
preview: function(html) {
522-
options = $.fn.codeparlMarkdown.defaults;
523-
//add the preview panel
524-
$container = this.parent();
525-
$preview = $('<div>').addClass('cpme-preview markdown-body overflow-auto p-2 bg-white border')
526-
.appendTo($container).css({
527-
height: options.editor.editorHeight
528-
});
529-
530-
531-
this.html($preview.html(disableJs(html)));
522+
preview: function(markdown,options) {
523+
if(markdown){
524+
options = $.extend(true, {},$.fn.codeparlMarkdown.defaults, options);
525+
//add the preview panel
526+
$container = this.parent();
527+
$preview = $('<div>').addClass('cpme-preview markdown-body overflow-auto p-2 bg-white border')
528+
.appendTo($container).css({
529+
height: options.editorHeight,
530+
width: options.editorWidth
531+
});
532+
if (markdown.trim().length > 0) {
533+
var html = converter.makeHtml(markdown || '');
534+
this.html($preview.html(disableJs(html)));
535+
}
536+
}
532537

533538
},
534539
destroy: function() {}
535540
};
536541

537-
538542
//bind our plugin with jquery
539543

540544
$.fn.codeparlMarkdown = function(options) {

test/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<link rel="stylesheet" href="../src/codeparl-bootstrap-markdown-editor.min.css">
1212

1313
<title>CodeParl bootstrap markdown editor </title>
14+
1415
</head>
1516

1617
<body>

0 commit comments

Comments
 (0)