Ergebnis 1 bis 2 von 2

Thema: tinyMCE plugin funktioniert bei mir nicht

  1. #1
    Contao-Nutzer
    Registriert seit
    09.05.2021.
    Ort
    Konstanz
    Beiträge
    43

    Standard tinyMCE plugin funktioniert bei mir nicht

    Hilfe Plugin tinyMce, ich bin am Verzweifeln

    Was mache ich falsch. Ich möchte eine Erweiterung für TinyMce machen
    meine tinyMce Version 5.10.7

    Mein Template sieht so aus be_tinyMCE.html5
    HTML-Code:
    <?php
    
    namespace Contao;
    
    if ($GLOBALS['TL_CONFIG']['useRTE']):
    ?>
    <script>window.tinymce || document.write('<script src="<?= $this->asset('js/tinymce.min.js', 'contao-components/tinymce4') ?>">\x3C/script>')
    </script>
    
    <script>
    [B]console.log('init be_tinyMce');[/B]
    debugger;
    window.tinymce && tinymce.init({
      selector: '#<?= $this->selector ?>',
      min_height: 336,
      language: '<?= Backend::getTinyMceLanguage() ?>',
      element_format: 'html',
      document_base_url: '<?= Environment::get('base') ?>',
      entities: '160,nbsp,60,lt,62,gt,173,shy',
      branding: false,
      setup: function(editor) {
        editor.getElement().removeAttribute('required');
        document.querySelectorAll('[accesskey]').forEach(function(el) {
          editor.addShortcut('access+' + el.accessKey, el.id, function() { el.click(); });
        });
      },
      init_instance_callback: function(editor) {
        if (document.activeElement && document.activeElement.id && document.activeElement.id == editor.id) {
          editor.editorManager.get(editor.id).focus();
        }
        editor.on('focus', function() { Backend.getScrollOffset(); });
      },
    
      <?php $this->block('picker'); ?>
        file_picker_callback: function (callback, value, meta) {
          Backend.openModalSelector({
            'id': 'tl_listing',
            'title': document.getElement('.tox-dialog__title').get('text'),
            'url': Contao.routes.backend_picker + '?context=' + (meta.filetype == 'file' ? 'link' : 'file') + '&amp;extras[fieldType]=radio&amp;extras[filesOnly]=true&amp;extras[source]=<?= $this->source ?>&amp;value=' + value + '&amp;popup=1',
            'callback': function(table, val) {
              callback(val.join(','));
            }
          });
        },
        file_picker_types: <?= json_encode($this->fileBrowserTypes) ?>,
      <?php $this->endblock(); ?>
    
      <?php $this->block('content_css'); ?>
        content_css: 'system/themes/<?= Backend::getTheme() ?>/tinymce.min.css',
      <?php $this->endblock(); ?>
    
      <?php $this->block('plugins'); ?>
        plugins: 'autosave charmap code fullscreen image importcss link lists paste searchreplace stripnbsp tabfocus table visualblocks visualchars [B]newslink[/B]',
      <?php $this->endblock(); ?>
    
      <?php $this->block('valid_elements'); ?>
        extended_valid_elements: 'q[cite|class|title],article,section,hgroup,figure,figcaption,a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|data-lightbox]',
      <?php $this->endblock(); ?>
    
      <?php $this->block('menubar'); ?>
        menubar: 'file edit insert view format table',
      <?php $this->endblock(); ?>
    
      <?php $this->block('toolbar'); ?>
        toolbar: 'link unlink | image | formatselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | code | [B]newslink[/B]',
      <?php $this->endblock(); ?>
    
      <?php $this->block('contextmenu'); ?>
        contextmenu: false,
      <?php $this->endblock(); ?>
    
      <?php $this->block('cache_suffix'); ?>
        cache_suffix: '?v=<?= $this->assetVersion('js/tinymce.min.js', 'contao-components/tinymce4') ?>',
      <?php $this->endblock(); ?>
    
      <?php $this->block('custom'); ?>
      <?php $this->endblock(); ?>
    
      <?php if ($this->readonly): ?>
        readonly: true,
      <?php endif; ?>
    
      browser_spellcheck: true,
      tabfocus_elements: ':prev,:next',
      importcss_append: true
    });
    [B]console.log('ende init');[/B]
    </script>
    <?php endif; ?>
    Die console.log Ausschriebe
    console.log('init be_tinyMce');
    debugger,
    console.log('ende init');

    erfolgen



    Unter assets/tinymce4/js/plugins/newslink liegt plugin.min.js

    HTML-Code:
    [B]console.log('PBD plugin newslink loaded');[/B]
    tinymce.PluginManager.add("newslink", function (editor, url) {
    [B]debugger;[/B]
        editor.on('init', function () {
            // Get language-data from tinyCustom.php
            let langCode = tinymce.util.I18n.getCode();
            let langData = tinyMCE.activeEditor.getParam('newslink_language_data');
            // Adds translations for a specific language code. --> http://archive.tinymce.com/wiki.php/api4:method.tinymce.util.I18n.add
            tinymce.util.I18n.add(langCode, langData);
        });
    
    …
    Mein Problem ist, dass dies nicht aufgerufen wird.

    Weder der Ausschrieb
    console.log('PBD plugin newslink loaded');
    noch der debugger wird erreicht.

    Wenn ich ein nicht vorhandenes plugin verwende z.B. paula, bekomme ich im Konsole window des debuggers die Meldung, dass paula nicht errreichbar ist.

    Das asset assets/tinymce4/js/plugins/newslink/plugin.min.js ist per http Requests erreichbar. Es wird dann korrekt im Browser angezeigt.

    Ich habe schon viele Hinweise untersucht (cache löschen, .....)


    Kann mir jemand helfen.

    Peter

  2. #2
    Contao-Nutzer
    Registriert seit
    09.05.2021.
    Ort
    Konstanz
    Beiträge
    43

    Standard

    Alles OK nach langem Suchen doch noch gefunden. der Fehler lag im plugin.min.js
    Danke fürs lesen
    Peter

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •