Skip to content
This repository has been archived by the owner on Nov 4, 2019. It is now read-only.

Commit

Permalink
See CHANGELOG.md v1.3.8 for changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperbjerke committed Nov 22, 2015
1 parent cbd352c commit 21eb699
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 40 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<h1 id="changelog">CHANGELOG</h1>
<h2 id="1-3-8">1.3.8</h2>
<ul>
<li>Fixed bug where pasting regular content would cast a TypeError and stop executing</li>
<li>Fixed Notice when on 404 page</li>
</ul>
<h2 id="1-3-7">1.3.7</h2>
<ul>
<li>Removed class requirement on auto config</li>
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
CHANGELOG
=========
## 1.3.8
* Fixed bug where pasting regular content would cast a TypeError and stop executing
* Fixed Notice when on 404 page

## 1.3.7
* Removed class requirement on auto config
* Added full ACF support
Expand Down
2 changes: 2 additions & 0 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ <h2 id="proposed-features-to-do-s">Proposed features/To do&#39;s</h2>
<li>[ ] Mirror style of current WP admin theme</li>
<li>[ ] Ability to create child-categories</li>
<li>[ ] Ability to create settings-modal for each editor</li>
<li>[ ] Ability to change page template</li>
<li>[ ] Break out built-in extensions into separate plugins</li>
</ul>
<h2 id="proposed-extensions">Proposed extensions</h2>
<ul>
<li>[ ] Live SEO analyzis and tips with Yoast integration</li>
<li>[ ] WPML integration</li>
<li>[ ] Markdown parser</li>
</ul>
<h2 id="requirements">Requirements</h2>
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ WA Fronted (or just “Fronted“) is a frontend editor for WordPress. It’s a
* [ ] Mirror style of current WP admin theme
* [ ] Ability to create child-categories
* [ ] Ability to create settings-modal for each editor
* [ ] Ability to change page template
* [ ] Break out built-in extensions into separate plugins

## Proposed extensions
* [ ] Live SEO analyzis and tips with Yoast integration
* [ ] WPML integration
* [ ] Markdown parser

