From 880e8ff006e1e13ab45e30bd4f5ca87e449f6712 Mon Sep 17 00:00:00 2001 From: etchirag Date: Tue, 27 Aug 2024 17:45:08 +0530 Subject: [PATCH 1/2] Added shortcode popup and moved variable button to top --- css/qsm-admin.css | 25 ++++++++++++++++++++ js/qsm-admin.js | 24 ++++++++++++++++++- php/admin/options-page-results-page-tab.php | 24 +++++++++++++++++++ php/images/extra-shortcodes.png | Bin 0 -> 164877 bytes 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 php/images/extra-shortcodes.png diff --git a/css/qsm-admin.css b/css/qsm-admin.css index a0fd17d8d..f7e26b7de 100644 --- a/css/qsm-admin.css +++ b/css/qsm-admin.css @@ -3461,4 +3461,29 @@ input#preferred-date-format-custom { margin: 13px -15px 8px; content: ""; width: calc(100% + 26px); +} + +/* Extra shortcodes popup */ +button.button.qsm-extra-shortcode-popup { + display: flex; + align-items: center; + position: relative; + top: 30px; + left: 197px; + z-index: 10; +} + +button.button.qsm-slashcommand-variables-button { + display: flex; + align-items: center; + position: relative; + top: 30px; + left: 110px; + z-index: 10; + margin: -30px 0; +} + +button.button.qsm-slashcommand-variables-button .qsm-slash-inside { + margin: 0 4px 0 -1px; + font-weight: 1000; } \ No newline at end of file diff --git a/js/qsm-admin.js b/js/qsm-admin.js index ec54a71e3..e3aca8c0b 100644 --- a/js/qsm-admin.js +++ b/js/qsm-admin.js @@ -1366,10 +1366,32 @@ function qsm_is_substring_in_array( text, array ) { editor.execCommand('mceInsertContent', false, pastedValue.replace(/%([^%]+)%/g, '$1 ') ); } }); + + // Stop multiple times registering click event + $(document).off('click', '.qsm-slashcommand-variables-button').on('click', '.qsm-slashcommand-variables-button', function(e) { + e.preventDefault(); + var id = $(this).data('id'); + var editor = tinymce.get(id); + var contentToInsert = '/'; + editor.focus(); + editor.selection.setContent(contentToInsert); + showAutocomplete(editor, true); + }); }); } } addTinyMceAutoSuggestion(); + + $( document ).on( 'click', '.qsm-extra-shortcode-popup', function( e ) { + e.preventDefault(); + MicroModal.show('modal-extra-shortcodes'); + } ); + + jQuery(document).on('qsm_after_add_result_block', function(event, conditions, page, redirect, total) { + var $matchingElement = $(`#results-page-${total}`); + var $button = $matchingElement.parents('.results-page-show').find('.qsm-result-editor-custom-button'); + $button.attr('data-id', total - 1); + }); } } }(jQuery)); @@ -3817,7 +3839,7 @@ var import_button; tinymce: { plugins: "qsmslashcommands link image lists charmap colorpicker textcolor hr fullscreen wordpress", forced_root_block: '', - toolbar1: 'formatselect,bold,italic,underline,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,qsm_slash_command,wp_adv', + toolbar1: 'formatselect,bold,italic,underline,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,wp_adv', toolbar2: 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help,wp_code,fullscreen', }, quicktags: true, diff --git a/php/admin/options-page-results-page-tab.php b/php/admin/options-page-results-page-tab.php index 911729b1e..103fb8f5c 100644 --- a/php/admin/options-page-results-page-tab.php +++ b/php/admin/options-page-results-page-tab.php @@ -242,6 +242,30 @@ function qsm_options_results_tab_template(){

+ + 'modal-extra-shortcodes', + "title" => __('QSM Shortcode', 'quiz-master-next'), + "description" => __('Wondering how to setup resultpage content with QSM conditional shortcode. Easily use conditional shortcodes and make your result page with conditional content.', 'quiz-master-next'), + "chart_image" => plugins_url('', dirname(__FILE__)) . '/images/extra-shortcodes.png', + "information" => __('QSM Addon Bundle is the best way to get all our add-ons at a discount. Upgrade to save 95% today OR you can buy QSM Extra Shortodes Addon separately.', 'quiz-master-next'), + "buy_btn_text" => __('Buy QSM Extra Shortodes Addon', 'quiz-master-next'), + "doc_link" => qsm_get_plugin_link( 'docs/add-ons/extra-shortcodes/', 'qsm_list', 'extrashortcodea_button', 'extra-shortcodes-upsell_read_documentation', 'qsm_plugin_upsell' ), + "upgrade_link" => qsm_get_plugin_link( 'pricing', 'qsm_list', 'extrashortcodea_button', 'extra-shortcodes-upsell_upgrade', 'qsm_plugin_upsell' ), + "addon_link" => qsm_get_plugin_link( 'downloads/extra-shortcodes', 'qsm_list', 'extrashortcodea_button', 'extra-shortcodes-upsell_buy_addon', 'qsm_plugin_upsell' ), + ); + qsm_admin_upgrade_popup($qsm_pop_up_arguments); + ?> + + + pluginHelper->get_question_setting( $id, 'autofill' ); $limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'limit_text' ); $min_text_length = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'min_text_length' ); + $placeholder_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'placeholder_text' ); $autofill_att = $autofill ? "autocomplete='off' " : ''; $min_text_attr = $min_text_length ? "minlength=" . $min_text_length . "" : ''; if ( 0 == $required ) { @@ -29,7 +30,7 @@ function qmn_small_open_display( $id, $question, $answers ) { $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' ); qsm_question_title_func( $question, '', $new_question_title, $id ); ?> - type="text" class="mlw_answer_open_text " id="question" name="question" maxlength="" /> + type="text" class="mlw_answer_open_text " id="question" name="question" maxlength="" Placeholder="" />