2017-05-11 7 views
0

Ich habe folgendes Testskript:CKEditor Fehler beim Erstellen Dialog

var field = {id: "html1"}; 
 
    var editor = CKEDITOR.replace(field.id); 
 
    var dialogObj = new CKEDITOR.dialog(editor, 'smiley');

bekomme ich folgende Fehlermeldung: Nicht abgefangene Typeerror: kann Eigenschaft 'dir' undefinierter bei CKEDITOR.dialog lesen (ckeditor.js: 573) bei testCKE.html: 24

ich bin mit der Vollversion 4.6.2 (12. Januar 2017)

dir scheint ein Element der editor.lang Ich experimentierte mit der Einstellung config.language und config.defaultLanguage

Ich versuchte es mit und ohne jquery, kein Unterschied

Der Editor öffnet fein und scheint zu sein, zu arbeiten, . Was mache ich falsch?

UPDATE: eine Antwort gefunden, siehe unten. Immer noch interessiert, ob es einen besseren Weg gibt.

Antwort

0

bekam ich den Dialog Code auf den Proben/alt/Dialog-Dateien, cutdown Version basiert mit zu arbeiten:

var field = {id: "html1"}; 
CKEDITOR.on('instanceCreated', function(ev){ 
    var editor = ev.editor; 

    // Listen for the "pluginsLoaded" event, so we are sure that the 
    // "dialog" plugin has been loaded and we are able to do our 
    // customizations. 
    editor.on('pluginsLoaded', function() { 

     // If our custom dialog has not been registered, do that now. 
     if (!CKEDITOR.dialog.exists('myDialog')) { 

      CKEDITOR.dialog.add('myDialog', function(){ 
       return {title: 'My Dialog', 
        minWidth: 400, 
        minHeight: 200, 
        contents:[ 
         { 
          id: 'tabA', 
          label: 'TabA', 
          title: 'TabA', 
          elements: [ 
           { 
            id: 'button1', 
            type: 'button', 
            label: 'Button Field' 
           } 
          ] 
         } 
        ] 
       }; 
      }); 
     } 

     // Register the command used to open the dialog. 
     editor.addCommand('myDialogCmd', new CKEDITOR.dialogCommand('myDialog')); 

     // Add the a custom toolbar buttons, which fires the above 
     // command.. 
     editor.ui.add('MyButton', CKEDITOR.UI_BUTTON, { 
      label: 'My Dialog', 
      command: 'myDialogCmd' 
     }); 
    }); 
}); 

var editor = CKEDITOR.replace(field.id); 
Verwandte Themen