2017-04-07 84 views

回答

1

您可以使用Custom Popup example为出发点和通过改变如下的initPopup方法从那里延伸:

// Popup buttons. 
var popup_buttons = ''; 

// Create the list of buttons. 
if (editor.opts.popupButtons.length > 1) { 
    popup_buttons += '<div class="fr-buttons">'; 
    popup_buttons += editor.button.buildList(editor.opts.popupButtons); 
    popup_buttons += '</div>'; 
} 

// Custom layer. 
var custom_layer = '<div class="fr-my-layer fr-layer fr-active" id="fr-my-layer-' + editor.id + '"><div class="fr-input-line"><input id="fr-my-layer-text-' + editor.id + '" type="text" placeholder="' + editor.language.translate('Alternate Text') + '" tabIndex="1"></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="myButton" tabIndex="2" role="button">' + editor.language.translate('Insert') + '</button></div></div>'; 

// Load popup template. 
var template = { 
    buttons: popup_buttons, 
    custom_layer: custom_layer 
}; 

// Create popup. 
var $popup = editor.popups.create('customPlugin.popup', template); 

return $popup;