Remove SimpleMDE and include EasyMDE
This commit is contained in:
parent
d1f7e32885
commit
61628ff56d
@ -1,4 +1,5 @@
|
||||
.editor-toolbar { background: #f1f1f1; border-radius: 0 !important; }
|
||||
.editor-toolbar { background: #f1f1f1; border-radius: 0 !important; font-size: 1.5em;}
|
||||
.editor-toolbar::before { margin-bottom: 2px !important }
|
||||
.editor-toolbar::after { margin-top: 2px !important }
|
||||
.CodeMirror, .CodeMirror-scroll { flex:1; border-radius: 0 !important; }
|
||||
.editor-toolbar .fa { color: #555;}
|
7
bl-plugins/easymde/css/easymde.min.css
vendored
Normal file
7
bl-plugins/easymde/css/easymde.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
7
bl-plugins/easymde/js/easymde.min.js
vendored
Normal file
7
bl-plugins/easymde/js/easymde.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "SimpleMDE",
|
||||
"name": "EasyMDE",
|
||||
"description": "Einfacher Editor auf der Grundlage der Auszeichnungssprache Markdown."
|
||||
},
|
||||
"toolbar": "Werkzeugleiste",
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "SimpleMDE",
|
||||
"name": "EasyMDE",
|
||||
"description": "Einfacher Editor auf der Grundlage der Auszeichnungssprache Markdown."
|
||||
},
|
||||
"toolbar": "Werkzeugleiste",
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "SimpleMDE",
|
||||
"name": "EasyMDE",
|
||||
"description": "Markdown editor, cleaned interface to create markup language."
|
||||
},
|
||||
"toolbar": "Toolbar",
|
||||
@ -9,4 +9,4 @@
|
||||
"autosave": "Autosave",
|
||||
"spell-checker": "Spell Checker",
|
||||
"content-here-supports-markdown-and-html-code": "Content here supports Markdown and HTML code"
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "SimpleMDE",
|
||||
"name": "EasyMDE",
|
||||
"description": "Editor Markdown, interfaz limpia para crear lenguaje de marcado."
|
||||
},
|
||||
"toolbar": "Barra de herramientas",
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "SimpleMDE",
|
||||
"name": "EasyMDE",
|
||||
"description": "ویرایشگر Markdown، رابط ساده برای ایجاد زبان markup."
|
||||
},
|
||||
"toolbar": "نوار ابزار",
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "SimpleMDE",
|
||||
"name": "EasyMDE",
|
||||
"description": "Éditeur Markdown avec une interface d’écriture épurée, pour créer le langage de balisage sémantique."
|
||||
},
|
||||
"toolbar": "Barre d’outils",
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "SimpleMDE",
|
||||
"name": "EasyMDE",
|
||||
"description": "Editor Markdown, interfaccia pulita per creare linguaggio markup."
|
||||
},
|
||||
"toolbar": "Barra degli strumenti",
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "SimpleMDE",
|
||||
"name": "EasyMDE",
|
||||
"description": "Markdown-editor om inhoud te verwerken in de Markdown opmaaktaal."
|
||||
},
|
||||
"toolbar": "Werkbalk",
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "SimpleMDE",
|
||||
"name": "EasyMDE",
|
||||
"description": "Редактор с простым интерфейсом для создания markup разметки."
|
||||
},
|
||||
"toolbar": "Панель инструментов",
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "SimpleMDE",
|
||||
"name": "EasyMDE",
|
||||
"description": "Markdown editörü, işaretleme dili oluşturmak için temizlenmiş bir arayüz."
|
||||
},
|
||||
"toolbar": "Araç çubuğu",
|
10
bl-plugins/easymde/metadata.json
Normal file
10
bl-plugins/easymde/metadata.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"author": "EasyMDE",
|
||||
"email": "",
|
||||
"website": "https://easymde.tk",
|
||||
"version": "2.6.0",
|
||||
"releaseDate": "2019-04-15",
|
||||
"license": "MIT",
|
||||
"compatible": "3.9.0",
|
||||
"notes": ""
|
||||
}
|
123
bl-plugins/easymde/plugin.php
Normal file
123
bl-plugins/easymde/plugin.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
class plugineasyMDE extends Plugin {
|
||||
|
||||
// The plugin is going to be loaded in this views
|
||||
private $loadOnViews = array(
|
||||
'new-content',
|
||||
'edit-content'
|
||||
);
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'tabSize'=>'2',
|
||||
'toolbar'=>'"bold", "italic", "heading", "|", "quote", "unordered-list", "|", "link", "image", "code", "horizontal-rule", "|", "preview", "side-by-side", "fullscreen"',
|
||||
'spellChecker'=>true
|
||||
);
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $L;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label>'.$L->get('toolbar').'</label>';
|
||||
$html .= '<input name="toolbar" id="jstoolbar" type="text" value="'.$this->getValue('toolbar').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('tab-size').'</label>';
|
||||
$html .= '<input name="tabSize" id="jstabSize" type="text" value="'.$this->getValue('tabSize').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('spell-checker').'</label>';
|
||||
$html .= '<select name="spellChecker">';
|
||||
$html .= '<option value="true" '.($this->getValue('spellChecker')===true?'selected':'').'>'.$L->get('enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('spellChecker')===false?'selected':'').'>'.$L->get('disabled').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function adminHead()
|
||||
{
|
||||
if (!in_array($GLOBALS['ADMIN_VIEW'], $this->loadOnViews)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Include plugin's CSS files
|
||||
$html = $this->includeCSS('easymde.min.css');
|
||||
$html .= $this->includeCSS('bludit.css');
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function adminBodyEnd()
|
||||
{
|
||||
if (!in_array($GLOBALS['ADMIN_VIEW'], $this->loadOnViews)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Language
|
||||
global $L;
|
||||
$langImage = $L->g('Image description');
|
||||
|
||||
$spellCheckerEnable = $this->getValue('spellChecker')?'true':'false';
|
||||
$tabSize = $this->getValue('tabSize');
|
||||
$toolbar = Sanitize::htmlDecode($this->getValue('toolbar'));
|
||||
$pageBreak = PAGE_BREAK;
|
||||
|
||||
// Javascript path and file
|
||||
$jsEasyMDE = $this->domainPath().'js/easymde.min.js?version='.BLUDIT_VERSION;
|
||||
|
||||
return <<<EOF
|
||||
<script charset="utf-8" src="$jsEasyMDE"></script>
|
||||
<script>
|
||||
var easymde = null;
|
||||
|
||||
// Insert an image in the editor at the cursor position
|
||||
// Function required for Bludit
|
||||
function editorInsertMedia(filename) {
|
||||
var text = easymde.value();
|
||||
easymde.value(text + "![$langImage]("+filename+")" + "\\n");
|
||||
easymde.codemirror.refresh();
|
||||
}
|
||||
|
||||
// Returns the content of the editor
|
||||
// Function required for Bludit
|
||||
function editorGetContent() {
|
||||
return easymde.value();
|
||||
}
|
||||
|
||||
easymde = new EasyMDE({
|
||||
element: document.getElementById("jseditor"),
|
||||
status: false,
|
||||
toolbarTips: true,
|
||||
toolbarGuideIcon: true,
|
||||
autofocus: false,
|
||||
placeholder: "",
|
||||
lineWrapping: true,
|
||||
autoDownloadFontAwesome: false,
|
||||
indentWithTabs: true,
|
||||
tabSize: $tabSize,
|
||||
spellChecker: $spellCheckerEnable,
|
||||
toolbar: [$toolbar,
|
||||
"|",
|
||||
{
|
||||
name: "pageBreak",
|
||||
action: function addPageBreak(editor){
|
||||
var cm = editor.codemirror;
|
||||
output = "$pageBreak";
|
||||
cm.replaceSelection(output);
|
||||
},
|
||||
className: "fa fa-crop",
|
||||
title: "Page break",
|
||||
}]
|
||||
});
|
||||
|
||||
</script>
|
||||
EOF;
|
||||
}
|
||||
}
|
7
bl-plugins/simplemde/css/simplemde.min.css
vendored
7
bl-plugins/simplemde/css/simplemde.min.css
vendored
File diff suppressed because one or more lines are too long
@ -1,40 +0,0 @@
|
||||
This version of SimpleMDE have a little changes for Bludit.
|
||||
|
||||
--- Image preview hack ---
|
||||
|
||||
Original
|
||||
<img src="'+e+'"
|
||||
|
||||
Bludit hack
|
||||
<img src="'+HTML_PATH_UPLOADS+e+'"
|
||||
|
||||
|
||||
--- HTTP for HTTPS ---
|
||||
Original
|
||||
http://
|
||||
|
||||
Bludit hack
|
||||
https://
|
||||
|
||||
--- Icons ---
|
||||
|
||||
fa-quote-left
|
||||
oi-double-quote-serif-left
|
||||
|
||||
fa-list-ul
|
||||
oi-list
|
||||
|
||||
oi-link
|
||||
oi-link-intact
|
||||
|
||||
fa-picture-o
|
||||
oi-image
|
||||
|
||||
fa-columns
|
||||
oi-browser
|
||||
|
||||
fa-arrows-alt
|
||||
oi-fullscreen-enter
|
||||
|
||||
fa fa-
|
||||
fa fa-
|
15
bl-plugins/simplemde/js/simplemde.min.js
vendored
15
bl-plugins/simplemde/js/simplemde.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,10 +0,0 @@
|
||||
{
|
||||
"author": "Sparksuite",
|
||||
"email": "",
|
||||
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
||||
"version": "1.11.2",
|
||||
"releaseDate": "2016-06-14",
|
||||
"license": "MIT",
|
||||
"compatible": "3.9.0",
|
||||
"notes": ""
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?php
|
||||
|
||||
class pluginsimpleMDE extends Plugin {
|
||||
|
||||
private $loadOnController = array(
|
||||
'new-content',
|
||||
'edit-content'
|
||||
);
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'tabSize'=>'2',
|
||||
'toolbar'=>'"bold", "italic", "heading", "|", "quote", "unordered-list", "|", "link", "image", "code", "horizontal-rule", "|", "preview", "side-by-side", "fullscreen"',
|
||||
'spellChecker'=>true
|
||||
);
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $L;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label>'.$L->get('toolbar').'</label>';
|
||||
$html .= '<input name="toolbar" id="jstoolbar" type="text" value="'.$this->getValue('toolbar').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('tab-size').'</label>';
|
||||
$html .= '<input name="tabSize" id="jstabSize" type="text" value="'.$this->getValue('tabSize').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('spell-checker').'</label>';
|
||||
$html .= '<select name="spellChecker">';
|
||||
$html .= '<option value="true" '.($this->getValue('spellChecker')===true?'selected':'').'>'.$L->get('enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('spellChecker')===false?'selected':'').'>'.$L->get('disabled').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function adminHead()
|
||||
{
|
||||
if (!in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Include plugin's CSS files
|
||||
$html = $this->includeCSS('simplemde.min.css');
|
||||
$html .= $this->includeCSS('bludit.css');
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function adminBodyEnd()
|
||||
{
|
||||
global $L;
|
||||
|
||||
if (!in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Spell Checker
|
||||
$spellCheckerEnable = $this->getValue('spellChecker')?'true':'false';
|
||||
|
||||
// Include plugin's Javascript files
|
||||
$html = $this->includeJS('simplemde.min.js');
|
||||
$html .= '<script>'.PHP_EOL;
|
||||
$html .= 'var simplemde = null;'.PHP_EOL;
|
||||
|
||||
// Include add content to the editor
|
||||
$html .= 'function addContentSimpleMDE(content) {
|
||||
var text = simplemde.value();
|
||||
simplemde.value(text + content + "\n");
|
||||
simplemde.codemirror.refresh();
|
||||
}'.PHP_EOL;
|
||||
|
||||
// Returns the content of the editor
|
||||
// Function required for Bludit
|
||||
$html .= 'function editorGetContent(content) {
|
||||
return simplemde.value();
|
||||
}'.PHP_EOL;
|
||||
|
||||
// Insert an image in the editor at the cursor position
|
||||
// Function required for Bludit
|
||||
$html .= 'function editorInsertMedia(filename) {
|
||||
addContentSimpleMDE("!['.$L->get('Image description').']("+filename+")");
|
||||
}'.PHP_EOL;
|
||||
|
||||
//$html .= '$(document).ready(function() { '.PHP_EOL;
|
||||
$html .= 'simplemde = new SimpleMDE({
|
||||
element: document.getElementById("jseditor"),
|
||||
status: false,
|
||||
toolbarTips: true,
|
||||
toolbarGuideIcon: true,
|
||||
autofocus: false,
|
||||
placeholder: "'.$L->get('content-here-supports-markdown-and-html-code').'",
|
||||
lineWrapping: true,
|
||||
autoDownloadFontAwesome: false,
|
||||
indentWithTabs: true,
|
||||
tabSize: '.$this->getValue('tabSize').',
|
||||
spellChecker: '.$spellCheckerEnable.',
|
||||
toolbar: ['.Sanitize::htmlDecode($this->getValue('toolbar')).',
|
||||
"|",
|
||||
{
|
||||
name: "pageBreak",
|
||||
action: function addPageBreak(editor){
|
||||
var cm = editor.codemirror;
|
||||
output = "\n'.PAGE_BREAK.'\n";
|
||||
cm.replaceSelection(output);
|
||||
},
|
||||
className: "fa fa-crop",
|
||||
title: "'.$L->get('Pagebreak').'",
|
||||
}]
|
||||
});';
|
||||
$html .= '</script>';
|
||||
return $html;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user