From 5e100dd0f57ccb6495274ba042e70556060d2bfc Mon Sep 17 00:00:00 2001 From: jk Date: Tue, 7 Sep 2021 12:48:21 +0100 Subject: [PATCH] updating files to try and implement additional fields --- controllers/editor.php | 6 +++++- public/editor-files/editor.js | 10 +++++++++- views/editor.php | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/controllers/editor.php b/controllers/editor.php index f813f9e..86da9b0 100644 --- a/controllers/editor.php +++ b/controllers/editor.php @@ -22,6 +22,8 @@ $app->post('/editor/publish', function() use($app) { $micropub_request = array( 'name' => [$params['name']], + 'description' => [$params['description']], + 'image' => [$params['image']], 'content' => [$content] ); $json = true; @@ -31,6 +33,8 @@ $app->post('/editor/publish', function() use($app) { $micropub_request = array( 'h' => 'entry', 'name' => [$params['name']], + 'description' => [$params['description']], + 'image' => [$params['image']], 'content' => [$content] ); } @@ -137,7 +141,7 @@ $app->get('/editor/oembed', function() use($app) { $url = 'http://medium.iframe.ly/api/oembed?iframe=1&url='.urlencode($app->request()->params()['url']); $json = file_get_contents($url); $app->response()['Content-type'] = 'application/json'; - $app->response()->body($json); + $app->response()->body($json); }); $app->post('/editor/test-login', function() use($app) { diff --git a/public/editor-files/editor.js b/public/editor-files/editor.js index fefbb47..0f249fa 100644 --- a/public/editor-files/editor.js +++ b/public/editor-files/editor.js @@ -76,6 +76,8 @@ $(function() { $.post('/editor/publish', { name: $("#post-name").val(), + description: $("#post-description").val(), + image: $("#post-image").val(), body: editor.serialize().content.value, category: category, slug: $("#post-slug").val(), @@ -139,6 +141,8 @@ $(function() { function reset_page() { $("#post-name").val(''); + $("#post-description").val(''); + $("#postimage").val(''); $("#post-slug").val(''); $("#post-tags").tokenfield('setTokens',[]); $("#post-status").val('published'); @@ -161,6 +165,8 @@ function doAutoSave() { autosaveTimeout = false; var savedData = { title: $("#post-name").val(), + description: $("#post-description").val(), + image: $("#post-image").val(), body: editor.serialize().content.value, tags: $("#post-tags").tokenfield('getTokensList'), slug: $("#post-slug").val(), @@ -189,6 +195,8 @@ $(function(){ $("#post-slug").val(val.slug); $("#post-status").val(val.status); $("#post-publish-date").val(val.publish); + $("#post-description").val(val.description); + $("#post-image").val(val.image); // drop the cursor into the editor which clears the placeholder text $("#content").focus().click(); activateTokenField(); @@ -210,5 +218,5 @@ editor.on(document.getElementById('content'), 'input', function(){ contentChanged(); }); $(function(){ - $('#post-name, #post-tags, #post-slug, #post-publish-date').on('keyup', contentChanged); + $('#post-name, #post-description, #post-image, #post-tags, #post-slug, #post-publish-date').on('keyup', contentChanged); }); diff --git a/views/editor.php b/views/editor.php index b80375f..7337151 100644 --- a/views/editor.php +++ b/views/editor.php @@ -126,6 +126,8 @@
+ +