Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
5888234
updated TOC title wrapper to be dynamic from the block titleWrapper attr
Nickbahson Apr 11, 2023
17d39b7
aligned comment
Nickbahson Apr 11, 2023
99fb231
added debug statement for toc block, to get the nested headings first
Nickbahson Apr 14, 2023
2821b53
added nested headings and children to dynamic block output
Nickbahson Apr 15, 2023
d4ef737
added settings to include in renderer
Nickbahson Apr 15, 2023
de61bfa
reset to a better approach than dynamic block
Nickbahson Apr 15, 2023
f845d57
Merge remote-tracking branch 'origin/fixed-164' into fixed-168
Nickbahson Apr 15, 2023
e4fd294
updated missing DOM id from client as well
Nickbahson Apr 15, 2023
536ee18
added dist file for TOC block
Nickbahson Apr 15, 2023
94ab24b
deafult titleWrapper already set in block attributes
Nickbahson Apr 17, 2023
4242891
to exclude higher level headers from the sliced array
Nickbahson Apr 28, 2023
855176f
added deprecated block property
Nickbahson Apr 29, 2023
4dda1a7
included deprecated property in registerBlock
Nickbahson Apr 29, 2023
e43c877
fixed CS
Nickbahson Apr 29, 2023
35e76b5
added dist build
Nickbahson Apr 29, 2023
46fc57f
restored package.json
Nickbahson Apr 29, 2023
50a265c
headlist sliced upto the start of higher level title
Nickbahson May 2, 2023
e6e03bf
fixed missing nested higher level headers list of list
Nickbahson May 2, 2023
05f98db
accurate slice for higher levels inside low level headers
Nickbahson May 2, 2023
253ffc0
fixed CS violations
Nickbahson May 2, 2023
dfdeaba
optimized and fixed lenght miscount for other nested levels
Nickbahson May 3, 2023
d86dfd8
bug to fix where list is also appended to the children as well (multi…
Nickbahson May 3, 2023
793f052
non children elements not appended to the presiding children
Nickbahson May 3, 2023
369f950
added TODO for bug where higher level titles are prepended to the wro…
Nickbahson May 3, 2023
a1eac3d
fixed CS and a place to start for current issue
Nickbahson May 3, 2023
f725f90
added debug statement and cause of bug as TODOs
Nickbahson May 3, 2023
f7ac695
addressed TODOs relating to double occurrence and wrong child-parent …
Nickbahson May 4, 2023
e747ed9
fresh approach to nesting headings
Nickbahson May 4, 2023
31616de
added TOC links including all links
Nickbahson May 5, 2023
e940aa1
added shortcode scaffold definition
Nickbahson May 5, 2023
0ad23fe
included toc title wrapper options configuration on admin dashboard
Nickbahson May 5, 2023
33c6782
applied options from gutenberg settings
Nickbahson May 5, 2023
292f8b6
settings for shortcode are applied too
Nickbahson May 5, 2023
f37366d
updated ServerSideRender to updated list when post is saved
Nickbahson May 5, 2023
27783c3
removed dev scripts and included build dist
Nickbahson May 5, 2023
de10a6f
undefined in block edit view
Nickbahson May 5, 2023
c23b693
added additional css classes in general options
Nickbahson May 5, 2023
686d6e3
commented out un-used logic on edit view and added TODOs
Nickbahson May 5, 2023
8397986
added visual hirechy for list children
Nickbahson May 6, 2023
4807fb3
cleaned unused attributes and states
Nickbahson May 6, 2023
47299df
added comments for block attr settings
Nickbahson May 6, 2023
2ed08f2
passed all attributes to ServerSideRender and updated children to tak…
Nickbahson May 6, 2023
8108fb2
excluded heading from post->post_content
Nickbahson May 6, 2023
cd19b0a
returns early with helpful messages
Nickbahson May 6, 2023
cec2e0e
included dist build
Nickbahson May 6, 2023
d116c72
fixed cs rules
Nickbahson May 8, 2023
5f59508
added toc_options as a class property
Nickbahson May 8, 2023
951f018
Merge remote-tracking branch 'origin/fixed-164' into dynamic-toc-block
Nickbahson May 8, 2023
799982e
added deprecation for prev versions
Nickbahson May 8, 2023
b6b4527
added dist build
Nickbahson May 8, 2023
bc1d122
normalized list styles
Nickbahson May 8, 2023
2a7ce1a
added missing editor script wp dependency
Nickbahson May 11, 2023
7cb66d2
fixed CS and removed unused defs
Nickbahson May 11, 2023
3683bef
updated sub-main parents for better visuals from the main TOC list
Nickbahson May 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 28 additions & 151 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
module.exports = {
root: true,
parser: 'babel-eslint',
extends: [
'plugin:@wordpress/eslint-plugin/recommended',
'plugin:@wordpress/eslint-plugin/recommended-with-formatting',
'plugin:eslint-comments/recommended',
],
env: {
Expand All @@ -12,166 +11,44 @@ module.exports = {
mocha: true,
},
parserOptions: {
sourceType: "module",
sourceType: 'module',
ecmaFeatures: {
jsx: true
}
jsx: true,
},
},
globals: {
_: true,
wp: true,
wpApiSettings: true,
window: true,
document: true,
ClipboardJS: true,
rankMath: true,
rankMathAdmin: true,
rankMathEditor: true,
rankMathGutenberg: true,
ClipboardJS: true,
rankMathAnalyzer: true,
AnalysisResult: true,
ElementorConfig: true,
elementor: true,
$e: true,
tinymce: true,

// Elementor
$e: true,
elementor: true,
elementorCommon: true,
ElementorConfig: true,
},
settings: {
react: {
pragma: "wp"
pragma: 'wp',
},
jsdoc: {
preferredTypes: [ "jqXHR" ]
}
preferredTypes: [ 'jqXHR' ],
},
},
rules: {
"array-bracket-spacing": ["error", "always"],
"brace-style": ["error", "1tbs"],
"camelcase": ["error", { "properties": "never" }],
"comma-dangle": ["error", "always-multiline"],
"comma-spacing": "error",
"comma-style": "error",
"computed-property-spacing": ["error", "always"],
"constructor-super": "error",
"dot-notation": "error",
"eol-last": "error",
"eqeqeq": "error",
"func-call-spacing": "error",
"indent": ["error", "tab", { "SwitchCase": 1 }],
"key-spacing": "error",
"keyword-spacing": "error",
"lines-around-comment": "off",
"no-alert": "error",
"no-bitwise": "error",
"no-caller": "error",
"no-console": "error",
"no-const-assign": "error",
"no-debugger": "error",
"no-dupe-args": "error",
"no-dupe-class-members": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-duplicate-imports": "error",
"no-else-return": "error",
"no-eval": "error",
"no-extra-semi": "error",
"no-fallthrough": "error",
"no-lonely-if": "error",
"no-mixed-operators": "error",
"no-mixed-spaces-and-tabs": "error",
"no-multiple-empty-lines": ["error", { "max": 1 }],
"no-multi-spaces": "error",
"no-multi-str": "off",
"no-negated-in-lhs": "error",
"no-nested-ternary": "error",
"no-redeclare": "error",
"no-restricted-syntax": [
"error",
{
"selector":
"ImportDeclaration[source.value=/^@wordpress\\u002F.+\\u002F/]",
"message": "Path access on WordPress dependencies is not allowed."
},
{
"selector": "ImportDeclaration[source.value=/^blocks$/]",
"message": "Use @wordpress/blocks as import path instead."
},
{
"selector": "ImportDeclaration[source.value=/^components$/]",
"message": "Use @wordpress/components as import path instead."
},
{
"selector": "ImportDeclaration[source.value=/^date$/]",
"message": "Use @wordpress/date as import path instead."
},
{
"selector": "ImportDeclaration[source.value=/^editor$/]",
"message": "Use @wordpress/editor as import path instead."
},
{
"selector": "ImportDeclaration[source.value=/^element$/]",
"message": "Use @wordpress/element as import path instead."
},
{
"selector": "ImportDeclaration[source.value=/^i18n$/]",
"message": "Use @wordpress/i18n as import path instead."
},
{
"selector": "ImportDeclaration[source.value=/^data$/]",
"message": "Use @wordpress/data as import path instead."
},
{
"selector": "ImportDeclaration[source.value=/^utils$/]",
"message": "Use @wordpress/utils as import path instead."
},
{
"selector":
"CallExpression[callee.name=/^__|_n|_x$/]:not([arguments.0.type=/^Literal|BinaryExpression$/])",
"message": "Translate function arguments must be string literals."
},
{
"selector":
"CallExpression[callee.name=/^_n|_x$/]:not([arguments.1.type=/^Literal|BinaryExpression$/])",
"message": "Translate function arguments must be string literals."
},
{
"selector":
"CallExpression[callee.name=_nx]:not([arguments.2.type=/^Literal|BinaryExpression$/])",
"message": "Translate function arguments must be string literals."
}
],
"no-shadow": "error",
"no-undef": "error",
"no-undef-init": "error",
"no-unreachable": "error",
"no-unsafe-negation": "error",
"no-unused-expressions": "error",
"no-unused-vars": "error",
"no-useless-computed-key": "error",
"no-useless-constructor": "error",
"no-useless-return": "error",
"no-var": "error",
"no-whitespace-before-property": "error",
"object-curly-spacing": ["error", "always"],
"padded-blocks": ["error", "never"],
"prefer-const": "error",
"quote-props": ["error", "as-needed"],
"semi": [ 1, "never" ],
"semi-spacing": "error",
"space-before-blocks": ["error", "always"],
"space-before-function-paren": ["error", "never"],
"space-in-parens": ["error", "always"],
"space-infix-ops": ["error", { "int32Hint": false }],
"space-unary-ops": [
"error",
{
"overrides": {
"!": true
}
}
],
"template-curly-spacing": ["error", "always"],
"valid-jsdoc": ["error", { "requireReturn": false }],
"valid-typeof": "error",
"yoda": "off"
}
}
semi: [ 1, 'never' ],
'semi-spacing': 'error',

// jsdoc.
'jsdoc/check-access': 'off',
'jsdoc/require-property': 'off',
'jsdoc/require-property-type': 'off',
'jsdoc/require-property-name': 'off',
'jsdoc/require-property-description': 'off',
'jsdoc/check-property-names': 'off',
'jsdoc/empty-tags': 'off',
'import/no-unresolved': 'off',
},
}
6 changes: 3 additions & 3 deletions includes/modules/schema/blocks/class-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ protected function get_styles( $attributes ) {
* @return string
*/
protected function get_list_style( $style ) {
if ( 'numbered' === $style ) {
if ( 'numbered' === $style || 'ol' === $style ) {
return 'ol';
}

if ( 'unordered' === $style ) {
if ( 'unordered' === $style || 'ul' === $style ) {
return 'ul';
}

Expand All @@ -99,7 +99,7 @@ protected function get_list_style( $style ) {
* @return string
*/
protected function get_list_item_style( $style ) {
if ( 'numbered' === $style || 'unordered' === $style ) {
if ( 'numbered' === $style || 'unordered' === $style || 'ol' === $style || 'ul' === $style ) {
return 'li';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'wp-element',
'wp-components',
'wp-block-editor',
'wp-editor',
'wp-data',
'wp-dom',
'wp-url',
Expand Down
Loading