Version Description
- Bug fix
Download this release
Release Info
Developer | theluckywp |
Plugin | LuckyWP Table of Contents |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.0.4
- luckywp-table-of-contents.php +2 -2
- plugin/Shortcode.php +4 -1
- plugin/editorBlock/editorBlock.min.js +1 -1
- plugin/editorBlock/src/editorBlock.js +0 -105
- readme.txt +6 -3
luckywp-table-of-contents.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: LuckyWP Table of Contents
|
4 |
Plugin URI: https://theluckywp.com/product/table-of-contents/
|
5 |
Description: Creates a table of contents for your posts/pages. Works automatically or manually (via shortcode or Gutenberg block).
|
6 |
-
Version: 1.0.
|
7 |
Author: LuckyWP
|
8 |
Author URI: https://theluckywp.com/
|
9 |
Text Domain: lwptoc
|
@@ -29,6 +29,6 @@ $lwptocAutoloader->register();
|
|
29 |
$lwptocAutoloader->addNamespace('luckywp\tableOfContents', __DIR__);
|
30 |
|
31 |
$config = require(__DIR__ . '/config/plugin.php');
|
32 |
-
(new \luckywp\tableOfContents\plugin\Plugin($config))->run('1.0.
|
33 |
|
34 |
require_once __DIR__ . '/functions.php';
|
3 |
Plugin Name: LuckyWP Table of Contents
|
4 |
Plugin URI: https://theluckywp.com/product/table-of-contents/
|
5 |
Description: Creates a table of contents for your posts/pages. Works automatically or manually (via shortcode or Gutenberg block).
|
6 |
+
Version: 1.0.4
|
7 |
Author: LuckyWP
|
8 |
Author URI: https://theluckywp.com/
|
9 |
Text Domain: lwptoc
|
29 |
$lwptocAutoloader->addNamespace('luckywp\tableOfContents', __DIR__);
|
30 |
|
31 |
$config = require(__DIR__ . '/config/plugin.php');
|
32 |
+
(new \luckywp\tableOfContents\plugin\Plugin($config))->run('1.0.4', __FILE__, 'lwptoc_');
|
33 |
|
34 |
require_once __DIR__ . '/functions.php';
|
plugin/Shortcode.php
CHANGED
@@ -40,10 +40,13 @@ class Shortcode extends BaseObject
|
|
40 |
{
|
41 |
parent::init();
|
42 |
add_shortcode(self::TAG, function ($attrs) {
|
|
|
|
|
|
|
|
|
43 |
if (!is_array($attrs)) {
|
44 |
$attrs = [];
|
45 |
}
|
46 |
-
global $post;
|
47 |
if ($post instanceof WP_Post) {
|
48 |
$postSettings = new PostSettings($post->ID);
|
49 |
foreach ([
|
40 |
{
|
41 |
parent::init();
|
42 |
add_shortcode(self::TAG, function ($attrs) {
|
43 |
+
global $post;
|
44 |
+
if (!is_single($post) && !is_page($post)) {
|
45 |
+
return '';
|
46 |
+
}
|
47 |
if (!is_array($attrs)) {
|
48 |
$attrs = [];
|
49 |
}
|
|
|
50 |
if ($post instanceof WP_Post) {
|
51 |
$postSettings = new PostSettings($post->ID);
|
52 |
foreach ([
|
plugin/editorBlock/editorBlock.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){var
|
1 |
+
!function(t){var o={};function e(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.l=!0,r.exports}e.m=t,e.c=o,e.d=function(t,o,n){e.o(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,o){if(1&o&&(t=e(t)),8&o)return t;if(4&o&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&o&&"string"!=typeof t)for(var r in t)e.d(n,r,function(o){return t[o]}.bind(null,r));return n},e.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,"a",o),o},e.o=function(t,o){return Object.prototype.hasOwnProperty.call(t,o)},e.p="",e(e.s=1)}([function(t,o){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(o){return"function"==typeof Symbol&&"symbol"===e(Symbol.iterator)?t.exports=n=function(t){return e(t)}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":e(t)},n(o)}t.exports=n},function(t,o,e){"use strict";e.r(o);var n=e(0),r=e.n(n),i=wp.blocks.registerBlockType,l=wp.element,c=l.createElement,u=l.Fragment,p=wp.editor.BlockControls,s=wp.components,a=s.Toolbar,y=s.IconButton,f=0,d={};i("luckywp/tableofcontents",{title:lwptocMain.tableOfContents,icon:"list-view",category:"common",supports:{customClassName:!1,html:!1},attributes:{min:{type:"integer"},depth:{type:"integer"},hierarchical:{type:"boolean"},numeration:{type:"string"},title:{type:"string"},toggle:{type:"boolean"},labelShow:{type:"string"},labelHide:{type:"string"},hideItems:{type:"boolean"},smoothScroll:{type:"boolean"},smoothScrollOffset:{type:"integer"},width:{type:"string"},float:{type:"string"},titleFontSize:{type:"string"},titleFontWeight:{type:"string"},itemsFontSize:{type:"string"},colorScheme:{type:"string"},backgroundColor:{type:"string"},borderColor:{type:"string"},titleColor:{type:"string"},linkColor:{type:"string"},hoverLinkColor:{type:"string"},visitedLinkColor:{type:"string"}},edit:function(t){var o=t.attributes,e=t.setAttributes,n={};$.each(o,function(t,o){r()(o)==r()(!0)&&(o=o?1:0),n[t]=o});var i="lwptocEditorBlock"+ ++f,l=JSON.stringify(o);return void 0===d[l]&&($.ajax({url:lwptocMain.ajaxUrl,data:{_ajax_nonce:lwptocMain.nonce,action:"lwptoc_block_view",attrs:n},success:function(t){d[l]=t,$("#"+i).replaceWith(t)}}),d[l]='<div class="lwptocEditorBlock_title lwptocEditorBlock_title-loading" id="'+i+'">'+lwptocMain.tableOfContents+"</div>"),c(u,null,c(p,null,c(a,null,c(y,{label:lwptocMain.Edit,icon:"edit",onClick:function(){$(document).one("lwptocEditorBlockChanged",function(t,o){_.each(o,function(t,e){null===t&&(o[e]=void 0)}),e(o)}),$.lwptocCustomize.show({action:"lwptoc_block_edit",attrs:n,postId:lwptocMain.postId},function(){$(document).off("lwptocEditorBlockChanged")})}}))),c("div",{class:"lwptocEditorBlock",dangerouslySetInnerHTML:{__html:d[l]}}))},save:function(t){return t.attributes.shortcode}})}]);
|
plugin/editorBlock/src/editorBlock.js
DELETED
@@ -1,105 +0,0 @@
|
|
1 |
-
const {
|
2 |
-
registerBlockType,
|
3 |
-
} = wp.blocks;
|
4 |
-
const {
|
5 |
-
createElement,
|
6 |
-
Fragment,
|
7 |
-
} = wp.element;
|
8 |
-
const {
|
9 |
-
BlockControls,
|
10 |
-
} = wp.editor;
|
11 |
-
const {
|
12 |
-
Toolbar,
|
13 |
-
IconButton,
|
14 |
-
} = wp.components;
|
15 |
-
|
16 |
-
let viewCounter = 0,
|
17 |
-
viewCache = {};
|
18 |
-
|
19 |
-
registerBlockType('luckywp/tableofcontents', {
|
20 |
-
title: lwptocMain.tableOfContents,
|
21 |
-
icon: 'list-view',
|
22 |
-
category: 'common',
|
23 |
-
supports: {
|
24 |
-
customClassName: false,
|
25 |
-
html: false,
|
26 |
-
},
|
27 |
-
attributes: {
|
28 |
-
min: {type: 'integer'},
|
29 |
-
depth: {type: 'integer'},
|
30 |
-
hierarchical: {type: 'boolean'},
|
31 |
-
numeration: {type: 'string'},
|
32 |
-
title: {type: 'string'},
|
33 |
-
toggle: {type: 'boolean'},
|
34 |
-
labelShow: {type: 'string'},
|
35 |
-
labelHide: {type: 'string'},
|
36 |
-
hideItems: {type: 'boolean'},
|
37 |
-
smoothScroll: {type: 'boolean'},
|
38 |
-
smoothScrollOffset: {type: 'integer'},
|
39 |
-
width: {type: 'string'},
|
40 |
-
float: {type: 'string'},
|
41 |
-
titleFontSize: {type: 'string'},
|
42 |
-
titleFontWeight: {type: 'string'},
|
43 |
-
itemsFontSize: {type: 'string'},
|
44 |
-
colorScheme: {type: 'string'},
|
45 |
-
backgroundColor: {type: 'string'},
|
46 |
-
borderColor: {type: 'string'},
|
47 |
-
titleColor: {type: 'string'},
|
48 |
-
linkColor: {type: 'string'},
|
49 |
-
hoverLinkColor: {type: 'string'},
|
50 |
-
visitedLinkColor: {type: 'string'},
|
51 |
-
},
|
52 |
-
edit: function({attributes, setAttributes}) {
|
53 |
-
function onEdit() {
|
54 |
-
$(document).one('lwptocEditorBlockChanged', function(e, data) {
|
55 |
-
_.each(data, function(el, idx) {
|
56 |
-
if (el === null) {
|
57 |
-
data[idx] = undefined;
|
58 |
-
}
|
59 |
-
});
|
60 |
-
setAttributes(data);
|
61 |
-
});
|
62 |
-
$.lwptocCustomize.show({
|
63 |
-
action: 'lwptoc_block_edit',
|
64 |
-
attrs: attributes,
|
65 |
-
postId: lwptocMain.postId,
|
66 |
-
}, function() {
|
67 |
-
$(document).off('lwptocEditorBlockChanged');
|
68 |
-
});
|
69 |
-
};
|
70 |
-
|
71 |
-
let id = 'lwptocEditorBlock' + (++viewCounter),
|
72 |
-
key = JSON.stringify(attributes);
|
73 |
-
if (typeof viewCache[key] === 'undefined') {
|
74 |
-
$.ajax({
|
75 |
-
url: lwptocMain.ajaxUrl,
|
76 |
-
data: {
|
77 |
-
_ajax_nonce: lwptocMain.nonce,
|
78 |
-
action: 'lwptoc_block_view',
|
79 |
-
attrs: attributes,
|
80 |
-
},
|
81 |
-
success: function(response) {
|
82 |
-
viewCache[key] = response;
|
83 |
-
$('#' + id).replaceWith(response);
|
84 |
-
},
|
85 |
-
});
|
86 |
-
viewCache[key] = '<div class="lwptocEditorBlock_title lwptocEditorBlock_title-loading" id="' + id + '">' + lwptocMain.tableOfContents + '</div>';
|
87 |
-
}
|
88 |
-
|
89 |
-
return <Fragment>
|
90 |
-
<BlockControls>
|
91 |
-
<Toolbar>
|
92 |
-
<IconButton
|
93 |
-
label={lwptocMain.Edit}
|
94 |
-
icon="edit"
|
95 |
-
onClick={onEdit}
|
96 |
-
/>
|
97 |
-
</Toolbar>
|
98 |
-
</BlockControls>
|
99 |
-
<div class="lwptocEditorBlock" dangerouslySetInnerHTML={{__html: viewCache[key]}}></div>
|
100 |
-
</Fragment>;
|
101 |
-
},
|
102 |
-
save: function(props) {
|
103 |
-
return props.attributes.shortcode;
|
104 |
-
},
|
105 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: theluckywp
|
|
3 |
Donate link: https://theluckywp.com/product/table-of-contents/
|
4 |
Tags: table of contents, toc, navigation, links, heading
|
5 |
Requires at least: 4.7
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 1.0.
|
8 |
-
Requires PHP: 5.
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -89,6 +89,9 @@ The menu item "Table of Contents" will appear in the menu "Settings" of the Word
|
|
89 |
|
90 |
== Changelog ==
|
91 |
|
|
|
|
|
|
|
92 |
= 1.0.3 =
|
93 |
* Minor appearance changes
|
94 |
* Bug fix
|
3 |
Donate link: https://theluckywp.com/product/table-of-contents/
|
4 |
Tags: table of contents, toc, navigation, links, heading
|
5 |
Requires at least: 4.7
|
6 |
+
Tested up to: 5.1.1
|
7 |
+
Stable tag: 1.0.4
|
8 |
+
Requires PHP: 5.6.20
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
89 |
|
90 |
== Changelog ==
|
91 |
|
92 |
+
= 1.0.4 =
|
93 |
+
* Bug fix
|
94 |
+
|
95 |
= 1.0.3 =
|
96 |
* Minor appearance changes
|
97 |
* Bug fix
|