From a5180135f6e28755066556206a4f67d7bdc39c7f Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Wed, 20 Feb 2019 08:45:55 +0100 Subject: [PATCH] API Improve and Pages class --- bl-kernel/admin/themes/grizzly/html/main.php | 31 +++++----- bl-kernel/admin/themes/grizzly/html/tags.php | 37 ++++++++++-- bl-kernel/admin/themes/grizzly/js/ajax.js | 59 +++++++++++++------- bl-kernel/pages.class.php | 8 +-- bl-plugins/api/plugin.php | 24 +++++--- 5 files changed, 103 insertions(+), 56 deletions(-) diff --git a/bl-kernel/admin/themes/grizzly/html/main.php b/bl-kernel/admin/themes/grizzly/html/main.php index c1f1ca0c..d53fea83 100644 --- a/bl-kernel/admin/themes/grizzly/html/main.php +++ b/bl-kernel/admin/themes/grizzly/html/main.php @@ -36,6 +36,10 @@ function editorInitialize(content) { initialValue: content }); + // Get the tags from the content + // When the content is setted the tags need to be setted + _tags = parser.tags(content); + // Editor event change _editor.codemirror.on("change", function(){ // If the content doesn't changed is not need to autosave @@ -69,28 +73,21 @@ function editorInitialize(content) { }); } -function editorSetContent(text) { - // Get the tags from the content - // When the content is setted the tags need to be setted - _tags = parser.tags(text); - - // Set the current content to the variable - // This variable helps to know when the content was changed - _content = text; - - // Set the new content into the editor - _editor.value(text); -} - function editorGetContent() { return _editor.value(); } +function createPage() { + let response = ajax.createPage(); + response.then(function(key) { + // Log + log('createPage() => ajax.createPage => key',key); + _key = key; + editorInitialize('# Title \n'); + }); +} + // MAIN - -// Init editor area -editorInitialize("# Title \n"); - $(document).ready(function() { showAlert("Welcome to Bludit"); }); diff --git a/bl-kernel/admin/themes/grizzly/html/tags.php b/bl-kernel/admin/themes/grizzly/html/tags.php index 90ded10a..3d944584 100644 --- a/bl-kernel/admin/themes/grizzly/html/tags.php +++ b/bl-kernel/admin/themes/grizzly/html/tags.php @@ -18,14 +18,14 @@ function displayTags() { // Init array for current tags _currentTags = []; // Remove all tags from the