## Requirements
Expand Down
14 changes: 7 additions & 7 deletions js/min/scripts.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion js/tinymce/tinymce.image.js
Original file line number Diff line number Diff line change
Expand Up @@ -980,12 +980,13 @@ tinymce.PluginManager.add( 'fronted_image', function( editor ) {
if ( cmd === 'mceInsertContent' ) {
// When inserting content, if the caret is inside a caption create new paragraph under
// and move the caret there

if ( node = dom.getParent( editor.selection.getNode(), 'div.mceTemp' ) ) {
p = dom.create( 'p' );
dom.insertAfter( p, node );
editor.selection.setCursorLocation( p, 0 );
editor.nodeChanged();
}else if(event.value.indexOf('[gallery ') !== -1){
}else if(!event.value.hasOwnProperty('content') && event.value.indexOf('[gallery ') !== -1){
event.preventDefault();
wa_fronted.show_loading_spinner();
wa_fronted.shortcode_to_html(event.value, true, function(html){
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: jesperb
Tags: frontend, editor, edit, medium, content
Requires at least: 4.0
Tested up to: 4.3.1
Stable tag: 1.3.7
Stable tag: 1.3.8
License: GPLv2
License URI: https://github.com/jesperbjerke/wa-fronted/blob/master/LICENSE.md

Expand Down
129 changes: 98 additions & 31 deletions wa-fronted.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
Plugin Name: WA-Fronted
Plugin URI: http://github.com/jesperbjerke/wa-fronted
Description: Edit content directly from fronted in the contents actual place
Version: 1.3.7
Version: 1.3.8
Tags: frontend, editor, edit, medium
Requires at least: 4.0
Tested up to: 4.3.1
Stable tag: 1.3.7
Stable tag: 1.3.8
Text Domain: wa-fronted
Domain Path: /languages
Author: Jesper Bjerke
Expand Down Expand Up @@ -321,22 +321,30 @@ protected function get_options(){
$options = apply_filters('wa_fronted_options', array());

global $post;
$this->post_lock = wp_check_post_lock($post->ID);

if($post){
$this->post_lock = wp_check_post_lock($post->ID);
}

$default_options = array(
'native' => true,
'direction' => 'ltr',
'media_upload' => true,
'toolbar' => 'full',
'post_id' => $post->ID,
'post_id' => ($post) ? $post->ID : false,
'shortcodes' => false,
'field_type' => false,
'permission' => 'default',
'image_size' => 'post-thumbnail',
'paragraphs' => true,
'validation' => false,
'auto_configure' => true,
'init_on_load' => true
'init_on_load' => true,
'add_new' => true,
'placeholders' => array(
'post_title' => __('Enter title here', 'wordpress'),
'post_content' => __('Enter post content here', 'wa-fronted')
)
);

if(is_front_page() && !is_home()){
Expand Down Expand Up @@ -384,39 +392,90 @@ protected function get_options(){
if($continue){
//If Fronted should not be enabled automatically, add button to admin bar and prevent init otherwise continue init
if($default_options['init_on_load'] === false && (!isset($_GET['is_editing']) || $_GET['is_editing'] == false)){

add_action('admin_bar_menu', function($wp_admin_bar){
$args = array(
'id' => 'enable-wa-fronted',
'title' => __('Edit here', 'wa-fronted'),
'href' => esc_url(add_query_arg('is_editing', 'true', $_SERVER['REQUEST_URI']))
);
$wp_admin_bar->add_node($args);
}, 90);

wp_add_inline_style( 'admin-bar', '#wpadminbar #wp-admin-bar-enable-wa-fronted a:before{
content: \'\f464\';
top: 2px;
position: relative;
float: left;
font: 400 20px/1 dashicons;
speak: none;
padding: 4px 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-image: none!important;
margin-right: 6px;
}' );

$this->add_edit_button();
return false;
}else{
// if($default_options['add_new']){
// $this->add_new_button($default_options, $post_type_options);
// }
return $post_type_options;
}
}else{
return false;
}
}

/**
* Adds a "edit here" button in admin bar
*/
private function add_edit_button(){
add_action('admin_bar_menu', function($wp_admin_bar){
$args = array(
'id' => 'enable-wa-fronted',
'title' => __('Edit here', 'wa-fronted'),
'href' => esc_url(add_query_arg('is_editing', 'true', $_SERVER['REQUEST_URI']))
);
$wp_admin_bar->add_node($args);
}, 90);

wp_add_inline_style( 'admin-bar', '#wpadminbar #wp-admin-bar-enable-wa-fronted a:before{
content: \'\f464\';
top: 2px;
position: relative;
float: left;
font: 400 20px/1 dashicons;
speak: none;
padding: 4px 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-image: none!important;
margin-right: 6px;
}' );
}

/**
* Adds a "create new" button in admin bar
*/
private function add_new_button($default_options, $post_type_options){

if(isset($_GET['add_new']) && $_GET['add_new']){
global $post;

$new_post_id = wp_insert_post(array(
'post_type' => $post->post_type,
'post_status' => 'draft',
'post_title' => $default_options['placeholders']['post_title'],
'post_content' => $default_options['placeholders']['post_content']
));

wp_safe_redirect(add_query_arg('editing_new', 'true', get_the_permalink($new_post_id)));
exit;
}

add_action('admin_bar_menu', function($wp_admin_bar){
$args = array(
'id' => 'add-new-wa-fronted',
'title' => __('Add new here', 'wa-fronted'),
'href' => esc_url(add_query_arg('add_new', 'true', $_SERVER['REQUEST_URI']))
);
$wp_admin_bar->add_node($args);
}, 90);

wp_add_inline_style( 'admin-bar', '#wpadminbar #wp-admin-bar-add-new-wa-fronted a:before{
content: \'\f132\';
top: 2px;
position: relative;
float: left;
font: 400 20px/1 dashicons;
speak: none;
padding: 4px 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-image: none!important;
margin-right: 6px;
}' );
}

/**
* Queues script files and styles if logged in user has any editable areas and current page is not in admin.
* Hookable through action 'wa_fronted_scripts'
Expand Down Expand Up @@ -769,7 +828,7 @@ public function wa_fronted_autosave(){
$autosave_data = apply_filters('wa_fronted_autosave_data', $autosave_data, $data);

foreach($post_ids as $post_id){
$new_post_id;
$new_post_id = false;
$this_autosave_data = $autosave_data[$post_id];

if(!isset($this_autosave_data['post_content'])){
Expand Down Expand Up @@ -951,6 +1010,14 @@ public function wa_get_image_src(){
public function wa_fronted_toolbar(){
?>
<div id="wa-fronted-toolbar">

<?php if(isset($_GET['editing_new']) && $_GET['editing_new']): ?>
<button id="wa-fronted-publish" title="<?php _e('Publish', 'wa-fronted'); ?>">
<i class="dashicons dashicons-yes"></i>
<?php _e('Publish', 'wa-fronted'); ?>
</button>
<?php endif; ?>

<button id="wa-fronted-save" title="<?php _e('Save', 'wa-fronted'); ?>">
<i class="fa fa-save"></i>
<?php _e('Save', 'wa-fronted'); ?>
Expand Down Expand Up @@ -1569,4 +1636,4 @@ function wa_fronted_init(){

if(phpversion() >= 5.43){
add_action('plugins_loaded', 'wa_fronted_init', 999);
}
}

0 comments on commit 21eb699

Please sign in to comment.