0
Welcome Guest! Login
0 items Join Now

rokpad conflict with custom plugin

    • Codensapz's Avatar
    • Codensapz
    • Rocketeer
    • Posts: 61
    • Thanks: 0
    • Founder of Codesnapz

    rokpad conflict with custom plugin

    Posted 10 years 9 months ago
    • Hi i have made a plugin that places a button on the joomla editor when clicked it inserts a chunk of code into the editor.

      this works fine with other editors but when i use it with rokpad i get an error on button click and nothing happens.

      the plugin code to inject the chunk of code.

      <?php
      /**
       * @version   	1.4
       * @package     Joomla
       * @subpackage  System
       * @copyright   Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.
       * @license     GNU GPL v2.0
       */
       
      defined('_JEXEC') or die;
      
      class plgButtonsnapchunkz extends JPlugin
      {
          public function onDisplay($name)
          {
      		$chunkz = file_get_contents(JURI::root(). 'plugins/editors-xtd/Snapchunkz/models/chunks/test.txt');
      		$label = 'btnnnnnn';
      		$jsCode = "
                      function chk(editor) {
                          jInsertEditorText('" . preg_replace('#\s+#imsU',' ',$chunkz) ."');  
                      }
      				";
      				
      		$doc = JFactory::getDocument();
      		$doc->addScriptDeclaration($jsCode);
      		
              $button = new JObject();				
      		$button->modal = false;
      		$button->class = 'btn';
              $button->text = $label;
              $button->name = 'blank';
      		$button->onclick = 'chk(\''.$name.'\');return false;';				
              //$button->link = '#';
      		
              return $button;
          }
      }
      ?>
      

      test.txt

      <div class="ph-row">
      		<div class="ph-col4" style="margin: 0px;">		
      			<div class="ph-boxed-module">							
      				     <span class="ph-boxed-module-icon ph-left icon-home icon-4x"></span>
      				         <h3 class="ph-black">Small Business</h3>
      						 <h5 class="ph-grey">Websites</h5>
      			</div>			
      		</div>	
      </div>
      


      this is therror it produces

      Uncaught TypeError: Cannot read property 'replaceSelection' of undefined rokpad.js?cache=2.1.8:425
      RokPadData.insertion.onGetInsertMethod rokpad.js?cache=2.1.8:425
      jInsertEditorText index.php?option=com_modules&view=module&layout=edit&id=90:77
      chk index.php?option=com_modules&view=module&layout=edit&id=90:83
      onclick
      
    • Flat design is the new BOSS.
    • DanG's Avatar
    • DanG
    • Preeminent Rocketeer
    • Posts: 36750
    • Thanks: 3229
    • Custom work done

    Re: rokpad conflict with custom plugin

    Posted 10 years 9 months ago
    • DO the developers say that Snapchunkz is compatible with the ACE editor platform that RokPad is built on?
    • Codensapz's Avatar
    • Codensapz
    • Rocketeer
    • Posts: 61
    • Thanks: 0
    • Founder of Codesnapz

    Re: rokpad conflict with custom plugin

    Posted 10 years 9 months ago
    • no as i am still developing this plugin thats why i posted it in here for a rt dev to check it out. the issue is coming from


       function chk(editor) {
                          jInsertEditorText('" . preg_replace('#\s+#imsU',' ',$chunkz) ."');  
                      }
      
      


      im pretty sure rt devs have some kind of functions or something that bypass or something the whole joomla jInsertEditorText function so i need to run a if statement but for what i dont know.
    • Flat design is the new BOSS.
    • DanG's Avatar
    • DanG
    • Preeminent Rocketeer
    • Posts: 36750
    • Thanks: 3229
    • Custom work done

    Re: rokpad conflict with custom plugin

    Posted 10 years 9 months ago
    • I'll ask the devs to take a look at this topic.

Time to create page: 0.114 seconds