Le seguenti istruzioni si applicano alle versioni 2.x.x e 3.x.x di raffineria CMS.
Tuttavia, nella versione 3.x.x sarà necessario utilizzare custom_visual_editor_boot_options anziché custom_wymeditor_boot_options.
Utilizzando questo file: https://github.com/refinery/refinerycms/blob/master/core/app/assets/javascripts/admin.js è possibile specificare le opzioni personalizzate per WYMeditor in raffineria.
In primo luogo, è necessario sovrascrivere il file:
bundle exec rake refinery:override javascript=admin
Ora, applicazione aperta/Attività/javascript/admin.js e modificarlo per essere come il seguente:
// Use this to customize the wymeditor boot process
// Just mirror the options specified in boot_wym.js with the new options here.
// This will completely override anything specified in boot_wym.js for that key.
// e.g. skin: 'something_else'
if (typeof(custom_wymeditor_boot_options) == "undefined") {
custom_wymeditor_boot_options = {
containersItems: [
{'name': 'h1', 'title':'Heading_1', 'css':'wym_containers_h1'}
, {'name': 'h2', 'title':'Heading_2', 'css':'wym_containers_h2'}
, {'name': 'h3', 'title':'Heading_3', 'css':'wym_containers_h3'}
, {'name': 'h4', 'title':'Heading_4', 'css':'wym_containers_h4'}
, {'name': 'p', 'title':'Paragraph', 'css':'wym_containers_p'}
]
};
}
Si noti che quello che stai facendo è sovrascrivere boot_wym.js.erb che specifica solo h1, h2, h3 e p come tag contenitore. Vedi: https://github.com/refinery/refinerycms/blob/2-0-stable/core/app/assets/javascripts/refinery/boot_wym.js.erb#L49-L54
eventuali opzioni specificate all'interno custom_wymeditor_boot_options sovrascrivono nulla all'interno wymeditor_boot_options in boot_wym.js.erb in modo da assicurarsi che sia valida Javascript altrimenti gli editori non si carica a tutti.
Spero che questo aiuti; fammi sapere se hai bisogno di chiarimenti.
Phil
Solo un po 'di correzione, il comando per superiori admin.js è "fascio exec rake raffineria: ignorare javascript = admin" w/l'estensione .js –
Si noti inoltre che in 3.x che è stato rinominato a 'custom_visual_editor_boot_options' ... mi ci è voluto un po 'per capire perché non funzionava. https://github.com/parndt/refinerycms-wymeditor/blob/master/app/assets/javascripts/refinery/boot_wym.js.erb#L5 – natebeaty