We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42562
    • 1,145 Posts
    You are in luck sir,

    MODx Manager does not give TVs specific permanent identifiers, so it would be rather difficult to target any one TV
    That statement is just plain wrong!!

    I looked closely, and the textarea IDs in the HTML source code are indeed the Template Variable MODx IDs.
    So, no need to write any plugin. SWEET!

    Just do:
    tinymce.init({
    mode : "exact",
    selector : "#tv12.modx-richtext, #tv13.modx-richtext",
    //where 12 and 13 are the IDs of your Question TV and Answer TV
    ...})


    If you don't want to share TinyMCE init for both TVs, do this in the same TinymceWrapperTVs chunk
    tinymce.init({
    selector : "#tv12.modx-richtext",
    ...})
    
    tinymce.init({
    selector : " #tv13.modx-richtext",
    ...})
      TinymceWrapper: Complete back/frontend content solution.
      Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
      5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
      • Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 42562
        • 1,145 Posts
        Note: (info thanks to bruno17)
        INCOMPATIBILITY ISSUES

        FixedPre or any other extra that runs a plugin at OnParseDocument will render TinymceWrapper useless.
        The way it's looking, it might be no fault of TinymceWrapper... still looking...
        For quick solution, be cool, and disable the Extras that disturb this one. wink
          TinymceWrapper: Complete back/frontend content solution.
          Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
          5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
          • 4172
          • 5,888 Posts
          This is an issue with every plugin, which is invoked within another plugin.
          In this case OnParseDocument is invoked by $modx->getChunk inside the TinymceWrapper - plugin.

          The $modx->event->name gets overridden by the event, which is invoked inside the outer event.

          A MODX-fix for that could be to store the current eventname like that:

              /**
               * Invokes a specified Event with an optional array of parameters.
               *
               * @todo refactor this completely, yuck!!
               *
               * @access public
               * @param string $eventName Name of an event to invoke.
               * @param array $params Optional params provided to the elements registered with an event.
               * @return bool|array
               */
              public function invokeEvent($eventName, array $params= array ()) {
                  if (!$eventName)
                      return false;
                  if ($this->eventMap === null && $this->context instanceof modContext)
                      $this->_initEventMap($this->context->get('key'));
                  if (!isset ($this->eventMap[$eventName])) {
                      //$this->log(modX::LOG_LEVEL_DEBUG,'System event '.$eventName.' was executed but does not exist.');
                      return false;
                  }
                  $oldEventName = $this->event->name;//store current eventname
                  $results= array ();
                  if (count($this->eventMap[$eventName])) {
                      $this->event= new modSystemEvent();
                      foreach ($this->eventMap[$eventName] as $pluginId => $pluginPropset) {
                          $plugin= null;
                          $this->Event= & $this->event;
                          $this->event->resetEventObject();
                          $this->event->name= $eventName;
                          if (isset ($this->pluginCache[$pluginId])) {
                              $plugin= $this->newObject('modPlugin');
                              $plugin->fromArray($this->pluginCache[$pluginId], '', true, true);
                              $plugin->_processed = false;
                              if ($plugin->get('disabled')) {
                                  $plugin= null;
                              }
                          } else {
                              $plugin= $this->getObject('modPlugin', array ('id' => intval($pluginId), 'disabled' => '0'), true);
                          }
                          if ($plugin && !$plugin->get('disabled')) {
                              $this->event->activated= true;
                              $this->event->activePlugin= $plugin->get('name');
                              $this->event->propertySet= (($pspos = strpos($pluginPropset, ':')) >= 1) ? substr($pluginPropset, $pspos + 1) : '';
          
                              /* merge in plugin properties */
                              $eventParams = array_merge($plugin->getProperties(),$params);
          
                              $msg= $plugin->process($eventParams);
                              $results[]= $this->event->_output;
                              if ($msg && is_string($msg)) {
                                  $this->log(modX::LOG_LEVEL_ERROR, '[' . $this->event->name . ']' . $msg);
                              } elseif ($msg === false) {
                                  $this->log(modX::LOG_LEVEL_ERROR, '[' . $this->event->name . '] Plugin failed!');
                              }
                              $this->event->activePlugin= '';
                              $this->event->propertySet= '';
                              if (!$this->event->isPropagatable()) {
                                  break;
                              }
                          }
                          
                      }
                  }
                  $this->event->name= $oldEventName;//get eventname back after looping
                  return $results;
              }
          


          Anyone wants to create a pull - request with this fix?
          [ed. note: Bruno17 last edited this post 8 years, 6 months ago.]
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 4172
            • 5,888 Posts
            For MIGX, this should work:

            tinymce.init({
            mode: "exact",
            elements: "tv[[+tv_id]]",
            [[$TinymceWrapperCommonCode]]
            plugins:"autoresize,preview,paste,contextmenu,image,wordcount,fullscreen,code,link,charmap,searchreplace,textpattern,emoticons,insertdatetime",
            paste_word_valid_elements: "a,div,b,strong,i,em,h1,h2,h3,p,blockquote,ol,ul,pre",
            valid_elements: "iframe[*],object[*],audio[*],-span[!title|!class<test test2],a[href|target|class|rel|title|data-ajax|data-iframe],strong,b,-p[class<text-align-left?text-align-center?text-align-right],br,-h1[class|data-ajax|data-iframe],-h2[class|data-ajax|data-iframe],-h3[class|data-ajax|data-iframe],-img[!src|!alt|!class=round_img|data-ajax|data-iframe],em,-blockquote,pre[class],-ol,-ul,-li,-code[class]",
            valid_children: "-li[ul],-li[ol],-li[div],-strong[*],-em[*],-h1[*],-h2[*],-h3[*],-a[strong|em|h1|h2|h3|p|div],blockquote[p|ol|ul],pre,div",
            resize:true,
            autoresize_min_height:100,
            autoresize_max_height:400,
            toolbar: "newdocument | fullscreen preview | undo redo | blockquote | bold | italic | aligncenter | bullist numlist | link unlink | image | styleselect | charmap emoticons insertdatetime | searchreplace",
            contextmenu: "removeformat | link | image | code",
            setup: function(editor) {
                  editor.on('mouseleave', function(evt) {
                  tinyMCE.activeEditor.save();
                  //console.log("saved");//debug stuff
                });
                }
            });
            


            note:
            I have just replaced
            [[+commonTinyMCECode]]

            with
            [[$TinymceWrapperCommonCode]]

              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
            • Reading that code gives me a Costello moment...
              Costello: I don't even know what I'm talking about!
              https://www.youtube.com/watch?v=kTcRRaXV-fg
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 42562
                • 1,145 Posts
                @sottwell
                Haha, which part?
                the
                tinymce.init({
                mode: "exact",
                elements: "tv[[+tv_id]]",
                [[$TinymceWrapperCommonCode]]...

                or
                public function invokeEvent($eventName, array $params= array ()) {
                    if (!$eventName)


                @bruno17
                Users who have a suffix to their chunks will have to remember to add the suffix to that chunk name. The plugin did it automatically when it rendered the placeholder.
                I am going to test it now
                  TinymceWrapper: Complete back/frontend content solution.
                  Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                  5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                  • 42562
                  • 1,145 Posts
                  MIGX 2.9.6 now works fine with TinymceWrapper.
                  Added two bug issues to Github regarding MIGX modal window
                    TinymceWrapper: Complete back/frontend content solution.
                    Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                    5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                    • 37105
                    • 194 Posts
                    In version 2.1.0 the access to repsonse filemanager for specific usergroups using addition in config.modx.php was succesful. In current version 2.1.1 it seems to ignore this setting and throws an error:

                    IT SEEMS YOU DON'T HAVE PERMISSION TO USE THIS COOL MANAGER

                    My current line in core.modx.php for access restriction is:
                    if ($modx->user->isMember(array('Administrator','xxxxx'))){

                    How do I manage in current version access by usergroup for the responsive manager? [ed. note: donquicky last edited this post 8 years, 6 months ago.]
                      Codeplaza Webdesign: for professional websites at low cost
                      • 42562
                      • 1,145 Posts
                      In 2.1.1, core.modx.php should not even exist. Everything was moved to MODx snippet.

                      Go to responsivefilemanagerConnector snippet - properties,
                      find rfmUserGroups [Comma-separated list of Who can access RFM]

                      Use noAccessMessage to customize the message

                      Just tested it again, it works!
                        TinymceWrapper: Complete back/frontend content solution.
                        Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                        5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.