Skip to content

Commit

Permalink
Merge branch 'feature/strict-markdown'
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasDoebertin committed May 21, 2015
2 parents 5d2e570 + 98302f7 commit 7bcab46
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 16 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## Version 1.3.1

**Features:**

* Respect the new (Kirby 2.1) strict markdown mode

**Special Thanks:**

* @shoesforindustry for bringing this to my attention

## Version 1.3.0

**Features:**
Expand Down
2 changes: 1 addition & 1 deletion assets/css/visualmarkdown.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Visual Markdown Editor Field for Kirby 2
*
* @version 1.3.0
* @version 1.3.1
* @author Jonas Döbertin <[email protected]>
* @copyright Jonas Döbertin <[email protected]>
* @link https://github.com/JonasDoebertin/kirby-visual-markdown
Expand Down
2 changes: 1 addition & 1 deletion assets/js/kirbytags-mode.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Visual Markdown Editor Field for Kirby 2
*
* @version 1.3.0
* @version 1.3.1
* @author Jonas Döbertin <[email protected]>
* @copyright Jonas Döbertin <[email protected]>
* @link https://github.com/JonasDoebertin/kirby-visual-markdown
Expand Down
15 changes: 12 additions & 3 deletions assets/js/visualmarkdowneditor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Visual Markdown Editor Field for Kirby 2
*
* @version 1.3.0
* @version 1.3.1
* @author Jonas Döbertin <[email protected]>
* @copyright Jonas Döbertin <[email protected]>
* @link https://github.com/JonasDoebertin/kirby-visual-markdown
Expand Down Expand Up @@ -29,6 +29,7 @@ var VisualMarkdownEditor = function($, $element, options) {
toolbar: true,
header1: 'h1',
header2: 'h2',
kirbytext: true,
codemirror: {
theme: 'visualmarkdown',
tabSize: 4,
Expand Down Expand Up @@ -83,10 +84,18 @@ var VisualMarkdownEditor = function($, $element, options) {
self.insertBefore('* ', 2);
},
link: function () {
self.insertAround('(link: http:// text: ', ')');
if(self.options.kirbytext) {
self.insertAround('(link: http:// text: ', ')');
} else {
self.insertAround('[', '](http://)');
}
},
image: function () {
self.insertBefore('(image: filename.jpg)');
if(self.options.kirbytext) {
self.insertBefore('(image: filename.jpg)');
} else {
self.insertBefore('![alt text](http://)');
}
},
line: function() {
self.insert('****');
Expand Down
11 changes: 6 additions & 5 deletions assets/js/visualmarkdownfield.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Visual Markdown Editor Field for Kirby 2
*
* @version 1.3.0
* @version 1.3.1
* @author Jonas Döbertin <[email protected]>
* @copyright Jonas Döbertin <[email protected]>
* @link https://github.com/JonasDoebertin/kirby-visual-markdown
Expand All @@ -27,10 +27,11 @@ var VisualMarkdownField = function($, $field) {
this.editor = null;

this.options = {
toolbar: $field.data('toolbar'),
header1: $field.data('header1'),
header2: $field.data('header2'),
tools: $field.data('tools').split(',')
toolbar: $field.data('toolbar'),
header1: $field.data('header1'),
header2: $field.data('header2'),
tools: $field.data('tools').split(','),
kirbytext: $field.data('kirbytext')
};

/**
Expand Down
13 changes: 7 additions & 6 deletions markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Visual Markdown Editor Field for Kirby 2
*
* @version 1.3.0
* @version 1.3.1
* @author Jonas Döbertin <[email protected]>
* @copyright Jonas Döbertin <[email protected]>
* @link https://github.com/JonasDoebertin/kirby-visual-markdown
Expand Down Expand Up @@ -279,11 +279,12 @@ public function input()
$input->removeAttr('value');
$input->html($this->value() ?: false);
$input->data(array(
'field' => 'markdownfield',
'toolbar' => ($this->toolbar) ? 'true' : 'false',
'tools' => implode(',', $this->tools),
'header1' => $this->header1,
'header2' => $this->header2,
'field' => 'markdownfield',
'toolbar' => ($this->toolbar) ? 'true' : 'false',
'tools' => implode(',', $this->tools),
'header1' => $this->header1,
'header2' => $this->header2,
'kirbytext' => (c::get('panel.kirbytext', true)) ? 'true' : 'false',
));

// Set up wrapping element
Expand Down

0 comments on commit 7bcab46

Please sign in to comment.