Alexander O'Neill 6 years ago
parent
commit
c8bf170a5b
  1. 3
      bibcite_footnotes.module
  2. 20
      js/replace_citations.js

3
bibcite_footnotes.module

@ -250,8 +250,9 @@ function bibcite_footnotes_form_node_form_alter(&$form, FormStateInterface &$for
$triggering_element = $form_state->getTriggeringElement();
if (!$triggering_element) {
$form[]['#attached']['library'][] = 'bibcite_footnotes/reference_footnote';
$form['#attached']['library'][] = 'bibcite_footnotes/replace_citations';
$form['#attached']['drupalSettings']['bibcite_footnotes']['references'] = $bibcite_references;
// $form['#attached']['drupalSettings']['']
}
else {
$form[$triggering_element['#parents'][0]]['widget']['#attached']['library'][] = 'bibcite_footnotes/replace_citations';

20
js/replace_citations.js

@ -12,16 +12,18 @@
Drupal.behaviors.bibciteFootnotesReplaceCitations = {
attach: function attach(context, settings) {
var formats = drupalSettings.editor.formats;
if (formats) {
for (var key in formats) {
var format = drupalSettings.editor.formats[key];
if (format.editor == "ckeditor") {
format.editorSettings.referenceFootnotes_list = drupalSettings.bibcite_footnotes.references;
}
alert('got here');
if (CKEDITOR.instances) {
for (var instance in CKEDITOR.instances) {
var editor = CKEDITOR.instances[instance];
var config = editor.config;
if (config.hasOwnProperty('referenceFootnotes_list')) {
config.referenceFootnotes_list = drupalSettings.bibcite_footnotes.references;
var name = editor.name;
editor.destroy();
CKEDITOR.replace(name, config);
}
}
}
}
}

Loading…
Cancel
Save