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',
|
'name'=>'content',
|
||||||
'value'=>$_Page->contentRaw(false),
|
'value'=>$_Page->contentRaw(false),
|
||||||
'class'=>'uk-width-1-1 uk-form-large',
|
'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',
|
'name'=>'content',
|
||||||
'value'=>$_Post->contentRaw(false),
|
'value'=>$_Post->contentRaw(false),
|
||||||
'class'=>'uk-width-1-1 uk-form-large',
|
'class'=>'uk-width-1-1 uk-form-large',
|
||||||
'placeholder'=>$L->g('Content')
|
'placeholder'=>''
|
||||||
));
|
));
|
||||||
|
|
||||||
// Form buttons
|
// Form buttons
|
||||||
|
|
|
@ -27,7 +27,7 @@ echo '<div class="uk-width-large-8-10">';
|
||||||
'name'=>'content',
|
'name'=>'content',
|
||||||
'value'=>'',
|
'value'=>'',
|
||||||
'class'=>'uk-width-1-1 uk-form-large',
|
'class'=>'uk-width-1-1 uk-form-large',
|
||||||
'placeholder'=>$L->g('Content')
|
'placeholder'=>''
|
||||||
));
|
));
|
||||||
|
|
||||||
// Form buttons
|
// Form buttons
|
||||||
|
|
|
@ -27,7 +27,7 @@ echo '<div class="uk-width-large-8-10">';
|
||||||
'name'=>'content',
|
'name'=>'content',
|
||||||
'value'=>'',
|
'value'=>'',
|
||||||
'class'=>'uk-width-1-1 uk-form-large',
|
'class'=>'uk-width-1-1 uk-form-large',
|
||||||
'placeholder'=>$L->g('Content')
|
'placeholder'=>''
|
||||||
));
|
));
|
||||||
|
|
||||||
// Form buttons
|
// 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":
|
"plugin-data":
|
||||||
{
|
{
|
||||||
"name": "SimpleMDE",
|
"name": "SimpleMDE",
|
||||||
"description": "A simple, beautiful, and embeddable JavaScript markdown editor by @WesCossick. Adapted by Diego Najar for Bludit.",
|
"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"
|
|
||||||
},
|
},
|
||||||
"toolbar": "Toolbar",
|
"toolbar": "Toolbar",
|
||||||
"tab-size": "Tab size"
|
"tab-size": "Tab size",
|
||||||
|
"autosave": "Autosave"
|
||||||
}
|
}
|
|
@ -2,8 +2,8 @@
|
||||||
"author": "NextStepWebs",
|
"author": "NextStepWebs",
|
||||||
"email": "",
|
"email": "",
|
||||||
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
||||||
"version": "1.9.0",
|
"version": "1.10.0",
|
||||||
"releaseDate": "2015-12-05",
|
"releaseDate": "2015-01-22",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"requires": "Bludit v1.0",
|
"requires": "Bludit v1.0",
|
||||||
"notes": ""
|
"notes": ""
|
||||||
|
|
|
@ -13,7 +13,8 @@ class pluginsimpleMDE extends Plugin {
|
||||||
{
|
{
|
||||||
$this->dbFields = array(
|
$this->dbFields = array(
|
||||||
'tabSize'=>'2',
|
'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 .= '<input name="tabSize" id="jstabSize" type="text" value="'.$this->getDbField('tabSize').'">';
|
||||||
$html .= '</div>';
|
$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;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +83,17 @@ class pluginsimpleMDE extends Plugin {
|
||||||
// Load CSS and JS only on Controllers in array.
|
// Load CSS and JS only on Controllers in array.
|
||||||
if(in_array($layout['controller'], $this->loadWhenController))
|
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();
|
$pluginPath = $this->htmlPath();
|
||||||
|
|
||||||
$html = '<script>'.PHP_EOL;
|
$html = '<script>'.PHP_EOL;
|
||||||
|
@ -100,6 +117,11 @@ class pluginsimpleMDE extends Plugin {
|
||||||
indentWithTabs: true,
|
indentWithTabs: true,
|
||||||
tabSize: '.$this->getDbField('tabSize').',
|
tabSize: '.$this->getDbField('tabSize').',
|
||||||
spellChecker: false,
|
spellChecker: false,
|
||||||
|
autosave: {
|
||||||
|
enabled: '.$autosaveEnable.',
|
||||||
|
uniqueId: "'.$autosaveID.'",
|
||||||
|
delay: 1000,
|
||||||
|
},
|
||||||
toolbar: ['.Sanitize::htmlDecode($this->getDbField('toolbar')).']
|
toolbar: ['.Sanitize::htmlDecode($this->getDbField('toolbar')).']
|
||||||
});';
|
});';
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<section id="intro">
|
<section id="intro">
|
||||||
<header>
|
<header>
|
||||||
<h2><?php echo $Site->title() ?></h2>
|
<h2><?php echo $Site->title() ?></h2>
|
||||||
<p><?php echo $Site->description() ?></p>
|
<p><?php echo $Site->slogan() ?></p>
|
||||||
</header>
|
</header>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue