Changeset 2986891
- Timestamp:
- 10/31/2023 03:33:02 PM (9 months ago)
- Location:
- faq-block-for-gutenberg
- Files:
-
- 15 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
faq-block-for-gutenberg/trunk/assets/css/style.css
r2364572 r2986891 1 .wp-block-faq-block-for-gutenberg-faq{font-family:'roboto', sans-serif;color:#666;font-size:16px;background:#f9f9f9;line-height:1.6em;padding:20px;margin-bottom:10px}.wp-block-faq-block-for-gutenberg-faq .question{font-weight:700;font-size:120%;cursor:pointer;text-transform:capitalize;padding:7px}.wp-block-faq-block-for-gutenberg-faq .question h4{margin-bottom:10px;padding:0;clear:none}.edit-answer .answer,.answer.edit-answer,.edit-answer{display:block !important}.wp-block-faq-block-for-gutenberg-faq .answer{display:none}.answer{background:#3BB0D6;padding:7px 7px 7px 7px;overflow-wrap:break-word;color:#ffffff}.question:first-child:before{content:'\002B';font-size:20px;float:right;margin-left:5px}.wp-block-faq-block-for-gutenberg-faq .active:before{content:'\2212'} 2 1 .wp-block-faq-block-for-gutenberg-faq{font-family:"roboto",sans-serif;color:#666;font-size:16px;background:#f9f9f9;line-height:1.6em;padding:20px;margin-bottom:10px}.wp-block-faq-block-for-gutenberg-faq .question{font-weight:700;font-size:120%;cursor:pointer;padding:7px}.wp-block-faq-block-for-gutenberg-faq .question h4{margin-bottom:10px;padding:0;clear:none;margin:0 !important;font-size:inherit}.wp-block-faq-block-for-gutenberg-faq .answer{display:none}.wp-block-faq-block-for-gutenberg-faq .active:before{content:"−" !important}.edit-answer .answer,.answer.edit-answer,.edit-answer{display:block !important}.answer{background:#3bb0d6;padding:7px 7px 7px 7px;overflow-wrap:break-word;color:#fff}.question:first-child:before{content:"+";font-size:20px;float:right;margin-left:5px}.faq-block-action-button{margin:0 auto;margin-top:-10px;margin-right:3px;text-align:right;display:flex;gap:10px;justify-content:flex-end}.faq-block-action-button a{font-size:11px;font-weight:400;text-decoration:none;color:var(--wp-admin-theme-color, #3858e9);font-weight:700}.faq-block-action-button a.faq-block-action-remove{color:#cc1818 !important}.faq-block-action-button a:focus{border:none;outline:none;box-shadow:none} -
faq-block-for-gutenberg/trunk/assets/js/block.build.js
r2364572 r2986891 1 !function( t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e){var n,o,r,i,s,a,l,u,c;n=window.wp,o=n.blocks.registerBlockType,r=n.element.createElement,i=n.blockEditor.RichText,s=n.blockEditor.InspectorControls,a=n.components.PanelBody,l=n.blockEditor.ColorPalette,u=n.blockEditor.BlockControls,c=n.blockEditor.AlignmentToolbar,o("faq-block-for-gutenberg/faq",{title:n.i18n.__("FAQ","faq-block-for-gutenberg"),icon:"index-card",category:"layout",attributes:{question:{type:"array",source:"children",selector:"h4"},answer:{type:"array",source:"children",selector:".answer"},backgroundColor:{type:"string"},questionText:{type:"string"},questionBg:{type:"string"},answerText:{type:"string"},answerBg:{type:"string"},alignment:{type:"string"}},edit:function(t){var e=t.focus?t.focus.editable||"question":null,o=t.attributes,g=t.attributes.alignment,b=t.isSelected;return r("div",null,b&&r(u,{key:"controls"},r(c,{value:g,onChange:function(e){t.setAttributes({alignment:e})}})),r(s,{key:"inspector"},r(a,{title:n.i18n.__("Background color","faq-block-for-gutenberg"),initialOpen:!0},r(l,{value:t.attributes.backgroundColor,onChange:function(e){t.setAttributes({backgroundColor:e})}})),r(a,{title:n.i18n.__("Question Font Color","faq-block-for-gutenberg"),initialOpen:!1},r(l,{value:t.attributes.questionText,colors:["#F00"],onChange:function(e){t.setAttributes({questionText:e})}})),r(a,{title:n.i18n.__("Question Background","faq-block-for-gutenberg"),initialOpen:!1},r(l,{value:t.attributes.questionBg,colors:["#000"],onChange:function(e){t.setAttributes({questionBg:e})}})),r(a,{title:n.i18n.__("Answer Font Color","faq-block-for-gutenberg"),initialOpen:!1},r(l,{value:t.attributes.answerText,colors:["#F00"],onChange:function(e){t.setAttributes({answerText:e})}})),r(a,{title:n.i18n.__("Answer Background","faq-block-for-gutenberg"),initialOpen:!1},r(l,{value:t.attributes.answerBg,colors:["#000"],onChange:function(e){t.setAttributes({answerBg:e})}})),r("hr",null)),r("div",{className:t.className,key:"editor",style:{background:o.backgroundColor},onClick:function(t){var e=t.target.closest(".wp-block-faq-block-for-gutenberg-faq").querySelector(".answer");if(t.target.parentNode.parentNode.classList.length>0&&!t.target.parentNode.parentNode.classList.contains("question")&&(e=null),null!=e&&t.target.classList.length>0&&!t.target.classList.contains("question")&&(e=null),null!=e){var n=e.classList||[];n.length>0&&(n.contains("editor-rich-text")||n.contains("block-editor-rich-text__editable"))&&(n.contains("edit-answer")?(n.remove("edit-answer"),t.target.closest(".question").classList.remove("active")):(n.add("edit-answer"),t.target.closest(".question").classList.add("active")))}}},r(i,{tagName:"div",className:"question",placeholder:n.i18n.__("Question:","faq-block-for-gutenberg"),value:o.question,onChange:function(e){t.setAttributes({question:e})},focus:"question"===e,onFocus:function(e){t.setFocus(_.extend({},e,{editable:"question"}))},style:{background:o.questionBg,color:o.questionText,textAlign:g}}),r(i,{tagName:"div",className:"answer",placeholder:n.i18n.__("Answer:","faq-block-for-gutenberg"),value:o.answer,onChange:function(e){t.setAttributes({answer:e})},focus:"answer"===e,onFocus:function(e){t.setFocus(_.extend({},e,{editable:"answer"}))},style:{background:o.answerBg,color:o.answerText,textAlign:g}})))},save:function(t){var e=t.className,n=t.attributes.question,o=t.attributes.answer,i=t.attributes.id,s=t.attributes.backgroundColor,a=t.attributes.questionText,l=t.attributes.questionBg,u=t.attributes.answerText,c=t.attributes.alignment,g=t.attributes.answerBg;return r("div",{className:e,"data-id":i,style:{background:s}},r("div",{className:"question",style:{background:l,textAlign:c,color:a}},r("h4",{style:{color:a}},null,n)),r("div",{className:"answer",style:{background:g,color:u,textAlign:c}},o))}})}]);1 !function())}})}]); -
faq-block-for-gutenberg/trunk/faq-block-for-gutenberg.php
r2774118 r2986891 9 9 * Text Domain: faq-block-for-gutenberg 10 10 * Domain Path: /languages 11 * Version: 2. 411 * Version: 2. 12 12 * License: GPLv3 or later 13 13 * License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 17 17 18 18 // Include class file. 19 require_once 19 require_once plugin_dir_path( __FILE__ ) . '/includes/class-faq-block-for-gutenberg.php'; 20 20 21 21 /** … … 23 23 */ 24 24 function gutenberg_faq_block_textdomain() { 25 load_plugin_textdomain( 'faq-block-for-gutenberg', false, basename( dirname( __FILE__ )) . '/languages' );25 load_plugin_textdomain( 'faq-block-for-gutenberg', false, basename( ) . '/languages' ); 26 26 } 27 27 … … 46 46 */ 47 47 function gutenberg_faq_block_init() { 48 new Faq_Block_For_Gutenberg ;48 new Faq_Block_For_Gutenberg; 49 49 } 50 50 add_action( 'plugins_loaded', 'gutenberg_faq_block_init' ); -
faq-block-for-gutenberg/trunk/includes/class-faq-block-for-gutenberg.php
r2774118 r2986891 25 25 public function gutenberg_faq_block_register() { 26 26 // Register script. 27 wp_register_script( 'gutenberg-faq-block', plugin_dir_url( __FILE__ ) . '../assets/js/block.build.js', array( 'wp- blocks', 'wp-i18n', 'wp-element' ), '', true );27 wp_register_script( 'gutenberg-faq-block', plugin_dir_url( __FILE__ ) . '../assets/js/block.build.js', array( 'wp-, true ); 28 28 // Added wp i18n support. 29 29 wp_set_script_translations( 'gutenberg-faq-block', 'faq-block-for-gutenberg' ); 30 30 // Register style. 31 wp_register_style( 'gutenberg-faq-block-style', plugin_dir_url( __FILE__ ) . '../assets/css/style.css' );31 wp_register_style( 'gutenberg-faq-block-style', plugin_dir_url( __FILE__ ) . '../assets/css/style.css' ); 32 32 // Register block. 33 33 register_block_type( … … 36 36 'editor_script' => 'gutenberg-faq-block', 37 37 'style' => 'gutenberg-faq-block-style', 38 39 40 41 42 43 44 45 46 47 48 49 50 51 38 52 ) 39 53 ); … … 56 70 public function gutenberg_faq_block_enqueue_script() { 57 71 // Enqueue public script. 58 wp_enqueue_script( 'gutenberg-faq-js', plugin_dir_url( __FILE__ ) . '../assets/js/faq-block-for-gutenberg.js', array( 'jquery' ), '', true );72 wp_enqueue_script( 'gutenberg-faq-js', plugin_dir_url( __FILE__ ) . '../assets/js/faq-block-for-gutenberg.js', array( 'jquery' ), , true ); 59 73 // Enqueue faq style. 60 74 wp_enqueue_style( 'gutenberg-faq-block-style' ); … … 68 82 // Default schema data. 69 83 $faq_data = array( 70 '@context' 71 '@type' 84 '@context'=> esc_url( 'https://schema.org' ), 85 '@type'=> 'FAQPage', 72 86 ); 73 87 // If check faq parse block. … … 76 90 foreach ( $faq_parse_block as $faqs ) { 77 91 $filter_faqs = $this->gutenberg_faq_block_strip_tags( $faqs['innerHTML'] ); 78 if ( preg_match( '/<h4 >(.*?)<\/h4>/s', $filter_faqs, $matches ) ) {92 if ( preg_match( '/<h4>(.*?)<\/h4>/s', $filter_faqs, $matches ) ) { 79 93 $faq_data['mainEntity'][] = array( 80 '@type' 81 '@id' 82 'name' 83 'answerCount' => 1,84 'position' 85 'url' 94 '@type'=> 'Question', 95 '@id' => get_the_permalink() . '#' . uniqid(), 96 'name'=> trim( wp_strip_all_tags( end( $matches ) ) ), 97 'answerCount' => 1, 98 'position' => $count, 99 'url' => get_the_permalink() . '#' . uniqid(), 86 100 'acceptedAnswer' => array( 87 '@type' 88 'text' 101 '@type'=> 'Answer', 102 'text'=> trim( str_replace( reset( $matches ), '', $filter_faqs ) ), 89 103 ), 90 104 ); 91 $count++;105 ; 92 106 } 93 107 } … … 118 132 $block_data = array(); 119 133 if ( $post ) { 120 $blocks = parse_blocks( $post->post_content);134 $blocks = ); 121 135 foreach ( $blocks as $block ) { 122 136 if ( 'faq-block-for-gutenberg/faq' === $block['blockName'] ) { -
faq-block-for-gutenberg/trunk/includes/index.php
r1833902 r2986891 1 <?php // Slicense is golden.1 <?php // Slicense is golden. -
faq-block-for-gutenberg/trunk/index.php
r1833902 r2986891 1 <?php // Slicense is golden.1 <?php // Slicense is golden. -
faq-block-for-gutenberg/trunk/readme.txt
r2774118 r2986891 7 7 Tags: blocks, faq, gutenberg faq, editor, faq block 8 8 Requires at least: 5.0 9 Tested up to: 6. 010 Requires PHP: 5.6.311 Stable tag: 2. 49 Tested up to: 6. 10 Requires PHP: 11 Stable tag: 2. 12 12 License: GPLv3 or later 13 13 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 41 41 `add_filter( 'fbfg_json_ld_output', '__return_false' );` 42 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 43 70 44 71 == Changelog == 72 73 74 75 76 77 78 79 45 80 = 2.4 = 46 81 * Bug Fixed ( https://wordpress.org/support/topic/php-warning-366/ )
Note: See TracChangeset
for help on using the changeset viewer.