Browse Source

updating files to try and implement additional fields

main
jk 3 years ago
parent
commit
5e100dd0f5
  1. 6
      controllers/editor.php
  2. 10
      public/editor-files/editor.js
  3. 2
      views/editor.php

6
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) {

10
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);
});

2
views/editor.php

@ -126,6 +126,8 @@
<div class="container">
<input id="post-name" type="text" value="" placeholder="Title">
<input id="post-description" type="text" value="" placeholder="Description">
<input id="post-image" type="text" value="" placeholder="Banner Image">
<div id="content" class="editable"></div>
</div>

Loading…
Cancel
Save