Simplemde autosave
This commit is contained in:
parent
80a6b148c6
commit
8b65fecfb0
|
@ -33,7 +33,7 @@ echo '<div class="uk-width-large-8-10">';
|
|||
'name'=>'content',
|
||||
'value'=>$_Page->contentRaw(false),
|
||||
'class'=>'uk-width-1-1 uk-form-large',
|
||||
'placeholder'=>$L->g('Content')
|
||||
'placeholder'=>''
|
||||
));
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ echo '<div class="uk-width-large-8-10">';
|
|||
'name'=>'content',
|
||||
'value'=>$_Post->contentRaw(false),
|
||||
'class'=>'uk-width-1-1 uk-form-large',
|
||||
'placeholder'=>$L->g('Content')
|
||||
'placeholder'=>''
|
||||
));
|
||||
|
||||
// Form buttons
|
||||
|
|
|
@ -27,7 +27,7 @@ echo '<div class="uk-width-large-8-10">';
|
|||
'name'=>'content',
|
||||
'value'=>'',
|
||||
'class'=>'uk-width-1-1 uk-form-large',
|
||||
'placeholder'=>$L->g('Content')
|
||||
'placeholder'=>''
|
||||
));
|
||||
|
||||
// Form buttons
|
||||
|
|
|
@ -27,7 +27,7 @@ echo '<div class="uk-width-large-8-10">';
|
|||
'name'=>'content',
|
||||
'value'=>'',
|
||||
'class'=>'uk-width-1-1 uk-form-large',
|
||||
'placeholder'=>$L->g('Content')
|
||||
'placeholder'=>''
|
||||
));
|
||||
|
||||
// Form buttons
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2,13 +2,9 @@
|
|||
"plugin-data":
|
||||
{
|
||||
"name": "SimpleMDE",
|
||||
"description": "A simple, beautiful, and embeddable JavaScript markdown editor by @WesCossick. Adapted by Diego Najar for Bludit.",
|
||||
"author": "NextStepWebs",
|
||||
"email": "",
|
||||
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
||||
"version": "1.8.1",
|
||||
"releaseDate": "2015-11-13"
|
||||
"description": "A simple, beautiful, and embeddable JavaScript markdown editor by @WesCossick. Adapted by Diego Najar for Bludit."
|
||||
},
|
||||
"toolbar": "Toolbar",
|
||||
"tab-size": "Tab size"
|
||||
"tab-size": "Tab size",
|
||||
"autosave": "Autosave"
|
||||
}
|
|
@ -2,8 +2,8 @@
|
|||
"author": "NextStepWebs",
|
||||
"email": "",
|
||||
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
||||
"version": "1.9.0",
|
||||
"releaseDate": "2015-12-05",
|
||||
"version": "1.10.0",
|
||||
"releaseDate": "2015-01-22",
|
||||
"license": "MIT",
|
||||
"requires": "Bludit v1.0",
|
||||
"notes": ""
|
||||
|
|
|
@ -13,7 +13,8 @@ class pluginsimpleMDE extends Plugin {
|
|||
{
|
||||
$this->dbFields = array(
|
||||
'tabSize'=>'2',
|
||||
'toolbar'=>'"bold", "italic", "heading", "|", "quote", "unordered-list", "|", "link", "image", "code", "horizontal-rule", "|", "preview", "side-by-side", "fullscreen", "guide"'
|
||||
'toolbar'=>'"bold", "italic", "heading", "|", "quote", "unordered-list", "|", "link", "image", "code", "horizontal-rule", "|", "preview", "side-by-side", "fullscreen", "guide"',
|
||||
'autosave'=>false
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -31,6 +32,11 @@ class pluginsimpleMDE extends Plugin {
|
|||
$html .= '<input name="tabSize" id="jstabSize" type="text" value="'.$this->getDbField('tabSize').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<input name="autosave" id="jsautosave" type="checkbox" value="true" '.($this->getDbField('autosave')?'checked':'').'>';
|
||||
$html .= '<label class="forCheckbox" for="jsautosave">'.$Language->get('Autosave').'</label>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
@ -77,6 +83,17 @@ class pluginsimpleMDE extends Plugin {
|
|||
// Load CSS and JS only on Controllers in array.
|
||||
if(in_array($layout['controller'], $this->loadWhenController))
|
||||
{
|
||||
// Autosave
|
||||
global $_Page, $_Post;
|
||||
$autosaveID = $layout['controller'];
|
||||
$autosaveEnable = $this->getDbField('autosave')?'true':'false';
|
||||
if(isset($_Page)) {
|
||||
$autosaveID = $_Page->key();
|
||||
}
|
||||
if(isset($_Post)) {
|
||||
$autosaveID = $_Post->key();
|
||||
}
|
||||
|
||||
$pluginPath = $this->htmlPath();
|
||||
|
||||
$html = '<script>'.PHP_EOL;
|
||||
|
@ -100,6 +117,11 @@ class pluginsimpleMDE extends Plugin {
|
|||
indentWithTabs: true,
|
||||
tabSize: '.$this->getDbField('tabSize').',
|
||||
spellChecker: false,
|
||||
autosave: {
|
||||
enabled: '.$autosaveEnable.',
|
||||
uniqueId: "'.$autosaveID.'",
|
||||
delay: 1000,
|
||||
},
|
||||
toolbar: ['.Sanitize::htmlDecode($this->getDbField('toolbar')).']
|
||||
});';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<section id="intro">
|
||||
<header>
|
||||
<h2><?php echo $Site->title() ?></h2>
|
||||
<p><?php echo $Site->description() ?></p>
|
||||
<p><?php echo $Site->slogan() ?></p>
|
||||
</header>
|
||||
</section>
|
||||
|
||||
|
|
Loading…
Reference in New Issue