Quill improves, parsedonw updated, rss updated

This commit is contained in:
Diego 2017-05-04 20:35:05 +02:00
parent ce438a8e02
commit 182d1a6c04
4 changed files with 48 additions and 55 deletions

View File

@ -92,7 +92,7 @@ function buildPost($key)
return $Post; return $Post;
} }
function buildPostsForPage($pageNumber=0, $amount=POSTS_PER_PAGE_ADMIN, $removeUnpublished=true, $key, $type='tag') function buildPostsForPage($pageNumber=0, $amount=POSTS_PER_PAGE_ADMIN, $removeUnpublished=true, $key=false, $type='tag')
{ {
global $dbPosts; global $dbPosts;
global $dbTags; global $dbTags;

View File

@ -17,7 +17,7 @@ class Parsedown
{ {
# ~ # ~
const version = '1.6.0'; const version = '1.6.2';
# ~ # ~
@ -115,7 +115,7 @@ class Parsedown
# Blocks # Blocks
# #
private function lines(array $lines) protected function lines(array $lines)
{ {
$CurrentBlock = null; $CurrentBlock = null;
@ -175,7 +175,7 @@ class Parsedown
} }
else else
{ {
if (method_exists($this, 'block'.$CurrentBlock['type'].'Complete')) if ($this->isBlockCompletable($CurrentBlock['type']))
{ {
$CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock); $CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock);
} }
@ -216,7 +216,7 @@ class Parsedown
$Block['identified'] = true; $Block['identified'] = true;
} }
if (method_exists($this, 'block'.$blockType.'Continue')) if ($this->isBlockContinuable($blockType))
{ {
$Block['continuable'] = true; $Block['continuable'] = true;
} }
@ -245,7 +245,7 @@ class Parsedown
# ~ # ~
if (isset($CurrentBlock['continuable']) and method_exists($this, 'block'.$CurrentBlock['type'].'Complete')) if (isset($CurrentBlock['continuable']) and $this->isBlockCompletable($CurrentBlock['type']))
{ {
$CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock); $CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock);
} }
@ -278,6 +278,16 @@ class Parsedown
return $markup; return $markup;
} }
protected function isBlockContinuable($Type)
{
return method_exists($this, 'block'.$Type.'Continue');
}
protected function isBlockCompletable($Type)
{
return method_exists($this, 'block'.$Type.'Complete');
}
# #
# Code # Code
@ -438,7 +448,7 @@ class Parsedown
return $Block; return $Block;
} }
$Block['element']['text']['text'] .= "\n".$Line['body'];; $Block['element']['text']['text'] .= "\n".$Line['body'];
return $Block; return $Block;
} }
@ -505,6 +515,16 @@ class Parsedown
), ),
); );
if($name === 'ol')
{
$listStart = stristr($matches[0], '.', true);
if($listStart !== '1')
{
$Block['element']['attributes'] = array('start' => $listStart);
}
}
$Block['li'] = array( $Block['li'] = array(
'name' => 'li', 'name' => 'li',
'handler' => 'li', 'handler' => 'li',
@ -1184,7 +1204,7 @@ class Parsedown
$remainder = $Excerpt['text']; $remainder = $Excerpt['text'];
if (preg_match('/\[((?:[^][]|(?R))*)\]/', $remainder, $matches)) if (preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches))
{ {
$Element['text'] = $matches[1]; $Element['text'] = $matches[1];
@ -1197,7 +1217,7 @@ class Parsedown
return; return;
} }
if (preg_match('/^[(]((?:[^ ()]|[(][^ )]+[)])+)(?:[ ]+("[^"]*"|\'[^\']*\'))?[)]/', $remainder, $matches)) if (preg_match('/^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*"|\'[^\']*\'))?\s*[)]/', $remainder, $matches))
{ {
$Element['attributes']['href'] = $matches[1]; $Element['attributes']['href'] = $matches[1];
@ -1519,10 +1539,10 @@ class Parsedown
'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing', 'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing',
'i', 'rp', 'del', 'code', 'strike', 'marquee', 'i', 'rp', 'del', 'code', 'strike', 'marquee',
'q', 'rt', 'ins', 'font', 'strong', 'q', 'rt', 'ins', 'font', 'strong',
's', 'tt', 'sub', 'mark', 's', 'tt', 'kbd', 'mark',
'u', 'xm', 'sup', 'nobr', 'u', 'xm', 'sub', 'nobr',
'var', 'ruby', 'sup', 'ruby',
'wbr', 'span', 'var', 'span',
'time', 'wbr', 'time',
); );
} }

View File

@ -11,12 +11,7 @@ class pluginQuill extends Plugin {
public function init() public function init()
{ {
$this->dbFields = array( return false;
'tabSize'=>'2',
'toolbar'=>'"bold", "italic", "heading", "|", "quote", "unordered-list", "|", "link", "image", "code", "horizontal-rule", "|", "preview", "side-by-side", "fullscreen", "guide"',
'autosave'=>0,
'spellChecker'=>0
);
} }
// Returns true if the plugins is loaded on the controller defined // Returns true if the plugins is loaded on the controller defined
@ -37,35 +32,6 @@ class pluginQuill extends Plugin {
return $html; return $html;
} }
public function form()
{
global $Language;
$html = '<div>';
$html .= '<label>'.$Language->get('Toolbar').'</label>';
$html .= '<input name="toolbar" id="jstoolbar" type="text" value="'.$this->getDbField('toolbar').'">';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$Language->get('Tab size').'</label>';
$html .= '<input name="tabSize" id="jstabSize" type="text" value="'.$this->getDbField('tabSize').'">';
$html .= '</div>';
$html .= '<div>';
$html .= '<input type="hidden" name="autosave" value="0">';
$html .= '<input name="autosave" id="jsautosave" type="checkbox" value="1" '.($this->getDbField('autosave')?'checked':'').'>';
$html .= '<label class="forCheckbox" for="jsautosave">'.$Language->get('Autosave').'</label>';
$html .= '</div>';
$html .= '<div>';
$html .= '<input type="hidden" name="spellChecker" value="0">';
$html .= '<input name="spellChecker" id="jsspellChecker" type="checkbox" value="1" '.($this->getDbField('spellChecker')?'checked':'').'>';
$html .= '<label class="forCheckbox" for="jsspellChecker">'.$Language->get('spell-checker').'</label>';
$html .= '</div>';
return $html;
}
public function adminBodyEnd() public function adminBodyEnd()
{ {
global $layout; global $layout;
@ -74,9 +40,11 @@ class pluginQuill extends Plugin {
$html = ''; $html = '';
if( $this->enabled() ) { if( $this->enabled() ) {
$html .= ' $html .= '
<script> <script>
var quill = new Quill("#editor-container", { $("#jscontent").hide().after("<div id=\"quillcontent\"></div>");
var quill = new Quill("#quillcontent", {
modules: { modules: {
toolbar: [ toolbar: [
[{ header: [1, 2, false] }], [{ header: [1, 2, false] }],
@ -84,10 +52,15 @@ var quill = new Quill("#editor-container", {
["image"] ["image"]
] ]
}, },
placeholder: "asd",
theme: "snow" theme: "snow"
}); });
</script>
$(".uk-form").submit(function( event ) {
$("#jscontent").val(quill.root.innerHTML);
return true;
});
</script>
'; ';
} }