Clean up and Quill editor fixes

This commit is contained in:
Diego Najar 2018-07-03 23:04:08 +02:00
parent be555b289b
commit 8652daadf0
27 changed files with 85 additions and 61 deletions

View File

@ -51,6 +51,12 @@
'name'=>'coverImage',
'value'=>$page->coverImage()
));
// Content
echo Bootstrap::formInputHidden(array(
'name'=>'content',
'value'=>$page->contentRaw(false)
));
?>
<!-- TABS CONTENT -->
@ -61,11 +67,11 @@
</div>
<div class="form-group mt-1">
<div id="jscontent" name="content"><?php echo $page->contentRaw(false) ?></div>
<textarea id="jseditor"></textarea>
</div>
<div class="form-group mt-2">
<button id="jsbuttonSave" type="submit" class="btn btn-primary"><?php echo $L->g('Publish') ?></button>
<button id="jsbuttonSave" type="button" class="btn btn-primary"><?php echo $L->g('Publish') ?></button>
<button id="jsbuttonDraft" type="button" class="btn btn-secondary"><?php echo $L->g('Save as draft') ?></button>
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary"><?php echo $L->g('Cancel') ?></a>
</div>
@ -203,12 +209,14 @@ $(document).ready(function() {
// Button Save
$("#jsbuttonSave").on("click", function() {
$("#jsstatus").val("published");
$("#jscontent").val( editorGetContent() );
$("#jsform").submit();
});
// Button Save as draft
$("#jsbuttonDraft").on("click", function() {
$("#jsstatus").val("draft");
$("#jscontent").val( editorGetContent() );
$("#jsform").submit();
});
@ -224,13 +232,13 @@ $(document).ready(function() {
});
// Generate slug when the user type the title
$("#jstitle").keyup(function() {
var text = $(this).val();
var parent = $("#jsparent").val();
var currentKey = "";
var ajax = new bluditAjax();
ajax.generateSlug(text, parent, currentKey, $("#jsslug"));
});
// $("#jstitle").keyup(function() {
// var text = $(this).val();
// var parent = $("#jsparent").val();
// var currentKey = "";
// var ajax = new bluditAjax();
// ajax.generateSlug(text, parent, currentKey, $("#jsslug"));
// });
// Autosave interval
setInterval(function() {

View File

@ -45,6 +45,12 @@
'name'=>'coverImage',
'value'=>''
));
// Content
echo Bootstrap::formInputHidden(array(
'name'=>'content',
'value'=>''
));
?>
<!-- TABS CONTENT -->
@ -55,11 +61,11 @@
</div>
<div class="form-group mt-1">
<div id="jscontent" name="content"></div>
<textarea id="jseditor"></textarea>
</div>
<div class="form-group mt-2">
<button id="jsbuttonSave" type="submit" class="btn btn-primary"><?php echo $L->g('Publish') ?></button>
<button id="jsbuttonSave" type="button" class="btn btn-primary"><?php echo $L->g('Publish') ?></button>
<button id="jsbuttonDraft" type="button" class="btn btn-secondary"><?php echo $L->g('Save as draft') ?></button>
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary"><?php echo $L->g('Cancel') ?></a>
</div>
@ -186,12 +192,14 @@ $(document).ready(function() {
// Button Save
$("#jsbuttonSave").on("click", function() {
$("#jsstatus").val("published");
$("#jscontent").val( editorGetContent() );
$("#jsform").submit();
});
// Button Save as draft
$("#jsbuttonDraft").on("click", function() {
$("#jsstatus").val("draft");
$("#jscontent").val( editorGetContent() );
$("#jsform").submit();
});

View File

@ -129,9 +129,9 @@ class Text {
global $Language;
if (EXTREME_FRIENDLY_URL) {
$string = trim($string, '-');
$string = self::lowercase($string);
$string = preg_replace("/[\/_|+ -]+/", $separator, $string);
$string = preg_replace("/[\/_|+:!@#$%^&*(). -]+/", $separator, $string);
$string = trim($string, '-');
return $string;
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -51,7 +51,10 @@ function editorGetContent() {
$(document).ready(function() {
quill = new Quill("#jscontent", {
var content = $("#jscontent").val();
$("#jseditor").replaceWith("<div id=\"jseditor\">"+content+"</div>");
quill = new Quill("#jseditor", {
modules: {
toolbar: [
[{ header: [1, 2, false] }],

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -5,6 +5,6 @@
"version": "1.11.2",
"releaseDate": "2016-06-14",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -99,20 +99,25 @@ class pluginsimpleMDE extends Plugin {
simplemde.value(text + content + "\n");
}'.PHP_EOL;
// This function is necesary on each Editor, it is used by Bludit Images v8.
$html .= 'function editorAddImage(filename) {
// Function required for Autosave function
$html .= 'function editorGetContent(content) {
return simplemde.value();
}'.PHP_EOL;
// Function required for Media Manager to insert a file on the editor
$html .= 'function editorInsertMedia(filename) {
addContentSimpleMDE("!['.$Language->get('Image description').']("+filename+")");
}'.PHP_EOL;
$html .= '$(document).ready(function() { '.PHP_EOL;
$html .= '
var content = $("#jscontent").html();
$("#jscontent").replaceWith("<textarea id=\"jscontent\" name=\"content\">"+content+"</textarea>");
var content = $("#jscontent").val();
simplemde = new SimpleMDE({
element: document.getElementById("jscontent"),
element: document.getElementById("jseditor"),
status: false,
initialValue: content,
toolbarTips: true,
toolbarGuideIcon: true,
autofocus: false,

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-03-07",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -5,6 +5,6 @@
"version": "4.7.5",
"releaseDate": "2018-01-22",
"license": "GPL v2",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://themes.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-02-20",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://themes.bludit.com",
"version": "2.3",
"version": "3.0",
"releaseDate": "2018-02-20",
"license": "MIT",
"compatible": "2.3",
"compatible": "3.0",
"notes": ""
}