diff --git a/sources/raje/app/js/rajemce/plugin/raje_crossref.js b/sources/raje/app/js/rajemce/plugin/raje_crossref.js
index 744f2a5..9f59842 100644
--- a/sources/raje/app/js/rajemce/plugin/raje_crossref.js
+++ b/sources/raje/app/js/rajemce/plugin/raje_crossref.js
@@ -82,16 +82,6 @@ tinymce.PluginManager.add('raje_crossref', function (editor, url) {
}
})
- editor.on('nodeChange', function (e) {
- $('span.cgen[data-rash-original-content]').each(function () {
-
- let position = $(this).text().replace('[', '').replace(']', '')
- let id =
-
- $(this).replaceWith(`${$(this).attr('data-rash-original-content')}`)
- })
- })
-
crossref = {
getAllReferenceableSections: function () {
let sections = []
@@ -273,14 +263,14 @@ function references() {
footnote_element.parent("section[role=doc-endnotes], section[role=doc-footnotes]").length > 0) {
var count = $(current_id).prevAll("section").length + 1;
if (prev_el.find("sup").hasClass("fn")) {
- $(this).before(",");
+ $(this).before(",");
}
- $(this).html("" +
+ $(this).html("" +
"" + count + "");
} else {
- $(this).html("ERR: footnote '" + current_id.replace("#", "") + "' does not exist");
}
/* Common sections */
@@ -289,47 +279,66 @@ function references() {
"section:not([role=doc-abstract]):not([role=doc-bibliography]):" +
"not([role=doc-endnotes]):not([role=doc-footnotes]):not([role=doc-acknowledgements])");
if (cur_count != null && cur_count != "") {
- $(this).html("Section " + cur_count + "");
}
/* Reference to figure boxes */
} else if (referenced_element_figure.length > 0) {
var cur_count = referenced_element_figure.findNumber(figurebox_selector);
if (cur_count != 0) {
- $(this).html("Figure " + cur_count + "");
}
/* Reference to table boxes */
} else if (referenced_element_table.length > 0) {
var cur_count = referenced_element_table.findNumber(tablebox_selector);
if (cur_count != 0) {
- $(this).html("Table " + cur_count + "");
}
/* Reference to formula boxes */
} else if (referenced_element_formula.length > 0) {
var cur_count = referenced_element_formula.findNumber(formulabox_selector);
if (cur_count != 0) {
- $(this).html("Formula " + cur_count + "");
}
/* Reference to listing boxes */
} else if (referenced_element_listing.length > 0) {
var cur_count = referenced_element_listing.findNumber(listingbox_selector);
if (cur_count != 0) {
- $(this).html("Listing " + cur_count + "");
}
} else {
- $(this).html("ERR: referenced element '" + cur_id.replace("#", "") +
"' has not the correct type (it should be either a figure, a table, a formula, a listing, or a section)");
}
} else {
- $(this).replaceWith("ERR: referenced element '" + cur_id.replace("#", "") + "' does not exist");
}
}
});
/* /END References */
+}
+
+function updateReferences() {
+ tinymce.triggerSave()
+
+ if ($('span.cgen[data-rash-original-reference]').length) {
+
+ // Restore all saved content
+ $('span.cgen[data-rash-original-reference]').each(function () {
+
+ // Save original content and reference
+ let original_content = $(this).attr('data-rash-original-content')
+ let original_reference = $(this).attr('data-rash-original-reference')
+
+ $(this).replaceWith(`${original_content}`)
+ })
+
+ references()
+ }
}
\ No newline at end of file
diff --git a/sources/raje/app/js/rajemce/plugin/raje_section.js b/sources/raje/app/js/rajemce/plugin/raje_section.js
index b802167..d90e8ad 100644
--- a/sources/raje/app/js/rajemce/plugin/raje_section.js
+++ b/sources/raje/app/js/rajemce/plugin/raje_section.js
@@ -202,6 +202,10 @@ tinymce.PluginManager.add('raje_section', function (editor, url) {
tinymce.activeEditor.undoManager.transact(function () {
tinymce.activeEditor.execCommand('delete')
section.updateBibliographySection()
+ updateReferences()
+
+ // update iframe
+ updateIframeFromSavedContent()
})
return false
@@ -741,9 +745,6 @@ section = {
$(`${BIBLIOENTRY_SELECTOR}:not(:has(p))`).each(function () {
$(this).remove()
})
-
- // update iframe
- updateIframeFromSavedContent()
},
/**